Home / Function/ test_anthropic_generate() — langchain Function Reference

test_anthropic_generate() — langchain Function Reference

Architecture documentation for the test_anthropic_generate() function in test_chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  3f8d9139_2ead_6747_26a6_1c98c1763a46["test_anthropic_generate()"]
  f27640dd_3870_5548_d153_f9504ae1021f["test_chat_models.py"]
  3f8d9139_2ead_6747_26a6_1c98c1763a46 -->|defined in| f27640dd_3870_5548_d153_f9504ae1021f
  style 3f8d9139_2ead_6747_26a6_1c98c1763a46 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/tests/integration_tests/test_chat_models.py lines 339–352

def test_anthropic_generate() -> None:
    """Test generate method of anthropic."""
    chat = ChatAnthropic(model=MODEL_NAME)  # type: ignore[call-arg]
    chat_messages: list[list[BaseMessage]] = [
        [HumanMessage(content="How many toes do dogs have?")],
    ]
    messages_copy = [messages.copy() for messages in chat_messages]
    result: LLMResult = chat.generate(chat_messages)
    assert isinstance(result, LLMResult)
    for response in result.generations[0]:
        assert isinstance(response, ChatGeneration)
        assert isinstance(response.text, str)
        assert response.text == response.message.content
    assert chat_messages == messages_copy

Domain

Subdomains

Frequently Asked Questions

What does test_anthropic_generate() do?
test_anthropic_generate() is a function in the langchain codebase, defined in libs/partners/anthropic/tests/integration_tests/test_chat_models.py.
Where is test_anthropic_generate() defined?
test_anthropic_generate() is defined in libs/partners/anthropic/tests/integration_tests/test_chat_models.py at line 339.

Analyze Your Own Codebase

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

Try Supermodel Free