// Copyright (c) Microsoft. All rights reserved.
using Microsoft.SemanticKernel.ChatCompletion;
namespace Step04;
///
/// Provider based access to the chat history.
///
///
/// While the in-memory implementation is trivial, this abstraction demonstrates how one might
/// allow for the ability to access chat history from a remote store for a distributed service.
///
/// class CosmosDbChatHistoryProvider(CosmosClient client, string sessionId) : IChatHistoryProvider { }
///
///
internal interface IChatHistoryProvider
{
///
/// Provides access to the chat history.
///
Task GetHistoryAsync();
///
/// Commits any updates to the chat history.
///
Task CommitAsync();
}
///
/// In memory based specialization of .
///
internal sealed class ChatHistoryProvider(ChatHistory history) : IChatHistoryProvider
{
///
public Task GetHistoryAsync() => Task.FromResult(history);
///
public Task CommitAsync()
{
return Task.CompletedTask;
}
}