To request an answer in a specific response format, pass an OpenAI-style responseFormat object to the answer method. The returned result.answer contains a JSON string matching your schema instead of Markdown.
Inline citations no longer appear in the answer text. The result.citations field is returned regardless of the response format. If the responseFormat is malformed, it is rejected before the request is billed, and an error is raised as SeltzAPIError.
Answer does not validate the model’s output against your schema before returning it. A request can succeed with a 200 and still return an answer that is cut off partway through if, for example, generation is truncated, in which case the response does not parse as valid JSON. Always wrap your parse call in a try/catch or equivalent rather than assuming answer is well-formed.
The response’s answer field is a JSON string matching the schema above:
Next steps
- Structured responses: Step-by-step guidance on schema design, query anchoring, and worked examples across every data scope