Browse Source

fix:更换openai的API

main
gjl 1 year ago
parent
commit
642ae45d19
3 changed files with 22 additions and 8 deletions
  1. +4
    -2
      src/mindpilot/app/agent/agents_registry.py
  2. +9
    -2
      src/mindpilot/app/configs/model_config.py
  3. +9
    -4
      src/mindpilot/app/utils/system_utils.py

+ 4
- 2
src/mindpilot/app/agent/agents_registry.py View File

@@ -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.
''',
)
),


+ 9
- 2
src/mindpilot/app/configs/model_config.py View File

@@ -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,


+ 9
- 4
src/mindpilot/app/utils/system_utils.py View File

@@ -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"):


Loading…
Cancel
Save