I have defined the schema for responses in an Assistant, and in the Playground it will return JSON, but when calling with the API it returns a string. That string is the correct JSON, but it’s in text format. Any help understanding here would be appreciate, thanks!
When I use Playground with the Assistant:
{
“tag_number”: “CHWP-1~3”,
“qty”: “3”,
“total_system_flow”: “550 USgpm”,
“environment”: “Not specified”
}
When I just the API the response.content[0] is the following. Granted, it’s JSON, but it doesn’t fit my schema (see below) and it defines the actual output as text.
{
type: 'text',
text: {
value: '{"tag_number":"CHWP-1~3","qty":"3","total_system_flow":"550 USgpm","environment":""}',
annotations: []
}
}
Here’s the settings and schema I’m using:
Schema:
{
"name": "json_response",
"strict": true,
"schema": {
"type": "object",
"properties": {
"tag_number": {
"type": "string",
"description": "The tag number of the current pump"
},
"qty": {
"type": "string",
"description": "The qty of the current pump"
},
"total_system_flow": {
"type": "string",
"description": "The total system flow of the current pump"
},
"environment": {
"type": "string",
"description": "The environment of the current pump"
}
},
"additionalProperties": false,
"required": [
"tag_number",
"qty",
"total_system_flow",
"environment"
]
}
}