Unitalk AI icon

Unitalk AI

Consume Open AI

Actions5

Chat → Complete

AI-generated

Summary

Sends a prompt to the Unitalk AI chat model and returns a completion or list of completions.

Inputs

  • model (required) — The model to use for the completion. Loaded dynamically from the available models list.
  • prompt (required) — A collection of messages to send to the chat model. Each message has a 'role' (user, assistant, system) and 'content'.
  • options — Additional parameters controlling generation. Includes 'echo' (includes prompt in output), 'frequency_penalty', 'maxTokens', 'n', 'presence_penalty', 'temperature', and 'topP'.
  • simplifyOutput — When true, extracts the 'choices' array from the raw response into a 'data' property. When false, returns the raw response body. Default is true.

Output shape

A list of items containing a 'data' property (or raw body if 'simplifyOutput' is false). Each item in 'data' contains the model's generated text.

If 'simplifyOutput' is true, the output structure is simplified. Errors (4xx/5xx) are thrown as node errors.

Examples

Example 1: Send a simple user prompt and get a response

Model: Select a chat model (e.g., gpt-3.5-turbo). Prompt: Add a message with role 'user' and content 'Hello world'. Simplify Output: true.

Example 2: Generate multiple completions with controlled randomness

Model: Select a model. Prompt: Add a message. Options: Set Temperature to 0.5 and Number of Completions to 3.

Links

Discussion