refactor: move API key input into Cohere and NVIDIA rerank components (#6339)

Remove generic API key input from base compressor model and add specific API key inputs for Cohere and NVIDIA Rerank components
This commit is contained in:
Gabriel Luiz Freitas Almeida 2025-02-13 08:28:18 -03:00 committed by GitHub
commit 63294b9b08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 5 deletions

View file

@ -2,7 +2,7 @@ from abc import abstractmethod
from langflow.custom import Component
from langflow.field_typing import BaseDocumentCompressor
from langflow.io import DataInput, IntInput, MultilineInput, SecretStrInput
from langflow.io import DataInput, IntInput, MultilineInput
from langflow.schema import Data
from langflow.schema.dataframe import DataFrame
from langflow.template.field.base import Output
@ -15,10 +15,6 @@ class LCCompressorComponent(Component):
display_name="Search Query",
tool_mode=True,
),
SecretStrInput(
name="api_key",
display_name="API Key",
),
DataInput(
name="search_results",
display_name="Search Results",

View file

@ -1,5 +1,6 @@
from langflow.base.compressors.model import LCCompressorComponent
from langflow.field_typing import BaseDocumentCompressor
from langflow.inputs.inputs import SecretStrInput
from langflow.io import DropdownInput
from langflow.template.field.base import Output
@ -12,6 +13,10 @@ class CohereRerankComponent(LCCompressorComponent):
inputs = [
*LCCompressorComponent.inputs,
SecretStrInput(
name="api_key",
display_name="Cohere API Key",
),
DropdownInput(
name="model",
display_name="Model",

View file

@ -2,6 +2,7 @@ from typing import Any
from langflow.base.compressors.model import LCCompressorComponent
from langflow.field_typing import BaseDocumentCompressor
from langflow.inputs.inputs import SecretStrInput
from langflow.io import DropdownInput, StrInput
from langflow.schema.dotdict import dotdict
from langflow.template.field.base import Output
@ -14,6 +15,10 @@ class NvidiaRerankComponent(LCCompressorComponent):
inputs = [
*LCCompressorComponent.inputs,
SecretStrInput(
name="api_key",
display_name="NVIDIA API Key",
),
StrInput(
name="base_url",
display_name="Base URL",