Skip to main content

Code

cookbook/08_knowledge/vector_db/pgvector/async_pg_vector.py

Usage

1

Set up your virtual environment

2

Install dependencies

3
Run PgVector on Docker
4
Create a file resources.py with the following contents:
5
from agno.docker.app.postgres import PgVectorDb
from agno.docker.resources import DockerResources

# -*- PgVector running on port 5432:5432
vector_db = PgVectorDb(
    pg_user="ai",
    pg_password="ai",
    pg_database="ai",
    debug_mode=True,
)

# -*- DockerResources
dev_docker_resources = DockerResources(apps=[vector_db])
6
Start resources using:
7
Mac
Windows
8
Press Enter to confirm and verify container status on the docker dashboard.
9

Set environment variables

10

Run Agent