KeyError: 'environment' when generating response with MindSearch on macOS Python 3.12
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Reproduce the failure with the stated macOS, Python 3.12, GPT-4o command and DuckDuckGoSearch setup. Trace from mindsearch/agent/streaming.py and mindsearch/agent/mindsearch_agent.py into lagent/llms/openai.py and lagent/llms/base_api.py, where the traceback shows the role mapping failure; done means the query completes without the KeyError.
Written by the indexing model from the issue text.
Description
Description:
When deploying MindSearch on macOS with Python 3.12, I encounter an error where the system pauses after partially outputting text during a query. The backend throws a KeyError: 'environment' related to the role mapping in the OpenAI API integration. Below are the details of the error and environment setup.
Environment Details:
- Operating System: macOS
- Python Version: 3.12
- Command Used to Start Backend:
python -m mindsearch.app --lang cn --model_format gpt4 --search_engine DuckDuckGoSearch --asy - API Used: GPT-4o API
Error Traceback:
ERROR:root:An error occurred while generating the response.
Traceback (most recent call last):
File "/Users/kt/Downloads/MindSearch/mindsearch/app.py", line 142, in generate
async for message in agent(inputs, session_id=session_id):
File "/Users/kt/Downloads/MindSearch/mindsearch/agent/streaming.py", line 50, in __call__
async for response_message in self.forward(*message, session_id=session_id, **kwargs):
File "/Users/kt/Downloads/MindSearch/mindsearch/agent/mindsearch_agent.py", line 156, in forward
async for message in self.agent(message, session_id=session_id, **kwargs):
File "/Users/kt/Downloads/MindSearch/mindsearch/agent/streaming.py", line 50, in __call__
async for response_message in self.forward(*message, session_id=session_id, **kwargs):
File "/Users/kt/Downloads/MindSearch/mindsearch/agent/streaming.py", line 99, in forward
async for model_state, response, _ in self.llm.stream_chat(
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/lagent/llms/openai.py", line 597, in stream_chat
messages = self.template_parser._prompt2api(inputs)
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/lagent/llms/base_api.py", line 114, in _prompt2api
api_role = self._role2api_role(prompt)
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/lagent/llms/base_api.py", line 119, in _role2api_role
merged_prompt = self.roles[role_prompt['role']]
KeyError: 'environment'
- 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from InternLM/MindSearch
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
InternLM/MindSearch#326 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
InternLM/MindSearch#315 ·
-
问答只回复一次,没有完整推理搜索回复Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
InternLM/MindSearch#312 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
InternLM/MindSearch#311 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
InternLM/MindSearch#310 ·
All issues in InternLM/MindSearch
Similar issues
-
area/frontend good first issue topic/intents
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
aws-samples/sample-collaborative-ai-dlc#1049 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
avniproject/avni-client#2268 ·
-
plugins/dsh: todayStr() computes UTC but is documented as local — journal entries written 00:00–08:00 local land in the previous day's filePossibly taken @Beehtrix claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
zilliztech/memsearch#907 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
we-promise/sure#6115 ·
Maintainers usually reply within 1 day
-
withImplementation leaves the temporary mock installed when its callback throws or rejectsPossibly taken @Cynnamoroll claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 10 days