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

messages.py — anthropic-sdk-python Source File

Architecture documentation for messages.py, a python file in the anthropic-sdk-python codebase. 52 imports, 1 dependents.

File python AnthropicClient Authentication 52 imports 1 dependents 5 functions 6 classes

Entity Profile

Dependency Diagram

graph LR
  16f9761f_052b_9813_1b8d_d40d64684eff["messages.py"]
  0db75921_ff1f_34f6_b0e3_6b94eee3e8e5["0db75921:ff1f:34f6:b0e3:6b94eee3e8e5"]
  16f9761f_052b_9813_1b8d_d40d64684eff --> 0db75921_ff1f_34f6_b0e3_6b94eee3e8e5
  b2b2bd85_e598_f0e9_64e6_661945bb42ac["batches.py"]
  16f9761f_052b_9813_1b8d_d40d64684eff --> b2b2bd85_e598_f0e9_64e6_661945bb42ac
  e2cc954c_b743_44af_8834_77533ae996fd["Batches"]
  16f9761f_052b_9813_1b8d_d40d64684eff --> e2cc954c_b743_44af_8834_77533ae996fd
  ed73efe2_f340_c24f_2bf4_933c18889495["AsyncBatches"]
  16f9761f_052b_9813_1b8d_d40d64684eff --> ed73efe2_f340_c24f_2bf4_933c18889495
  13b027cc_0b85_e0ee_25fb_06c322926320["BatchesWithRawResponse"]
  16f9761f_052b_9813_1b8d_d40d64684eff --> 13b027cc_0b85_e0ee_25fb_06c322926320
  6a10a9dd_afb1_8cd3_1062_107f22acfe15["AsyncBatchesWithRawResponse"]
  16f9761f_052b_9813_1b8d_d40d64684eff --> 6a10a9dd_afb1_8cd3_1062_107f22acfe15
  d2b412f6_74cb_29cf_f8d2_287948d9bb09["BatchesWithStreamingResponse"]
  16f9761f_052b_9813_1b8d_d40d64684eff --> d2b412f6_74cb_29cf_f8d2_287948d9bb09
  829896fe_5b1d_978e_61f7_cb3964c9583d["AsyncBatchesWithStreamingResponse"]
  16f9761f_052b_9813_1b8d_d40d64684eff --> 829896fe_5b1d_978e_61f7_cb3964c9583d
  4f8a5ca5_1399_26fa_96cc_530083c5b56a["_types"]
  16f9761f_052b_9813_1b8d_d40d64684eff --> 4f8a5ca5_1399_26fa_96cc_530083c5b56a
  a598874f_bdd1_847f_b583_9bee29d9aefd["_utils"]
  16f9761f_052b_9813_1b8d_d40d64684eff --> a598874f_bdd1_847f_b583_9bee29d9aefd
  9be5f176_2b59_9ad9_2567_fdb1385b6411["_compat"]
  16f9761f_052b_9813_1b8d_d40d64684eff --> 9be5f176_2b59_9ad9_2567_fdb1385b6411
  8260eb76_006d_a810_a568_220b5c6d661f["_models"]
  16f9761f_052b_9813_1b8d_d40d64684eff --> 8260eb76_006d_a810_a568_220b5c6d661f
  940accd6_4f2d_2a66_2b2c_c6069ca0fbc7["_resource"]
  16f9761f_052b_9813_1b8d_d40d64684eff --> 940accd6_4f2d_2a66_2b2c_c6069ca0fbc7
  33844c08_d82a_73b3_1c52_f240f812e55b["_response"]
  16f9761f_052b_9813_1b8d_d40d64684eff --> 33844c08_d82a_73b3_1c52_f240f812e55b
  style 16f9761f_052b_9813_1b8d_d40d64684eff 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

import inspect
import warnings
from typing import TYPE_CHECKING, List, Type, Union, Iterable, Optional, cast
from functools import partial
from itertools import chain
from typing_extensions import Literal, overload

import httpx
import pydantic

from .... import _legacy_response
from .batches import (
    Batches,
    AsyncBatches,
    BatchesWithRawResponse,
    AsyncBatchesWithRawResponse,
    BatchesWithStreamingResponse,
    AsyncBatchesWithStreamingResponse,
)
from ...._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
from ...._utils import is_given, required_args, maybe_transform, strip_not_given, async_maybe_transform
from ...._compat import cached_property
from ...._models import TypeAdapter
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
from ....lib.tools import (
    BetaToolRunner,
    BetaAsyncToolRunner,
    BetaStreamingToolRunner,
    BetaAsyncStreamingToolRunner,
)
from ...._constants import DEFAULT_TIMEOUT, MODEL_NONSTREAMING_TOKENS
from ...._streaming import Stream, AsyncStream
from ....types.beta import (
    BetaThinkingConfigParam,
    message_create_params,
    message_count_tokens_params,
)
from ...._exceptions import AnthropicError
from ...._base_client import make_request_options
from ...._utils._utils import is_dict
from ....lib.streaming import BetaMessageStreamManager, BetaAsyncMessageStreamManager
from ...messages.messages import DEPRECATED_MODELS, MODELS_TO_WARN_WITH_THINKING_ENABLED
from ....types.model_param import ModelParam
from ....lib._parse._response import ResponseFormatT, parse_beta_response
from ....lib._parse._transform import transform_schema
from ....types.beta.beta_message import BetaMessage
from ....lib.tools._beta_functions import (
    BetaFunctionTool,
    BetaRunnableTool,
    BetaAsyncFunctionTool,
    BetaAsyncRunnableTool,
    BetaBuiltinFunctionTool,
    BetaAsyncBuiltinFunctionTool,
)
from ....types.anthropic_beta_param import AnthropicBetaParam
// ... (3686 more lines)

Subdomains

Dependencies

  • 0db75921:ff1f:34f6:b0e3:6b94eee3e8e5
  • AsyncBatches
  • AsyncBatchesWithRawResponse
  • AsyncBatchesWithStreamingResponse
  • Batches
  • BatchesWithRawResponse
  • BatchesWithStreamingResponse
  • _base_client
  • _client
  • _compat
  • _constants
  • _exceptions
  • _models
  • _resource
  • _response
  • _streaming
  • _types
  • _utils
  • _utils._utils
  • batches.py
  • functools
  • httpx
  • inspect
  • itertools
  • lib._parse._response
  • lib._parse._transform
  • lib.streaming
  • lib.tools
  • lib.tools._beta_compaction_control
  • lib.tools._beta_functions
  • messages.messages
  • pydantic
  • types.anthropic_beta_param
  • types.beta
  • types.beta.beta_context_management_config_param
  • types.beta.beta_json_output_format_param
  • types.beta.beta_message
  • types.beta.beta_message_param
  • types.beta.beta_message_tokens_count
  • types.beta.beta_metadata_param
  • types.beta.beta_output_config_param
  • types.beta.beta_raw_message_stream_event
  • types.beta.beta_request_mcp_server_url_definition_param
  • types.beta.beta_text_block_param
  • types.beta.beta_thinking_config_param
  • types.beta.beta_tool_choice_param
  • types.beta.beta_tool_union_param
  • types.beta.parsed_beta_message
  • types.model_param
  • typing
  • typing_extensions
  • warnings

Frequently Asked Questions

What does messages.py do?
messages.py is a source file in the anthropic-sdk-python codebase, written in python. It belongs to the AnthropicClient domain, Authentication subdomain.
What functions are defined in messages.py?
messages.py defines 5 function(s): _client, _merge_output_configs, _validate_output_config_conflict, _warn_output_format_deprecated, validate_output_format.
What does messages.py depend on?
messages.py imports 52 module(s): 0db75921:ff1f:34f6:b0e3:6b94eee3e8e5, AsyncBatches, AsyncBatchesWithRawResponse, AsyncBatchesWithStreamingResponse, Batches, BatchesWithRawResponse, BatchesWithStreamingResponse, _base_client, and 44 more.
What files import messages.py?
messages.py is imported by 1 file(s): __init__.py.
Where is messages.py in the architecture?
messages.py is located at src/anthropic/resources/beta/messages/messages.py (domain: AnthropicClient, subdomain: Authentication, directory: src/anthropic/resources/beta/messages).

Analyze Your Own Codebase

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

Try Supermodel Free