@@ -35,21 +35,50 @@ Go to [Google AI Studio](https://aistudio.google.com/apikey), get your API Key a
3535 export GOOGLE_API_KEY=" your-api-key-here"
3636 ```
3737
38- ### 4. Run PgVector
38+ ### 4. Set Up PgVector
3939The app uses ** PgVector** for vector storage and retrieval. Follow these steps to set it up:
4040
41- Install Docker Desktop first, then run:
42- ``` bash
43- docker run -d \
44- -e POSTGRES_DB=ai \
45- -e POSTGRES_USER=ai \
46- -e POSTGRES_PASSWORD=ai \
47- -e PGDATA=/var/lib/postgresql/data/pgdata \
48- -v pgvolume:/var/lib/postgresql/data \
49- -p 5532:5432 \
50- --name pgvector \
51- agnohq/pgvector:16
52- ```
41+ 1 . ** Install Docker Desktop:** Ensure Docker Desktop is installed on your machine.
42+ 2 . ** Run the PgVector Docker Container:** Use the following command to start the PgVector container:
43+ ``` bash
44+ docker run -d \
45+ -e POSTGRES_DB=ai \
46+ -e POSTGRES_USER=ai \
47+ -e POSTGRES_PASSWORD=ai \
48+ -e PGDATA=/var/lib/postgresql/data/pgdata \
49+ -v pgvolume:/var/lib/postgresql/data \
50+ -p 5532:5432 \
51+ --name pgvector \
52+ agnohq/pgvector:16
53+ ```
54+
55+ 3 . ** Verify the Container is Running:**
56+ Run the following command to confirm that the PgVector container is running:
57+ ``` bash
58+ docker ps
59+ ```
60+ You should see an entry for ` pgvector ` with port ` 5532 ` listed.
61+
62+ 4 . ** Connect to the Database:**
63+ Access the PostgreSQL shell inside the container with this command:
64+ ``` bash
65+ docker exec -it pgvector psql -U ai -d ai
66+ ```
67+
68+ 5 . ** Create a New Table with Vector(768):**
69+ If you're setting up a new table with an embedding column of dimension 768, run the following SQL command:
70+ ``` sql
71+ CREATE TABLE pdf_documents_v2 (
72+ id character varying PRIMARY KEY ,
73+ name character varying,
74+ meta_data jsonb DEFAULT ' {}' ::jsonb,
75+ filters jsonb DEFAULT ' {}' ::jsonb,
76+ content text ,
77+ embedding vector(768 ), -- Embedding column with 768 dimensions
78+ usage jsonb DEFAULT ' {}' ::jsonb,
79+ content_hash VARCHAR
80+ );
81+ ```
5382
5483### 5. Run the Reflex App
5584Start the application to begin interacting with your PDF:
@@ -76,10 +105,11 @@ reflex run
76105
77106## Troubleshooting
78107- ** Gemini API Key Not Set:** Ensure the ` GOOGLE_API_KEY ` environment variable is set correctly.
79- - ** PgVector Not Running:** Verify that the PgVector Docker container is running and accessible on port ` 5532 ` .
108+ - ** PgVector Not Running:** Verify that the PgVector Docker container is running and accessible on port ` 5532 ` .
109+
80110---
81111
82112## Contributing
83113Contributions are welcome! Feel free to open issues or submit pull requests to improve the app.
84114
85- ---
115+ ---
0 commit comments