I am currently using the @azure/openai npm package for Node.js to interact with the GPT-4 model. I have noticed that the toolCalls in the response are empty, even though I have included tools in my request.
Code:
```javascript
const getCurrentWeather = {
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'],
},
};
const messages = [{ role: 'user', content: 'What is the weather like in Glasgow Scotland?' }];
const options = {
tools: [
{
type: 'function',
function: getCurrentWeather,
},
],
};
client.getChatCompletions(deploymentIdBest, messages, options).then((res) => console.log(res));
Expected Behavior:
Ofcourse we expect something like this in the response:
{'role': 'assistant',
'content': None,
'tool_calls': [{'id': 'call_o7uyztQLeVIoRdjcDkDJY3ni',
'type': 'function',
'function': {'name': 'get_current_weather',
'arguments': '{\n "location": "Glasgow, Scotland",\n "format": "celsius"\n}'}}]}
Actual Behavior:
This is the full response from the azure/openai client (tried both gpt-4-turbo and gpt-35-turbo):
{
"id": "chatcmpl-8fr5PAthe2uTIHVjd8mcy7pOMkrx5",
"object": "chat.completion",
"model": "gpt-4",
"usage": {
"promptTokens": 172,
"completionTokens": 22,
"totalTokens": 194
},
"created": "1970-01-20T17:36:26.203Z",
"promptFilterResults": [
{
"promptIndex": 0,
"contentFilterResults": {}
}
],
"choices": [
{
"index": 0,
"finishReason": "tool_calls",
"contentFilterResult": {
"error": {
"code": "content_filter_error",
"message": "The contents are not filtered"
}
},
"message": {
"role": "assistant",
"toolCalls": []
},
"contentFilterResults": {}
}
]
}
@azure/openai versions in question: 1.0.0-beta.10 and 1.0.0-alpha.20240104.1