JSON format difference in tools in assistant API vs. chat completions

I originally worked most of my system against the assistants API and started to use multiple formats for a type – so in the attached screenshot where you see the type for “location” as “string”, I’ve been using “type”: [“string”, “number”] to allow more than 1 type. Works great for assistant API.

However recently decided to use chat completions instead and I see the input parser for tools doesn’t accept an array of formats in this case.

Looked at docs and seeing no clarification – so before I recode all my functions to remove this “array of types” for chat completions API thought I’d check here in case I’m missing something.

Thanks
-J

Thu Mar 06 2025 09:49:18 GMT-0800 (Pacific Standard Time) POST /v1/ai/chat: "400 Invalid schema for function 'doAction': In context=('properties', 'value1'), schema must have a 'type' key.": stacktrace follows =>


I’m facing the same issue. did you find a solution?

No I didn’t find a good solution.

I ended up “downgrading” the JSON I used to be less exact and strict but more compatible across openAI’s APIs

I kind of got the impression given the respective maturity of different APIs (chat completions, assistants, response) that openAI is kind of at a beta level and trying to evolve the APIs rather that a 100% mature API supported by an active team and good support. So I choose to make my needs simpler rather than push this.

-J