Skip to content

Chat Open AI

Item Name: Chat Open AI

Category: Cognitive

Description: Advanced functionality. Allows integration with OpenIA APIs by adding the ability to integrate conversational features, based on a base corpus.

Functionality: It is oriented towards managing OpenAI-based chats, where messages are processed by emulating the behavior of a cognitive engine, but without the need to define an IEC model for each intentionality. What in its most basic form would be a free chat, based on the context of a corpus or previous context.

Action Configuration Fields**

[Name]: Unique configuration box descriptor for identification purposes in the flow.

OPENAI Configuration Subset

[Expression defining the training corpus]: An expression defining the behavior for the OPENAI chat is entered, it supports the Human/AI format proposed in the example documentation https://beta.openai.com/examples (Chat).

-- Example 1 expression:

<p>` Human: Hola, buenos días?</p><p></p><p>`  
     `AI: Hola en que te puedo ayudar?</p><p></p><p>`

    `Human: Quiero saber si se cobra el talonario de cheques</p><p></p><p>`  
     `AI: Banco de Acme no te cobra por el talonario de cheques; pero sí existen cobros por las chequeras con diseño.</p><p></p><p>`

  `Human: Quiero mi talonario de cheques</p><p></p><p>`  
    `AI: Al abrir tu cuenta te entregamos una chequera y un talonario, en el cual encontrarás un formulario que debes presentar para solicitar tu próximo talonario. Si no tienes el formulario, puedes solicitarlo en la sucursal más cercana.</p><p></p><p>`

  `Human: Que hacer si necesito efectivo y no ando con cheques o tarjetas?</p><p></p><p>` 
    `AI: Acércate al mesón de atención de cualquier sucursal del Banco y solicita dinero en efectivo de Emergencia. Puedes solicitarlo como giros de tu Cuenta Corriente o Línea de Crédito o como avance de tu Tarjeta de Crédito.. `</p><p></p>

[Note 📑]: Note that it is easier to enclose corpora in backticks (`) instead of quotation marks.

[Chat Input]: Mandatory field that stores an entity that defines the input to be analyzed. For most chat implementation cases, its value should be set to the entity: CURRENT_EVALUATION.

Remember that this entity will be empty for login sessions that do not depend on a client message (Example: opening the web chat does not require a login message like other channels such as WhatsApp).

[Chat Entity]: Mandatory field that stores a string type entity that supports corpus aggregation transactions. Define an entity for the operation of this action.

[Model]: A string expression that indicates the model to use for text validation. There are models with different levels of capabilities:

  • GPT-3: Sets of models that allow understanding and generating natural language
  • text-davinci-003: Allows performing any task that other models in this set can do, with higher quality, longer duration, and better instruction following. (Maximum request of 4000 tokens).
  • text-curie-001: Very capable, but faster and less expensive than Davinci (Maximum request of 2048 tokens).
  • text-babbage-001: Capable of performing simple requests, very fast, and less expensive (Maximum request of 2048 tokens).
  • text-ada-001: Capable of performing very simple tasks, usually the fastest and lowest-cost model. (Maximum request of 2048 tokens).
  • Codex: Sets of models that allow understanding and generating code, including translation of natural language to code.
  • code-davinci-002: Most capable model. Particularly good at translating natural language to code. In addition to completing the code, it allows for the insertion of completions within the code. (Maximum request of 8000 tokens).
  • code-cushman-001: Almost as capable as Davinci Codex, but faster. This advantage can be used for real-time applications. (Maximum request of 2048 tokens).
  • Content Filter: A refined model that allows detecting if the text may be confidential or secure. The expression should be inserted in single quotes.

-- Example: 'text-davinci-003'

Note 📑: Please see available models HERE.

[Temperature]: A float parameter that indicates how much risk or slack the model will assume in its response. If the value 0.9 is inserted, it can be used in more creative applications, and 0 for those that have a well-defined response.

The default value is 1.

-- Example: 0.8

Note 📑: Consult the temperature suggestions based on the selected function in OPENAI (examples).

[Top_P]: A float parameter that considers the % of the most used words and uses them in the AI response. That is, if the value of 0.6 is inserted, it will correspond to 60% of the most used words.

-- Example: 0.6

[Max_Tokens]: An integer expression that corresponds to the maximum number of tokens to be generated.

Tokens can be individual words, but also characters, phrases, or sentences. They are what allow understanding and generating response texts.

Mainly configuring a higher token value will generate more complex, assertive, and higher-quality responses, with the disadvantage that they may take longer to process and have a higher cost.

-- Example: 150

[Authorization]: A key-type parameter that allows the configuration of the authorization key associated with an OPENAI API query. To know how to manage this parameter and create your own keys, consult HERE.

[Entity where the evaluation result will be deposited]: This field defines the name of a string-type entity that will contain the output of the OPENAI analysis, and it is possible to post-process it.

[Error Handler]: A selection box that identifies the intention that will be activated in case of an error in the OpenAI action. When an error overflow occurs, the entity OpenAi_Error will be loaded with the error detail if it is available.

Implementation Example

Preconditions:

  • Obtain authorization parameters.
  • Create support entities for the action.

Expression that defines the training corpus:

lessCopy code

`Human: Hello, good morning?

` `AI: Hello, how can I help you?

` `Human: I want to know if there is a charge for the checkbook.

` `AI: Banco Acme does not charge you for the checkbook; however, there are charges for checkbooks with designs.

` `Human: I want my checkbook.

` `AI: When you open your account, we give you a checkbook and a checkbook stub, in which you will find a form that you must submit to request your next checkbook. If you do not have the form, you can request it at the nearest branch. `

CHAT INPUT: CURRENT_EVALUATION

CHAT ENTITY: OPENAI_INPUT

MODEL: 'text-davinci-003'

TEMPERATURE: 0.8

TOP_P: 0

MAX_TOKENS: 150

Authorization: A2421ksmXXXXX

Entity where the evaluation result will be deposited: OPENAI

Error Handler: ErrorH

Input:

Client writes: What about the checkbook?

CURRENT_EVALUATION <-- ‘What about the checkbook?’

Output:

OPENAI <--

The checkbook is a set of pre-printed checks that are given when opening a checking account.

These checks contain basic account information such as the account holder's name, account number, and bank name. The checkbook is a useful tool for making payments and transferring funds. Banco de Acme does not charge for the checkbook, but there are fees for checkbooks with designs.

OPENAI_INPUT <-- Corpus + new processed Human/AI.