Home / Function/ test_web_search_async() — langchain Function Reference

test_web_search_async() — langchain Function Reference

Architecture documentation for the test_web_search_async() function in test_responses_api.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  b7c7fdab_8de0_5d29_0383_2ffa7b7d4970["test_web_search_async()"]
  992496d5_b7d4_139f_00cf_3e585d851f81["test_responses_api.py"]
  b7c7fdab_8de0_5d29_0383_2ffa7b7d4970 -->|defined in| 992496d5_b7d4_139f_00cf_3e585d851f81
  b0966d53_e5bb_3879_d8d6_00823de68309["_check_response()"]
  b7c7fdab_8de0_5d29_0383_2ffa7b7d4970 -->|calls| b0966d53_e5bb_3879_d8d6_00823de68309
  style b7c7fdab_8de0_5d29_0383_2ffa7b7d4970 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py lines 137–161

async def test_web_search_async() -> None:
    llm = ChatOpenAI(model=MODEL_NAME, output_version="v0")
    response = await llm.ainvoke(
        "What was a positive news story from today?",
        tools=[{"type": "web_search_preview"}],
    )
    _check_response(response)
    assert response.response_metadata["status"]

    # Test streaming
    full: BaseMessageChunk | None = None
    async for chunk in llm.astream(
        "What was a positive news story from today?",
        tools=[{"type": "web_search_preview"}],
    ):
        assert isinstance(chunk, AIMessageChunk)
        full = chunk if full is None else full + chunk
    assert isinstance(full, AIMessageChunk)
    _check_response(full)

    for msg in [response, full]:
        assert msg.additional_kwargs["tool_outputs"]
        assert len(msg.additional_kwargs["tool_outputs"]) == 1
        tool_output = msg.additional_kwargs["tool_outputs"][0]
        assert tool_output["type"] == "web_search_call"

Domain

Subdomains

Frequently Asked Questions

What does test_web_search_async() do?
test_web_search_async() is a function in the langchain codebase, defined in libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py.
Where is test_web_search_async() defined?
test_web_search_async() is defined in libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py at line 137.
What does test_web_search_async() call?
test_web_search_async() calls 1 function(s): _check_response.

Analyze Your Own Codebase

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

Try Supermodel Free