建议增加提示词中示例代码兼容其他模型

Open
#233 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
ai

Research direction

Start with mindsearch/agent/mindsearch_prompt.py and compare the existing searcher_system_prompt_cn and GRAPH_PROMPT_CN examples with the proposed format. Check how the prompts are consumed, then verify that the revised examples work with qwen, deepseek, and claude; the work is done when those models can run the demonstrated search graph successfully.

Written by the indexing model from the issue text.

Description

我的实践,在提示词中增加fow shot,可以让qwen, deepseek, cluade也能跑通。修改如下:

# mindsearch/agent/mindsearch_prompt.py
searcher_system_prompt_cn = """## 人物简介
你是一个可以调用网络搜索工具的智能助手。请根据"当前问题",调用搜索工具收集信息并回复问题,注意一次回答只能调用一个工具,请在多轮回答中使用多次工具。你能够调用如下工具:
…省略…
## 要求

- 基于"当前问题"的搜索结果,撰写详细完备的回复,优先回答"当前问题"。如果上下文中没有可以回答问题的信息,不生成问题回复,不要编造回答。
…省略…


GRAPH_PROMPT_CN = """## 人物简介
…省略…
## 注意事项

1. 注意,每个搜索节点的内容必须单个问题,不要包含多个问题(比如同时问多个知识点的问题或者多个事物的比较加筛选,类似 A, B, C 有什么区别,那个价格在哪个区间 -> 分别查询)
2. 不要杜撰搜索结果,要等待代码返回结果
3. 同样的问题不要重复提问,可以在已有问题的基础上继续提问
4. 一次输出中,不要包含多个代码块,每次只能有一个代码块
5. 每个代码块应该放置在一个代码块标记中,同时生成完代码后添加一个<|action_end|>标志,如下所示:
    <|action_start|><|interpreter|>```python
    # 你的代码块
    ```<|action_end|>
6. 一个代码块中,一个节点必须和一条边相连,并最后调用node方法获取结果。
7. 整个图构建最后一次回复应该是添加node_name为'response'的 response 节点,必须添加 response 节点,不要添加其他节点。 添加 response 节点的时候,要单独添加,不要和其他节点一起添加,不能同时添加 response 节点和其他节点
示例(注意这是多次的回答而不是单次的):
<|action_start|><|interpreter|>```python
graph = WebSearchGraph()
# 添加根节点
graph.add_root_node(node_content="人工智能的最新进展有哪些?\", node_name="root")
# 添加搜索节点
graph.add_node(node_name="key_areas", node_content="人工智能研究的关键领域有哪些?")
# 添加边,表示搜索节点之间的关系
graph.add_edge(start_node="key_areas", end_node="trends")
# 读取节点的查询结果并打印出来
graph.node("key_areas")
```<|action_end|>
<|action_start|><|interpreter|>```python
# 添加根节点
graph.add_node(node_name="trends", node_content="机器学习的最新趋势是什么?")
graph.add_edge(start_node="key_areas", end_node="trends")
graph.node("trends")
```<|action_end|>
<|action_start|><|interpreter|>```python
graph.add_response_node(node_name="response")
graph.add_edge(start_node="trends", end_node="response")
```<|action_end|>
…省略…
Dominant language
JavaScript
Stars
7k
Forks
684
PR merge metrics
No merged PRs in 30d

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from InternLM/MindSearch

All issues in InternLM/MindSearch

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.