Home / Function/ test_chat_groq_extra_kwargs() — langchain Function Reference

test_chat_groq_extra_kwargs() — langchain Function Reference

Architecture documentation for the test_chat_groq_extra_kwargs() function in test_chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  aabcd4a0_cb01_4920_f05b_59e956ad0104["test_chat_groq_extra_kwargs()"]
  5bf2e477_37e0_3e98_4042_bc609f2f7f60["test_chat_models.py"]
  aabcd4a0_cb01_4920_f05b_59e956ad0104 -->|defined in| 5bf2e477_37e0_3e98_4042_bc609f2f7f60
  style aabcd4a0_cb01_4920_f05b_59e956ad0104 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/groq/tests/unit_tests/test_chat_models.py lines 213–242

def test_chat_groq_extra_kwargs() -> None:
    """Test extra kwargs to chat groq."""
    # Check that foo is saved in extra_kwargs.
    with pytest.warns(UserWarning) as record:
        llm = ChatGroq(model="foo", foo=3, max_tokens=10)  # type: ignore[call-arg]
        assert llm.max_tokens == 10
        assert llm.model_kwargs == {"foo": 3}
    assert len(record) == 1
    assert type(record[0].message) is UserWarning
    assert "foo is not default parameter" in record[0].message.args[0]

    # Test that if extra_kwargs are provided, they are added to it.
    with pytest.warns(UserWarning) as record:
        llm = ChatGroq(model="foo", foo=3, model_kwargs={"bar": 2})  # type: ignore[call-arg]
        assert llm.model_kwargs == {"foo": 3, "bar": 2}
    assert len(record) == 1
    assert type(record[0].message) is UserWarning
    assert "foo is not default parameter" in record[0].message.args[0]

    # Test that if provided twice it errors
    with pytest.raises(ValueError):
        ChatGroq(model="foo", foo=3, model_kwargs={"foo": 2})  # type: ignore[call-arg]

    # Test that if explicit param is specified in kwargs it errors
    with pytest.raises(ValueError):
        ChatGroq(model="foo", model_kwargs={"temperature": 0.2})

    # Test that "model" cannot be specified in kwargs
    with pytest.raises(ValueError):
        ChatGroq(model="foo", model_kwargs={"model": "test-model"})

Domain

Subdomains

Frequently Asked Questions

What does test_chat_groq_extra_kwargs() do?
test_chat_groq_extra_kwargs() is a function in the langchain codebase, defined in libs/partners/groq/tests/unit_tests/test_chat_models.py.
Where is test_chat_groq_extra_kwargs() defined?
test_chat_groq_extra_kwargs() is defined in libs/partners/groq/tests/unit_tests/test_chat_models.py at line 213.

Analyze Your Own Codebase

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

Try Supermodel Free