Python 88.3%
TypeScript 7.6%
Shell 4.1%
1#!/usr/bin/env bash2# Citations on a plain-text document block (citations.enabled true) → char_location citations on the text blocks.3# STATUS: LIVE_VERIFIED 2026-09-18 (claude-haiku-4-5-20251001): citation {char_location, cited_text "Grass is green.", 17-32} (~$0.0007).4# Run: bash examples/anthropic/citations/citations_text_document.sh5set -eo pipefail6cd "$(dirname "$0")/../../.." && source scripts/lib.sh7OUTF="$(mktemp)"; trap 'rm -f "$OUTF"' EXIT8# `ant` sets ANT_STATUS; calling it inside $(...) would lose it, so write the body to a file instead.9call() { ant "$@" > "$OUTF"; OUT="$(cat "$OUTF")"; }10MODEL="${ANTHROPIC_MODEL:-claude-haiku-4-5-20251001}"11call POST /v1/messages -d "$(jq -n --arg m "$MODEL" '{model:$m, max_tokens:100, messages:[{role:"user", content:[12 {type:"document", source:{type:"text", media_type:"text/plain", data:"The sky is blue. Grass is green."}, title:"Colors", citations:{enabled:true}},13 {type:"text", text:"What color is grass? Answer in one sentence and cite."}]}]}')"14echo "HTTP $ANT_STATUS"15echo "$OUT" | jq -c '.content[] | {text, citations}'16log_request anthropic POST /v1/messages "$ANT_STATUS" 0.0007 "example citations/citations_text_document.sh $MODEL"17