Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Copilot Studio - Bot Extensibility
Answered

Retain conversation context when interacting with an Azure OpenAI ChatGPT model

(6) ShareShare
ReportReport
Posted on by

I previously shared how to maintain past context when interacting with an OpenAI GPT model, by setting and updating a global variable using Bot Framework Composer, here: Set and update global variables using Bot Framework Composer and how to retain conversation context when interacting with OpenAI GPT models.

 

Today I'd like to show how to do the same, but this time using Azure OpenAI ChatGPT model that just came out.

I find that model much better suited for conversation experiences and automatically formats code samples:

 

2023-03-14 15-41-50-815 (1)_ChatGPT_Bot__Microsoft_Teams_-_Charlie_Guibord.gif

 

Couple of useful resources on this topic:

Categories:
  • H.Hassan Profile Picture
    4 on at
    Retain conversation context when interacting with an Azure OpenAI ChatGPT model
    Hi @minakshimathpal,

    Did you find any approach to save the context of the conversation in a Copilot Studio topic? I also need to save the context. If you found an approach, please let me know how to achieve this.
  • minakshimathpal Profile Picture
    32 on at
    Re: Retain conversation context when interacting with an Azure OpenAI ChatGPT model

    @mboninco I have created an FAQ bot. But my bot is facing a hard time in maintaining context. I am saving the entities provided by user in his response and thus I can use them. I was wondering is there a way to access/save bot's response in any variable. 

    To provide full context of a session to bot, the only solution I can think of is to append these to and fro messages in a string variable. But I am clueless how can I set/append this new variable with the texts being exchanged between the bot and the user. 

  • minakshimathpal Profile Picture
    32 on at
    Re: Retain conversation context when interacting with an Azure OpenAI ChatGPT model

    @HenryJammes How can this be done in MS copilot studio . I want my bot to maintain the context of the conversation, however currently it is not.

  • HenryJammes Profile Picture
    on at
    Re: Retain conversation context when interacting with an Azure OpenAI ChatGPT model

    FYI I've created a new version of this article using the Chat Completion API format, in both the classic and new version of Power Virtual Agents:

    Integrate a PVA chatbot with Azure OpenAI ChatGPT using the Chat Completion API format

  • angerfire1213 Profile Picture
    90 on at
    Re: Retain conversation context when interacting with an Azure OpenAI ChatGPT model

    now It's worked good in our prod env.

    our PVA in teams version bot face to about 1000+ users

  • angerfire1213 Profile Picture
    90 on at
    Re: Retain conversation context when interacting with an Azure OpenAI ChatGPT model

    I already use the same way to use azure openai gpt-4. thank you!

  • angerfire1213 Profile Picture
    90 on at
    Re: Retain conversation context when interacting with an Azure OpenAI ChatGPT model

    @HenryJammes   Let me show you our different about our OpenAI chatGPT trubo

    Screenshot 2023-03-31 at 10.22.33 AM.png

     

     

  • angerfire1213 Profile Picture
    90 on at
    Re: Retain conversation context when interacting with an Azure OpenAI ChatGPT model

    Thank you ! Hope you got Azure OpenAI GPT-4 soon...

  • HenryJammes Profile Picture
    on at
    Re: Retain conversation context when interacting with an Azure OpenAI ChatGPT model

    Hi @angerfire1213 the example above was created on the GPT 3.5 Turbo model with Chat Markup Language and works.

    I haven't tried the Chat Completion format yet, and GPT-4 might require that format, so the above approach would indeed need reworking to meet the new JSON format requirements, but the approach should be the same.

    I'll try to update or create a new article once I get access to GPT-4.

  • angerfire1213 Profile Picture
    90 on at
    Re: Retain conversation context when interacting with an Azure OpenAI ChatGPT model

    How to do that for GPT-35-Turbo (preview) & GPT-4 (preview)   ?

    In GPT-35-Turbo (preview) & GPT-4 (preview) use messages not prompt

    messages=[ {"role": "system", "content": "Assistant is a large language model trained by OpenAI."}, {"role": "user", "content": "What's the difference between garbanzo beans and chickpeas?"}, ]

     

    learn more about GPT-35-Turbo (preview) & GPT-4 (preview):

    https://learn.microsoft.com/en-us/azure/cognitive-services/openai/how-to/chatgpt?pivots=programming-language-chat-completions#working-with-the-chatgpt-and-gpt-4-models-preview

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,513 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,681 Most Valuable Professional

Leaderboard

Featured topics