Home / Function/ test_extra_body_with_model_kwargs() — langchain Function Reference

test_extra_body_with_model_kwargs() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/partners/openai/tests/unit_tests/chat_models/test_base.py lines 3019–3037

def test_extra_body_with_model_kwargs() -> None:
    """Test that extra_body and model_kwargs work together correctly."""
    llm = ChatOpenAI(
        model="gpt-4o-mini",
        api_key=SecretStr(
            "test-api-key"
        ),  # Set a fake API key to avoid validation error
        temperature=0.5,
        extra_body={"ttl": 600},
        model_kwargs={"custom_non_openai_param": "test_value"},
    )

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

    # Verify both extra_body and model_kwargs are in payload
    assert payload["extra_body"]["ttl"] == 600
    assert payload["custom_non_openai_param"] == "test_value"
    assert payload["temperature"] == 0.5

Domain

Subdomains

Frequently Asked Questions

What does test_extra_body_with_model_kwargs() do?
test_extra_body_with_model_kwargs() 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_with_model_kwargs() defined?
test_extra_body_with_model_kwargs() is defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py at line 3019.

Analyze Your Own Codebase

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

Try Supermodel Free