Last active
February 24, 2026 19:34
-
-
Save benjaminjackson/fb23178ef6b758a975b4596f2efd15b2 to your computer and use it in GitHub Desktop.
Exa Answer API: intermittent 500 on structured output with large-volume queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Exa Answer API - Intermittent 500 INTERNAL_ERROR on structured output queries | |
| # Usage: EXA_API_KEY=your-key bash exa_repro.sh | |
| # Requires: jq | |
| PAYLOAD=$(cat << 'JSON' | |
| { | |
| "query": "Are there any mainstream news articles with controversies, scandals, lawsuits, legal settlements, or major fines involving Goldman Sachs (goldmansachs.com) OR companies owned by Goldman Sachs?", | |
| "systemPrompt": "Research: Goldman Sachs (goldmansachs.com) and its portfolio companies. Extract reputation issues from news journalism ONLY. Required sources: news articles from established journalism outlets (Reuters, Bloomberg, WSJ, FT, etc.).", | |
| "outputSchema": { | |
| "type": "object", | |
| "required": ["has_issues", "summary", "key_findings"], | |
| "properties": { | |
| "has_issues": { "type": "boolean" }, | |
| "summary": { "type": "string" }, | |
| "key_findings": { | |
| "type": "array", | |
| "items": { | |
| "type": "object", | |
| "required": ["evidence", "citation_url", "materiality", "is_about_target_entity", "reasoning"], | |
| "properties": { | |
| "evidence": { "type": "string" }, | |
| "citation_url": { "type": "string" }, | |
| "materiality": { "type": "string", "enum": ["high", "medium", "low"] }, | |
| "is_about_target_entity": { "type": "boolean" }, | |
| "reasoning": { "type": "string" } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| } | |
| JSON | |
| ) | |
| for i in 1 2 3; do | |
| echo "=== Attempt $i ===" | |
| curl -s -X POST https://api.exa.ai/answer \ | |
| -H "x-api-key: $EXA_API_KEY" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$PAYLOAD" \ | |
| | jq '{result: (if .error then "ERROR: \(.tag) - \(.error)" else "SUCCESS: answer type is \(.answer | type)" end)}' | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment