-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Hi! If you create a chat using acreate, provide functions, up-to-date model, the arguments field is always empty regardless, reproduces every single time. Altho, if you are using simple synchronous create on the same setup, it works perfectly.
To Reproduce
ChatCompletion.acreate
gen = await openai.ChatCompletion.acreate(
model='gpt-3.5-turbo-0613',
messages=[{"role": "user", "content": "What's the weather like in Boston?"}],
stream=True,
functions=[
{
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA",
},
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},
},
"required": ["location"],
},
}
],
function_call='auto'
)
resp = gen.__anext__()
delta = resp.choices[0].delta
print(f'DELTA:\n{delta}')
OUTPUT (ARGUMENTS ARE ABSENT)
DELTA:
{
"role": "assistant",
"content": null,
"function_call": {
"name": "get_current_weather",
"arguments": ""
}
}
ChatCompletion.create
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo-0613",
messages=[{"role": "user", "content": "What's the weather like in Boston?"}],
functions=[
{
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA",
},
"unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},
},
"required": ["location"],
},
}
],
function_call="auto",
)
message = response["choices"][0]["message"]
print(message)
OUTPUT (ARGUMENTS ARE PRESENT)
{
"role": "assistant",
"content": null,
"function_call": {
"name": "get_current_weather",
"arguments": "{\n \"location\": \"Boston\"\n}"
}
}
Code snippets
No response
OS
Ubuntu 20.04.5 LTS
Python version
Python 3.9.15
Library version
openai-python v0.27.8
nc and valaises
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working