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:
parent
a3cc0c7fa6
commit
ce39b75c37
5 changed files with 7 additions and 7 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
from langchain import CustomComponent
|
from langflow import CustomComponent
|
||||||
from langflow.field_typing import Document
|
from langflow.field_typing import Document
|
||||||
from typing import Optional, Dict
|
from typing import Optional, Dict
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
from langflow import CustomComponent
|
from langflow import CustomComponent
|
||||||
from langchain_community.vectorstores.faiss import FAISS
|
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.schema import BaseRetriever
|
||||||
from langchain.vectorstores.base import VectorStore
|
from langchain.vectorstores.base import VectorStore
|
||||||
from langflow.field_typing import (
|
from langflow.field_typing import (
|
||||||
|
|
@ -23,6 +23,6 @@ class FAISSComponent(CustomComponent):
|
||||||
def build(
|
def build(
|
||||||
self,
|
self,
|
||||||
embedding: Embeddings,
|
embedding: Embeddings,
|
||||||
documents: Optional[List[Document]] = None,
|
documents: List[Document] = None,
|
||||||
) -> Union[VectorStore, FAISS, BaseRetriever]:
|
) -> Union[VectorStore, FAISS, BaseRetriever]:
|
||||||
return FAISS.from_documents(documents=documents, embedding=embedding)
|
return FAISS.from_documents(documents=documents, embedding=embedding)
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ class PineconeComponent(CustomComponent):
|
||||||
def build(
|
def build(
|
||||||
self,
|
self,
|
||||||
embedding: Embeddings,
|
embedding: Embeddings,
|
||||||
documents: Optional[List[Document]] = None,
|
documents: List[Document] = None,
|
||||||
index_name: Optional[str] = None,
|
index_name: Optional[str] = None,
|
||||||
pinecone_api_key: Optional[str] = None,
|
pinecone_api_key: Optional[str] = None,
|
||||||
pinecone_env: Optional[str] = None,
|
pinecone_env: Optional[str] = None,
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class QdrantComponent(CustomComponent):
|
||||||
def build(
|
def build(
|
||||||
self,
|
self,
|
||||||
embedding: Embeddings,
|
embedding: Embeddings,
|
||||||
documents: Optional[List[Document]] = None,
|
documents: List[Document] = None,
|
||||||
api_key: Optional[str] = None,
|
api_key: Optional[str] = None,
|
||||||
collection_name: Optional[str] = None,
|
collection_name: Optional[str] = None,
|
||||||
content_payload_key: str = "page_content",
|
content_payload_key: str = "page_content",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
from langflow import CustomComponent
|
from langflow import CustomComponent
|
||||||
from typing import Optional, List, Union
|
from typing import List, Union
|
||||||
from langchain_community.vectorstores.supabase import SupabaseVectorStore
|
from langchain_community.vectorstores.supabase import SupabaseVectorStore
|
||||||
from langflow.field_typing import (
|
from langflow.field_typing import (
|
||||||
Document,
|
Document,
|
||||||
|
|
@ -29,7 +29,7 @@ class SupabaseComponent(CustomComponent):
|
||||||
def build(
|
def build(
|
||||||
self,
|
self,
|
||||||
embedding: Embeddings,
|
embedding: Embeddings,
|
||||||
documents: Optional[List[Document]] = None,
|
documents: List[Document],
|
||||||
query_name: str = "",
|
query_name: str = "",
|
||||||
search_kwargs: NestedDict = {},
|
search_kwargs: NestedDict = {},
|
||||||
supabase_service_key: str = "",
|
supabase_service_key: str = "",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue