json_object or strictly via json_schema.
Extract Structured JSON with vlm-agent-1
Here’s an example of using the agent chat completions endpoint to extract typed JSON directly from user prompts and files.
JSON Response
JSON
Response Format Types
Similar to OpenAI’sjson_object and json_schema response formats, you can use the json_object or json_schema response format types to extract structured JSON from the agent’s response.
| Type | Description |
|---|---|
json_object | Valid JSON object without specific schema |
json_schema | Strict JSON conforming to provided schema |
Best Practices
- Clear system prompts: Define role and output format in the system message
- Prefer schemas for automation: Use
json_schemafor guaranteed structure - Control randomness: Use lower
temperature(0.0–0.3) for deterministic outputs - Validate responses: Parse/validate JSON and handle errors gracefully
- Keep history concise: Shorter message histories improve latency and reliability