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

get_transformed_string() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  a416b689_97bc_b9fa_4a5c_e498209ac96c["get_transformed_string()"]
  69ef29cd_4eb8_35c9_a323_d7cf936be862["_transform.py"]
  a416b689_97bc_b9fa_4a5c_e498209ac96c -->|defined in| 69ef29cd_4eb8_35c9_a323_d7cf936be862
  style a416b689_97bc_b9fa_4a5c_e498209ac96c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/anthropic/lib/_parse/_transform.py lines 35–51

def get_transformed_string(
    schema: dict[str, Any],
) -> dict[str, Any]:
    """Transforms a JSON schema of type string to ensure it conforms to the API's expectations.

    Specifically, it ensures that if the schema is of type "string" and does not already
    specify a "format", it sets the format to "text".

    Args:
        schema: The original JSON schema.

    Returns:
        The transformed JSON schema.
    """
    if schema.get("type") == "string" and "format" not in schema:
        schema["format"] = "text"
    return schema

Subdomains

Frequently Asked Questions

What does get_transformed_string() do?
get_transformed_string() is a function in the anthropic-sdk-python codebase, defined in src/anthropic/lib/_parse/_transform.py.
Where is get_transformed_string() defined?
get_transformed_string() is defined in src/anthropic/lib/_parse/_transform.py at line 35.

Analyze Your Own Codebase

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

Try Supermodel Free