Azure OpenAI Chat Completion Job

The Azure OpenAI Chat Completion job type calls an Azure OpenAI chat-capable deployment synchronously via POST /openai/deployments/{deployment}/chat/completions. The deployment is identified by its name — Polysync stores that in the External Id.

This job type is supported on the Azure OpenAI platform.

Required job fields

  • External Id — the deployment name.
  • Job TypeAzure OpenAI Chat Completion (set automatically on import).

Job discovery

Control-plane (requires AAD auth):

GET /deployments?api-version=2023-05-01

Each deployment whose model name does not contain embedding is imported as a Chat Completion Job. (Embedding deployments are imported as Azure OpenAI Embedding.) Every chat-capable deployment is also imported as Azure OpenAI Batch Job.

Parameter handling

Parameter Direction Role
system_prompt Input Optional; falls back to job attribute OpenAI System Prompt.
user_prompt Input Required; becomes the user message.
response Output choices[0].message.content.
prompt_tokens Output usage.prompt_tokens.
completion_tokens Output usage.completion_tokens.
total_tokens Output usage.total_tokens.
finish_reason Output choices[0].finish_reason.

Request body:

{
  "messages": [
    { "role": "system", "content": "<system_prompt>" },
    { "role": "user",   "content": "<user_prompt>"   }
  ],
  "max_tokens":  <OpenAI Max Tokens or omitted>,
  "temperature": <OpenAI Temperature or omitted>
}

max_tokens and temperature come from job attributes OpenAI Max Tokens and OpenAI Temperature when present.

Execution flow

Synchronous — no real polling:

  1. POST /openai/deployments/{deployment}/chat/completions?api-version=2024-10-21 (data-plane scope: https://cognitiveservices.azure.com/.default).
  2. Output parameters are populated immediately from the response.
  3. RunId encodes the status ("{deployment}#sync#Success" / …#Failed) — status decoding is local to Polysync.
  4. Cancel is not supported.

Monitor URL

https://portal.azure.com/#@/resource/subscriptions/{subId}/resourceGroups/{rg}
  /providers/Microsoft.CognitiveServices/accounts/{resourceName}/overview

Best practices

  • Set OpenAI System Prompt at the Job level for stable agent behaviour; let Tasks override system_prompt only when they truly need a different persona.
  • Keep prompts in code / repository assets rather than embedding them in the Polysync UI for traceability.

Troubleshooting

  • Discovery returned 0 deployments — API Key auth was used for discovery, which is not supported (control-plane calls need ARM tokens). Switch Platform auth to AAD.
  • Long latency on production — for large-batch inference use Azure OpenAI Batch Job.