Home / Function/ test_stateful_api() — langchain Function Reference

test_stateful_api() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  2a5adbdd_78a8_7ab8_7a0b_b566829ab2ce["test_stateful_api()"]
  992496d5_b7d4_139f_00cf_3e585d851f81["test_responses_api.py"]
  2a5adbdd_78a8_7ab8_7a0b_b566829ab2ce -->|defined in| 992496d5_b7d4_139f_00cf_3e585d851f81
  style 2a5adbdd_78a8_7ab8_7a0b_b566829ab2ce fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py lines 374–383

def test_stateful_api() -> None:
    llm = ChatOpenAI(model=MODEL_NAME, use_responses_api=True)
    response = llm.invoke("how are you, my name is Bobo")
    assert "id" in response.response_metadata

    second_response = llm.invoke(
        "what's my name", previous_response_id=response.response_metadata["id"]
    )
    assert isinstance(second_response.content, list)
    assert "bobo" in second_response.content[0]["text"].lower()  # type: ignore

Domain

Subdomains

Frequently Asked Questions

What does test_stateful_api() do?
test_stateful_api() is a function in the langchain codebase, defined in libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py.
Where is test_stateful_api() defined?
test_stateful_api() is defined in libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py at line 374.

Analyze Your Own Codebase

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

Try Supermodel Free