This is an accelerator that can be used to generate a Kubernetes deployment for PostgresML.
- Install App Accelerator: (see https://docs.vmware.com/en/Tanzu-Application-Platform/1.0/tap/GUID-cert-mgr-contour-fcd-install-cert-mgr.html)
tanzu package available list accelerator.apps.tanzu.vmware.com --namespace tap-install
tanzu package install accelerator -p accelerator.apps.tanzu.vmware.com -v 1.0.1 -n tap-install -f resources/app-accelerator-values.yaml
Verify that package is running: tanzu package installed get accelerator -n tap-install
Get the IP address for the App Accelerator API: kubectl get service -n accelerator-system
Publish Accelerators:
tanzu plugin install --local <path-to-tanzu-cli> all
tanzu acc create postgresml --git-repository https://github.com/agapebondservant/postgresml-accelerator.git --git-branch main
User-Defined Functions
- run_llm_inference_task: Invokes a HuggingFace pipeline using postgresml
- Parameters:
- question: Input prompt
- task: HuggingFace task (summarization, question-answering, feature-extraction etc)
- task_model: Large Language Model from public or private HuggingFace repository
- use_topk: Flag indicating whether to use only the top k embedding chunks for the query
- Returns: (Table object)
- Matched document link
- Query result
- run_semantic_search: Performs semantic search using pgvector
- Parameters:
- input: Input prompt
- Returns: (Table object)
- Query result
- generate_batch_embeddings: Generates and stores embeddings from a preconfigured datasource using pgvector
- Parameters:
- N/A
- Returns:
- N/A
-[ ] Install helm
- Build the postgresml-enabled Postgres instance image (NOTE: Skip if already built; also, must build on a network with sufficient bandwidth - example, might run into issues behind some VPNs):
source .env
cd resources
build-postgresml-baseimage.sh
watch kubectl get pvc -n ${DATA_E2E_POSTGRESML_NS}
cd -
- Deploy Postgres instance:
resources/deploy-postgresml-cluster.sh
watch kubectl get all -n ${DATA_E2E_POSTGRESML_NS}
- To get the connect string for the postgresml-enabled instance:
export POSTGRESML_PW=${DATA_E2E_BITNAMI_AUTH_PASSWORD}
export POSTGRESML_ENDPOINT=$(kubectl get svc ${DATA_E2E_BITNAMI_AUTH_DATABASE}-bitnami-postgresql -n${DATA_E2E_POSTGRESML_NS} -o jsonpath="{.status.loadBalancer.ingress[0].hostname}")
echo postgresql://postgres:${POSTGRESML_PW}@${POSTGRESML_ENDPOINT}/${DATA_E2E_BITNAMI_AUTH_DATABASE}?sslmode=require
- To delete the Postgres instance:
resources/delete-postgresml-cluster.sh