多语言大模型API
在某些情况下,您可能希望为不同组件使用不同的LLM模型。 例如,您可能希望为Planner使用OpenAI GPT-4,而为CodeInterpreter使用Google gemini-pro。 本部分将展示如何为不同组件配置不同的LLM模型。
如果只需要使用一个大型语言模型,您只需在taskweaver_config.json文件中配置主LLM设置。
如果需要使用多个LLM,则需要在taskweaver_config.json文件中配置ext_llms.llm_configs来为不同组件指定额外的LLM。
下面我们将展示如何配置taskweaver_config.json文件来使用多个LLM。
"llm.api_type":"openai",
"llm.api_base": "https://api.openai.com/v1",
"llm.api_key": "YOUR_API_KEY",
"llm.model": "gpt-3.5-turbo-1106",
"llm.response_format": "json_object"
"ext_llms.llm_configs": {
"llm_A":
{
"llm.api_type": "openai",
"llm.api_base": "https://api.openai.com/v1",
"llm.api_key": "YOUR_API_KEY",
"llm.model": "gpt-4-1106-preview",
"llm.response_format": "json_object",
},
"llm_B":
{
"llm.api_type": "google_genai",
"llm.api_key": "YOUR_API_KEY",
"llm.model": "gemini-pro",
},
},
- 主要的LLM设置通过
llm.字段指定,这是必填项。 ext_llms.llm_configs是可选的,它是一个包含不同组件的额外LLM的字典。如果不指定它,将只使用主LLM。
在taskweaver_config.json中为不同组件指定大语言模型。
例如,我们希望为Planner使用OpenAI GPT-4,并为CodeInterpreter使用Google gemini-pro。
"planner.llm_alias": "llm_A",
"code_generator.llm_alias": "llm_B"
tip
如果没有为某个组件指定LLM,默认将使用主LLM。
在上述示例中,GPT-3.5-turbo-1106将同时用于Planner和CodeInterpreter。