This directory contains a simple worker program that listens to a message queue, processes messages, and sends the results back to the service.
The worker program relies on the following environment variables:
TOPIC
: The topic of the message queue to listen to. Ifai.sh
usesmodel="gpt-3.5-turbo"
, then it should listen toTOPIC=model-gpt-3.5-turbo
.OPENAI_API_KEY
: The API key for OpenAI.PULSAR_URL
: The URL of the Pulsar service. The default value is'pulsar://localhost:6650'
.
DO NOT SUPPORT AUTHENTICATION FOR PULSAR YET
-
Install dependencies:
pnpm i
-
Start the development server:
pnpm dev
-
Start the main program and message queue.
-
Run the
ai.sh
script to see the results:bash ai.sh
This should show the results of the OpenAI API call, demonstrating that the worker program is functioning correctly. are correctly configured and running to verify the complete functionality of the worker program.