llms
semantic_router.llms.base
BaseLLM Objects
Base class for LLMs typically used by dynamic routes.
This class provides a base implementation for LLMs. It defines the common configuration and methods for all LLM classes.
__init__
Initialize the BaseLLM.
Arguments:
name
(str
): The name of the LLM.**kwargs
(dict
): Additional keyword arguments for the LLM.
__call__
Call the LLM.
Must be implemented by subclasses.
Arguments:
messages
(List[Message]
): The messages to pass to the LLM.
Returns:
Optional[str]
: The response from the LLM.
extract_function_inputs
Extract the function inputs from the query.
Arguments:
query
(str
): The query to extract the function inputs from.function_schemas
(List[Dict[str, Any]]
): The function schemas to extract the function inputs from.
Returns:
List[Dict[str, Any]]
: The function inputs.