fix(components): fix import statement in UnstructuredWordDocumentLoader.py to use langflow instead of langchain

fix(vectorstores): change optional List[Document] parameters to required List[Document] in FAISS.py, Pinecone.py, Qdrant.py, and SupabaseVectorStore.py to improve consistency and avoid potential NoneType errors
This commit is contained in:
anovazzi1 2024-01-25 14:51:28 -03:00
commit ce39b75c37
5 changed files with 7 additions and 7 deletions

View file

@ -1,4 +1,4 @@
from langchain import CustomComponent
from langflow import CustomComponent
from langflow.field_typing import Document
from typing import Optional, Dict

View file

@ -1,6 +1,6 @@
from langflow import CustomComponent
from langchain_community.vectorstores.faiss import FAISS
from typing import Optional, List, Union
from typing import List, Union
from langchain.schema import BaseRetriever
from langchain.vectorstores.base import VectorStore
from langflow.field_typing import (
@ -23,6 +23,6 @@ class FAISSComponent(CustomComponent):
def build(
self,
embedding: Embeddings,
documents: Optional[List[Document]] = None,
documents: List[Document] = None,
) -> Union[VectorStore, FAISS, BaseRetriever]:
return FAISS.from_documents(documents=documents, embedding=embedding)

View file

@ -28,7 +28,7 @@ class PineconeComponent(CustomComponent):
def build(
self,
embedding: Embeddings,
documents: Optional[List[Document]] = None,
documents: List[Document] = None,
index_name: Optional[str] = None,
pinecone_api_key: Optional[str] = None,
pinecone_env: Optional[str] = None,

View file

@ -35,7 +35,7 @@ class QdrantComponent(CustomComponent):
def build(
self,
embedding: Embeddings,
documents: Optional[List[Document]] = None,
documents: List[Document] = None,
api_key: Optional[str] = None,
collection_name: Optional[str] = None,
content_payload_key: str = "page_content",

View file

@ -1,5 +1,5 @@
from langflow import CustomComponent
from typing import Optional, List, Union
from typing import List, Union
from langchain_community.vectorstores.supabase import SupabaseVectorStore
from langflow.field_typing import (
Document,
@ -29,7 +29,7 @@ class SupabaseComponent(CustomComponent):
def build(
self,
embedding: Embeddings,
documents: Optional[List[Document]] = None,
documents: List[Document],
query_name: str = "",
search_kwargs: NestedDict = {},
supabase_service_key: str = "",