-
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
Changes from 4 commits
55815dc
254dbc2
3207689
8c59f41
658af57
bf0029e
8ae4b6e
1de5bdf
6fb2278
9dc93d7
7f5191b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,11 @@ | |
|
||
Using MetaGPT involves connecting with model providers. We will walk through the setup in this page. | ||
|
||
## Setup for LLM API | ||
After your [Installation](./installation.md) is complete, follow the instructions in this document to complete the | ||
configuration before use. | ||
At the moment, the example of this project only needs to configure OpenAi API. | ||
|
||
## OpenAI API | ||
|
||
We will take OpenAI API as an example. You can finish the setup in either way: | ||
|
||
|
@@ -22,34 +26,161 @@ Or in 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, etc. | ||
``` | ||
|
||
### 2. Use a config or key file | ||
|
||
1. In your current working directory, create a folder `config` and add a new file named `config.yaml` or `key.yaml` under it. | ||
2. Copy the content from the example [config.yaml](https://github.com/geekan/MetaGPT/blob/main/config/config.yaml) file into your new files | ||
1. In your current working directory, create a folder `config` and add a new file named `config.yaml` or `key.yaml` | ||
under it. | ||
2. Copy the content from the example [config.yaml](https://github.com/geekan/MetaGPT/blob/main/config/config.yaml) file | ||
into your new files | ||
3. Fill in your own values to the file: | ||
|
||
```yaml | ||
OPENAI_API_KEY: 'sk-...' # YOUR_API_KEY | ||
OPENAI_API_MODEL: 'intended model' # gpt-4, gpt-3.5-turbo, etc. | ||
``` | ||
|
||
Remember: If you follow the `git clone` approach in [Installation](./installation), `config/config.yaml` will already be there. Just edit it or make a copy named `config/key.yaml` for editting. This way you don't accidentally commit and share your API key using git. | ||
Remember: If you follow the `git clone` approach in [Installation](./installation), `config/config.yaml` will already be | ||
there. Just edit it or make a copy named `config/key.yaml` for editting. This way you don't accidentally commit and | ||
share your API key using git. | ||
|
||
> Note: | ||
> MetaGPT will read your setup in this priority order: `config/key.yaml > config/config.yaml > environment variable` | ||
|
||
Here you are good to go! See [Quickstart](./quickstart) or our [Tutorials](/guide/tutorials/agent_101) for your first run! | ||
Here you are good to go! See [Quickstart](./quickstart) or our [Tutorials](/guide/tutorials/agent_101) for your first | ||
run! | ||
|
||
MetaGPT also supports various LLM models, configure the keys of model APIs according to your needs. | ||
|
||
## Zhipu API | ||
|
||
```yaml | ||
#### if zhipuai from `https://open.bigmodel.cn`. You can set here or export API_KEY="YOUR_API_KEY" | ||
ZHIPUAI_API_KEY: "YOUR_API_KEY" | ||
``` | ||
|
||
## iFlytek's large model Spark API : | ||
|
||
``` yaml | ||
#### if Spark | ||
### Nomally YOU only need to modify 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" | ||
``` | ||
|
||
## Baidu's large model Ernie API | ||
|
||
``` yaml | ||
#### if Ernie | ||
ERNIE_API_KEY : "YOUR_API_KEY" | ||
ERNIE_SECRET_KEY : "YOUR_API_SECRET" | ||
``` | ||
|
||
## Anthropic API | ||
|
||
``` yaml | ||
#### if Anthropic | ||
Anthropic_API_KEY: "YOUR_API_KEY" | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 还有个疑问,ernie和anthropic现在应该还不支持吧?应该先去掉或者放后面些留空? |
||
|
||
## Microsoft Azure Based Openai | ||
|
||
``` yaml | ||
#### if AZURE, check https://github.com/openai/openai-cookbook/blob/main/examples/azure/chat.ipynb | ||
#### You can use ENGINE or DEPLOYMENT mode | ||
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" | ||
``` | ||
|
||
## Web Searching API | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. the above has writen with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个我后面提个PR来改吧 |
||
|
||
``` yaml | ||
#### for Search | ||
|
||
## Supported values: serpapi/google/serper/ddg | ||
SEARCH_ENGINE: serpapi | ||
|
||
## Visit https://serpapi.com/ to get key. | ||
SERPAPI_API_KEY: "YOUR_API_KEY" | ||
|
||
## Visit https://console.cloud.google.com/apis/credentials to get key. | ||
GOOGLE_API_KEY: "YOUR_API_KEY" | ||
## Visit https://programmablesearchengine.google.com/controlpanel/create to get id. | ||
GOOGLE_CSE_ID: "YOUR_CSE_ID" | ||
|
||
## Visit https://serper.dev/ to get key. | ||
SERPER_API_KEY: "YOUR_API_KEY" | ||
``` | ||
|
||
## Website Access For Agent | ||
|
||
``` yaml | ||
#### for web access | ||
|
||
## Supported values: playwright/selenium | ||
WEB_BROWSER_ENGINE: playwright | ||
|
||
## Supported values: chromium/firefox/webkit, visit https://playwright.dev/python/docs/api/class-browsertype | ||
PLAYWRIGHT_BROWSER_TYPE: chromium | ||
|
||
## Supported values: chrome/firefox/edge/ie, visit https://www.selenium.dev/documentation/webdriver/browsers/ | ||
SELENIUM_BROWSER_TYPE: chrome | ||
``` | ||
|
||
## Auzre TTS | ||
|
||
```` yaml | ||
#### for TTS | ||
|
||
AZURE_TTS_SUBSCRIPTION_KEY: "YOUR_API_KEY" | ||
AZURE_TTS_REGION: "eastus" | ||
```` | ||
|
||
## Stable Diffusion Local Deployment | ||
|
||
````yaml | ||
#### for Stable Diffusion | ||
## Use SD service, based on https://github.com/AUTOMATIC1111/stable-diffusion-webui | ||
SD_URL: "YOUR_SD_URL" | ||
SD_T2I_API: "/sdapi/v1/txt2img" | ||
|
||
```` | ||
|
||
## Other Abilities | ||
|
||
````yaml | ||
#### for Execution | ||
LONG_TERM_MEMORY: false | ||
#### for Mermaid CLI | ||
## If you installed mmdc (Mermaid CLI) only for metagpt then enable the following configuration. | ||
PUPPETEER_CONFIG: "./config/puppeteer-config.json" | ||
MMDC: "./node_modules/.bin/mmdc" | ||
|
||
|
||
## Setup for different model providers | ||
### for calc_usage | ||
CALC_USAGE: false | ||
|
||
### OpenAI | ||
### for Research | ||
MODEL_FOR_RESEARCHER_SUMMARY: gpt-3.5-turbo | ||
MODEL_FOR_RESEARCHER_REPORT: gpt-3.5-turbo-16k | ||
|
||
### Azure | ||
### choose the engine for mermaid conversion, | ||
# default is nodejs, you can change it to playwright,pyppeteer or ink | ||
MERMAID_ENGINE: nodejs | ||
|
||
### Anthropic | ||
### browser path for pyppeteer engine, support Chrome, Chromium,MS Edge | ||
PYPPETEER_EXECUTABLE_PATH: "/usr/bin/google-chrome-stable" | ||
|
||
## Setup for other APIs | ||
PROMPT_FORMAT: json #json or markdown | ||
```` |
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 are two spaces, only need one.
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.
使用PyCharm自动格式化了.