Home / Function/ test_backward_compatibility_with_string_system_prompt() — langchain Function Reference

test_backward_compatibility_with_string_system_prompt() — langchain Function Reference

Architecture documentation for the test_backward_compatibility_with_string_system_prompt() function in test_system_message.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  28228df4_c0c0_245e_1ce8_eea57ba07fec["test_backward_compatibility_with_string_system_prompt()"]
  6469df6a_13d0_be79_9859_f2030c6dde8c["TestSystemMessageMiddlewareIntegration"]
  28228df4_c0c0_245e_1ce8_eea57ba07fec -->|defined in| 6469df6a_13d0_be79_9859_f2030c6dde8c
  56f7d1ae_98db_01a6_dc7e_786fe86dd0c4["_make_request()"]
  28228df4_c0c0_245e_1ce8_eea57ba07fec -->|calls| 56f7d1ae_98db_01a6_dc7e_786fe86dd0c4
  style 28228df4_c0c0_245e_1ce8_eea57ba07fec fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/test_system_message.py lines 940–954

    def test_backward_compatibility_with_string_system_prompt(self) -> None:
        """Test that middleware still works with string system prompts."""

        def string_middleware(request: ModelRequest) -> ModelRequest:
            """Middleware using string system prompt (backward compatible)."""
            current_prompt = request.system_prompt or ""
            new_prompt = current_prompt + " Additional instructions."
            # system_prompt is deprecated but supported at runtime for backward compatibility
            return request.override(system_prompt=new_prompt.strip())  # type: ignore[call-arg]

        request = _make_request(system_prompt="Base prompt")
        new_request = string_middleware(request)

        assert new_request.system_prompt == "Base prompt Additional instructions."
        assert isinstance(new_request.system_message, SystemMessage)

Domain

Subdomains

Frequently Asked Questions

What does test_backward_compatibility_with_string_system_prompt() do?
test_backward_compatibility_with_string_system_prompt() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/test_system_message.py.
Where is test_backward_compatibility_with_string_system_prompt() defined?
test_backward_compatibility_with_string_system_prompt() is defined in libs/langchain_v1/tests/unit_tests/agents/test_system_message.py at line 940.
What does test_backward_compatibility_with_string_system_prompt() call?
test_backward_compatibility_with_string_system_prompt() calls 1 function(s): _make_request.

Analyze Your Own Codebase

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

Try Supermodel Free