Home / File/ tool_param.py — anthropic-sdk-python Source File

tool_param.py — anthropic-sdk-python Source File

Architecture documentation for tool_param.py, a python file in the anthropic-sdk-python codebase. 6 imports, 3 dependents.

File python AnthropicClient 6 imports 3 dependents 2 classes

Entity Profile

Dependency Diagram

graph LR
  0a6fc20c_de0a_9f7c_f378_c2e368483562["tool_param.py"]
  c200b525_3039_1d0b_d858_f0f2859bd98e["_types"]
  0a6fc20c_de0a_9f7c_f378_c2e368483562 --> c200b525_3039_1d0b_d858_f0f2859bd98e
  699c911a_fb78_b883_732f_5ac6bf31d4a3["_models"]
  0a6fc20c_de0a_9f7c_f378_c2e368483562 --> 699c911a_fb78_b883_732f_5ac6bf31d4a3
  7b6a56f6_ac0b_b2be_9a30_e7e1bb30529a["cache_control_ephemeral_param.py"]
  0a6fc20c_de0a_9f7c_f378_c2e368483562 --> 7b6a56f6_ac0b_b2be_9a30_e7e1bb30529a
  f1f58cbf_75c8_98cd_2b10_51b503d83961["CacheControlEphemeralParam"]
  0a6fc20c_de0a_9f7c_f378_c2e368483562 --> f1f58cbf_75c8_98cd_2b10_51b503d83961
  89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875["typing"]
  0a6fc20c_de0a_9f7c_f378_c2e368483562 --> 89ddcdd7_3ae1_4c7b_41bb_9f1e25f16875
  37c05070_ca59_d596_7250_de9d1939227f["typing_extensions"]
  0a6fc20c_de0a_9f7c_f378_c2e368483562 --> 37c05070_ca59_d596_7250_de9d1939227f
  2eb1aa7f_c778_4d68_0a26_a102fadd9638["__init__.py"]
  2eb1aa7f_c778_4d68_0a26_a102fadd9638 --> 0a6fc20c_de0a_9f7c_f378_c2e368483562
  297c2067_cd78_c65b_b9eb_ee1696eac623["message_count_tokens_tool_param.py"]
  297c2067_cd78_c65b_b9eb_ee1696eac623 --> 0a6fc20c_de0a_9f7c_f378_c2e368483562
  454d11cb_0b86_9e73_f884_ace481771106["tool_union_param.py"]
  454d11cb_0b86_9e73_f884_ace481771106 --> 0a6fc20c_de0a_9f7c_f378_c2e368483562
  style 0a6fc20c_de0a_9f7c_f378_c2e368483562 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import Dict, Union, Optional
from typing_extensions import Literal, Required, TypeAlias, TypedDict

from .._types import SequenceNotStr
from .._models import set_pydantic_config
from .cache_control_ephemeral_param import CacheControlEphemeralParam

__all__ = ["ToolParam", "InputSchema"]


class InputSchemaTyped(TypedDict, total=False):
    """[JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.

    This defines the shape of the `input` that your tool accepts and that the model will produce.
    """

    type: Required[Literal["object"]]

    properties: Optional[Dict[str, object]]

    required: Optional[SequenceNotStr[str]]


set_pydantic_config(InputSchemaTyped, {"extra": "allow"})

InputSchema: TypeAlias = Union[InputSchemaTyped, Dict[str, object]]


class ToolParam(TypedDict, total=False):
    input_schema: Required[InputSchema]
    """[JSON schema](https://json-schema.org/draft/2020-12) for this tool's input.

    This defines the shape of the `input` that your tool accepts and that the model
    will produce.
    """

    name: Required[str]
    """Name of the tool.

    This is how the tool will be called by the model and in `tool_use` blocks.
    """

    cache_control: Optional[CacheControlEphemeralParam]
    """Create a cache control breakpoint at this content block."""

    description: str
    """Description of what this tool does.

    Tool descriptions should be as detailed as possible. The more information that
    the model has about what the tool is and how to use it, the better it will
    perform. You can use natural language descriptions to reinforce important
    aspects of the tool input JSON schema.
    """

    eager_input_streaming: Optional[bool]
    """Enable eager input streaming for this tool.

    When true, tool input parameters will be streamed incrementally as they are
    generated, and types will be inferred on-the-fly rather than buffering the full
    JSON output. When false, streaming is disabled for this tool even if the
    fine-grained-tool-streaming beta is active. When null (default), uses the
    default behavior based on beta headers.
    """

    strict: bool
    """When true, guarantees schema validation on tool names and inputs"""

    type: Optional[Literal["custom"]]

Dependencies

Frequently Asked Questions

What does tool_param.py do?
tool_param.py is a source file in the anthropic-sdk-python codebase, written in python. It belongs to the AnthropicClient domain.
What does tool_param.py depend on?
tool_param.py imports 6 module(s): CacheControlEphemeralParam, _models, _types, cache_control_ephemeral_param.py, typing, typing_extensions.
What files import tool_param.py?
tool_param.py is imported by 3 file(s): __init__.py, message_count_tokens_tool_param.py, tool_union_param.py.
Where is tool_param.py in the architecture?
tool_param.py is located at src/anthropic/types/tool_param.py (domain: AnthropicClient, directory: src/anthropic/types).

Analyze Your Own Codebase

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

Try Supermodel Free