Home / Function/ test_openai_invoke() — langchain Function Reference

test_openai_invoke() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  c92807a0_02c3_1070_f863_ac6403e38ed3["test_openai_invoke()"]
  48232d20_f8c1_b597_14fa_7dc407e9bfe5["test_base.py"]
  c92807a0_02c3_1070_f863_ac6403e38ed3 -->|defined in| 48232d20_f8c1_b597_14fa_7dc407e9bfe5
  style c92807a0_02c3_1070_f863_ac6403e38ed3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/openai/tests/unit_tests/chat_models/test_base.py lines 664–673

def test_openai_invoke(mock_client: MagicMock) -> None:
    llm = ChatOpenAI()

    with patch.object(llm, "client", mock_client):
        res = llm.invoke("bar")
        assert res.content == "Bar Baz"

        # headers are not in response_metadata if include_response_headers not set
        assert "headers" not in res.response_metadata
    assert mock_client.with_raw_response.create.called

Domain

Subdomains

Frequently Asked Questions

What does test_openai_invoke() do?
test_openai_invoke() is a function in the langchain codebase, defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py.
Where is test_openai_invoke() defined?
test_openai_invoke() is defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py at line 664.

Analyze Your Own Codebase

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

Try Supermodel Free