get_action_and_input() — langchain Function Reference
Architecture documentation for the get_action_and_input() function in test_structured_chat.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD b13e411d_df46_adca_bd89_cc0401719dde["get_action_and_input()"] a890525c_8c6f_1157_9955_6e77e67c50fd["test_structured_chat.py"] b13e411d_df46_adca_bd89_cc0401719dde -->|defined in| a890525c_8c6f_1157_9955_6e77e67c50fd 9ef21679_4b1a_9e6f_1d26_d55f723ff50c["test_parse_with_language()"] 9ef21679_4b1a_9e6f_1d26_d55f723ff50c -->|calls| b13e411d_df46_adca_bd89_cc0401719dde e65baf3e_ca3a_eef4_7287_51a307f3cf92["test_parse_without_language()"] e65baf3e_ca3a_eef4_7287_51a307f3cf92 -->|calls| b13e411d_df46_adca_bd89_cc0401719dde 33dbe2e9_de16_e5e3_017c_116a62f62e6f["test_parse_with_language_and_spaces()"] 33dbe2e9_de16_e5e3_017c_116a62f62e6f -->|calls| b13e411d_df46_adca_bd89_cc0401719dde ad4262e5_d113_a2c6_7748_43acd812aa7e["test_parse_without_language_without_a_new_line()"] ad4262e5_d113_a2c6_7748_43acd812aa7e -->|calls| b13e411d_df46_adca_bd89_cc0401719dde 735f6ada_b6bb_b983_6c2c_176beecb52c7["test_parse_with_language_without_a_new_line()"] 735f6ada_b6bb_b983_6c2c_176beecb52c7 -->|calls| b13e411d_df46_adca_bd89_cc0401719dde ed4c5fc1_ef5f_ed27_8fff_b1e1573117a2["test_parse_case_matched_and_final_answer()"] ed4c5fc1_ef5f_ed27_8fff_b1e1573117a2 -->|calls| b13e411d_df46_adca_bd89_cc0401719dde style b13e411d_df46_adca_bd89_cc0401719dde fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/tests/unit_tests/agents/test_structured_chat.py lines 22–29
def get_action_and_input(text: str) -> tuple[str, str]:
output = output_parser.parse(text)
if isinstance(output, AgentAction):
return output.tool, str(output.tool_input)
if isinstance(output, AgentFinish):
return output.return_values["output"], output.log
msg = "Unexpected output type" # type: ignore[unreachable]
raise ValueError(msg)
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does get_action_and_input() do?
get_action_and_input() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/agents/test_structured_chat.py.
Where is get_action_and_input() defined?
get_action_and_input() is defined in libs/langchain/tests/unit_tests/agents/test_structured_chat.py at line 22.
What calls get_action_and_input()?
get_action_and_input() is called by 6 function(s): test_parse_case_matched_and_final_answer, test_parse_with_language, test_parse_with_language_and_spaces, test_parse_with_language_without_a_new_line, test_parse_without_language, test_parse_without_language_without_a_new_line.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free