fc_agent

Module Contents

Classes

FunctionCallAgent

Asynchronous variant of the Agent class

EnvAgent

Asynchronous variant of the Agent class

Functions

get_tool_prompt(actions[, exclude_arguments, template])

Attributes

DEFAULT_TOOL_TEMPLATE

lagent.agents.fc_agent.DEFAULT_TOOL_TEMPLATE = Multiline-String
Show Value
"""# Tools

You may call one or more functions to assist with the user query.

You are provided with function signatures within <tools></tools> XML tags:
<tools>
{tools}
</tools>

For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:
<tool_call>
{{"name": <function-name>, "arguments": <args-json-object>}}
</tool_call>"""
lagent.agents.fc_agent.get_tool_prompt(actions, exclude_arguments=None, template=DEFAULT_TOOL_TEMPLATE)
参数:
  • actions (list) –

  • exclude_arguments (list) –

  • template (str) –

返回类型:

str

class lagent.agents.fc_agent.FunctionCallAgent(select_agent, env_agent, finish_condition=lambda x, _: ..., max_turn=None, name=None)

Bases: lagent.agents.agent.AsyncAgent

Asynchronous variant of the Agent class

参数:
select_agent
env_agent
finish_condition
max_turn = None
async forward(env_message, session_id, **kwargs)
参数:
class lagent.agents.fc_agent.EnvAgent(actions, stateful_tools=None, max_tool_response_length=None, tool_response_truncate_side='middle', action_hooks=None, name=None)

Bases: lagent.agents.agent.AsyncAgent

Asynchronous variant of the Agent class

参数:
  • actions (list) –

  • stateful_tools (List[str]) –

  • max_tool_response_length (int) –

  • tool_response_truncate_side (Literal['left', 'right', 'middle']) –

  • action_hooks (List[Union[dict, lagent.hooks.Hook]]) –

  • name (Optional[str]) –

actions
stateful_tools = []
max_tool_response_length = None
tool_response_truncate_side = 'middle'
async forward(selection_message, session_id, **kwargs)
参数:
async execute_tool(tool_call, session_id)
参数:
  • tool_call (dict) –

  • session_id (str | int) –

返回类型:

lagent.schema.ActionReturn