Update SupabaseVectorStore implementation
This commit is contained in:
parent
f7faef33bd
commit
e79022c71f
1 changed files with 8 additions and 12 deletions
|
|
@ -1,11 +1,14 @@
|
||||||
from langflow import CustomComponent
|
from langflow import CustomComponent
|
||||||
from typing import Optional, List
|
from typing import Optional, List,Union
|
||||||
from langchain.vectorstores import SupabaseVectorStore
|
from langchain_community.vectorstores.supabase import SupabaseVectorStore
|
||||||
from langflow.field_typing import (
|
from langflow.field_typing import (
|
||||||
Document,
|
Document,
|
||||||
Embeddings,
|
Embeddings,
|
||||||
NestedDict,
|
NestedDict,
|
||||||
)
|
)
|
||||||
|
from langchain.schema import BaseRetriever
|
||||||
|
from langchain.vectorstores.base import VectorStore
|
||||||
|
from supabase.client import Client, create_client
|
||||||
|
|
||||||
|
|
||||||
class SupabaseComponent(CustomComponent):
|
class SupabaseComponent(CustomComponent):
|
||||||
|
|
@ -32,13 +35,6 @@ class SupabaseComponent(CustomComponent):
|
||||||
supabase_service_key: str = "",
|
supabase_service_key: str = "",
|
||||||
supabase_url: str = "",
|
supabase_url: str = "",
|
||||||
table_name: str = "",
|
table_name: str = "",
|
||||||
) -> SupabaseVectorStore:
|
) -> Union[VectorStore,SupabaseVectorStore,BaseRetriever]:
|
||||||
return SupabaseVectorStore(
|
supabase: Client = create_client(supabase_url, supabase_key=supabase_service_key)
|
||||||
documents=documents,
|
return SupabaseVectorStore.from_documents(documents=documents,embedding=embedding,query_name=query_name,search_kwargs=search_kwargs,client=supabase,table_name=table_name)
|
||||||
embedding=embedding,
|
|
||||||
query_name=query_name,
|
|
||||||
search_kwargs=search_kwargs,
|
|
||||||
supabase_service_key=supabase_service_key,
|
|
||||||
supabase_url=supabase_url,
|
|
||||||
table_name=table_name,
|
|
||||||
)
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue