Community Center | Not monitored
Tag not monitored by Microsoft.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I'm try to use the new function call ability with gpt-35-turbo and gpt-4.
When I use function call without stream, everything looks fine.
request
{
"messages":[
{
"role":"user",
"content":"Find beachfront hotels in San Diego for less than $300 a month with free breakfast."
}
],
"functions":[
{
"name":"search_hotels",
"description":"Retrieves hotels from the search index based on the parameters provided",
"parameters":{
"type":"object",
"properties":{
"location":{
"type":"string",
"description":"The location of the hotel (i.e. Seattle, WA)"
},
"max_price":{
"type":"number",
"description":"The maximum price for the hotel"
},
"features":{
"type":"string",
"description":"A comma separated list of features (i.e. beachfront, free wifi, etc.)"
}
},
"required":[
"location"
]
}
}
],
"stream":true
}
response
{
"id": "chatcmpl-7gExCICGZN9A6K6nzVCacyZD0GcH7",
"object": "chat.completion",
"created": 1690301614,
"model": "gpt-35-turbo",
"prompt_annotations": [
{
"prompt_index": 0,
"content_filter_results": {}
}
],
"choices": [
{
"index": 0,
"finish_reason": "function_call",
"message": {
"role": "assistant",
"function_call": {
"name": "search_hotels",
"arguments": "{\n\"location\": \"San Diego\",\n\"max_price\": 300,\n\"features\": \"beachfront,free breakfast\"\n}"
}
},
"content_filter_result": {
"error": {
"code": "content_filter_error",
"message": "The contents are not filtered"
}
},
"content_filter_results": {}
}
],
"usage": {
"completion_tokens": 34,
"prompt_tokens": 120,
"total_tokens": 154
}
}
But when I use the same messages, functions with stream is on, the function_call field “argument” in response is misssing .
{"id":"","object":"","created":0,"model":"","prompt_annotations":[{"prompt_index":0,"content_filter_results":{}}],"choices":[],"usage":null}
{"id":"chatcmpl-7gF43LHCgx0xqORaeUbula3PPq1Ff","object":"chat.completion.chunk","created":1690302039,"model":"gpt-35-turbo","choices":[{"index":0,"finish_reason":null,"delta":{"role":"assistant","function_call":{"name":"search_hotels"}},"content_filter_result":{"error":{"code":"content_filter_error","message":"The contents are not filtered"}},"content_filter_results":{}}],"usage":null}
Can't some one tell me why.
Tag not monitored by Microsoft.