Agents are configurable objects you can have to scale ChatGPT.
To configure an agent, all you need is an OpenAI API key and some basic configuration to make him understand what you want to do.
The usage of an agent can be for interacting with tickets (by getting data to edit tickets) or even as a JSM chat bot, that will consume your information and use as a response.
To invoke an agent:
Code Block | ||
---|---|---|
| ||
# DeclareBase your Agent agent = Agent('Smith') agent.set_token('your openai api token') agent.set_role('AI program in the Matrix') # Add Instructions agent.add_instruction('your written instruction 1') agent.add_instruction('your written instruction 2') # Provide Knowledge agent.set_knowledge('any string') # If you want to scale it on issues, create a text field and pass set it as agent.set_state_field('customfield_100xx') # with your actual field Id. agent.set_state('Investigating') # this will update the field on issues so you can query the agent state via jql # Ask something to your agentConfiguration api_key = "YOUR_OPENAI_API_KEY" agent_name = "Support Bot" # Getting your Agent agent = Agent(api_key, agent_name) # Set his knowledge agent.set_system_instructions("Please provide a response based on the examples.") agent.add_example_output("I'm sorry to hear that. Let me see what I can do to help.") agent.add_example_output("Thank you for reaching out. I'll assist you with this.") agent.add_example_output("Sure, I can help you with that. Let's find a solution together.") # Get your response response = agent.processget_response('any string input'"I'm having trouble accessing my account.") |
The base configuration to your agent is:
Code Block | ||
---|---|---|
| ||
modeltemperature = 'gpt-3.5-turbo-16k' CFG_TEMPERATURE0.41 max_tokens = 0.5256 CFGtop_MAX_TOKENSp = 120001 CFGfrequency_TOP_Ppenalty = 0.70 CFGpresence_FREQUENCY_PENALTYpenalty = 0.3 CFG_PRESENCE_PENALTY = 0.3 |
To override any of those configurations, do the following:
Code Block | ||
---|---|---|
| ||
agent.model = 'gpt-3.5-turbo-16k' agent.CFG_TEMPERATURE temperature = 0.541 agent.CFGmax_MAX_TOKENStokens = 11000256 agent.CFGtop_TOP_Pp = 0.51 agent.CFGfrequency_FREQUENCY_PENALTYpenalty = 0.0 agent.CFGpresence_PRESENCE_PENALTYpenalty = 0.0 |