Skip to content

Commit

Permalink
[autofix.ci] apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Jan 27, 2025
1 parent 28f180a commit d939f0e
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 45 deletions.
13 changes: 4 additions & 9 deletions src/backend/base/langflow/base/compressors/model.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from abc import abstractmethod

from langflow.custom import Component
from langflow.field_typing import BaseDocumentCompressor
from langflow.io import MultilineInput, DataInput, SecretStrInput, IntInput
from langflow.template.field.base import Output
from langflow.io import DataInput, IntInput, MultilineInput, SecretStrInput
from langflow.schema import Data
from langflow.template.field.base import Output


class LCCompressorComponent(Component):

inputs = [
MultilineInput(
name="search_query",
Expand All @@ -24,12 +24,7 @@ class LCCompressorComponent(Component):
info="Search Results from a Vector Store.",
is_list=True,
),
IntInput(
name="top_n",
display_name="Top N",
value=3,
advanced=True
),
IntInput(name="top_n", display_name="Top N", value=3, advanced=True),
]

outputs = [
Expand Down
4 changes: 1 addition & 3 deletions src/backend/base/langflow/components/cohere/cohere_rerank.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from typing import cast

from langflow.field_typing import BaseDocumentCompressor
from langflow.base.compressors.model import LCCompressorComponent
from langflow.field_typing import BaseDocumentCompressor
from langflow.io import DropdownInput
from langflow.template.field.base import Output

Expand Down
4 changes: 2 additions & 2 deletions src/backend/base/langflow/components/nvidia/nvidia_rerank.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Any

from langflow.field_typing import BaseDocumentCompressor
from langflow.base.compressors.model import LCCompressorComponent
from langflow.field_typing import BaseDocumentCompressor
from langflow.io import DropdownInput, StrInput
from langflow.schema.dotdict import dotdict
from langflow.template.field.base import Output
Expand All @@ -26,7 +26,7 @@ class NvidiaRerankComponent(LCCompressorComponent):
display_name="Model",
options=["nv-rerank-qa-mistral-4b:1"],
value="nv-rerank-qa-mistral-4b:1",
)
),
]

outputs = [
Expand Down
10 changes: 2 additions & 8 deletions src/backend/base/langflow/components/voyage/voyage_rerank.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from typing import Any

from langflow.field_typing import BaseDocumentCompressor
from langflow.base.compressors.model import LCCompressorComponent
from langflow.field_typing import BaseDocumentCompressor
from langflow.io import DropdownInput
from langflow.template.field.base import Output

Expand Down Expand Up @@ -35,8 +33,4 @@ def build_compressor(self) -> BaseDocumentCompressor:
except ImportError as e:
msg = "Please install langchain-voyageai to use the Voyage AI model."
raise ImportError(msg) from e
return VoyageAIRerank(
voyageai_api_key=self.api_key,
model=self.model,
top_k=self.top_n
)
return VoyageAIRerank(voyageai_api_key=self.api_key, model=self.model, top_k=self.top_n)
2 changes: 1 addition & 1 deletion src/backend/base/langflow/field_typing/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from langchain_core.chat_history import BaseChatMessageHistory
from langchain_core.document_loaders import BaseLoader
from langchain_core.documents import Document
from langchain_core.documents.compressor import BaseDocumentCompressor
from langchain_core.embeddings import Embeddings
from langchain_core.language_models import BaseLanguageModel, BaseLLM
from langchain_core.language_models.chat_models import BaseChatModel
Expand All @@ -16,7 +17,6 @@
from langchain_core.retrievers import BaseRetriever
from langchain_core.tools import BaseTool, Tool
from langchain_core.vectorstores import VectorStore, VectorStoreRetriever
from langchain_core.documents.compressor import BaseDocumentCompressor
from langchain_text_splitters import TextSplitter

from langflow.schema.data import Data
Expand Down
75 changes: 53 additions & 22 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d939f0e

Please sign in to comment.