From 642ae45d19432521f4d898d2d7902be66deceeeb Mon Sep 17 00:00:00 2001 From: gjl <2802427218@qq.com> Date: Mon, 5 Aug 2024 17:26:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=9B=B4=E6=8D=A2openai=E7=9A=84API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mindpilot/app/agent/agents_registry.py | 6 ++++-- src/mindpilot/app/configs/model_config.py | 11 +++++++++-- src/mindpilot/app/utils/system_utils.py | 13 +++++++++---- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/mindpilot/app/agent/agents_registry.py b/src/mindpilot/app/agent/agents_registry.py index e6cdeb7..7fa005b 100644 --- a/src/mindpilot/app/agent/agents_registry.py +++ b/src/mindpilot/app/agent/agents_registry.py @@ -62,11 +62,13 @@ Action: ``` {{ "action": "Final Answer", - "action_input": "Final response to human" + "action_input": "Summarize all the information obtained earlier and provide a comprehensive final response to human. Please provide sufficient content in this section." }} ``` -Begin! Reminder to ALWAYS respond with a valid JSON blob of a single action. Use tools if necessary. Try to reply in Chinese as much as possible.Don't forget the Question, Thought, and Observation sections.Please provide as much output content as possible for the Final Answer. +Begin! Reminder to ALWAYS respond with a valid JSON blob of a single action. Use tools if necessary. Try to reply in Chinese as much as possible. +Don't forget the Question, Thought, and Observation sections.You MUST strictly follow the above process to output, first output the Question section, then repeat the Thought section, Action section, Observation section N times until you receive the Final Answer. +Please provide as much output content as possible for the Final Answer. ''', ) ), diff --git a/src/mindpilot/app/configs/model_config.py b/src/mindpilot/app/configs/model_config.py index 41ea7de..b284697 100644 --- a/src/mindpilot/app/configs/model_config.py +++ b/src/mindpilot/app/configs/model_config.py @@ -9,9 +9,16 @@ MODEL_CONFIG = { }, }, "llm_model": { - "glm-4": { + # "glm-4": { + # "temperature": 0.8, + # "max_tokens": 4096, + # "history_len": 10, + # "prompt_name": "default", + # "callbacks": True, + # }, + "gpt-4o-mini": { "temperature": 0.8, - "max_tokens": 4096, + "max_tokens": 8192, "history_len": 10, "prompt_name": "default", "callbacks": True, diff --git a/src/mindpilot/app/utils/system_utils.py b/src/mindpilot/app/utils/system_utils.py index 44c1208..b45e5ba 100644 --- a/src/mindpilot/app/utils/system_utils.py +++ b/src/mindpilot/app/utils/system_utils.py @@ -129,9 +129,12 @@ def get_ChatOpenAI( try: # TODO 配置文件 params.update( - openai_api_base="https://open.bigmodel.cn/api/paas/v4/", - openai_api_key="8424573178d3681bb2e9bfbc5af24dd5.BKKxdk1d6zzgvfnV", + # openai_api_base="https://open.bigmodel.cn/api/paas/v4/", + # openai_api_key="8424573178d3681bb2e9bfbc5af24dd5.BKKxdk1d6zzgvfnV", + openai_api_base="https://api.chatanywhere.tech/v1/", + openai_api_key="sk-cERDW9Fr2ujq8D2qYck9cpc9MtPytN26466bunfYXZVZWV7Y", openai_proxy="", + ) model = ChatOpenAI(**params) except Exception as e: @@ -204,8 +207,10 @@ def get_OpenAIClient( # assert platform_info, f"cannot find configured platform: {platform_name}" # TODO 配置文件 params = { - "base_url": "https://open.bigmodel.cn/api/paas/v4/", - "api_key": "8424573178d3681bb2e9bfbc5af24dd5.BKKxdk1d6zzgvfnV" + # "base_url": "https://open.bigmodel.cn/api/paas/v4/", + # "api_key": "8424573178d3681bb2e9bfbc5af24dd5.BKKxdk1d6zzgvfnV" + "base_url": "https://api.chatanywhere.tech/v1/", + "api_key": "sk-cERDW9Fr2ujq8D2qYck9cpc9MtPytN26466bunfYXZVZWV7Y" } httpx_params = {} # if api_proxy := platform_info.get("api_proxy"):