This example extracts code chunks from local Python files, stores the code and their vector embeddings in Postgres (pgvector), and provides a simple semantic search demo for code.
- A running Postgres with the pgvector extension available
POSTGRES_URLset, e.g.
export POSTGRES_URL="postgres://cocoindex:cocoindex@localhost/cocoindex"Install deps:
pip install -e .Build/update the index (writes rows into Postgres):
cocoindex update main.pyQuery:
python main.py query "embedding"