Getting Started with PrizmDoc AI Features using IBM watsonx
This guide will walk you through the process of setting up PrizmDoc with the Process Manager and AI Hub to utilize the AI features. We'll cover configuring each component and checking their status. We will also provide a docker-compose.yml
example for easy deployment, a sample viewer application for testing, and the API for direct use.
See the AI Features topic for more information on the API and functionality this example provides.
If you would like to use Docker run commands instead of Docker Compose, see how to run the AI Hub worker.
If you are looking to deploy to a cluster, see deployment of the AI Hub to Kubernetes.
1. Prerequisites
Before you begin, ensure you have the following:
- Docker and Docker Compose installed.
- PrizmDoc license with AI features enabled.
- Access to the proper credentials needed for the IBM watsonx powered AI features.
- Basic understanding of PrizmDoc Server, PrizmDoc Application Services (PAS), and databases.
1.1 Docker
Our Docker images include all the requirements to run PrizmDoc with the AI Hub. All you need to do is run the Docker images in a container.
To use the AI Hub Docker image, the MySQL Database, PrizmDoc Server, PrizmDoc Application Services and Process Manager Docker images must also be run.
Supported Docker Compose version for this sample: v2.34
.
1.2 Licensing
The AI features for PrizmDoc require a license.
To purchase the AI features, contact us at info@accusoft.com.
You can register for a free trial of PrizmDoc here.
1.3 IBM watsonx
In order to utilize the AI features with IBM watsonx, you must procure the proper credentials and resources. Please contact Accusoft at info@accusoft.com for more information.
1.4 PrizmDoc Server and PrizmDoc Application Services
The PrizmDoc Server and PrizmDoc Application Services versions must be 14.4 or later.
1.5 Pulling the Required Docker Images
The necessary Docker images to use the AI features can be pulled with the following commands:
NOTE: For production environments, it is highly recommended to provide specific tags, i.e.
mysql:8.0-oraclelinux9
,accusoft/prizmdoc-server:14.4
,accusoft/ai-hub:0.1.318187
.
docker pull mysql:latest
docker pull accusoft/prizmdoc-server:latest
docker pull accusoft/prizmdoc-application-services:latest
docker pull accusoft/process-manager:latest
docker pull accusoft/ai-hub:latest
2. Configure MySQL Database
The database stores the viewing and process-related data for the PrizmDoc Server, PAS, and Process Manager.
2.1. Environment Variables
Configure MySQL using the following environment variables in the docker-compose.yml
file:
Environment Variable | Default Value | Note | Required? |
---|---|---|---|
MYSQL_DATABASE |
- | Database name | Yes |
MYSQL_ROOT_PASSWORD |
- | Root password | Yes |
For more information, see the documentation on deploying MySQL with Docker containers.
2.2. Check Database Status
- The
healthcheck
in thedocker-compose.yml
verifies the database's health. You can also connect to the database using a MySQL client to confirm its functionality.
3. Configure PrizmDoc Server
PrizmDoc Server handles document processing and rendering.
For more in-depth information, see how to use Docker with PrizmDoc Server.
3.1. Environment Variables
Configure PrizmDoc Server using the following environment variables in the docker-compose.yml
file:
Environment Variable | Default Value | Note | Required? |
---|---|---|---|
ACCEPT_EULA |
- | EULA must be accepted - set variable value to 'YES' | Yes |
Volumes:
./pdserver:/config
: Mounts a local directory for PrizmDoc Server configurations.
Example prizm-services-config.yml
(prizmdoc-server service):
license.key: "YOUR_LICENSE_KEY"
license.solutionName: "YOUR_SOLUTION_NAME"
network.publicPort: 18681
network.internalStartingPort: 19000
cache.directory: "/app/data/cache"
workFiles.directory: "/app/data/cache/workfileCache"
userDocuments.directory: "/app/data/cache/userDocuments"
processIds.lifetime: 20m
viewing.allowDocumentDownload: true
viewing.sessionLifetime: 60m
processState.storage: "database"
database.connectionString: "mysql://root:insecurelocal@database:3306/prizmdoc"
For more options, see the central configuration topic.
3.2. Check PrizmDoc Server Status
- The
healthcheck
in thedocker-compose.yml
verifies the server's health. You can also accesshttp://localhost:18681/PCCIS/V1/Service/Current/Info
to check its status.
4. Configure PrizmDoc Application Services (PAS)
PAS provides API endpoints for interacting with PrizmDoc.
For more in-depth information, see how to use Docker with PrizmDoc Application Services.
4.1. Environment Variables
Configure PAS using the following environment variables in the docker-compose.yml
file:
Environment Variable | Default Value | Note | Required? |
---|---|---|---|
ACCEPT_EULA |
- | EULA must be accepted - set variable value to 'YES' | Yes |
Volumes:
./pas:/config
: Mounts a local directory for PAS configurations.
Example pcc.nix.yml
(pas service):
port: 3000
license.key: "YOUR_LICENSE_KEY"
license.solutionName: "YOUR_SOLUTION_NAME"
secretKey: "mysecretkey"
pccServer.hostName: "prizmdoc-server"
pccServer.port: 18681
pccServer.scheme: "http"
logs.path: "/logs"
defaults.viewingSessionTimeout: "20m"
documents.storage: "filesystem"
documents.path: "/data/documents"
documents.legacyMode: true
markupXml.storage: "filesystem"
markupXml.path: "/data/markup"
markupXml.legacyMode: true
markupLayerRecords.storage: "filesystem"
markupLayerRecords.path: "/data/markupLayerRecords"
markupLayerRecords.legacyMode: true
formDefinitions.storage: "filesystem"
formDefinitions.path: "/data/formDefinitions"
imageStamps.storage: "filesystem"
imageStamps.path: "/data/imageStamp"
imageStamps.validTypes: ["png", "jpg", "jpeg", "gif"]
viewingSessionsData.storage: "database"
viewingSessionsProcessesMetadata.storage: "database"
database.adapter: mysql
database.connectionString: "mysql://root:insecurelocal@database:3306/prizmdoc"
processManager.url: http://process-manager:3000
For more options, see the PAS configuration topic.
4.2. Check PAS Status
- The
healthcheck
in thedocker-compose.yml
verifies the PAS health. You can also accesshttp://localhost:3000/health
to check its status.
5. Configure Process Manager
The Process Manager coordinates tasks between PrizmDoc and the AI Hub.
5.1. Environment Variables
Configure the Process Manager using these environment variables:
Environment Variable | Default Value | Note | Required? |
---|---|---|---|
ACCEPT_EULA |
- | EULA must be accepted - set variable value to 'YES' | Yes |
DATABASE_CONNECTION_STRING |
- | MySQL database connection string | Yes |
PRIZMDOC_SERVER_URL |
- | PrizmDoc Server base URL | Yes |
Example .env
configuration (for process-manager
service in docker-compose.yml
):
ACCEPT_EULA=YES
DATABASE_CONNECTION_STRING=mysql://root:insecurelocal@database:3306/prizmdoc
PRIZMDOC_SERVER_URL=http://prizmdoc-server:18681
For more options, see the Process Worker configuration guide.
5.2. Check Process Manager Status
- Liveness: Access
http://process-manager:3001/liveness
to check if the service is running. A 200 status code and "OK" response indicate it's active. - Readiness: Access
http://process-manager:3001/readiness
to check if the service is initialized and ready. A 200 status code and "OK" response mean it's ready for requests. - Metrics: View Prometheus metrics at
http://process-manager:3001/metrics
for monitoring.
See the Process Manager Health and Metrics API documentation for more information.
6. Configure AI Hub
The AI Hub acts as the bridge between PrizmDoc and IBM watsonx in order to provide the AI features. It requires configuration with your IBM watsonx credentials.
6.1. Environment Variables
Configure the AI Hub using the following environment variables:
Environment Variable | Default Value | Note | Required? |
---|---|---|---|
ACCEPT_EULA |
- | EULA must be accepted - set variable value to 'YES' | Yes |
WATSONX_API_ENDPOINT |
- | IBM watsonx API Endpoint | Yes |
WATSONX_API_KEY |
- | IBM watsonx API Key | Yes |
WATSONX_IAM_TOKEN_SERVICE |
- | IBM watsonx IAM Token Service, required for Watson SaaS | No |
WATSONX_PROJECT_ID |
- | IBM watsonx Project ID, required for Watson SaaS | No |
WATSONX_USER_ID |
- | IBM watsonx User ID, required for Watson Self-Hosted | No |
Example .env
configuration (for ai-hub
service in docker-compose.yml
):
ACCEPT_EULA=YES
WATSONX_API_ENDPOINT=YOUR_WATSONX_API_ENDPOINT
WATSONX_API_KEY=YOUR_WATSONX_API_KEY
WATSONX_PROJECT_ID=YOUR_WATSONX_PROJECT_ID
WATSONX_IAM_TOKEN_SERVICE=YOUR_WATSONX_IAM_TOKEN_SERVICE
For more options, see the AI Hub configuration guide.
6.2. Check AI Hub Status
- Health Check: Access
http://localhost:4100/health
(or the configured port) to verify the worker's health. A response of "OK" indicates it's running. - Metrics: View Prometheus metrics at
http://localhost:4100/metrics
for performance monitoring.
See the AI Health and Metrics API documentation for more information.
7. Docker Compose Setup
Here's an example docker-compose.yml
file to deploy PrizmDoc, PAS, Process Manager, AI Hub, and a database:
networks:
pd-ai-sample:
services:
database:
image: mysql:8.0-oraclelinux9
container_name: database
networks:
- pd-ai-sample
ports:
- "3306:3306"
restart: always
healthcheck:
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "-u", "root", "-pinsecurelocal", "--protocol=tcp"]
timeout: 20s
retries: 10
environment:
MYSQL_DATABASE: "prizmdoc"
MYSQL_ROOT_PASSWORD: "insecurelocal"
prizmdoc-server:
image: accusoft/prizmdoc-server:14.4
container_name: prizmdoc-server
networks:
- pd-ai-sample
ports:
- "18681:18681"
depends_on:
database:
condition: service_healthy
restart: always
healthcheck:
test: /usr/share/prizm/node.js/*/node --experimental-fetch -e "(async ()=> {process.exitCode = 1; const r = await fetch('http://localhost:18681/PCCIS/V1/Service/Current/Info'); if (r.status === 200) { process.exitCode = 0; } })()"
interval: 10s
retries: 30
timeout: 10s
start_period: 90s
volumes:
- ./pdserver:/config
environment:
ACCEPT_EULA: "YES"
pas:
image: accusoft/prizmdoc-application-services:14.4
container_name: pas
networks:
- pd-ai-sample
ports:
- "3000:3000"
depends_on:
database:
condition: service_healthy
prizmdoc-server:
condition: service_healthy
restart: always
healthcheck:
test: /usr/share/prizm/pas/node_modules/accusoft-node/bin/node --experimental-fetch -e "(async ()=> {process.exitCode = 1; const r = await fetch('http://localhost:3000/health'); if (r.status === 200) { process.exitCode = 0; } })()"
interval: 10s
timeout: 10s
retries: 30
start_period: 30s
volumes:
- ./pas:/config
environment:
ACCEPT_EULA: "YES"
process-manager:
image: accusoft/process-manager:1.0
container_name: process-manager
networks:
- pd-ai-sample
depends_on:
database:
condition: service_healthy
prizmdoc-server:
condition: service_healthy
ports:
- "3005:3000"
- "3006:3001"
healthcheck:
test: /usr/local/bin/node --experimental-fetch -e "(async ()=> {process.exitCode = 1; const r = await fetch('http://localhost:3001/readiness'); if (r.status === 200) { process.exitCode = 0; } })()"
interval: 10s
timeout: 10s
retries: 30
start_period: 30s
environment:
ACCEPT_EULA: "YES"
DATABASE_CONNECTION_STRING: "mysql://root:insecurelocal@database:3306/prizmdoc"
PRIZMDOC_SERVER_URL: "http://prizmdoc-server:18681"
ai-hub:
image: accusoft/ai-hub:0.1.318187
container_name: ai-hub
networks:
- pd-ai-sample
depends_on:
process-manager:
condition: service_healthy
ports:
- "4100:4100"
restart: always
healthcheck:
test: /usr/bin/node --experimental-fetch -e "(async ()=> {process.exitCode = 1; const r = await fetch('http://localhost:4100/health'); if (r.status === 200) { process.exitCode = 0; } })()"
interval: 10s
timeout: 10s
retries: 30
start_period: 30s
environment:
ACCEPT_EULA: "YES"
PROCESS_MANAGER_INTERNAL_URL: "http://process-manager:3001"
WATSONX_API_KEY: "YOUR_WATSONX_API_KEY"
WATSONX_PROJECT_ID: "YOUR_WATSONX_PROJECT_ID"
WATSONX_API_ENDPOINT: "YOUR_WATSONX_API_ENDPOINT"
WATSONX_IAM_TOKEN_SERVICE: "YOUR_WATSONX_IAM_TOKEN_SERVICE"
WORKFILE_SERVICE_URL: "http://prizmdoc-server:18681/PCCIS/V1/WorkFile"
To deploy:
- Save the
docker-compose.yml
file. - Replace the
ai-hub
watsonx environment variables with your credentials. - Run
docker-compose up -d
.
8. (Optional) Enable AI Features in the Viewer
If you would like to try the Viewer with the AI features, you can use the hello-prizmdoc-viewer-with-nodejs-and-html sample or any of our other samples we provide on the Accusoft GitHub site.
In order to enable the AI features in the viewer, see the following:
-
To enable summarization in the Viewer, set the Viewer documentSummarization option to
{ enableDocumentSummarization: true }
. -
To enable tagging and classification in the viewer, set the Viewer documentClassification option and provide a default list of classifications, for example:
{ enableDocumentClassification: true, classifications: ['Technology', 'Geography', 'History'] }
. -
To enable Q&A in the viewer, set the Viewer documentQuery option to
{ enableDocumentQuery: true }
.
Below is an example sample service with the AI features enabled using Docker Compose. The viewer options and demo document are configured within the entrypoint. Add this service to your existing docker-compose.yml
file before running:
services:
sample:
image: node:22.14-alpine3.21
container_name: sample
networks:
- pd-ai-sample
depends_on:
pas:
condition: service_healthy
ai-hub:
condition: service_healthy
ports:
- "8888:8888"
environment:
PAS_BASE_URL: "http://pas:3000"
PAS_SECRET_KEY: "mysecretkey"
entrypoint: |
sh -c "
apk add --no-cache git nodejs npm wget && \
git clone https://github.com/Accusoft/hello-prizmdoc-viewer-with-nodejs-and-html.git && \
cd hello-prizmdoc-viewer-with-nodejs-and-html && \
wget http://cdn.accusoft.com/sample/DemoAIPressRelease.pdf -P documents/ && \
sed -i \"s/const DOCUMENT_NAME = 'example.pdf';/const DOCUMENT_NAME = 'DemoAIPressRelease.pdf';/\" routes/index.js && \
sed -i '/attachmentViewingMode: \"ThisViewer\"/a \\
documentSummarization: { enableDocumentSummarization: true }, \\
documentClassification: { enableDocumentClassification: true, classifications: [ \"Press Release\", \"NDA\", \"Contract\", \"Quote\", \"Invoice\", \"RFP\", \"Financial Statement\" ] }, \\
documentQuery: { enableDocumentQuery: true }' public/viewer-assets/js/createViewer.js && \
npm install && \
npm start
"
9. (Optional) Use PAS AI API for AI Features
If you plan on using the AI features directly instead of through the Viewer, you can use the PAS AI API. See Summarizers, Taggers, Classifiers, and Queriers.
Before using the PAS AI API, you will need a Viewing Session ID, see PAS Viewing Sessions.
Using the resulting viewingSessionId
, you can perform AI tasks, such as summarizing text, with the PAS Summarizers API example below.
First make a POST request.
1. POST request:
POST pas_base_url/v2/viewingSessions/<viewingSessionId>/summarizers
Content-Type: application/json
{
"minSecondsAvailable": 600
"input": {
"text": "Emergency Medical Technicians (EMTs) perform life-saving medical procedures on-site and in ambulances as patients are being transported to hospitals. Read on to learn more about this critical medical career and how to join the profession. Emergency medical technicians (EMTs) provide critical medical care to patients both on-site and in ambulances on their way to the hospital. Key members of the emergency medical services (EMS), EMTs are often the first to arrive on the scene of an emergency, where they provide basic life-saving care to those in need. If you're interested in a fast-paced medical profession, then you might consider a career as an EMT. In this article, you'll learn more about what an EMT does, the skills they need to perform their life-saving responsibilities, their salary and job outlook, and how to become one. At the end, you'll also find recommended courses to help you get started today."
}
}
POST response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"processId": "pR5X6nPDgMwat6cxlmn0Q3",
"state": "processing",
"expirationDateTime": "2024-12-17T20:38:39.796Z"
}
Then using the Process ID from the POST response, GET the summarization.
2. GET request:
GET pas_base_url/v2/viewingSessions/<viewingSessionId>/summarizers/pR5X6nPDgMwat6cxlmn0Q3
GET response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"processId": "pR5X6nPDgMwat6cxlmn0Q3",
"state": "complete",
"expirationDateTime": "2024-12-17T20:38:39.796Z",
"output": {
"summarization": "Emergency Medical Technicians (EMTs) are critical members of the Emergency Medical Services (EMS) who provide life-saving medical care to patients both on-site and in ambulances. They are often the first to arrive on the scene of an emergency and require specific skills to perform their responsibilities. If interested in this fast-paced medical profession, individuals can learn more about the job outlook, salary, and steps to become an EMT, including recommended courses to get started."
}
}