Home / Function/ _parse_intermediate_steps() — langchain Function Reference

_parse_intermediate_steps() — langchain Function Reference

Architecture documentation for the _parse_intermediate_steps() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  782b6df1_2ffe_3fa8_3268_e14b8296dbcb["_parse_intermediate_steps()"]
  40171661_732e_8178_c8ae_92254ace13fe["OpenAIAssistantRunnable"]
  782b6df1_2ffe_3fa8_3268_e14b8296dbcb -->|defined in| 40171661_732e_8178_c8ae_92254ace13fe
  addd6899_a5cd_0e3e_74c7_bb99653507b2["invoke()"]
  addd6899_a5cd_0e3e_74c7_bb99653507b2 -->|calls| 782b6df1_2ffe_3fa8_3268_e14b8296dbcb
  2c47f734_2b6a_7a50_60db_4c515cc3d976["_wait_for_run()"]
  782b6df1_2ffe_3fa8_3268_e14b8296dbcb -->|calls| 2c47f734_2b6a_7a50_60db_4c515cc3d976
  style 782b6df1_2ffe_3fa8_3268_e14b8296dbcb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/agents/openai_assistant/base.py lines 520–540

    def _parse_intermediate_steps(
        self,
        intermediate_steps: list[tuple[OpenAIAssistantAction, str]],
    ) -> dict:
        last_action, _ = intermediate_steps[-1]
        run = self._wait_for_run(last_action.run_id, last_action.thread_id)
        required_tool_call_ids = set()
        if run.required_action:
            required_tool_call_ids = {
                tc.id for tc in run.required_action.submit_tool_outputs.tool_calls
            }
        tool_outputs = [
            {"output": str(output), "tool_call_id": action.tool_call_id}
            for action, output in intermediate_steps
            if action.tool_call_id in required_tool_call_ids
        ]
        return {
            "tool_outputs": tool_outputs,
            "run_id": last_action.run_id,
            "thread_id": last_action.thread_id,
        }

Subdomains

Called By

Frequently Asked Questions

What does _parse_intermediate_steps() do?
_parse_intermediate_steps() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/openai_assistant/base.py.
Where is _parse_intermediate_steps() defined?
_parse_intermediate_steps() is defined in libs/langchain/langchain_classic/agents/openai_assistant/base.py at line 520.
What does _parse_intermediate_steps() call?
_parse_intermediate_steps() calls 1 function(s): _wait_for_run.
What calls _parse_intermediate_steps()?
_parse_intermediate_steps() is called by 1 function(s): invoke.

Analyze Your Own Codebase

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

Try Supermodel Free