Azure OpenAI by YOOV icon

Azure OpenAI by YOOV

Interact with Azure OpenAI API, powered by YOOV

Actions7

Overview

This node allows you to interact with the Azure OpenAI API, specifically using the "Extensions Chat Completions" resource and the "Create" operation. It is designed to generate conversational AI responses by sending a sequence of messages (such as user prompts and system instructions) to an OpenAI model deployed on Azure. This is useful for building chatbots, virtual assistants, or any workflow that requires advanced natural language understanding and generation.

Practical examples:

  • Automating customer support conversations.
  • Creating interactive FAQ bots.
  • Generating context-aware replies in messaging applications.

Properties

Name Meaning
API Version Specifies the version of the Azure OpenAI API to use. Options: 2023-07-01-preview, 2023-06-01-preview, 2023-05-15, 2023-03-15-preview, 2022-12-01, 2022-03-01-preview.
Model in Current Deployment Selects which AI model to use for generating completions. Options: gpt-35-turbo, gpt-35-turbo-16k, text-embedding-ada-002.
Messages A collection of message objects representing the conversation history. Each message has a Role (Assistant, System, User) and Content (the actual message text).
Use JSON for Messages If enabled, allows you to provide the messages as raw JSON instead of using the structured UI input.

Output

The output is a JSON object containing the response from the Azure OpenAI API. The structure typically includes:

  • The generated message(s) from the AI model.
  • Metadata such as usage statistics, model information, and possibly the full conversation context.

Example output:

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1680000000,
  "model": "gpt-35-turbo",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I assist you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 8,
    "total_tokens": 18
  }
}

Note: The exact fields may vary depending on the API version and model used.

Dependencies

  • External Service: Requires access to Azure OpenAI API.
  • API Key/Credentials: You must configure the yoovAzureOpenAIApi credential in n8n, including the appropriate hostname and authentication details.
  • n8n Configuration: Ensure your n8n instance can reach the Azure OpenAI endpoint specified in your credentials.

Troubleshooting

Common Issues:

  • Invalid Credentials: If the API key or endpoint is incorrect, you may receive authentication errors. Double-check your yoovAzureOpenAIApi credential settings.
  • Model Not Deployed: If the selected model is not available in your Azure deployment, the API will return an error. Verify your Azure portal for available models.
  • Malformed Messages: If the messages are not formatted correctly (especially when using JSON mode), the API may reject the request. Ensure each message has both a valid role and content.
  • API Version Mismatch: Using an unsupported or deprecated API version may result in errors. Choose a version supported by your Azure OpenAI resource.

Error Handling:

  • If an error occurs and "Continue On Fail" is enabled, the node outputs a JSON object with an error field containing the error message.
  • Otherwise, the workflow execution will stop, and the error message will be shown in n8n.

Links and References

Discussion