1. Guides
  2. Using GPT

Guides

Using GPT

Understanding the workings behind the GPT Tasks

System Prompt

The system prompt is a set of instructions that is sent to the AI and is stored in the gpt chat log as "role": "system"

This gives the AI info on:

  • context about who it is
  • what is expect from it
  • examples of responses
  • pieces of data that it may need to correctly interact with the user

Chat Log

The AI itself does not keep any information about the chat that is being conducted. We therefore need to keep it informed of what has been said throughout the conversation.

A log of each interaction is automatically created and updated for each stub. This is called the chat_log.

This Chat log keeps a record of each interaction between the AI Assistant, the user and our systems and is automatically sent to the AI with each new request to the AI so that it knows what has been said and done from the start of the conversation.

AI Roles

When interacting with the AI, there are several roles that you need to be aware of. Each role depicts who send the message.

Roles are:

  • System
  • User
  • Assistant

System Role

This is, in most cases, the system_prompt

This is sent to the AI in the GPT Task Message as:

loading...

User Role

The message from the user that is being sent to the AI for it to respond to in context of the system_prompt.

This is sent to the AI in the GPT Task Message as:

loading...

Assistant Role

The message received back from the AI and is stored in the chat_log as:

loading...

Interacting with AI

There is a task that is used to send the users' text to the AI. This task type is : gpt_chat_task NEED LINK TO TASK PAGE

This task is added to the feedback stub action where the inbound customers message will enter the stub, eg. for incoming WhatsApp - _update_from_whatsapp

In the case WhatsApp, the users' actual text is injected into the stubpost's message, ie. stubpost.message. So in the gpt_chat_task, you would use the contents of this data key in the tasks' params.messages as the user role:

loading...

AI Functions

Certain GPT AI Models have the ability to call functions, enabling the AI to choose to do certain things depending on what is required.

A "function" in AI terms is something that AI can decide call in order to perform a certain task within our system.

example: If you need the AI Assistant to tell you what the weather is in Los Angeles, you need to provide the AI with a means to get that info. A weather API that can be called to fetch the info is required.

This API would be added into the tasks of an AI Enabled stub action.

Stub Actions as Function

Any stub action can be enabled to be used as an AI Function. To enable this, a few things need to be done.

The action needs to be available in the stubs' current state and ai_function_calling needs to be enabled in the action's action_meta object.

See AI Function Calling for more info.