Deploy the Base Application
Set Up and Configure
Work in the 1-base-app folder for this chapter. These steps create the Python
environment, configure secrets, start the database, and load the sample data the agent
needs.
Log into your lab instance
~/workshop/healthcare-assistant/, and your
OPENAI_API_KEY is already configured in the environment.Create a Kubernetes Secret
Run the following command to create a Kubernetes secret, which the application will use to connect to OpenAI models:
kubectl create secret generic openai-api \
--from-literal=openai-api-key="$OPENAI_API_KEY" \
--from-literal=openai-api-endpoint="$OPENAI_BASE_URL"Create a Kubernetes Config Map
Run the following command to create a Kubernetes config map, which the store additional configuration parameters used by the application:
cd ~/workshop/healthcare-assistant/1-base-app
kubectl apply -f healthcare-assistant-config.yamlStart the PostgreSQL Database
The healthcare assistant stores the medicine FAQ embeddings and patient records in PostgreSQL with the
pgvector extension. Start PostgreSQL in Kubernetes using the following command:
cd ~/workshop/healthcare-assistant/1-base-app
kubectl apply -f postgres.yamlEnsure that PostgreSQL is running:
kubectl get pods -l app=postgresNAME READY STATUS RESTARTS AGE
postgres-66ffcf4b8c-8s5lp 1/1 Running 0 16sLoad vector data and relational tables
Embed the medicine FAQ into pgvector and load the patient registry into PostgreSQL. The helper script does both:
cd ~/workshop/healthcare-assistant/1-base-app
kubectl apply -f setup-job.yaml This runs python helpers/setup_vectordb.py local, which creates the
healthcare_local_index pgvector collection from docs/qa.csv and the
healthcare_patient table from docs/relational_patient.csv.
Monitor the job with the following command (it may take 30-60 seconds for the job to start):
kubectl logs -f job/vectordb-setupSetting up vector database for healthcare in hosted environment
🔧 Environment setup complete
Using chunk_size: 1000, chunk_overlap: 200
Using embedding model: text-embedding-3-large
Creating PostgreSQL/pgvector collection: healthcare_hosted_index
Adding documents to vector store...
Loading relational tables for healthcare...
✓ Loaded relational table healthcare_patient (30 rows) from relational_patient.csv
✅ Successfully created vector database for healthcare
📊 Total documents embedded: 15
🔗 PostgreSQL collection: healthcare_hosted_index
