Skip to content

Latest commit

 

History

History

knowledge

Agent Knowledge

Knowledge Base: is information that the Agent can search to improve its responses. This directory contains a series of cookbooks that demonstrate how to build a knowledge base for the Agent.

Note: Fork and clone this repository if needed

1. Create a virtual environment

python3 -m venv ~/.venvs/aienv
source ~/.venvs/aienv/bin/activate

2. Install libraries

pip install -U pgvector "psycopg[binary]" sqlalchemy openai phidata

3. Run PgVector

Install docker desktop first.

  • Run using a helper script
./cookbook/run_pgvector.sh
  • OR run using the docker run command
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

4. Test Knowledge Cookbooks

Eg: PDF URL Knowledge Base

  • Install libraries
pip install -U pypdf bs4
  • Run the PDF URL script
python cookbook/knowledge/pdf_url.py