✓ PASS

any-llm 1.40.2

truncation.structured-output · anthropic

Back to results · Scenario

Requirements

IdLevelStatusEvidence
no-partial-successMUSTSATISFIEDstructured.attempted=true; structured.returned_as_success=false
cause-is-truncationMUSTSATISFIEDfinish.value="length" (primary: error.completion.choices[0].finish_reason); truth.finish="length"; error.category="truncation"; structured.returned_as_success=false
text-reportedSHOULDSATISFIEDtext.value="{\"islands\":[{\"name\":\"Κρήτη\",\"sea\":" (primary); truth.text="{\"islands\":[{\"name\":\"Κρήτη\",\"sea\":"
usage-reportedSHOULDSATISFIEDusage.input=25 (primary); truth.usage.input=25; usage.output=24 (primary); truth.usage.output=24

What the provider sent

Finish
length
Raw finish
max_tokens
Text
{"islands":[{"name":"Κρήτη","sea":
Tool calls
[]
Usage
{
  "alternatives": {},
  "cached_input": null,
  "input": 25,
  "output": 24,
  "raw": {
    "input_tokens": 25,
    "output_tokens": 24,
    "output_tokens_details": {
      "thinking_tokens": 4
    }
  },
  "reasoning": 4,
  "total": 49
}
Stream completed
null
Error
null
Wire excerpt
status: 200
content-type: application/json
body (json):
{
  "id": "msg_01Aq9w938a90dw8q",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "thinking",
      "thinking": "",
      "signature": "EqQBCgIYAhIM1gbcDa9GJwZA2b3hGgxBdjrkzLoky3dl1pkiMOYds..."
    },
    {
      "type": "text",
      "text": "{\"islands\":[{\"name\":\"Κρήτη\",\"sea\":"
    }
  ],
  "model": "claude-sonnet-5-5",
  "stop_reason": "max_tokens",
  "stop_sequence": null,
  "stop_details": null,
  "usage": {
    "input_tokens": 25,
    "output_tokens": 24,
    "output_tokens_details": {
      "thinking_tokens": 4
    }
  }
}

What the library reported

Outcome
raised
Finish
{
  "raw": "length",
  "source": "error.completion.choices[0].finish_reason",
  "surface": "primary",
  "value": "length"
}
Text
Value
{"islands":[{"name":"Κρήτη","sea":
Surface
primary
Tool calls
[]
Usage
{
  "cached_input": null,
  "input": 25,
  "output": 24,
  "reasoning": null,
  "surface": {
    "cached_input": "absent",
    "input": "primary",
    "output": "primary",
    "reasoning": "absent",
    "total": "primary"
  },
  "total": 49
}
Stream
{
  "chunks_seen": null,
  "completed": null,
  "used": false
}
Error
Type
any_llm.exceptions.LengthFinishReasonError
Message
Could not parse response content as the length limit was reached
Category
truncation
Retry after
null
Stack top
any_llm/any_llm.py:938
Unsupported reason
null
Full observation JSON
{
  "elapsed_ms": 106.44666291773319,
  "error": {
    "category": "truncation",
    "message": "Could not parse response content as the length limit was reached",
    "retry_after": null,
    "stack_top": "any_llm/any_llm.py:938",
    "type": "any_llm.exceptions.LengthFinishReasonError"
  },
  "finish": {
    "raw": "length",
    "source": "error.completion.choices[0].finish_reason",
    "surface": "primary",
    "value": "length"
  },
  "format": "wiretruth.observation/v1",
  "library": {
    "api": "any_llm.completion",
    "language": "python",
    "name": "any-llm",
    "version": "1.40.2"
  },
  "notes": [],
  "outcome": "raised",
  "stream": {
    "chunks_seen": null,
    "completed": null,
    "used": false
  },
  "structured": {
    "attempted": true,
    "returned_as_success": false,
    "value": null
  },
  "text": {
    "surface": "primary",
    "value": "{\"islands\":[{\"name\":\"Κρήτη\",\"sea\":"
  },
  "tool_calls": [],
  "unsupported_reason": null,
  "usage": {
    "cached_input": null,
    "input": 25,
    "output": 24,
    "reasoning": null,
    "surface": {
      "cached_input": "absent",
      "input": "primary",
      "output": "primary",
      "reasoning": "absent",
      "total": "primary"
    },
    "total": 49
  }
}

Fixture

documented anthropic/truncation.structured-output

ProvenanceValue
Sourcehttps://platform.claude.com/docs/en/build-with-claude/structured-outputs#invalid-outputs
NotesDocumented shapes, not a recording. Message envelope and stop fields follow handling-stop-reasons; content blocks follow thinking/streaming and handle-tool-calls. Model changed to claude-sonnet-5-5; IDs and scenario text are filled in. Token counts are illustrative, filled in to include thinking within the requested output limit, not measured. The native request uses output_config.format. ASSUMED partial Greek JSON prefix and thinking block at max_tokens; the docs describe incomplete structured output but do not print this exact envelope. The output_tokens_details.thinking_tokens breakdown follows thinking-steering.md (https://platform.claude.com/docs/en/build-with-claude/thinking-steering-and-cost#pricing); the thinking count of 4 is filled in, not measured.

Reproduce

wiretruth serve anthropic/truncation.structured-output

Plain-library snippet from the shim manifest.

any_llm.completion(model=model, provider='anthropic', api_base=WIRETRUTH_BASE_URL_ANTHROPIC, api_key=WIRETRUTH_API_KEY); host root, SDK appends /v1/messages and uses x-api-key

Upstream

No matching upstream report.

History

VersionGrade
1.40.2✓ PASS
1.38.0✓ PASS
1.33.0✓ PASS