Azure / Azure/azure-rest-api-specs

[BUG] [OpenAI API] Made "parameters" field of a tool specification optional

Open
#30,141 1 comment 0 reactions 1 assignee Claimed by @yuanzhuangyuanzhuang View on GitHub
bug customer-reported data-plane question
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
3d 37m
Merged PRs (30d)
446

Description

### API Spec link

https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2024-07-01-preview/inference.yaml

### API Spec version

2024-07-01-preview

### Describe the bug

The `parameters` field of a tool specification is declared as [required](https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2024-07-01-preview/inference.yaml#L3799).

Whereas, the OpenAI doc tells that it's [optional](https://platform.openai.com/docs/api-reference/chat/create)

Screenshot 2024-08-09 at 08 39 44

And indeed Azure OpenAI doesn't reject and handles properly requests with the missing `parameters` field like this one:

```json
{
"prompt": "What time is it?",
"tools": [
{
"type": "function",
"function": {
"name": "get_current_time",
"description": "This function provides the current time"
}
}
]
}
```

### Expected behavior

The `parameters` field of a tool spec is an optional fields.

### Actual behavior

The `parameters` field of a tool spec is a required field.

### Reproduction Steps

Send the request to Azure OpenAI `gpt-4` and observe that it doesn't reject the request and handles it properly by calling the tool with `{}` argument:

```json
HTTP POST AZURE_OPENAI_SERVICE/openai/deployments/gpt-4/chat/completions?api-version=2024-07-01-preview
{
"prompt": "What time is it?",
"tools": [
{
"type": "function",
"function": {
"name": "get_current_time",
"description": "This function provides the current time"
}
}
]
}
```

Response:

```json
{
"choices": [
{
"finish_reason": "tool_calls",
"index": 0,
"logprobs": null,
"message": {
"content": null,
"role": "assistant",
"tool_calls": [
{
"function": {
"arguments": "{}",
"name": "get_current_time"
},
"id": "call_rDBZsOqwqvkshflwQxrY9iS3",
"type": "function"
}
]
}
}
],
"created": 7777,
"id": "chatcmpl-8888",
"model": "gpt-4",
"object": "chat.completion",
"system_fingerprint": null,
"usage": {
"completion_tokens": 8,
"prompt_tokens": 45,
"total_tokens": 53
}
}
```

### Environment

Env is irrelevant. One could reproduce the steps by senting the HTTP request.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.