From bd4a6e9d3ad61441792a997335adea31d833b871 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Tue, 16 Jan 2024 12:54:31 -0300 Subject: [PATCH] Refactor CohereComponent instantiation in Cohere.py --- src/backend/langflow/components/llms/Cohere.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/backend/langflow/components/llms/Cohere.py b/src/backend/langflow/components/llms/Cohere.py index 0b56e9c88..1e0fea8fb 100644 --- a/src/backend/langflow/components/llms/Cohere.py +++ b/src/backend/langflow/components/llms/Cohere.py @@ -2,6 +2,7 @@ from langflow import CustomComponent from langchain_core.language_models.base import BaseLanguageModel from typing import Optional +from langchain_community.llms.cohere import Cohere class CohereComponent(CustomComponent): display_name = "Cohere" @@ -35,6 +36,4 @@ class CohereComponent(CustomComponent): max_tokens: Optional[int] = 256, temperature: Optional[float] = 0.75, ) -> BaseLanguageModel: - # Assuming there is a Cohere class that takes these parameters to initialize - # Please replace `Cohere` with the actual class name that should be instantiated - return Cohere(api_key=cohere_api_key, max_tokens=max_tokens, temperature=temperature) + return Cohere(cohere_api_key=cohere_api_key, max_tokens=max_tokens, temperature=temperature)