Question for React Agent
还没有人认领这个 Issue。
评估
调研方向
从 lagent_example.py 到 react.py 跟踪 prompt 和执行流程,从 select_action_template、output_format_template 以及 issue 中所示的 ActionFormat 和 FinishFormat 定义开始。跟踪用户查询、工具信息和环境输出分别从哪里进入每次迭代。完成的标准是记录之前的输出是否被纳入,并确定具体缺失或被误解的实现链路。
由索引模型根据 Issue 内容生成。
描述
I have taken a look at inside lagent_example.py and react.py.
it seems like the react prompt does not incorporate the previous output as new input.
Is it a systematic mistake, or am I missing some implementation chain?
So, where does the agent inject the question (user query) or environmental output?
So the prompt is like below
class ActionCall(BaseModel):
name: str = Field(description='调用的函数名称') # The name of the function being called
parameters: Dict = Field(description='调用函数的参数') # The parameters for the function call
class ActionFormat(BaseModel):
thought_process: str = Field(
description='描述当前所处的状态和已知信息。这有助于明确目前所掌握的信息和接下来的搜索方向。'
#description='Describe the current state and known information. This helps clarify what is known and the next search direction.'
)
action: ActionCall = Field(description='当前步骤需要执行的操作,包括函数名称和参数。') # description='The action to be performed at this step, including the function name and parameters.'
class FinishFormat(BaseModel):
thought_process: str = Field(
description='描述当前所处的状态和已知信息。这有助于明确目前所掌握的信息和接下来的搜索方向。'
#'Describe the current state and known information. This helps clarify what is known and the next search direction.'
)
conclusion: str = Field(description='总结当前的搜索结果,回答问题。') # 'Summarize the current search results and provide an answer.'
prompt_template = PromptTemplate(select_action_template)
output_format = JSONParser(output_format_template, function_format=ActionFormat, finish_format=FinishFormat)
select_action_template = """你是一个可以调用外部工具的助手,可以使用的工具包括:
{action_info}
{output_format}
开始!"""
"""
Translation
select_action_template = '''You are an assistant capable of calling external tools. The available tools include:
{action_info}
{output_format}
Begin!
"""
output_format_template = """如果使用工具请遵循以下格式回复:
{function_format}
如果你已经知道了答案,或者你不需要工具,请遵循以下格式回复
{finish_format}"""
''' Translation
output_format_template = """If you need to use a tool, please follow this response format:
{function_format}
If you already know the answer or do not need a tool, please follow this response format:
{finish_format}"""
- 主要语言
- Python
- 星标
- 2.3k
- 派生
- 249
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
InternLM/lagent 的其他 Issue
-
OpenAI shuts down gpt-3.5-turbo and gpt-4o-2024-05-13 on 2026-10-23: default model_type values need updating可能已有人在做 @qiyuhuating 于 53 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 65/100
-
`trust_remote_code=True` is hard-coded in the Hugging Face and vLLM wrappers and cannot be turned off可能已有人在做 @ningyixi 于 4 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 50/100
-
难度 5/5 一周以上 新手友好度 30/100
-
难度 5/5 一周以上 新手友好度 30/100
-
难度 5/5 一周以上 新手友好度 25/100
相似的 Issue
-
accepted
难度 2/5 1-3 小时 新手友好度 66/100
future-agi/future-agi#5908 ·
维护者通常 1 天内回复
-
Placeholder export disables HTML image input for picture description可能已有人在做 @cloudiful 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
docling-project/docling-serve#817 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 92/100
Techiebutler/freeframe#687 ·
维护者通常 1 天内回复
-
Parse truncated verbose GC logs up to the first XML error可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug verbose GC
难度 2/5 1-3 小时 新手友好度 74/100
IBM/javacore-analyser#677 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 79/100
维护者通常 2 天内回复