Nomadiction
01/07/2025, 7:49 PMstrict parameter to the function definition, but it still seems like something is not right, since I'm stil seeing incorrect tool calls (Invalid json) being passed around.
If I change the model to custom-llm (proxying to openai), it does work normally, so I assume that is not being passed down to the model correctly when using the openai models.
Another thing is that I noticed is that parallel tool calls still happens when strict is enabled, but that should not happen since structured output will not work in such case.
From OpenAI docs:
> Structured Outputs is not compatible with parallel function calls. When a parallel function call is generated, it may not match supplied schemas. Set parallel_tool_calls: false to disable parallel function calling.
[ref](https://openai.com/index/introducing-structured-outputs-in-the-api/)
So I assume you should set the parallel_tool_calls to false when strict is enabled.Vapi
01/07/2025, 7:50 PMstrict parameter is being handled, especially in relation to the parallel_tool_calls. To ensure that the structured output works correctly with the strict mode, it is indeed necessary to set parallel_tool_calls to false, as per the OpenAI documentation.
For the incorrect tool calls resulting in invalid JSON, this should not be happening, and it's important that we address this promptly. It's possible that there is a misconfiguration or a bug that is causing the strict parameter not to be respected when proxying to OpenAI models.
To resolve these issues, I would recommend reaching out to our support team with specific examples of the incorrect tool calls you're experiencing. They will be able to investigate the problem in more detail and work on a fix. Please provide them with as much information as possible, including any error messages and the context in which the issue occurs.
In the meantime, if you need to make any immediate changes to your setup, such as disabling parallel tool calls manually, please let me know, and I can assist you with that process.Vapi
01/07/2025, 7:50 PMVapi
01/07/2025, 7:51 PMNomadiction
01/07/2025, 7:51 PMc2f3d259-4a7d-4072-a9dc-5874a5c0ddd2Nomadiction
01/08/2025, 9:43 PMNomadiction
01/09/2025, 2:37 PMShubham Bajaj
01/09/2025, 11:14 PMShubham Bajaj
01/10/2025, 7:54 PMNomadiction
01/13/2025, 4:47 PMShubham Bajaj
01/13/2025, 4:55 PMShubham Bajaj
01/13/2025, 4:56 PMNomadiction
01/13/2025, 4:57 PMNomadiction
01/13/2025, 7:38 PMstrict parameter)Nomadiction
01/14/2025, 3:21 PMstrict parameter down to open ai
I created this tool:
{
"function": {
"name": "SaveUserInformation",
"strict": true,
"parameters": {
"type": "object",
"properties": {
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
}
},
"required": [
"firstName"
],
"additionalProperties": false
}
}
}
> To use Structured Outputs, all fields or function parameters must be specified as required.
https://platform.openai.com/docs/guides/structured-outputs?context=ex1#all-fields-must-be-requiredNomadiction
01/14/2025, 3:21 PMNomadiction
01/14/2025, 3:22 PMNomadiction
01/14/2025, 3:25 PMconst openai = require('openai');
const client = new openai.OpenAI();
const result = client.chat.completions.create({
model: 'gpt-4o',
tools: [
{
type: 'function',
function: {
name: 'SaveUserInformation',
strict: true,
parameters: {
type: 'object',
properties: {
firstName: {
type: 'string',
},
lastName: {
type: 'string',
},
},
required: ['firstName'],
additionalProperties: false,
},
},
},
],
messages: [{ role: 'user', content: 'Hello, world!' }],
});
result
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});Nomadiction
01/14/2025, 3:30 PMnode -r dotenv/config fix.js
BadRequestError: 400 Invalid schema for function 'SaveUserInformation': In context=(), 'required' is required to be supplied and to be an array including every key in properties. Missing 'lastName'.
at APIError.generate (node_modules/.pnpm/openai@4.77.3_zod@3.23.8/node_modules/openai/error.js:45:20)
at OpenAI.makeStatusError (node_modules/.pnpm/openai@4.77.3_zod@3.23.8/node_modules/openai/core.js:293:33)
at OpenAI.makeRequest (node_modules/.pnpm/openai@4.77.3_zod@3.23.8/node_modules/openai/core.js:337:30)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
status: 400,
request_id: 'req_3ade456d5b96234816315e7c3049e1f7',
error: {
message: "Invalid schema for function 'SaveUserInformation': In context=(), 'required' is required to be supplied and to be an array including every key in properties. Missing 'lastName'.",
type: 'invalid_request_error',
param: 'tools[0].function.parameters',
code: 'invalid_function_parameters'
},
code: 'invalid_function_parameters',
param: 'tools[0].function.parameters',
type: 'invalid_request_error'
}Nomadiction
01/14/2025, 3:30 PMstrict parameter down to openai, the llm should be erroring out in this case (Because of the rule of all fields must be required in the schema)Nomadiction
01/14/2025, 3:31 PMNomadiction
01/15/2025, 1:02 PMShubham Bajaj
01/15/2025, 1:45 PMNomadiction
01/15/2025, 1:45 PMShubham Bajaj
01/16/2025, 7:39 AMNomadiction
01/16/2025, 4:30 PMShubham Bajaj
01/17/2025, 1:20 PMNomadiction
01/22/2025, 9:31 PMShubham Bajaj
01/23/2025, 3:57 PMNomadiction
01/23/2025, 4:55 PMShubham Bajaj
01/25/2025, 5:23 AMNomadiction
01/27/2025, 7:51 PMNomadiction
02/03/2025, 5:32 PMShubham Bajaj
02/04/2025, 10:04 AMNomadiction
02/06/2025, 2:14 PMNomadiction
02/10/2025, 6:53 PMNomadiction
02/10/2025, 9:21 PMShubham Bajaj
02/11/2025, 6:35 PMNomadiction
02/13/2025, 6:23 PMNomadiction
02/13/2025, 6:23 PMPraveen
02/14/2025, 5:00 PM