Skip to content

devpatel30/vector-embedding-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Job Embeddings & Search with Supabase + Gemini

Job Embeddings & Search with Supabase + Gemini

Python script to:

  • Generate weighted embeddings for job postings using Google Gemini API.
  • Store embeddings in Supabase (pgvector).
  • Perform semantic search using stored procedures.

Setup

1️⃣ Install dependencies

pip install -r requirements.txt

2️⃣ Create .env

SUPABASE_PROD_LINK=your_supabase_url
SUPABASE_PROD_KEY=your_supabase_api_key
GEMINI_API_TIER_1=your_gemini_api_key

3️⃣ Enable pgvector & add column in Supabase

create extension if not exists vector;
-- enter your table name
-- change embedding vector based on your embedding model for gemini-embedding-001 keep as it is
alter table jobs add column if not exists embedding vector(768);

4️⃣ Create RPC functions Modify the function based on your filtering and output requirements

-- search
create or replace function search_jobs_by_embedding_filtered(
    query_embedding vector(768),
    limit_input int,
    max_distance float,
    offset_input int
) returns setof jobs as $$
    select * from jobs
    where embedding <-> query_embedding < max_distance
    order by embedding <-> query_embedding
    limit limit_input offset offset_input;
$$ language sql stable;

-- count
create or replace function count_jobs_by_embedding_filtered(
    query_embedding vector(768),
    max_distance float
) returns table(total_count bigint) as $$
    select count(*) from jobs
    where embedding <-> query_embedding < max_distance;
$$ language sql stable;

Run

python main.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages