How to add a history of past message in Azure OpenAI REST API

Charles Donbosco 5 Reputation points
2024-03-24T07:43:45.4566667+00:00

For any ideas and method it would to appreciable ? I don't see any option in rest api

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,052 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Sreeju Nair 12,346 Reputation points
    2024-03-24T13:18:05.9866667+00:00

    There is a REST API, that returns "List Messages" that returns a list of messages for the given thread.

    https://learn.microsoft.com/en-us/azure/ai-services/openai/assistants-reference-messages?tabs=python#list-messages

    With this you can view the message history in a converstation context.

    Otherthan this, Azure OpenAI Service itself does not offer a direct API endpoint specifically for retrieving message history or logs through its REST API

    0 comments No comments

  2. Suwarna S Kale 321 Reputation points
    2024-03-24T15:09:28.5833333+00:00

    Thanks for posting your question in the Microsoft Q&A forum.

    To maintain historical context in repeat API calls with Azure OpenAI REST API, you can include a summary of previous interactions as context in your subsequent API calls. Unfortunately, OpenAI’s GPT-3 API does not currently support sessions or maintaining state between API calls. However, you can manually concatenate all the previous outputs and use them as the “prompt” in your next API call.

    If the above response help answer your question, please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution. Thanks 😊

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.