Home / Function/ get_action_and_input() — langchain Function Reference

get_action_and_input() — langchain Function Reference

Architecture documentation for the get_action_and_input() function in test_mrkl.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  893a0b31_0a99_6756_3281_2a5a05606fe2["get_action_and_input()"]
  11e4d0ce_1ab2_b50d_7115_96011ca80049["test_mrkl.py"]
  893a0b31_0a99_6756_3281_2a5a05606fe2 -->|defined in| 11e4d0ce_1ab2_b50d_7115_96011ca80049
  2f6aa646_9dc1_04c1_ad28_568da3247560["test_get_action_and_input()"]
  2f6aa646_9dc1_04c1_ad28_568da3247560 -->|calls| 893a0b31_0a99_6756_3281_2a5a05606fe2
  9c1e7bc3_a861_31c6_aac9_199257c7c3d4["test_get_action_and_input_whitespace()"]
  9c1e7bc3_a861_31c6_aac9_199257c7c3d4 -->|calls| 893a0b31_0a99_6756_3281_2a5a05606fe2
  faf042c2_aa83_0ffc_6300_7591a96f6d06["test_get_action_and_input_newline()"]
  faf042c2_aa83_0ffc_6300_7591a96f6d06 -->|calls| 893a0b31_0a99_6756_3281_2a5a05606fe2
  b519d8f2_549d_98d4_86d1_54296c7c626a["test_get_action_and_input_newline_after_keyword()"]
  b519d8f2_549d_98d4_86d1_54296c7c626a -->|calls| 893a0b31_0a99_6756_3281_2a5a05606fe2
  bb77e2d3_0783_9884_cb51_329107c616bf["test_get_action_and_input_sql_query()"]
  bb77e2d3_0783_9884_cb51_329107c616bf -->|calls| 893a0b31_0a99_6756_3281_2a5a05606fe2
  4e050a17_294b_eb1d_1de5_ebd2ccf87a8c["test_get_final_answer()"]
  4e050a17_294b_eb1d_1de5_ebd2ccf87a8c -->|calls| 893a0b31_0a99_6756_3281_2a5a05606fe2
  64a5a894_6da7_3ce9_2006_33cd891c1428["test_get_final_answer_new_line()"]
  64a5a894_6da7_3ce9_2006_33cd891c1428 -->|calls| 893a0b31_0a99_6756_3281_2a5a05606fe2
  7e42ddb0_3ce5_f245_d5a1_9b65f41b2f7a["test_get_final_answer_multiline()"]
  7e42ddb0_3ce5_f245_d5a1_9b65f41b2f7a -->|calls| 893a0b31_0a99_6756_3281_2a5a05606fe2
  0656ca62_0e7d_1e2f_aa7d_f42144cb9521["test_bad_action_input_line()"]
  0656ca62_0e7d_1e2f_aa7d_f42144cb9521 -->|calls| 893a0b31_0a99_6756_3281_2a5a05606fe2
  6e4a8c0d_52fc_9c09_0846_0a8c09eb77e1["test_bad_action_line()"]
  6e4a8c0d_52fc_9c09_0846_0a8c09eb77e1 -->|calls| 893a0b31_0a99_6756_3281_2a5a05606fe2
  4c21af1e_5484_6b2f_503b_ae0b7fc6f538["test_valid_action_and_answer_raises_exception()"]
  4c21af1e_5484_6b2f_503b_ae0b7fc6f538 -->|calls| 893a0b31_0a99_6756_3281_2a5a05606fe2
  style 893a0b31_0a99_6756_3281_2a5a05606fe2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/agents/test_mrkl.py lines 15–19

def get_action_and_input(text: str) -> tuple[str, str]:
    output = MRKLOutputParser().parse(text)
    if isinstance(output, AgentAction):
        return output.tool, str(output.tool_input)
    return "Final Answer", output.return_values["output"]

Domain

Subdomains

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_mrkl.py.
Where is get_action_and_input() defined?
get_action_and_input() is defined in libs/langchain/tests/unit_tests/agents/test_mrkl.py at line 15.
What calls get_action_and_input()?
get_action_and_input() is called by 11 function(s): test_bad_action_input_line, test_bad_action_line, test_get_action_and_input, test_get_action_and_input_newline, test_get_action_and_input_newline_after_keyword, test_get_action_and_input_sql_query, test_get_action_and_input_whitespace, test_get_final_answer, and 3 more.

Analyze Your Own Codebase

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

Try Supermodel Free