Home / Function/ test_web_search() — langchain Function Reference

test_web_search() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  dfae374d_e0f2_3b83_2bf7_58f020317fe1["test_web_search()"]
  af57ae60_607e_c138_9ab0_fb8bb1c5916a["test_chat_models.py"]
  dfae374d_e0f2_3b83_2bf7_58f020317fe1 -->|defined in| af57ae60_607e_c138_9ab0_fb8bb1c5916a
  style dfae374d_e0f2_3b83_2bf7_58f020317fe1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/groq/tests/integration_tests/test_chat_models.py lines 671–700

def test_web_search() -> None:
    llm = ChatGroq(model="groq/compound")
    input_message = {
        "role": "user",
        "content": "Search for the weather in Boston today.",
    }
    full: AIMessageChunk | None = None
    for chunk in llm.stream([input_message]):
        full = chunk if full is None else full + chunk
    assert isinstance(full, AIMessageChunk)
    assert full.additional_kwargs["reasoning_content"]
    assert full.additional_kwargs["executed_tools"]
    assert [block["type"] for block in full.content_blocks] == [
        "reasoning",
        "server_tool_call",
        "server_tool_result",
        "text",
    ]

    next_message = {
        "role": "user",
        "content": "Now search for the weather in San Francisco.",
    }
    response = llm.invoke([input_message, full, next_message])
    assert [block["type"] for block in response.content_blocks] == [
        "reasoning",
        "server_tool_call",
        "server_tool_result",
        "text",
    ]

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free