Home / Function/ test_init_chat_model_chain() — langchain Function Reference

test_init_chat_model_chain() — langchain Function Reference

Architecture documentation for the test_init_chat_model_chain() function in test_base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  0dea28bb_f14f_e2c7_bf88_8d523ea8429c["test_init_chat_model_chain()"]
  d97c36f9_2cb7_79f6_9cc9_9f2139bb0c00["test_base.py"]
  0dea28bb_f14f_e2c7_bf88_8d523ea8429c -->|defined in| d97c36f9_2cb7_79f6_9cc9_9f2139bb0c00
  style 0dea28bb_f14f_e2c7_bf88_8d523ea8429c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/integration_tests/chat_models/test_base.py lines 22–35

async def test_init_chat_model_chain() -> None:
    model = init_chat_model("gpt-4o", configurable_fields="any", config_prefix="bar")
    model_with_tools = model.bind_tools([Multiply])

    model_with_config = model_with_tools.with_config(
        RunnableConfig(tags=["foo"]),
        configurable={"bar_model": "claude-sonnet-4-5-20250929"},
    )
    prompt = ChatPromptTemplate.from_messages([("system", "foo"), ("human", "{input}")])
    chain = prompt | model_with_config
    output = chain.invoke({"input": "bar"})
    assert isinstance(output, AIMessage)
    events = [event async for event in chain.astream_events({"input": "bar"}, version="v2")]
    assert events

Domain

Subdomains

Frequently Asked Questions

What does test_init_chat_model_chain() do?
test_init_chat_model_chain() is a function in the langchain codebase, defined in libs/langchain_v1/tests/integration_tests/chat_models/test_base.py.
Where is test_init_chat_model_chain() defined?
test_init_chat_model_chain() is defined in libs/langchain_v1/tests/integration_tests/chat_models/test_base.py at line 22.

Analyze Your Own Codebase

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

Try Supermodel Free