Home / Function/ test_load_response_with_empty_content_is_skipped() — langchain Function Reference

test_load_response_with_empty_content_is_skipped() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  2129e8f9_4d1d_d212_601a_cdeeb234be29["test_load_response_with_empty_content_is_skipped()"]
  9c4a2438_9884_cbb0_3cf5_de8827531653["test_chat_models.py"]
  2129e8f9_4d1d_d212_601a_cdeeb234be29 -->|defined in| 9c4a2438_9884_cbb0_3cf5_de8827531653
  style 2129e8f9_4d1d_d212_601a_cdeeb234be29 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/ollama/tests/unit_tests/test_chat_models.py lines 188–215

def test_load_response_with_empty_content_is_skipped(
    caplog: pytest.LogCaptureFixture,
) -> None:
    """Test that load responses with empty content log a warning and are skipped."""
    load_only_response = [
        {
            "model": "test-model",
            "created_at": "2025-01-01T00:00:00.000000000Z",
            "done": True,
            "done_reason": "load",
            "message": {"role": "assistant", "content": ""},
        }
    ]

    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 = load_only_response

        llm = ChatOllama(model="test-model")

        with (
            caplog.at_level(logging.WARNING),
            pytest.raises(ValueError, match="No data received from Ollama stream"),
        ):
            llm.invoke([HumanMessage("Hello")])

        assert "Ollama returned empty response with done_reason='load'" in caplog.text

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free