phidatahq / phidata

Build AI Agents with memory, knowledge, tools and reasoning. Chat with them using a beautiful Agent UI.
https://docs.phidata.com
Mozilla Public License 2.0
15.58k stars 2.14k forks source link

A question about PgVector in PDF Knowledge Base #1363

Closed KimMoon24 closed 3 weeks ago

KimMoon24 commented 3 weeks ago

Hello, I noticed that you mentioned in your work about "PDF Knowledge Base" that "We are using a local PgVector database for this example. Make sure it's running".

I have just entered this field for learning and don't quite understand what running means. Could you help me introduce how to "make sure it's running".

In addition, in the code, 'from knowledebase import knowledebase'. Where does knowledebase come from?

Thank you very much!!!!!!!!!!!!!

manthanguptaa commented 3 weeks ago

Hey @KimMoon24, you run this command in your terminal to "run" it on your machine.

docker run -d \
  -e POSTGRES_DB=ai \
  -e POSTGRES_USER=ai \
  -e POSTGRES_PASSWORD=ai \
  -e PGDATA=/var/lib/postgresql/data/pgdata \
  -v pgvolume:/var/lib/postgresql/data \
  -p 5532:5432 \
  --name pgvector \
  phidata/pgvector:16

But before this have you installed docker in your machine? Without docker you won't be able to run the above command in your terminal. If you have docker then when you open your docker UI application you will see a container running on it with the name of pgvector.

So the PDFKnowledgeBase you define in the knowledge_base.py file is imported using the statement from knowledge_base import knowledge_base. Which means that to use that piece of code in another file you need to import that to it.

KimMoon24 commented 3 weeks ago

Hey @KimMoon24, you run this command in your terminal to "run" it on your machine.

docker run -d \
  -e POSTGRES_DB=ai \
  -e POSTGRES_USER=ai \
  -e POSTGRES_PASSWORD=ai \
  -e PGDATA=/var/lib/postgresql/data/pgdata \
  -v pgvolume:/var/lib/postgresql/data \
  -p 5532:5432 \
  --name pgvector \
  phidata/pgvector:16

But before this have you installed docker in your machine? Without docker you won't be able to run the above command in your terminal. If you have docker then when you open your docker UI application you will see a container running on it with the name of pgvector.

So the PDFKnowledgeBase you define in the knowledge_base.py file is imported using the statement from knowledge_base import knowledge_base. Which means that to use that piece of code in another file you need to import that to it.

Thank you for your answer, your project is done great! Moreover, it's very, very coincidental that at the same time you replied to my question, I happened to run through the entire process you mentioned. Thank you very much!