For the complete documentation index, see llms.txt.
Skip to main content
Version: 8.10

Azure OpenAI connector

Send prompts to Azure OpenAI models from your BPMN process and use the response in later steps.

About this connector​

The Azure OpenAI connector is an outbound connector that calls the REST API of your Azure OpenAI resource. Use it to generate text with a deployed model as part of a process, for example to summarize a document or answer a question.

The connector is a protocol connector built on top of the REST connector, and supports the following prompt operations:

Not every model supports every operation. Refer to the Azure OpenAI models documentation to check which operations your model supports.

Prerequisites​

To use the Azure OpenAI connector, you need the following:

PrerequisiteDescription
Azure OpenAI resourceA created Azure OpenAI resource with a deployed model that supports the operation you want to use.
API key for the resourceA valid key for your Azure OpenAI resource.
note

Use secrets to store your API key and avoid exposing sensitive information directly from the process. Refer to managing secrets to learn more.

Use this connector​

New to using an outbound connector? Learn how to add and use this type of connector, apply element templates, use connector secrets, handle results and errors, and more.

Configuration​

Authentication​

PropertyTypeRequiredDescriptionExample
API keyStringYesThe API key of your Azure OpenAI resource.{{secrets.AZURE_OAI_SECRET}}

Job timeout​

PropertyTypeRequiredDescriptionExample
Job timeoutStringNoAn ISO-8601 duration after which Zeebe considers the job timed out if it is not completed yet. Leave empty to use the default timeout.PT5M

Operations​

Select the operation in the Operation dropdown. The Operation property determines which of the following properties appear.

Completion​

Generate a completion for a prompt. Select Completion in Operation. Learn more in the Azure OpenAI completions documentation.

Input parameters​

PropertyTypeRequiredDescriptionExample
Resource nameStringYesThe name of your Azure OpenAI resource.myresource
Deployment IDStringYesThe deployment name you chose when you deployed the model.mydeployment
API versionStringYesThe API version to use for this operation. The default is 2024-02-01.2024-02-01
PromptTextYesThe prompt or prompts to generate completions for, encoded as a string or an array of strings.Write a haiku about the sea
Max tokensStringNoThe maximum number of tokens to generate in the completion. The default is 16.
TemperatureStringNoThe sampling temperature to use, between 0 and 2. The default is 1.
Top PStringNoAn alternative to sampling with temperature, also known as nucleus sampling. The default is 1.
Logit biasTextNoModifies the likelihood of specified tokens appearing in the completion.
UserStringNoA unique identifier representing your end user.
Number of completionsStringNoHow many completions to generate for each prompt. The default is 1.
StreamDropdownYesWhether to stream back partial progress: False or True. The default is False.False
Log probabilitiesStringNoIncludes the log probabilities on the most likely tokens, as well as the chosen tokens.
SuffixStringNoThe suffix that comes after a completion of inserted text.
EchoDropdownNoWhether to echo back the prompt in addition to the completion: False or True. The default is False.False
StopStringNoUp to four sequences where the API stops generating further tokens.
Presence penaltyStringNoPositive values penalize new tokens based on whether they appear in the text so far. The default is 0.
Frequency penaltyStringNoPositive values penalize new tokens based on their existing frequency in the text so far. The default is 0.
Best ofStringNoGenerates the given number of completions server-side and returns the best one. The default is 1.

Output​

The connector returns the HTTP response of the Azure OpenAI REST API as an object with the status, headers, and body fields. The body field contains the response of the model. Learn more about the response format in REST connector response.

Chat completion​

Generate a response to a conversation. Select Chat completion in Operation. Learn more in the Azure OpenAI chat completions documentation.

The connector sends the Message content as the last message of the conversation. To add earlier messages, such as a system message, use Messages context.

Input parameters​

PropertyTypeRequiredDescriptionExample
Resource nameStringYesThe name of your Azure OpenAI resource.myresource
Deployment IDStringYesThe deployment name you chose when you deployed the model.mydeployment
API versionStringYesThe API version to use for this operation. The default is 2024-02-01.2024-02-01
Message roleDropdownYesWho gives the current message: User, System, Assistant, Tool, or Function. The default is User.User
Message contentTextYesThe content of the message.What is the age of the Universe?
Messages contextTextNoThe array of messages associated with this chat completion request, sent before the current message.=[{"role": "system", "content": "You are a helpful assistant."}]
Content partStringNoPart of a user's multi-modal message.
EnhancementsStringNoThe Vision enhancement features requested for the chat.
TemperatureStringNoThe sampling temperature to use, between 0 and 2. The default is 1.
Number of completionsStringNoHow many completions to generate for each prompt. The default is 1.
StreamDropdownYesWhether to stream back partial progress: False or True. The default is False.False
StopStringNoUp to four sequences where the API stops generating further tokens.
Max tokensStringNoThe maximum number of tokens to generate in the completion.
Presence penaltyStringNoPositive values penalize new tokens based on whether they appear in the text so far.
Frequency penaltyStringNoPositive values penalize new tokens based on their existing frequency in the text so far.
Logit biasStringNoModifies the likelihood of specified tokens appearing in the completion.
UserStringNoA unique identifier representing your end user.
ToolsStringNoA list of tools the model can call.
Data sourcesStringNoAdditional resource data.

Output​

The connector returns the HTTP response of the Azure OpenAI REST API as an object with the status, headers, and body fields. For example, for the input in Usage example:

{
"status": 200,
"headers": {},
"body": {
"choices": [
{
"content_filter_results": {
"hate": {
"filtered": false,
"severity": "safe"
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": false,
"severity": "safe"
},
"violence": {
"filtered": false,
"severity": "safe"
}
},
"finish_reason": "stop",
"index": 0,
"message": {
"content": "The age of the universe is estimated to be around 13.8 billion years. This age is determined through various scientific methods, such as measuring the cosmic microwave background radiation and studying the expansion rate of the universe.",
"role": "assistant"
}
}
],
"created": 1700000000,
"id": "chatcmpl-123",
"model": "gpt-35-turbo",
"object": "chat.completion",
"prompt_filter_results": [
{
"prompt_index": 0,
"content_filter_results": {
"hate": {
"filtered": false,
"severity": "safe"
},
"self_harm": {
"filtered": false,
"severity": "safe"
},
"sexual": {
"filtered": false,
"severity": "safe"
},
"violence": {
"filtered": false,
"severity": "safe"
}
}
}
],
"usage": {
"completion_tokens": 43,
"prompt_tokens": 24,
"total_tokens": 67
}
}
}

To store only the text of the answer in a process variable, use Result expression. FEEL lists start at index 1:

= {
"answer": response.body.choices[1].message.content
}

Completions extension​

Generate a response to a conversation, optionally using additional data sources. Select Completions extension in Operation. Learn more in the Azure OpenAI completions extensions documentation.

Input parameters​

PropertyTypeRequiredDescriptionExample
Resource nameStringYesThe name of your Azure OpenAI resource.myresource
Deployment IDStringYesThe deployment name you chose when you deployed the model.mydeployment
API versionStringYesThe API version to use for this operation. The default is 2023-12-01-preview.2023-12-01-preview
MessagesStringYesThe array of messages associated with this chat completion request.
Content partStringNoPart of a user's multi-modal message.
EnhancementsStringNoThe Vision enhancement features requested for the chat.
TemperatureStringNoThe sampling temperature to use, between 0 and 2. The default is 1.
Number of completionsStringNoHow many completions to generate for each prompt. The default is 1.
StreamDropdownYesWhether to stream back partial progress: False or True. The default is False.False
StopStringNoUp to four sequences where the API stops generating further tokens.
Max tokensStringNoThe maximum number of tokens to generate in the completion.
Presence penaltyStringNoPositive values penalize new tokens based on whether they appear in the text so far.
Frequency penaltyStringNoPositive values penalize new tokens based on their existing frequency in the text so far.
Logit biasStringNoModifies the likelihood of specified tokens appearing in the completion.
UserStringNoA unique identifier representing your end user.
ToolsStringNoA list of tools the model can call.
Data sourcesStringNoAdditional resource data.

Output​

The connector returns the HTTP response of the Azure OpenAI REST API as an object with the status, headers, and body fields. The body field contains the response of the model. Learn more about the response format in REST connector response.

Usage example​

Assume you deployed a gpt-35-turbo model as mydeployment on the resource myresource, and created a connector secret named AZURE_OAI_SECRET that holds your API key. To get an answer to a question, configure the connector as follows:

PropertyValue
API key{{secrets.AZURE_OAI_SECRET}}
OperationChat completion
Resource namemyresource
Deployment IDmydeployment
API version2024-02-01
Message roleUser
Message contentWhat is the age of the Universe?
Messages context=[{"role": "system", "content": "You are a helpful assistant."}]
Result variablemyOpenAIResponse

Leave the other properties empty or at their default values. The connector sends the request to https://myresource.openai.azure.com/openai/deployments/mydeployment/chat/completions?api-version=2024-02-01, and stores the response in myOpenAIResponse. See the chat completion output for the response.

Troubleshooting​

To learn about general error handling in Camunda, see BPMN errors and failing jobs.

Further resources​