Complete example: Enabling Knowledge Transformer

An example that shows the complete process of enabling Knowledge Transformer in an existing ZAssistantDeploy deployment.

About this task

Use this example to enable Knowledge Transformer in an existing ZAssistantDeploy deployment. This workflow includes creating secrets, updating the deployment configuration, and verifying the installation.

Procedure

  1. Create the Transform Secret
    1. Generate the API Key
      TRANSFORM_API_KEY=$(openssl rand -base64 32)
      echo "Save this API key: $TRANSFORM_API_KEY"
      
    2. Create a secret file
      cat > transform-secret.yaml <<EOF
      apiVersion: v1
      kind: Secret
      metadata:
        name: transform-secret
        namespace: wxa4z-zad
      type: Opaque
      stringData:
        TRANSFORM_API_KEY: $TRANSFORM_API_KEY
      EOF
    3. Apply secret
      oc apply -f transform-secret.yaml
  2. Update ZAssistantDeploy CR
    Edit your deploy-zad.yaml file and add the transform section:
    transform:
        enabled: true
        secretName: transform-secret
        createRoute: true
        route:
          annotations:
            haproxy.router.openshift.io/timeout: 30m
        env:
          MAX_ARCHIVE_FILES: "10000"
          LLM_TLS_VERIFY: "false"
        resources:
          requests:
            cpu: 500m
            memory: 512Mi
          limits:
            cpu: 2
            memory: 1Gi
            ephemeral-storage: "8Gi"
  3. Apply the changes
    oc apply -f deploy-zad.yaml
  4. Verify deployment
    1. Wait for the pod to be ready
      oc wait --for=condition=Ready pod -l app=wxa4z-transform -n wxa4z-zad --timeout=300s
    2. Get the API URL
      TRANSFORM_URL=https://$(oc get route wxa4z-transform -n wxa4z-zad -o jsonpath='{.spec.host}')
      echo "Transform API URL: $TRANSFORM_URL"
    3. Test the connection
      curl -k -H "X-API-Key: $TRANSFORM_API_KEY" $TRANSFORM_URL/health
  5. Configure zassist CLI
    1. Configure the CLI
      zassist config transform set-url $TRANSFORM_URL
      zassist config transform set-api-key $TRANSFORM_API_KEY
    2. Verify configuration
      zassist config transform show
  6. Test Knowledge Transformer
    1. Create a test document
      echo "# Test Document
      
      This is a test document for Knowledge Transformer.
      
      ## Section 1
      Content for section 1.
      
      ## Section 2
      Content for section 2." > test.md
      
    2. Transform the document
      zassist transform test.md
    3. Check the output
      ls -la output/

Results

You have successfully enabled Knowledge Transformer. The service is now running and configured for use with the zassist CLI.