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

test_method_count_tokens_with_all_params() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  fc8c1e85_ee5a_2687_c732_8dd38114ab49["test_method_count_tokens_with_all_params()"]
  2636caa4_a35b_502e_80af_e3973f39b3bf["TestMessages"]
  fc8c1e85_ee5a_2687_c732_8dd38114ab49 -->|defined in| 2636caa4_a35b_502e_80af_e3973f39b3bf
  bfabf7b9_23da_e12a_0fb6_eba7e2dc809b["test_method_count_tokens_with_all_params()"]
  bfabf7b9_23da_e12a_0fb6_eba7e2dc809b -->|calls| fc8c1e85_ee5a_2687_c732_8dd38114ab49
  bfabf7b9_23da_e12a_0fb6_eba7e2dc809b["test_method_count_tokens_with_all_params()"]
  fc8c1e85_ee5a_2687_c732_8dd38114ab49 -->|calls| bfabf7b9_23da_e12a_0fb6_eba7e2dc809b
  08e9c9e7_d7f9_615f_5837_b3de69122e37["assert_matches_type()"]
  fc8c1e85_ee5a_2687_c732_8dd38114ab49 -->|calls| 08e9c9e7_d7f9_615f_5837_b3de69122e37
  style fc8c1e85_ee5a_2687_c732_8dd38114ab49 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/api_resources/test_messages.py lines 308–373

    def test_method_count_tokens_with_all_params(self, client: Anthropic) -> None:
        message = client.messages.count_tokens(
            messages=[
                {
                    "content": "string",
                    "role": "user",
                }
            ],
            model="claude-opus-4-6",
            output_config={
                "effort": "low",
                "format": {
                    "schema": {"foo": "bar"},
                    "type": "json_schema",
                },
            },
            system=[
                {
                    "text": "Today's date is 2024-06-01.",
                    "type": "text",
                    "cache_control": {
                        "type": "ephemeral",
                        "ttl": "5m",
                    },
                    "citations": [
                        {
                            "cited_text": "cited_text",
                            "document_index": 0,
                            "document_title": "x",
                            "end_char_index": 0,
                            "start_char_index": 0,
                            "type": "char_location",
                        }
                    ],
                }
            ],
            thinking={
                "type": "adaptive",
            },
            tool_choice={
                "type": "auto",
                "disable_parallel_tool_use": True,
            },
            tools=[
                {
                    "input_schema": {
                        "type": "object",
                        "properties": {
                            "location": "bar",
                            "unit": "bar",
                        },
                        "required": ["location"],
                    },
                    "name": "name",
                    "cache_control": {
                        "type": "ephemeral",
                        "ttl": "5m",
                    },
                    "description": "Get the current weather in a given location",
                    "eager_input_streaming": True,
                    "strict": True,
                    "type": "custom",
                }
            ],
        )
        assert_matches_type(MessageTokensCount, message, path=["response"])

Subdomains

Frequently Asked Questions

What does test_method_count_tokens_with_all_params() do?
test_method_count_tokens_with_all_params() is a function in the anthropic-sdk-python codebase, defined in tests/api_resources/test_messages.py.
Where is test_method_count_tokens_with_all_params() defined?
test_method_count_tokens_with_all_params() is defined in tests/api_resources/test_messages.py at line 308.
What does test_method_count_tokens_with_all_params() call?
test_method_count_tokens_with_all_params() calls 2 function(s): assert_matches_type, test_method_count_tokens_with_all_params.
What calls test_method_count_tokens_with_all_params()?
test_method_count_tokens_with_all_params() is called by 1 function(s): test_method_count_tokens_with_all_params.

Analyze Your Own Codebase

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

Try Supermodel Free