langchain.agents.agent_iterator.AgentExecutorIterator

class langchain.agents.agent_iterator.AgentExecutorIterator(agent_executor: AgentExecutor, inputs: Any, callbacks: Callbacks = None, *, tags: Optional[list[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name: Optional[str] = None, run_id: Optional[UUID] = None, include_run_info: bool = False, yield_actions: bool = False)[source]

AgentExecutor的迭代器。

使用给定的AgentExecutor、输入和可选回调初始化AgentExecutorIterator。

Attributes

agent_executor

color_mapping

inputs

name_to_tool_map

callbacks

tags

metadata

run_name

run_id

include_run_info

yield_actions

Methods

__init__(agent_executor, inputs[, ...])

使用给定的AgentExecutor、输入和可选回调初始化AgentExecutorIterator。

make_final_outputs(outputs, run_manager)

reset()

将迭代器重置为初始状态,清除中间步骤、迭代次数和经过的时间。

update_iterations()

增加迭代次数并更新经过的时间。

Parameters
  • agent_executor (AgentExecutor) –

  • inputs (Any) –

  • callbacks (Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]]) –

  • tags (Optional[list[str]]) –

  • metadata (Optional[Dict[str, Any]]) –

  • run_name (Optional[str]) –

  • run_id (Optional[UUID]) –

  • include_run_info (bool) –

  • yield_actions (bool) –

__init__(agent_executor: AgentExecutor, inputs: Any, callbacks: Callbacks = None, *, tags: Optional[list[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name: Optional[str] = None, run_id: Optional[UUID] = None, include_run_info: bool = False, yield_actions: bool = False)[source]

使用给定的AgentExecutor、输入和可选回调初始化AgentExecutorIterator。

Parameters
  • agent_executor (AgentExecutor) –

  • inputs (Any) –

  • callbacks (Callbacks) –

  • tags (Optional[list[str]]) –

  • metadata (Optional[Dict[str, Any]]) –

  • run_name (Optional[str]) –

  • run_id (Optional[UUID]) –

  • include_run_info (bool) –

  • yield_actions (bool) –

make_final_outputs(outputs: Dict[str, Any], run_manager: Union[CallbackManagerForChainRun, AsyncCallbackManagerForChainRun]) AddableDict[source]
Parameters
Return type

AddableDict

reset() None[source]

将迭代器重置为初始状态,清除中间步骤、迭代次数和经过的时间。

Return type

None

update_iterations() None[source]

增加迭代次数并更新经过的时间。

Return type

None