AI/ML API icon

AI/ML API

Choose from 300+ AI models, from Gemini and ChatGPT to DeepSeek and Llama.

Chat Completion

AI-generated

Overview

This node performs chat completion using AI models. It allows users to generate text responses based on a prompt or a structured list of chat messages with explicit roles. It is useful for scenarios such as conversational AI, chatbots, and interactive assistants where generating context-aware text responses is required.

Use Case Examples

  1. Generating a chatbot reply based on a user prompt.
  2. Creating a multi-turn conversation by sending a sequence of messages with roles like system, user, and assistant.

Properties

Name Meaning
Model Name or ID Select the AI model to use for generating the chat completion.
Use Message List Toggle to send a custom sequence of chat messages with explicit roles instead of a single prompt.
Prompt The text prompt to send to the AI model when not using structured messages.
Messages A list of chat messages with roles and content to send to the model when using structured messages.
Extract From Response Select which part of the AI response to return (text only, assistant messages, choices array, or full raw JSON).
Options Additional parameters to customize the request such as audio output settings, penalties, max tokens, temperature, and response format.

Output

JSON

  • text - The generated text from the AI model (first message).
  • messages - Array of assistant messages returned by the model.
  • choices - Array of choice objects from the AI response.
  • raw - Full raw JSON response from the AI model.

Dependencies

  • An API key credential for the AI/ML API service

Troubleshooting

  • Common issues include unsupported operation errors if an invalid operation is selected.
  • Errors related to API authentication if credentials are missing or incorrect.
  • Handling of errors when the API request fails, with an option to continue on failure to avoid stopping the workflow.

Discussion