Set up Respan
Set up Respan
- Sign up — Create an account at platform.respan.ai
- Create an API key — Generate one on the API keys page
- Add credits or a provider key — Add credits on the Credits page or connect your own provider key on the Integrations page
What is structured output?
Structured Outputs is a feature that ensures the model will always generate responses that adhere to your supplied JSON Schema, so you don’t need to worry about the model omitting a required key, or hallucinating an invalid enum value.How to use structured output with Anthropic models
We currently only support structured output with Anthropic models only when you use OpenAI SDK. Which means to get structured output from Anthropic models, you should call anthropic models using the OpenAI SDK client to our endpoint.Example code
- OpenAI Python SDK
- OpenAI TypeScript SDK
You can simply add
response_format={json_schema: {YOUR_JSON_SCHEMA}} to your request. Under the hood, we create a function that asks Anthropic model to response in JSON format.