Open
Description
Query/Question
Is there a built-in tool or utility in the Azure OpenAI SDK for managing chat context (history and message truncation)?
Currently, I'm manually managing the chat messages list and context, like this:
List<ChatRequestMessage> chatMessages = new ArrayList<>();
chatMessages.add(new ChatRequestSystemMessage("..."));
chatMessages.add(new ChatRequestUserMessage("..."));
chatMessages.add(new ChatRequestAssistantMessage("..."));
chatMessages.add(new ChatRequestUserMessage("..."));
IterableStream<ChatCompletions> chatCompletionsStream = client.getChatCompletionsStream(deploymentOrModelId,
new ChatCompletionsOptions(chatMessages));
I'm looking for functionality that could help with:
Managing conversation history
Automatic message truncation when context length is exceeded
Smart context window management
If such tools don't exist in the SDK, are there any recommended patterns or best practices for implementing this?