diff --git a/src/backend/langflow/components/llms/HuggingFaceEndpoints.py b/src/backend/langflow/components/llms/HuggingFaceEndpoints.py index ea2b4f20b..0d28d5b9b 100644 --- a/src/backend/langflow/components/llms/HuggingFaceEndpoints.py +++ b/src/backend/langflow/components/llms/HuggingFaceEndpoints.py @@ -1,6 +1,6 @@ from typing import Optional from langflow import CustomComponent -from langchain.llms import HuggingFaceEndpoint +from langchain.llms.huggingface_endpoint import HuggingFaceEndpoint from langchain.llms.base import BaseLLM @@ -13,7 +13,6 @@ class HuggingFaceEndpointsComponent(CustomComponent): "endpoint_url": {"display_name": "Endpoint URL", "password": True}, "task": { "display_name": "Task", - "type": "select", "options": ["text2text-generation", "text-generation", "summarization"], }, "huggingfacehub_api_token": {"display_name": "API token", "password": True}, @@ -27,7 +26,7 @@ class HuggingFaceEndpointsComponent(CustomComponent): def build( self, endpoint_url: str, - task="text2text-generation", + task: str = "text2text-generation", huggingfacehub_api_token: Optional[str] = None, model_kwargs: Optional[dict] = None, ) -> BaseLLM: @@ -36,6 +35,7 @@ class HuggingFaceEndpointsComponent(CustomComponent): endpoint_url=endpoint_url, task=task, huggingfacehub_api_token=huggingfacehub_api_token, + model_kwargs=model_kwargs, ) except Exception as e: raise ValueError("Could not connect to HuggingFace Endpoints API.") from e