Define a Pydantic model and generate its JSON schema: schema = MyModel.model_json_schema()
Pass response_format={'type': 'json_schema', 'json_schema': {'name': 'response', 'schema': schema}} in the chat completion call
Parse the returned content with MyModel.model_validate_json(response.choices[0].message.content)
For function calling, pass tools as a list of tool dicts and set tool_choice='any' to force a function call on the current turn
Known gotchas
Structured output is enforced at generation time — the model cannot produce tokens that violate the schema, but semantic accuracy (correct field values) is not guaranteed
FireFunction models are specialized for function calling; using a general-purpose model for complex multi-tool calls may reduce accuracy
The base URL must be https://api.fireworks.ai/inference/v1 — the /inference prefix distinguishes Fireworks from plain OpenAI base URLs
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp