- OpenAI has a feature called JSON mode that ensures that the output is a valid JSON object.
- While this is great, it doesn’t guarantee adherence to your custom JSON schemas, but only that the output IS a JSON.
- Anyscale and Together AI go further - they not only enforce that the output is in JSON but also ensure that the output follows any given JSON schema.
Output JSON:
response_format
param. The response_format
’s type
is json_object
and the schema
contains all keys and their expected type.
Supporting Models
Model/Provider | Ensure JSON | Ensure Schema |
---|---|---|
mistralai/Mistral-7B-Instruct-v0.1 Anyscale | ||
mistralai/Mixtral-8x7B-Instruct-v0.1Anyscale | ||
mistralai/Mixtral-8x7B-Instruct-v0.1Together AI | ||
mistralai/Mistral-7B-Instruct-v0.1Together AI | ||
togethercomputer/CodeLlama-34b-InstructTogether AI | ||
gpt-4 and previous releases OpenAI / Azure OpenAI | ||
gpt-3.5-turbo and previous releases OpenAI / Azure OpenAI | ||
Ollama models |