Actions7
Overview
The Azure OpenAI by YOOV node, specifically for the Completions → Create operation, allows users to generate text completions using Azure-hosted OpenAI models (such as GPT-3.5 Turbo). This node is ideal for scenarios where you need AI-generated text based on a prompt, such as drafting emails, generating code snippets, answering questions, or creating conversational agents.
Practical examples:
- Auto-generating customer support replies.
- Summarizing long documents.
- Creating creative writing prompts or story continuations.
- Generating code or technical documentation from comments.
Properties
| Name | Meaning |
|---|---|
| API Version | 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 | The deployed model to use for completion. Options: gpt-35-turbo, gpt-35-turbo-16k, text-embedding-ada-002. |
| Prompt | The input text or prompt for the model to complete. Can be a string, list of strings, or list of token lists. If not specified, defaults to <|endoftext |
| Max Tokens | The maximum number of tokens to generate. Minimum: 0. |
| Temperature | Sampling temperature; higher values produce more creative results. Range: 0–2. |
| Top P | Nucleus sampling parameter; considers tokens with top_p probability mass. Range: 0–1. |
| Logit Bias | JSON object mapping token IDs to bias values (-100 to 100) to influence likelihood of specific tokens appearing. Example: {"50256": -100} prevents <|endoftext |
| User | ID of the end-user for tracking and rate-limiting. |
| N | Number of completions to generate per prompt. Range: 1–128. |
| Stream | Whether to enable streaming responses (server-sent events). |
| Logprobs | Include log probabilities for the most likely tokens. Range: 0–100. |
| Suffix | Text to append after the generated completion. |
| Echo | Whether to echo back the prompt in addition to the completion. |
| Stop | Sequence that indicates the end of the current document. Default: <|endoftext |
| Completion Config | Additional configuration for completion (string). |
| Cache Level | Server-side caching control: 0 = no cache, 1 = prompt prefix enabled, 2 = full cache. |
| Presence Penalty | Penalizes new tokens based on their frequency so far. Range: -2 to 2. |
| Frequency Penalty | Penalizes new tokens if they appear in the text so far. Range: -2 to 2. |
| Best Of | Number of generations to create server side, displaying only the best. Max: 128. No streaming if >1. |
| Model | Name of the model to use (string). |
Output
The output is a JSON object containing the response from the Azure OpenAI Completions API. Typical fields include:
{
"id": "unique-request-id",
"object": "text_completion",
"created": 1234567890,
"model": "gpt-35-turbo",
"choices": [
{
"text": "Generated completion text.",
"index": 0,
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 20,
"total_tokens": 30
}
}
- id: Unique identifier for the request.
- object: Type of object returned (e.g., "text_completion").
- created: Timestamp of creation.
- model: Model used for generation.
- choices: Array of generated completions, each with:
- text: The generated text.
- index: Position in the choices array.
- logprobs: Log probabilities (if requested).
- finish_reason: Why the completion finished ("stop", "length", etc.).
- usage: Token usage statistics.
Note: The actual structure may vary depending on the API version and options selected.
Dependencies
- External Service: Requires access to Azure OpenAI API.
- Credentials: You must configure the
yoovAzureOpenAIApicredential in n8n, which should include your Azure OpenAI endpoint and API key. - n8n Configuration: Ensure the node has network access to Azure services.
Troubleshooting
Common Issues:
- Invalid Credentials: If the API key or endpoint is incorrect, you'll receive authentication errors. Double-check your credentials in n8n.
- Model Not Deployed: If the selected model is not available in your Azure deployment, the API will return an error. Verify your Azure OpenAI resource and deployment settings.
- Prompt Too Large: Exceeding the maximum allowed prompt size will result in an error. Reduce the prompt length or number of prompts.
- Parameter Errors: Supplying invalid types (e.g., non-numeric value for "Max Tokens") can cause validation errors.
Error Messages:
"Resource not found": Check if the model name and deployment are correct."Invalid API version": Ensure the selected API version matches those supported by your Azure OpenAI resource."Authentication failed": Recheck your API key and endpoint."Input exceeds maximum context length": Shorten your prompt or reduce the number of tokens requested.