OpenAI & AppSheet #3: Enhance Your ChatGPT Interface with Supporting Info for Continued Conversation

Hello AppSheet community!

I'm back with the third video in my series on creating a ChatGPT-like interface in AppSheet!

In this tutorial, we'll expand the app we built in the second part by adding a companion to the dynamic Starter, which can be thought of as a "header" in your prompt engineering, and adding a new element that serves the role of the "footer" - allowing for expanded functionality in your app. 

I'm calling this "Supporting Info", but it can really serve a multitude of purposes.

If you haven't seen the first two videos, catch up here:

Watch the third video below

In this video, we'll learn how to add "Supporting Info" to the prompt sent to the AI. This additional text comes at the end of the prompt, after the instructions and thread history, but before the actual user prompt. It helps to steer the AI in the direction we want by providing supplementary information, updated knowledge, or preferred formatting instructions - anything really.  

It's the fact that this text comes where it does in the scheme of things, that's the important part - as that position in the Concatenate() plays a critical role in your prompt engineering.

Here's a step-by-step guide to update the app from part 2:

  1. Add a new table called "Supporting_Info" with these columns:

    1. SupInfo_Title

    2. SupInfo_Text

    3. SupInfo_Description

    4. SupInfo_Tokens

    5. SupInfo_ID

    6. CreationDatetime

  2. Add a new column to the "Messages" table as an EnumList (base type REF to the Supporting_Info table) allowing users to select one or more Supporting Info items: [Messages_Supporting_Info].

  3. Update the Automation Bot by adding a space in the Concatenate() function of the "Get Response" task to include the data from the selected items in the prompt sent to OpenAI. Use a Substitute() function to exchange the "default list separator" with a line break:

    Substitute(Concatenate([Messages_Supporting_Info][SupInfo_Text]), " , ", "
    ")

    (No modification to the script is necessary.)

By implementing these changes, your ChatGPT-like interface will be more versatile and capable of providing high-quality information, laying the foundation for advanced techniques that we'll explore in future videos.

I hope you find this tutorial helpful! Don't forget to like, comment, and subscribe to my channel for more updates in this series. If you have any questions or suggestions, feel free to leave a comment below.

Happy app building! dealwithitnowparrot.gif

-------------------------------------------------------------------------------

#CoWrittenByAi

3 2 328
2 REPLIES 2

Hello @MultiTech is it fully working? I need to create an integration, I watched your videos at the time you were uploading them, but I couldn't make it work that time. 


@peterson wrote:

is it fully working?


The models used in these earlier videos are no longer supported; however the structure, setup, tables, etc. is still the same.

The only big difference is that you need to use Chat Syntax for the [Messages_Reformatting], as all of the new models make use of this syntax. 

 

Concatenate(
  '{"role": "user", "content": "', 
  Substitute(Substitute(Substitute(Substitute([PROMPT_HERE], "\", "\\"), "
", "\n"), '"', '\"'), "	", "\t"), 
  '"}',
  ifs(IsNotBlank([RESPONSE_HERE]),
    Concatenate(
      ' , {"role":"assistant", "content": "',
      Substitute(Substitute(Substitute(Substitute([RESPONSE_HERE], "\", "\\"), "
", "\n"), '"', '\"'), "	", "\t"), 
      '"}'
    )
  )
)

 

I've got an upgraded app that I've put together,  just haven't made the video or post yet.

Top Labels in this Space