Saltar para o conteúdo principal
Versão: 20 R9 BETA

OpenAIChatHelper

The chat helper allow to keep a list of messages in memory and make consecutive prompt.

Propriedades

Property NameTipoDefault ValueDescrição
chatOpenAIChatAPI-The chat API instance used for communication with OpenAI.
systemPromptOpenAIMessage-The system prompt message that guides the chat assistant's responses.
numberOfMessagesInteger5The maximum number of messages to retain in the chat history.
parâmetrosOpenAIChatCompletionsParameters-The parameters for the OpenAI chat completion request.
messagesColeção de OpenAIMessage[]The collection of messages exchanged in the chat session.

Funções

prompt()

prompt(prompt : Text) : OpenAIChatCompletionsResult

ParâmetroTipoDescrição
promptTextThe text prompt to send to OpenAI chat.
ResultadoOpenAIChatCompletionsResultThe completion result returned by the chat.

Sends a user prompt to the chat and returns the corresponding completion result.

Example Usage

var $chatHelper:=$client.chat.create("You are a helpful assistant.")

var $result:=$chatHelper.prompt("Hello, how can I help you today?")
$result:=$chatHelper.prompt("Why 42?")