MindSearch
MindSearch copied to clipboard
`agent_memory` list index out of range
Steps to reproduce
Launch server:
python -m mindsearch.app --lang en --model_format gpt4 --search_engine DuckDuckGoSearch --asy
Launch streamlit:
streamlit run frontend/mindsearch_streamlit.py
Type in a query and get this error:
Traceback (most recent call last):
File "/Users/cxrh/Documents/GitHub/MindSearch/mindsearch/app.py", line 142, in generate
async for message in agent(inputs, session_id=session_id):
File "/Users/cxrh/Documents/GitHub/MindSearch/mindsearch/agent/streaming.py", line 50, in __call__
async for response_message in self.forward(*message, session_id=session_id, **kwargs):
File "/Users/cxrh/Documents/GitHub/MindSearch/mindsearch/agent/mindsearch_agent.py", line 189, in forward
reference, references_url = _generate_references_from_graph(gen.ret[1])
File "/Users/cxrh/Documents/GitHub/MindSearch/mindsearch/agent/mindsearch_agent.py", line 41, in _generate_references_from_graph
assert data_item["memory"]["agent.memory"][2]["sender"].endswith("ActionExecutor")
IndexError: list index out of range
i have the same problem
@blankanswer @braisedpork1964 @lcolok I would really appreciate if you can try to reproduce and fix the error. I tried again today and there is no way around this error, it keeps happening on every query.
exactly same problem
Add examples to system prompts. See https://github.com/InternLM/MindSearch/issues/249#issuecomment-2472680114
I used BingSearch,for DDGS keeps reporting timeout errors.
__init__.py
agent = (AsyncMindSearchAgent if use_async else MindSearchAgent)(
llm=llm,
template=date,
output_format=InterpreterParser(
begin="<|action_start|><|interpreter|>",
end="<|action_end|>",
template=(
GRAPH_PROMPT_CN + graph_fewshot_example_cn
if lang == "cn"
else GRAPH_PROMPT_EN + graph_fewshot_example_en
),
),
searcher_cfg=dict(
llm=llm,
plugins=plugins,
template=date,
output_format=PluginParser(
begin="<|action_start|><|plugin|>",
end="<|action_end|>",
template=(
searcher_system_prompt_cn + fewshot_example_cn
if lang == "cn"
else searcher_system_prompt_en + fewshot_example_en
),
tool_info=get_plugin_prompt(plugins),
),
user_input_template=(searcher_input_template_cn if lang == "cn" else searcher_input_template_en),
user_context_template=(searcher_context_template_cn if lang == "cn" else searcher_context_template_en),
),
summary_prompt=FINAL_RESPONSE_CN if lang == "cn" else FINAL_RESPONSE_EN,
max_turn=10,
)
models.py
gpt4 = dict(
type=GPTAPI,
model_type="gpt-4-turbo",
key=os.environ.get("OPENAI_API_KEY", "YOUR OPENAI API KEY"),
api_base=os.environ.get("OPENAI_API_BASE", "https://api.openai.com/v1/chat/completions"),
meta_template=[
dict(role="system", api_role="system"),
dict(role="user", api_role="user"),
dict(role="assistant", api_role="assistant"),
dict(role="environment", api_role="system"),
],
)
Hi @braisedpork1964, I followed your instructions but I still get the same error after adding fewshot examples to InterpreterParser and PluginParser.
Is it possible to figure out a permanent fix for this and upstream it to the main branch?
Hi @casper-hansen, did you solve this problem? I'm also using gpt4 and came across the same problem. Any help would be appreciated.
@EmilyQian2001 No I didn't solve the problem. This bug is breaking the whole interaction, rendering MindSearch useless. I love the concept of MindSearch, but it's current state is that it does not work.
@casper-hansen Same here. Did you successfully run it using internlm-2.5?