The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
huggingface: handle image-text-to-text pipeline task (#31611)
Peter Schneidercecfec5efa32
diff --git a/libs/partners/huggingface/langchain_huggingface/llms/huggingface_pipeline.py b/libs/partners/huggingface/langchain_huggingface/llms/huggingface_pipeline.pyindex 96e408bb7a..858aa92676 100644--- a/libs/partners/huggingface/langchain_huggingface/llms/huggingface_pipeline.py+++ b/libs/partners/huggingface/langchain_huggingface/llms/huggingface_pipeline.py@@ -23,6 +23,7 @@ DEFAULT_TASK = "text-generation"VALID_TASKS = ("text2text-generation","text-generation",+ "image-text-to-text","summarization","translation",)@@ -38,8 +39,8 @@ class HuggingFacePipeline(BaseLLM):To use, you should have the ``transformers`` python package installed.- Only supports `text-generation`, `text2text-generation`, `summarization` and- `translation` for now.+ Only supports `text-generation`, `text2text-generation`, `image-text-to-text`,+ `summarization` and `translation` for now.Example using from_model_id:.. code-block:: python@@ -327,6 +328,8 @@ class HuggingFacePipeline(BaseLLM):text = response["generated_text"]elif self.pipeline.task == "text2text-generation":text = response["generated_text"]+ elif self.pipeline.task == "image-text-to-text":+ text = response["generated_text"]elif self.pipeline.task == "summarization":text = response["summary_text"]elif self.pipeline.task in "translation":