Code
cookbook/models/ibm/watsonx/knowledge.py
Usage
1
Create a virtual environment
Open the
Terminal
and create a python virtual environment.2
Set your API key
3
Install libraries
4
Set up PostgreSQL with pgvector
You need a PostgreSQL database with the pgvector extension installed. Adjust the
db_url
in the code to match your database configuration.5
Run Agent
6
For subsequent runs
After the first run, comment out the
knowledge_base.load(recreate=True)
line to avoid reloading the PDF.pgvector
, pypdf
, etc.) and have a PostgreSQL database with the pgvector extension available.