Home / Function/ test_extra_body_parameter() — langchain Function Reference

test_extra_body_parameter() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/partners/openai/tests/unit_tests/chat_models/test_base.py lines 3000–3016

def test_extra_body_parameter() -> None:
    """Test that extra_body parameter is properly included in request payload."""
    llm = ChatOpenAI(
        model="gpt-4o-mini",
        api_key=SecretStr(
            "test-api-key"
        ),  # Set a fake API key to avoid validation error
        extra_body={"ttl": 300, "custom_param": "test_value"},
    )

    messages = [HumanMessage(content="Hello")]
    payload = llm._get_request_payload(messages)

    # Verify extra_body is included in the payload
    assert "extra_body" in payload
    assert payload["extra_body"]["ttl"] == 300
    assert payload["extra_body"]["custom_param"] == "test_value"

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free