Duplicate keys in JSON response

Hi, while implementing/testing the write tool, sometimes I’m getting a response from the OpenAI client with duplicate keys in the JSON. Please see below where function arguments have two keys “parameter”

[your_program] Usage of toolCall : ChatCompletionMessageToolCall{id=toolu_bdrk_014bUpP2ePKMmpCAK2xnFVfS, function=Function{arguments={“parameter”: “app/main.py”, “parameter”: “print(“Hello world”)”}, name=Write, additionalProperties={}}, type=function, additionalProperties={index=0}}

Also the schema of the parameters json in the response is changing across different calls

Hey @aniruddhaniranjan, you’re right that a function call with two "parameters" keys isn’t valid.

One issue is that the type fields should be lowercase "object" (per the JSON Schema specification), not "Object".

And the resulting function call should look like this:

Let me know if you need any further help.