Home / Function/ parse_beta_response() — anthropic-sdk-python Function Reference

parse_beta_response() — anthropic-sdk-python Function Reference

Architecture documentation for the parse_beta_response() function in _response.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  c52909f8_7c15_aa0f_e3f8_7324554a2c2c["parse_beta_response()"]
  aa7d21d4_f6f0_8301_73f8_2ea17597e81e["_response.py"]
  c52909f8_7c15_aa0f_e3f8_7324554a2c2c -->|defined in| aa7d21d4_f6f0_8301_73f8_2ea17597e81e
  003dda82_b050_1266_a7d3_b3e2e3c50b4a["parse_text()"]
  c52909f8_7c15_aa0f_e3f8_7324554a2c2c -->|calls| 003dda82_b050_1266_a7d3_b3e2e3c50b4a
  style c52909f8_7c15_aa0f_e3f8_7324554a2c2c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/lib/_parse/_response.py lines 23–46

def parse_beta_response(
    *,
    output_format: ResponseFormatT | NotGiven,
    response: BetaMessage,
) -> ParsedBetaMessage[ResponseFormatT]:
    content_list: list[ParsedBetaContentBlock[ResponseFormatT]] = []
    for content in response.content:
        if content.type == "text":
            content_list.append(
                construct_type_unchecked(
                    type_=ParsedBetaTextBlock[ResponseFormatT],
                    value={**content.to_dict(), "parsed_output": parse_text(content.text, output_format)},
                )
            )
        else:
            content_list.append(content)  # type: ignore

    return construct_type_unchecked(
        type_=ParsedBetaMessage[ResponseFormatT],
        value={
            **response.to_dict(),
            "content": content_list,
        },
    )

Subdomains

Calls

Frequently Asked Questions

What does parse_beta_response() do?
parse_beta_response() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/lib/_parse/_response.py.
Where is parse_beta_response() defined?
parse_beta_response() is defined in src/anthropic/lib/_parse/_response.py at line 23.
What does parse_beta_response() call?
parse_beta_response() calls 1 function(s): parse_text.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free