This template processes a variable list of file paths with one external prompt and one Zod schema. For each processed file, it emits one JSON line that contains the structured output from the model (based on the schema) and the input file path
The included example prompt and schema ask the model to return:
- Whether the decision is
dismissedorupheld - The principal reason in brief (maximum three sentences)
- The case reference number
- Node.js 22+
- An Azure OpenAI deployment
- Azure authentication via managed identity (or API key)
Set these before running:
AZURE_OPENAI_ENDPOINTAZURE_OPENAI_API_VERSION
Example:
export AZURE_OPENAI_ENDPOINT=https://swedencentral.api.cognitive.microsoft.com/
export AZURE_OPENAI_API_VERSION=2024-12-01-previewNote that these values are set in the .env.example which should be copied to .env and updated with your actual values if needed.
npm installnpm run start -- \
--deployment <azure_deployment_name> \
--prompt example/decision.prompt.md \
--schema example/decision.schema.ts \
123456.txtSchema flag supports both forms:
--schema <path>to load the module default export--schema <path>#<exportName>to load a named export
The command writes one JSON object per line to stdout.
Input file paths can be plain text (for example .txt), Word documents (.doc / .docx), or PDF documents (.pdf).
- Replace
example/decision.prompt.mdwith your own text file that contains the prompt. - Replace
example/decision.schema.tswith any module that exports a Zod schema that aligns with your prompt.