test_parse_uses_output_config() — anthropic-sdk-python Function Reference
Architecture documentation for the test_parse_uses_output_config() function in test_beta_messages.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 55e28727_496a_adff_d21a_2d67318f4082["test_parse_uses_output_config()"] 692db1db_e9a7_ed62_b129_14081098a7ae["TestAsyncMessages"] 55e28727_496a_adff_d21a_2d67318f4082 -->|defined in| 692db1db_e9a7_ed62_b129_14081098a7ae style 55e28727_496a_adff_d21a_2d67318f4082 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/lib/_parse/test_beta_messages.py lines 50–107
async def test_parse_uses_output_config(self, async_client: AsyncAnthropic, respx_mock: MockRouter) -> None:
class User(BaseModel):
name: str
age: int
async def simple_parse(client: AsyncAnthropic) -> LegacyAPIResponse[ParsedBetaMessage[User]]:
return await client.beta.with_raw_response.messages.parse(
model="claude-sonnet-4-5",
messages=[
{
"role": "user",
"content": "Extract the user's name and age from the following text:\n\nMy name is John Doe and I am 30 years old.",
}
],
output_format=User,
max_tokens=1024,
)
response = await make_async_stream_snapshot_request(
simple_parse,
content_snapshot=external("uuid:044ce19d-3e9c-42d2-90e7-759c978cd94b.json"),
respx_mock=respx_mock,
mock_client=async_client,
path="/v1/messages?beta=true",
)
request_json = json.loads(response.http_request.content)
assert request_json == snapshot(
{
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": """\
Extract the user's name and age from the following text:
My name is John Doe and I am 30 years old.\
""",
}
],
"model": "claude-sonnet-4-5",
"output_config": {
"format": {
"schema": {
"type": "object",
"title": "User",
"properties": {
"name": {"type": "string", "title": "Name"},
"age": {"type": "integer", "title": "Age"},
},
"additionalProperties": False,
"required": ["name", "age"],
},
"type": "json_schema",
}
},
}
)
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_parse_uses_output_config() do?
test_parse_uses_output_config() is a function in the anthropic-sdk-python codebase, defined in tests/lib/_parse/test_beta_messages.py.
Where is test_parse_uses_output_config() defined?
test_parse_uses_output_config() is defined in tests/lib/_parse/test_beta_messages.py at line 50.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free