Ok, I see. So, let me show a very simple example.
Thanks for the explanation. What I mean is this small example, slightly modified from the OpenAI first example.
functions = [
{
"name": "get_current_weather",
"description": "Get the current weather",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA",
},
"format": {
"type": "string",
"enum": ["celsius", "fahrenheit"],
"description": "The temperature unit to use.",
},
},
"required": ["location", "format"],
},
}
]
messages = []
messages.append({"role": "system", "content":"Don't make assumptions about what values to plug into functions. "})
messages.append({"role": "user", "content": "What's the weather like today in Lisbon"})
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo-0613",
messages=messages,
temperature=0.0,
functions = functions,
function_call="auto",
stream = False
)
print(response)
What would I need to do to write a one or two examples? From what your answer, I should give write explicitly in the description? Like this?
functions = [
{
"name": "get_current_weather",
"description": """Get the current weather.
Role: User
Content: How hot is today in London?
Role: Assistant
Content: {'city':'London','format':'fahrenheit'}
""",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA",
},
"format": {
"type": "string",
"enum": ["celsius", "fahrenheit"],
"description": "The temperature unit to use. ",
},
},
"required": ["location", "format"],
},
}
]
messages = []
messages.append({"role": "system", "content":"Don't make assumptions about what values to plug into functions. "})
messages.append({"role": "user", "content": "What's the weather like today in Lisbon"})
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo-0613",
messages=messages,
temperature=0.0,
functions = functions,
function_call="auto",
stream = False
)
print(response)