openai_chat_completion

Beta

Generates responses to messages in a chat conversation, using the OpenAI API.

# Config fields, showing default values
label: ""
openai_chat_completion:
  server_address: https://api.openai.com/v1
  api_key: "" # No default (required)
  model: gpt-4o # No default (required)
  prompt: "" # No default (optional)
  system_prompt: "" # No default (optional)

This processor sends the contents of user prompts to the OpenAI API, which generates responses. By default, the processor submits the entire payload of each message as a string, unless you use the prompt configuration field to customize it.

To learn more about chat completion, see the OpenAI API documentation.

Fields

server_address

The Open API endpoint that the processor sends requests to. Update the default value to use another OpenAI compatible service.

Type: string

Default: "https://api.openai.com/v1"

api_key

The API key for OpenAI API.

This field contains sensitive information that usually shouldn’t be added to a configuration directly. For more information, see Manage Secrets before adding it to your configuration.

Type: string

model

The name of the OpenAI model to use.

Type: string

# Examples

model: gpt-4o

model: gpt-4o-mini

model: gpt-4

model: gpt4-turbo

prompt

The user prompt you want to generate a response for. By default, the processor submits the entire payload as a string.

Type: string

system_prompt

The system prompt to submit along with the user prompt. This field supports interpolation functions.

Type: string