Skip to content

Structured output broken in 0.3.5 #173

Description

@HabermannR

Release notes:
Update llama.cpp-based JSON response generation; now supports more complex JSON schemas

But for me, my old use case does not work at all anymore:
Setting this in the gui works when calling it like this:
completion = self.client.chat.completions.create(
model=self.model_config.model_name,
messages=messages)

{
"type": "object",
"schema": {
"properties": {
"choices": {
"items": {
"properties": {
"name": {
"title": "Name",
"type": "string"
},
"description": {
"title": "Description",
"type": "string"
},
"development": {
"enum": [
"magical",
"hybrid",
"practical"
],
"title": "DevelopmentType",
"type": "string"
},
"stance": {
"enum": [
"peaceful",
"neutral",
"aggressive"
],
"title": "DiplomaticStance",
"type": "string"
}
},
"required": [
"name",
"description",
"development",
"stance"
],
"title": "TribeType",
"type": "object"
},
"title": "Choices",
"type": "array"
}
},
"required": [
"choices"
],
"title": "InitialChoices",
"type": "object"
}
}

but I can not call it with the "object":
completion = self.client.chat.completions.create(
model=self.model_config.model_name,
messages=messages,
response_format=create_json_schema(response_model),
max_tokens=max_tokens
)
openai.BadRequestError: Error code: 400 - {'error': "'response_format.type' must be 'json_schema'"}

Setting it to 'json_schema', both in the gui, as well as in the python code, gives an error:
openai.BadRequestError: Error code: 400 - {'error': ' Invalid structured output configuration: data/type must be equal to one of the allowed values, data/type must be array, data/type must match a schema in anyOf. Error Data: n/a, Additional Data: n/a'}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions