KeyError: 'environment' when generating response with MindSearch on macOS Python 3.12

オープン
#292 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
python
領域
ai, backend

調査の方向性

指定された macOS、Python 3.12、GPT-4o コマンド、DuckDuckGoSearch のセットアップで失敗を再現します。mindsearch/agent/streaming.py と mindsearch/agent/mindsearch_agent.py から lagent/llms/openai.py と lagent/llms/base_api.py まで追跡します。そこでは traceback にロールマッピングの失敗が示されています。クエリが KeyError なしで完了すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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'
主要言語
JavaScript
スター
7k
フォーク
684
PR マージ指標
30日以内にマージされた PR はありません

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

InternLM/MindSearch のほかの issue

InternLM/MindSearch の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。