MetaGPT LLM API 설정 — config2.yaml로 모델 지정
MetaGPT LLM API 설정 — config2.yaml로 모델 지정
MetaGPT는 여러 LLM API를 config 파일로 갈아 끼울 수 있어요. OpenAI를 예로 들면 metagpt --init-config로 생성한 ~/.metagpt/config2.yaml을 편집하는 방식이에요.
출처: https://docs.deepwisdom.ai/main/en/guide/get_started/configuration/llm_api_configuration.html
기본 설정(OpenAI)
metagpt --init-config 실행으로 ~/.metagpt/config2.yaml을 만든 뒤 예제를 참고해 채워요. 설정 우선순위는 ~/.metagpt/config2.yaml > config/config2.yaml이에요.
llm:
api_type: 'openai' # or azure / ollama / groq etc. Check LLMType for more options
model: 'gpt-4-turbo' # or gpt-3.5-turbo
base_url: 'https://api.openai.com/v1' # or forward url / other llm url
api_key: 'YOUR_API_KEY'
# proxy: 'YOUR_LLM_PROXY_IF_NEEDED' # Optional. If you want to use a proxy, set it here.
# pricing_plan: 'YOUR_PRICING_PLAN' # Optional. If your pricing plan uses a different name than the `model`.
대표 제공자 예시
- Claude/Anthropic:
api_type: 'claude',base_url: 'https://api.anthropic.com',model: 'claude-3-opus-20240229' - Azure OpenAI:
api_type: 'azure'+api_version(예: '2024-03-01-preview') - Google Gemini:
api_type: 'gemini', 기본 모델gemini-pro - Ollama(로컬):
api_type: 'ollama',base_url: 'http://127.0.0.1:11434/api',model: 'llama2' - OpenRouter:
api_type: 'openrouter',base_url: 'https://openrouter.ai/api/v1' - Groq:
base_url: 'https://api.groq.com/openai/v1',model: 'llama3-70b-8192'
o1 계열을 쓸 땐 추가로 use_system_prompt: false, stream: false를 넣어줘요.