You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When starting a tool call request. there are some issue in the request json.
The following AIFunctionOption is used:
var fo = new AIFunctionFactoryOptions()
{
Name = "get_current_weather",
Description = "Get the current weather for a given location",
MarshalResult = async (o, _, _) => { return o; },
SerializerOptions = new System.Text.Json.JsonSerializerOptions(System.Text.Json.JsonSerializerDefaults.Web)
{
WriteIndented = false,
TypeInfoResolver = new System.Text.Json.Serialization.Metadata.DefaultJsonTypeInfoResolver()
},
JsonSchemaCreateOptions = new AIJsonSchemaCreateOptions()
{
TransformOptions = new AIJsonSchemaTransformOptions()
{
DisallowAdditionalProperties = true,
}
}
};
But the following request json is post:
HTTP Request: 49fa56aa-415c-4983-84d4-6ab8059e0372
Method: POST
Uri: https://api.openai.com/chat/completions
Headers:
Accept: application/json
User-Agent: OpenAI/2.2.0-beta.4, (.NET 9.0.5; Microsoft Windows 10.0.19045)
Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxxxxx
Content-Type: application/json
Content:
{"tools":[{"function":{"description":"Get the current weather for a given location","name":"get_current_weather","parameters":{
"type": "object",
"required": [
"location",
"unit"
],
"properties": {
"location": {
"type": "string"
},
"unit": {
"type": "string"
}
},
"additionalProperties": false
},"type":"function"}],"messages":[{"role":"user","content":"Please say: Hello, AI World! This is a test."}],"model":"gpt-4o","stream":true,"stream_options":{"include_usage":true},"tool_choice":"auto"}
Beautified version:
{
"tools": [
{
"function": {
"description": "Get the current weather for a given location",
"name": "get_current_weather",
"parameters": {
"type": "object",
"required": [
"location",
"unit"
],
"properties": {
"location": {
"type": "string"
},
"unit": {
"type": "string"
}
},
"additionalProperties": false
},
"type": "function"
}
],
"messages": [
{
"role": "user",
"content": "Please say: Hello, AI World! This is a test."
}
],
"model": "gpt-4o",
"stream": true,
"stream_options": {
"include_usage": true
},
"tool_choice": "auto"
}
We can see the following issues:
There is still "additionalProperties" json node despite of "DisallowAdditionalProperties = true" . Is a wrong setting used?
We got json indent even "WriteIndented = false" is set.
Description
When starting a tool call request. there are some issue in the request json.
The following AIFunctionOption is used:
But the following request json is post:
Beautified version:
We can see the following issues:
Reproduction Steps
This is a minimal reproducing project. Just 2 cs files. ConsoleApp3.zip
Download the attachment and run it with
dotnet run -- sk-xxxxxxxxxxxxxxxxxxxxxxx gpt-4o
Look into "logs" folder
Expected behavior
Actual behavior
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response