AI Agent Chat Model

AI Agent model with JSON schema support

AI Agent Chat Model

AI-generated

Summary

Generate AI chat completions using a specified OpenAI model with optional JSON schema structured outputs.

Inputs

  • Model (required) — The OpenAI model to generate the completion, e.g., 'gpt-4-turbo'.
  • Temperature (required) — Controls the randomness of the output from 0 (deterministic) to 2 (very random), default is 0.7.
  • Response Format Type (required) — Choose between plain text ('text') or structured JSON output conforming to a JSON schema ('json_schema').
  • Schema Name — The name of the JSON schema to use for structured responses; only shown if Response Format Type is 'json_schema'.
  • JSON Schema — A JSON schema defining the expected structure of the AI's JSON response; only shown if Response Format Type is 'json_schema'.

Output shape

A single AI language model completion as a string, either plain text or JSON string matching the provided schema.

If 'Response Format Type' is 'json_schema', the output will be a JSON string conforming to the specified schema name and JSON schema. The output is returned in the 'ai_languageModel' output port as the 'response' content string from the OpenAI chat completion API.

Examples

Example 1: Generate a chat completion in plain text format using the 'gpt-4-turbo' model with moderate randomness.

Model='gpt-4-turbo', Temperature=0.7, Response Format Type='text'.

Example 2: Generate a structured chat completion that outputs a JSON object describing conversation analysis, enforcing required fields.

Model='gpt-4-turbo', Temperature=0.7, Response Format Type='json_schema', Schema Name='conversation_analysis', with a JSON schema defining fields like 'intencion_principal', 'estado_emocional', and others as per the provided schema JSON.

Discussion