I am having trouble executing
qa_chain.invoke({“question”: data, “chat_history”: chat_history})
I get the following error
‘syncrpcfilterrequestbuilder’ object has no attribute ‘params’
My script originally worked using Faiss vectorstore but i switched it to supabase vectorstore and this issue happened, it is definitely related to supabase.
here my script
def create_vectorstore(logs, embedding_model):
text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=50) documents = \[\] for log in logs: splits = text_splitter.split_text(log.get('full_log', '')) for chunk in splits: documents.append(Document(page_content=chunk, metadata={"id": 1})) print("after for loop") vs = SupabaseVectorStore.from_documents(documents, embedding_model, client=supabase, table_name="documents", query_name="match_documents", chunk_size=500,) return vsembedding_model = HuggingFaceEmbeddings(model_name=“Qwen/Qwen3-Embedding-0.6B”, model_kwargs={‘device’: ‘cuda’})
vectorstore = create_vectorstore(logs, embedding_model) llm = ChatOllama(model="llama3.1:8b") context = initialize_assistant_context() qa_chain = ConversationalRetrievalChain.from_llm( llm=llm, retriever=vectorstore.as_retriever(), return_source_documents=False )print(f" Received question: {data}")
response = qa_chain.invoke({“question”: data, “chat_history”: chat_history})
answer = response.get(“answer”, “”).replace(“\\n”, “\n”).strip()
Supabase structure
– Enable the pgvector extension to work with embedding vectors
create extension vector;– Create a table to store your documents
create table documents (
id uuid primary key,
content text, – corresponds to Document.pageContent
metadata jsonb, – corresponds to Document.metadata
embedding extensions.vector(1536) – 1536 works for OpenAI embeddings, change if needed
);– Create a function to search for documents
create function match_documents (
query_embedding extensions.vector(1536),
match_count int default null,
filter jsonb DEFAULT ‘{}’
) returns table (
id uuid,
content text,
metadata jsonb,
similarity float
)
language plpgsql
as $$
#variable_conflict use_column
begin
return query
select
id,
content,
metadata,
1 - (documents.embedding <=> query_embedding) as similarity
from documents
where metadata @> filter
order by documents.embedding <=> query_embedding
limit match_count;
end;
$$;