Initialize LLM#
Initialize an instance of the Language Model Manager (LLM).
initialize_llm
: This code that creates an instance of an LLM (Language Model Manager) class based on the desired type.- src.openCHA.llms.initialize_llm.initialize_llm(llm: str = LLMType.OPENAI, **kwargs: Any) BaseLLM [source]
This function initializes and returns an instance of the Language Model Manager (LLM) based on the specified LLM type.
- Parameters:
llm (str, optional) – The LLM type to initialize. Defaults to “openai”.
**kwargs (Any, optional) – Additional keyword arguments to pass to the LLM constructor.
- Returns:
An instance of the initialized LLM.
- Return type:
- Raises:
ValueError – If the specified LLM type is unknown.
Example
from openCHA.llms import LLMType llm = initialize_llm(llm=LLMType.OPENAI)