It seems that response_format for fields is very limited:
class MyFormat(BaseModel):
field: list[str]
works. But
class MyFormat(BaseModel):
field: list[dict]
does not. I also tried list[dict[str, str]] and list[Dict[str, str]] - fails.
I get the same error for all the complex types that is not helpful:
openai.BadRequestError: Error code: 400 - {'error': {'message': "Invalid schema for response_format 'MyFormat': In context=(), 'required' is required to be supplied and to be an array including every key in properties. Extra required key 'field' supplied.", 'type': 'invalid_request_error', 'param': 'response_format', 'code': None}}
The error seems to refer to input schema and references “required” which is not used in response_format class definition.
Is this an issue with Azure OpenAI or OpenAI in general?
Is there any way to specify a complex response_format? Using Pydantic Json type for field
does not work either.