Skip to content

Run the semantic evaluation preview ​

Barn uses the preview service to test a semantic evaluation before it publishes a route. The service evaluates one request without action routes or Kamelets.

Configure the same expert bean and provider settings as the runtime. Start the semantic evaluation service.

sh
java -jar target/wanaku-semantic-router-0.3.0-SNAPSHOT.jar preview \
  --bind 0.0.0.0 --port 8092 \
  --preview-timeout-ms 10000 --max-concurrent 4 \
  --preview-token-env WSR_PREVIEW_TOKEN \
  --expert supportExpert=org.apache.camel.component.typesafeai.TypeSafeAiSemanticAdapter \
  --property 'camel.component.typesafe-ai.api-key={{env:TYPESAFE_API_KEY}}' \
  --property 'camel.component.typesafe-ai.model={{env:TYPESAFE_MODEL}}'

Set WSR_PREVIEW_TOKEN, TYPESAFE_API_KEY, and TYPESAFE_MODEL in the process environment before startup. Set Barn's preview URL to http://wsr-preview:8092/api/v1/preview. Configure the matching token reference in Barn. The service creates an isolated Camel context per request without action routes. Barn must send expertBean, operation, optional parameters (default {}), and state; read resultType, typed value, and diagnostics from the response. See the preview contract. Migrate old preview clients and republish catalogs using semantic.evaluation before deploying this runtime; it does not translate old question YAML.

Preview optionPropertyDefault
--bindwsr.preview.bind127.0.0.1
--port, --preview-portwsr.preview.port8092
--preview-timeout-mswsr.preview.timeout-ms10000
--max-concurrentwsr.preview.max-concurrent4
--preview-token-envwsr.preview.token-envNo token

Next steps ​