test_none_parameters_excluded_from_options() — langchain Function Reference
Architecture documentation for the test_none_parameters_excluded_from_options() function in test_chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 9a4de024_bdb4_60e6_2e2b_c660eadb9276["test_none_parameters_excluded_from_options()"] 9c4a2438_9884_cbb0_3cf5_de8827531653["test_chat_models.py"] 9a4de024_bdb4_60e6_2e2b_c660eadb9276 -->|defined in| 9c4a2438_9884_cbb0_3cf5_de8827531653 style 9a4de024_bdb4_60e6_2e2b_c660eadb9276 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/ollama/tests/unit_tests/test_chat_models.py lines 315–351
def test_none_parameters_excluded_from_options() -> None:
"""Test that None parameters are excluded from the options dict sent to Ollama."""
response = [
{
"model": "test-model",
"created_at": "2025-01-01T00:00:00.000000000Z",
"done": True,
"done_reason": "stop",
"message": {"role": "assistant", "content": "Hello!"},
}
]
with patch("langchain_ollama.chat_models.Client") as mock_client_class:
mock_client = MagicMock()
mock_client_class.return_value = mock_client
mock_client.chat.return_value = response
# Create ChatOllama with only num_ctx set
llm = ChatOllama(model="test-model", num_ctx=4096)
llm.invoke([HumanMessage("Hello")])
# Verify that chat was called
assert mock_client.chat.called
# Get the options dict that was passed to chat
call_kwargs = mock_client.chat.call_args[1]
options = call_kwargs.get("options", {})
# Only num_ctx should be in options, not None parameters
assert "num_ctx" in options
assert options["num_ctx"] == 4096
# These parameters should NOT be in options since they were None
assert "mirostat" not in options
assert "mirostat_eta" not in options
assert "mirostat_tau" not in options
assert "tfs_z" not in options
Domain
Subdomains
Source
Frequently Asked Questions
What does test_none_parameters_excluded_from_options() do?
test_none_parameters_excluded_from_options() is a function in the langchain codebase, defined in libs/partners/ollama/tests/unit_tests/test_chat_models.py.
Where is test_none_parameters_excluded_from_options() defined?
test_none_parameters_excluded_from_options() is defined in libs/partners/ollama/tests/unit_tests/test_chat_models.py at line 315.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free