Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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
languagepy
# Declare# Base Configuration
api_key = "YOUR_OPENAI_API_KEY"
agent_name = "Support Bot"

# Getting your Agent
agent = Agent('Smith')
api_key, agent_name)

# Set his knowledge
agent.set_system_token('your openai api token'instructions("Please provide a response based on the examples.")
agent.setadd_example_roleoutput('AI program in the Matrix')

# Add Instructions"I'm sorry to hear that. Let me see what I can do to help.")
agent.add_example_instruction('your written instruction 1'output("Thank you for reaching out. I'll assist you with this.")
agent.add_example_instruction('your written instruction 2')

# Provide Knowledge
agent.set_knowledge('any string'output("Sure, I can help you with that. Let's find a solution together.")

# Ask something toGet your agentresponse
response = agent.processget_response('any string input'"I'm having trouble accessing my account.")

The base configuration to your agent is:

Code Block
languagepy
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
languagepy
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