Home / Function/ test_system_message_single_tool() — langchain Function Reference

test_system_message_single_tool() — langchain Function Reference

Architecture documentation for the test_system_message_single_tool() function in test_structured_chat.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  01395fd5_8e3a_e32a_38ae_97a2b4d748b5["test_system_message_single_tool()"]
  742971a1_c426_ee5f_9355_f94bbb636166["TestCreatePrompt"]
  01395fd5_8e3a_e32a_38ae_97a2b4d748b5 -->|defined in| 742971a1_c426_ee5f_9355_f94bbb636166
  style 01395fd5_8e3a_e32a_38ae_97a2b4d748b5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/agents/test_structured_chat.py lines 135–184

    def test_system_message_single_tool(self) -> None:
        prompt: Any = StructuredChatAgent.create_prompt(
            [Tool(name="foo", description="Test tool FOO", func=lambda x: x)],
        )
        actual = prompt.messages[0].prompt.format()

        expected = dedent(
            """
            Respond to the human as helpfully and accurately as possible. You have access to the following tools:

            foo: Test tool FOO, args: {'tool_input': {'type': 'string'}}

            Use a json blob to specify a tool by providing an action key (tool name) and an action_input key (tool input).

            Valid "action" values: "Final Answer" or foo

            Provide only ONE action per $JSON_BLOB, as shown:

            ```
            {
              "action": $TOOL_NAME,
              "action_input": $INPUT
            }
            ```

            Follow this format:

            Question: input question to answer
            Thought: consider previous and subsequent steps
            Action:
            ```
            $JSON_BLOB
            ```
            Observation: action result
            ... (repeat Thought/Action/Observation N times)
            Thought: I know what to respond
            Action:
            ```
            {
              "action": "Final Answer",
              "action_input": "Final response to human"
            }
            ```

            Begin! Reminder to ALWAYS respond with a valid json blob of a single action. Use tools if necessary. Respond directly if appropriate. Format is Action:```$JSON_BLOB```then Observation:.
            Thought:
            """,  # noqa: E501
        ).strip()

        assert actual == expected

Domain

Subdomains

Frequently Asked Questions

What does test_system_message_single_tool() do?
test_system_message_single_tool() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/agents/test_structured_chat.py.
Where is test_system_message_single_tool() defined?
test_system_message_single_tool() is defined in libs/langchain/tests/unit_tests/agents/test_structured_chat.py at line 135.

Analyze Your Own Codebase

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

Try Supermodel Free