Demonstrates getting validated JSON responses from the LLM using adam_run_json. The function appends a JSON structure hint to the prompt, validates that the response is parseable JSON, and automatically retries if the model produces invalid output.
echo "ANTHROPIC_API_KEY=sk-ant-..." > .env
make
./structured-json- Using
adam_run_jsonfor structured output with automatic validation - Providing a JSON hint to guide the response format
- Configuring retry count for robustness
- Inspecting
json_validandretries_usedfromadam_json_result_t