forked from langflow-ai/langflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into feat/vectorstore-pgvector
- Loading branch information
Showing
17 changed files
with
434 additions
and
359 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
FROM python:3.10-slim | ||
|
||
RUN apt-get update && apt-get install gcc g++ git make -y | ||
RUN apt-get update && apt-get install gcc g++ git make -y && apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
RUN useradd -m -u 1000 user | ||
USER user | ||
ENV HOME=/home/user \ | ||
PATH=/home/user/.local/bin:$PATH | ||
PATH=/home/user/.local/bin:$PATH | ||
|
||
WORKDIR $HOME/app | ||
|
||
COPY --chown=user . $HOME/app | ||
|
||
RUN pip install langflow>==0.0.71 -U --user | ||
CMD ["langflow", "--host", "0.0.0.0", "--port", "7860"] | ||
RUN pip install langflow>==0.5.0 -U --user | ||
CMD ["python", "-m", "langflow", "run", "--host", "0.0.0.0", "--port", "7860"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
from typing import Optional | ||
from langflow import CustomComponent | ||
|
||
from langchain.vectorstores.redis import Redis | ||
from langchain.schema import Document | ||
from langchain.vectorstores.base import VectorStore | ||
from langchain.embeddings.base import Embeddings | ||
|
||
|
||
class RedisComponent(CustomComponent): | ||
""" | ||
A custom component for implementing a Vector Store using Redis. | ||
""" | ||
|
||
display_name: str = "Redis" | ||
description: str = "Implementation of Vector Store using Redis" | ||
documentation = "https://python.langchain.com/docs/integrations/vectorstores/redis" | ||
beta = True | ||
|
||
def build_config(self): | ||
""" | ||
Builds the configuration for the component. | ||
Returns: | ||
- dict: A dictionary containing the configuration options for the component. | ||
""" | ||
return { | ||
"index_name": {"display_name": "Index Name", "value": "your_index"}, | ||
"code": {"show": False, "display_name": "Code"}, | ||
"documents": {"display_name": "Documents", "is_list": True}, | ||
"embedding": {"display_name": "Embedding"}, | ||
"redis_server_url": { | ||
"display_name": "Redis Server Connection String", | ||
"advanced": False, | ||
}, | ||
"redis_index_name": {"display_name": "Redis Index", "advanced": False}, | ||
} | ||
|
||
def build( | ||
self, | ||
embedding: Embeddings, | ||
redis_server_url: str, | ||
redis_index_name: str, | ||
documents: Optional[Document] = None, | ||
) -> VectorStore: | ||
""" | ||
Builds the Vector Store or BaseRetriever object. | ||
Args: | ||
- embedding (Embeddings): The embeddings to use for the Vector Store. | ||
- documents (Optional[Document]): The documents to use for the Vector Store. | ||
- redis_index_name (str): The name of the Redis index. | ||
- redis_server_url (str): The URL for the Redis server. | ||
Returns: | ||
- VectorStore: The Vector Store object. | ||
""" | ||
|
||
return Redis.from_documents( | ||
documents=documents, # type: ignore | ||
embedding=embedding, | ||
redis_url=redis_server_url, | ||
index_name=redis_index_name, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters