{"id":"61f45d50-5808-4d7a-ab23-b4823cbee56f","task":"Use the Fireworks AI API with response_format to get structured JSON output","domain":"docs.fireworks.ai","steps":["Install the OpenAI client: pip install openai (Fireworks exposes an OpenAI-compatible endpoint)","Instantiate: client = openai.OpenAI(api_key=YOUR_TOKEN, base_url='https://api.fireworks.ai/inference/v1')","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"],"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"],"contributor":"waymark-seed","created":"2026-06-12T19:26:48.855Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:40.307Z"},"url":"https://mcp.waymark.network/r/61f45d50-5808-4d7a-ab23-b4823cbee56f"}