Skip to content

OpenAI With Evaluation Of Intents

Element Name: OpenAI With Evaluation Of Intents

Category: Cognitive

Description: Extension module enabling the evaluation of intents within the cognitive module for decision-making within the flow designed in Lynn, complementing OPENAI's responses.

Functionality: Conducts evaluation complementing the actions or intentions defined for OpenAI chat behavior. For example: querying a web service following OPENAI's conversational response.

For its setup, the following parameters should be taken into account:

OpenAI With Evaluation Of Intents Action Configuration Fields (Required)

[Name]: Unique descriptor of the configuration box for identification within the flow.

[Random dialog type action to continue the conversation]: Mandatory field corresponding to a dropdown list with actions and intentions defining the OpenAI parameters to use.

[Expression defining the training corpus]: Enter an expression defining the behavior for the OPENAI chat, supporting the Human/AI format proposed in the example documentation https://beta.openai.com/examples (Chat).

-- Example 1 expression:

<p>` Human: Hello, good morning?</p><p></p><p>`  
     `AI: Hello, how can I help you?</p><p></p><p>`

    `Human: I want to know if there's a charge for the checkbook</p><p></p><p>`  
     `AI: Acme Bank doesn't charge you for the checkbook; however, there are fees for designed checkbooks.</p><p></p><p>`

  `Human: I want my checkbook</p><p></p><p>`  
    `AI: When you open your account, we provide you with a checkbook, in which you'll find a form to request your next checkbook. If you don't have the form, you can request it at the nearest branch.</p><p></p><p>`

  `Human: What if I need cash and I don't have checks or cards?</p><p></p><p>` 
    `AI: Approach the customer service counter at any branch of the Bank and request Emergency cash. You can request it as withdrawals from your Checking Account or Credit Line or as an advance on your Credit Card... `</p><p></p>

Note 📑: Observe that it's simpler to frame the corpus in lateral single quotes (`).

[MODEL]: String-type expression where the model to be used for text validation must be indicated. There are models with different levels of capabilities:

  • GPT-3: Sets of models allowing understanding and generating natural language.
  • text-davinci-003: Allows performing any task that the other models in this set can do, with higher quality, longer duration, and better instruction tracking. (Maximum request of 4000 tokens).
  • text-curie-001: Very capable, but faster and less costly than Davinci (Maximum request of 2048 tokens).
  • text-babbage-001: Capable of handling simple requests, very fast and low cost (Maximum request of 2048 tokens).
  • text-ada-001: Capable of handling very simple tasks, generally the fastest and lowest cost model. (Maximum request of 2048 tokens).
  • Codex: Sets of models allowing understanding and generating code, including natural language to code translation.
  • code-davinci-002: Most capable model, particularly good at translating natural language to code. Besides completing code, it allows inserting 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: Refined model allowing detection if the text could be confidential or secure.

[TEMPERATURE]: Mandatory field of type float indicating that the model will assume more risks or slack in the response. If the value of 0.9 is inserted, it can be used in more creative applications and 0 for those that have a well-defined response.

[TOP P]: Mandatory field of type Float considering the % of the most used words and using them in the AI response. That is, if the value of 0.6 is inserted, it will correspond to 60% of words with the highest usage.

[MAX TOKENS]: Mandatory field of type Integer corresponding to the maximum number of tokens to generate.

[Authorization]: Mandatory field of key type allowing the configuration of the authorization key associated with an OPENAI API query. To know how to manage this parameter and create your own keys, check HERE

[If the maximum number of failed attempts is reached, the action flow will be interrupted, and the error description will be passed to the selected intent with the name: 'OpenAi_Error'.] Checkbox identifying the intent 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 available.

[Intent monitoring threshold]: Dropdown list of seconds for corresponding monitoring.

[Requires confirmation]: Select "Yes" when you want to display the menu ("Yes-No") and require confirmation from the client for the intention found in the list of intentions to monitor. Otherwise, if you require automatic execution of the intention defined in the list of intentions to monitor, mark "No".

[List of intentions to monitor]: Optional field where you must enter the Name of the previously created intention, and in value, you should enter a question or text that the client will view to request their subsequent confirmation.

Implementation Example

In the following case, this extension module is used as a complement to OpenAI's response to the "Checkbook" intent, offering a transfer to an executive.

--Input:

[Random dialog type action to continue the conversation]: OPEN AI BASIC

[Expression defining the training corpus]:

Human: Hello, good morning?
  AI: Hello, how can I help you?
Human: I want to know if there's a charge for the checkbook
  AI: Acme Bank doesn't charge you for the checkbook; however, there are fees for checkbooks with designs.

[MODEL]: 'text-davinci-003'

[TEMPERATURE]: 0.8

[TOP P]: 0

[MAX TOKENS]: 150

[Authorization]:

[If the maximum number of failed attempts is reached, the action flow will be interrupted, and the error description will be passed to the selected intent with the name: 'OpenAi_Error']: 150

[Intent monitoring threshold]: 5

[Requires confirmation]: Yes

[List of intents to monitor]:

Key: executive transfer.

Value: Can I transfer you to an Executive for the request of your designed checkbook, are you in agreement?

--Result:

Client: Is there a charge for the checkbook?.
Lynn/OpenAI: Acme Bank doesn't charge you for the checkbook; however, there are fees for checkbooks with designs.
Lynn/Extension Module: Can I transfer you to an Executive for the request of your designed checkbook, are you in agreement? Yes/No
Client: Yes
Lynn: Transferring to executive...