Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available:
5.42.0
metadata
title: Template Final Assignment
emoji: 🕵🏻♂️
colorFrom: indigo
colorTo: indigo
sdk: gradio
sdk_version: 5.25.2
app_file: app.py
pinned: false
hf_oauth: true
hf_oauth_expiration_minutes: 480
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
1. Setup Supabase for Vector Store, following run this SQL Editor
- enable
vector
extension; - create
documents
table; - create
match_documents_langchain
function.
-- Enable the pgvector extension to work with embedding vectors
create extension vector;
-- Create a table to store your documents
create table documents (
id bigserial primary key,
content text, -- corresponds to Document.pageContent
metadata jsonb, -- corresponds to Document.metadata
embedding vector -- 1536 works for OpenAI embeddings, change if needed
);
-- Create a function to search for documents
create function match_documents_langchain (
query_embedding vector,
match_count int default null,
filter jsonb DEFAULT '{}'
) returns table (
id bigint,
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;
$$;
2. Setup Supabase API Key
export SUPABASE_URL=https://upkfycxsetvrlochkrti.supabase.co
export SUPABASE_SERVICE_KEY=
3. Setup Google Gemini API Key, or Groq Cloud
# Google Gemini
export GOOGLE_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxx_xxxxxxxx
# Groq Cloud
export GROQ_API_KEY=gsk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx