-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add config for other LLM #37
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
55815dc
Add config for other LLM
OopsYouDiedE 254dbc2
en config and zh config doc changes
OopsYouDiedE 3207689
LGTM by PyCharm
OopsYouDiedE 8c59f41
修改格式
OopsYouDiedE 658af57
Merge branch 'geekan:main' into main
OopsYouDiedE bf0029e
remove some api
OopsYouDiedE 8ae4b6e
Merge branch 'main' of https://github.com/zhouzinimg/MetaGPT-docs
OopsYouDiedE 1de5bdf
同步
OopsYouDiedE 6fb2278
Merge branch 'geekan:main' into main
OopsYouDiedE 9dc93d7
Sync
OopsYouDiedE 7f5191b
sync
OopsYouDiedE File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,166 @@ | ||
# 配置 | ||
# 设置 | ||
|
||
MetaGPT的使用涉及到不同模型提供商的访问配置,我们将在本页中详细介绍该设置。 | ||
使用MetaGPT需要配置模型API。我们将在本页面中介绍设置过程。 | ||
|
||
## 配置LLM API | ||
在[安装](./installation.md)完成后,请按照本文档中的说明完成配置,然后开始使用。 | ||
目前,该项目的示例只需要配置OpenAI API。 | ||
|
||
我们将使用OpenAI API作为例子。你可以通过下述方式完成配置: | ||
## OpenAI API | ||
|
||
1. 使用环境变量,这是推荐的最快捷的方式。 | ||
2. 使用config或key配置文件,这是推荐的进行完整功能体验和开发的方式。 | ||
我们以OpenAI API为例。您可以通过以下两种方式完成设置: | ||
|
||
1. 使用环境变量。这可以用于临时快速启动或尝试演示。 | ||
2. 使用key.yaml配置。这是推荐的方式,适用于持续和全功能的使用和开发。 | ||
|
||
### 1. 使用环境变量 | ||
|
||
在命令行下执行: | ||
在命令行中运行: | ||
|
||
```shell | ||
export OPENAI_API_KEY="sk-..." # YOUR_API_KEY | ||
export OPENAI_API_MODEL="intended model" # gpt-4, gpt-3.5-turbo, etc. | ||
export OPENAI_API_MODEL="intended model" # gpt-4, gpt-3.5-turbo, 等等 | ||
``` | ||
|
||
或者在python代码中添加: | ||
或在Python中: | ||
|
||
```python | ||
import os | ||
|
||
os.environ["OPENAI_API_KEY"] = "sk-..." # YOUR_API_KEY | ||
os.environ["OPENAI_API_MODEL"] = "intended model" # gpt-4, gpt-3.5-turbo, etc. | ||
os.environ["OPENAI_API_MODEL"] = "intended model" # gpt-4, gpt-3.5-turbo, 等等 | ||
``` | ||
|
||
### 2. 使用一个`config.yaml`或者`key.yaml`文件 | ||
### 2.使用一个`config.yaml`或者`key.yaml`文件 | ||
|
||
1. 在当前项目的工作目录下,新建一个文件夹`config`并在该文件夹下添加一个`config.yaml`或`key.yaml`文件 | ||
2. 拷贝样例配置 [config.yaml](https://github.com/geekan/MetaGPT/blob/main/config/config.yaml) 中的内容到你的新文件中。 | ||
3. 在新文件内设置自己的OPENAI API KEY配置: | ||
1. 在当前工作目录中创建一个名为`config`的文件夹,并在其中添加一个名为`key.yaml`的新文件。 | ||
2. 将示例[config.yaml](https://github.com/geekan/MetaGPT/blob/main/config/config.yaml)文件的内容复制到您的新文件中。 | ||
3. 将您自己的值填入文件中: | ||
|
||
```yaml | ||
OPENAI_API_KEY: 'sk-...' # YOUR_API_KEY | ||
OPENAI_API_MODEL: 'intended model' # gpt-4, gpt-3.5-turbo, etc. | ||
OPENAI_API_MODEL: 'intended model' # gpt-4, gpt-3.5-turbo, 等等 | ||
``` | ||
|
||
记住:如果你按照 [安装](./installation) 使用`git clone`的方法进行安装,`config/config.yaml`已经存在于目录中。只需要直接进行配置,或拷贝一个新文件 `config/key.yaml` 并进行配置。 这样你就不会因为不小心提交了API KEYT而导致泄露。 | ||
请记住:如果您按照[安装](./installation)中的`git clone`方法,`config/config.yaml` | ||
文件已经存在。只需编辑它或创建一个名为`config/key.yaml`的副本进行编辑。这样您就不会意外地使用git提交和共享您的API密钥。 | ||
|
||
> 注意: | ||
> MetaGPT将会按照下述优先级来读取你的配置:`config/key.yaml > config/config.yaml > environment variable` | ||
> MetaGPT将按照以下优先顺序读取您的设置:`config/key.yaml > config/config.yaml > 环境变量` | ||
|
||
现在您可以开始使用了!请参阅[快速入门](./quickstart)或我们的[教程](/guide/tutorials/agent_101)以进行第一次运行! | ||
|
||
MetaGPT还支持各种LLM模型,根据您的需求配置模型API的密钥。 | ||
|
||
## 智谱 API | ||
|
||
```yaml | ||
#### 关于智谱,搜索`https://open.bigmodel.cn`。您可以在此设置,或export API_KEY="YOUR_API_KEY" | ||
ZHIPUAI_API_KEY: "YOUR_API_KEY" | ||
``` | ||
|
||
## 科大讯飞的大模型 Spark API: | ||
|
||
``` yaml | ||
#### 如果是Spark | ||
### 通常您只需要修改 SPARK_APPID、SPARK_API_SECRET和SPARK_API_KEY | ||
SPARK_APPID : "YOUR_APPID" | ||
SPARK_API_SECRET : "YOUR_API_SECRET" | ||
SPARK_API_KEY : "YOUR_API_KEY" | ||
DOMAIN : "generalv2" | ||
SPARK_URL : "ws://spark-api.xf-yun.com/v2.1/chat" | ||
``` | ||
|
||
## 基于Microsoft Azure的Openai | ||
|
||
``` yaml | ||
#### 如果是AZURE,请参考https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat.ipynb | ||
#### 您可以使用ENGINE或DEPLOYMENT模式 | ||
OPENAI_API_TYPE: "azure" | ||
OPENAI_API_BASE: "YOUR_AZURE_ENDPOINT" | ||
OPENAI_API_KEY: "YOUR_AZURE_API_KEY" | ||
OPENAI_API_VERSION: "YOUR_AZURE_API_VERSION" | ||
DEPLOYMENT_NAME: "YOUR_DEPLOYMENT_NAME" | ||
DEPLOYMENT_ID: "YOUR_DEPLOYMENT_ID" | ||
``` | ||
|
||
## 网页搜索 API | ||
|
||
``` yaml | ||
#### 用于搜索 | ||
|
||
## 可选值:serpapi/google/serper/ddg | ||
SEARCH_ENGINE: serpapi | ||
|
||
## 访问 https://serpapi.com/ 获取密钥。 | ||
SERPAPI_API_KEY: "YOUR_API_KEY" | ||
|
||
## 访问 https://console.cloud.google.com/apis/credentials 获取密钥。 | ||
GOOGLE_API_KEY: "YOUR_API_KEY" | ||
## 访问 https://programmablesearchengine.google.com/controlpanel/create 获取ID。 | ||
GOOGLE_CSE_ID: "YOUR_CSE_ID" | ||
|
||
## 访问 https://serper.dev/ 获取密钥。 | ||
SERPER_API_KEY: "YOUR_API_KEY" | ||
``` | ||
|
||
## 代理访问网站 | ||
|
||
``` yaml | ||
#### 用于访问网站 | ||
|
||
## 可选值:playwright/selenium | ||
WEB_BROWSER_ENGINE: playwright | ||
|
||
## 可选值:chromium/firefox/webkit,访问 https://playwright.dev/python/docs/api/class-browsertype | ||
PLAYWRIGHT_BROWSER_TYPE: chromium | ||
|
||
## 可选值:chrome/firefox/edge/ie,访问 https://www.selenium.dev/documentation/webdriver/browsers/ | ||
SELENIUM_BROWSER_TYPE: chrome | ||
``` | ||
|
||
## Azure TTS | ||
|
||
```` yaml | ||
#### 用于TTS | ||
|
||
AZURE_TTS_SUBSCRIPTION_KEY: "YOUR_API_KEY" | ||
AZURE_TTS_REGION: "eastus" | ||
```` | ||
|
||
## Stable Diffusion 本地部署 | ||
|
||
````yaml | ||
#### 用于Stable Diffusion | ||
## 使用SD服务,基于 https://github.com/AUTOMATIC1111/stable-diffusion-webui | ||
SD_URL: "YOUR_SD_URL" | ||
SD_T2I_API: "/sdapi/v1/txt2img" | ||
|
||
```` | ||
|
||
## 其他功能 | ||
|
||
````yaml | ||
#### 用于执行 | ||
LONG_TERM_MEMORY: false | ||
#### 用于Mermaid CLI | ||
## 如果您只为metagpt安装了mmdc(Mermaid CLI),请启用以下配置。 | ||
PUPPETEER_CONFIG: "./config/puppeteer-config.json" | ||
MMDC: "./node_modules/.bin/mmdc" | ||
|
||
现在你可以开始使用了!参考 [快速开始](./quickstart) 或 [教程](/guide/tutorials/agent_101) 进行第一个软件项目的生成。 | ||
|
||
## 不同模型提供商的配置 | ||
### 用于计算使用量 | ||
CALC_USAGE: false | ||
|
||
### OpenAI | ||
### 用于搜索 | ||
MODEL_FOR_RESEARCHER_SUMMARY: gpt-3.5-turbo | ||
MODEL_FOR_RESEARCHER_REPORT: gpt-3.5-turbo-16k | ||
|
||
### Azure | ||
### 选择Mermaid转换的引擎, | ||
# 默认为nodejs,您可以将其更改为playwright、pyppeteer或ink | ||
MERMAID_ENGINE: nodejs | ||
|
||
### Anthropic | ||
### pyppeteer引擎的浏览器路径,支持Chrome、Chromium、MS Edge | ||
PYPPETEER_EXECUTABLE_PATH: "/usr/bin/google-chrome-stable" | ||
|
||
## 其他API的配置 | ||
PROMPT_FORMAT: json #json或markdown | ||
```` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
belows are not LLM API configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
尽管不是,但本章讲的是配置问题。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the above has writen with
MetaGPT also supports various LLM models
. If it's focus on configuration, you can split it with LLM-configuration and non-LLM-configuration. Put them together will make people think it's all about LLM-configuration.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个我后面提个PR来改吧