MCPcopy Create free account
hub / github.com/Mercury7353/PyBench / build_llm

Function build_llm

llms/__init__.py:9–27  ·  view source on GitHub ↗

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])

Source from the content-addressed store, hash-verified

7
8
9def 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

Callers 1

mainFunction · 0.90

Calls 1

OpenAIAPIClass · 0.90

Tested by

no test coverage detected