build llm from config Args: llm_type (str): llm type, only support openai config (Dict[str, Any]): the dict of llm config Raises: ValueError: llm_type should be openai Returns: BaseLLM: OpenAIAPI
(llm_type: str, config: Dict[str, Any])
| 7 | |
| 8 | |
| 9 | def build_llm(llm_type: str, config: Dict[str, Any]) -> BaseLLM: |
| 10 | """build llm from config |
| 11 | |
| 12 | Args: |
| 13 | llm_type (str): llm type, only support openai |
| 14 | config (Dict[str, Any]): the dict of llm config |
| 15 | |
| 16 | Raises: |
| 17 | ValueError: llm_type should be openai |
| 18 | |
| 19 | Returns: |
| 20 | BaseLLM: OpenAIAPI |
| 21 | """ |
| 22 | |
| 23 | if llm_type == "openai": |
| 24 | llm = OpenAIAPI(config) |
| 25 | else: |
| 26 | raise ValueError("llm_type should be llmcenter or openai") |
| 27 | return llm |