Skip to content

Commit

Permalink
refactor: move API key input into Cohere and NVIDIA rerank components (
Browse files Browse the repository at this point in the history
…#6339)

Remove generic API key input from base compressor model and add specific API key inputs for Cohere and NVIDIA Rerank components
  • Loading branch information
ogabrielluiz authored Feb 13, 2025
1 parent 339f065 commit 63294b9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/backend/base/langflow/base/compressors/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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
Expand All @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions src/backend/base/langflow/components/cohere/cohere_rerank.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions src/backend/base/langflow/components/nvidia/nvidia_rerank.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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
Expand All @@ -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",
Expand Down

0 comments on commit 63294b9

Please sign in to comment.