Add support for Hugging Face Inference Endpoint as LLM (#1143)
This commit is contained in:
@@ -72,6 +72,8 @@ class BaseLlmConfig(BaseConfig):
|
||||
query_type: Optional[str] = None,
|
||||
callbacks: Optional[List] = None,
|
||||
api_key: Optional[str] = None,
|
||||
endpoint: Optional[str] = None,
|
||||
model_kwargs: Optional[Dict[str, Any]] = {},
|
||||
):
|
||||
"""
|
||||
Initializes a configuration class instance for the LLM.
|
||||
@@ -105,6 +107,12 @@ class BaseLlmConfig(BaseConfig):
|
||||
:type system_prompt: Optional[str], optional
|
||||
:param where: A dictionary of key-value pairs to filter the database results., defaults to None
|
||||
:type where: Dict[str, Any], optional
|
||||
:param api_key: The api key of the custom endpoint, defaults to None
|
||||
:type api_key: Optional[str], optional
|
||||
:param endpoint: The api url of the custom endpoint, defaults to None
|
||||
:type endpoint: Optional[str], optional
|
||||
:param model_kwargs: A dictionary of key-value pairs to pass to the model, defaults to None
|
||||
:type model_kwargs: Optional[Dict[str, Any]], optional
|
||||
:param callbacks: Langchain callback functions to use, defaults to None
|
||||
:type callbacks: Optional[List], optional
|
||||
:raises ValueError: If the template is not valid as template should
|
||||
@@ -132,7 +140,8 @@ class BaseLlmConfig(BaseConfig):
|
||||
self.query_type = query_type
|
||||
self.callbacks = callbacks
|
||||
self.api_key = api_key
|
||||
|
||||
self.endpoint = endpoint
|
||||
self.model_kwargs = model_kwargs
|
||||
if type(prompt) is str:
|
||||
prompt = Template(prompt)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user