You can not select more than 25 topics
Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- using LLama.Common;
- using System.Text.Json.Serialization;
-
- namespace LLama.Abstractions
- {
- /// <summary>
- /// Transform history to plain text and vice versa.
- /// </summary>
- [JsonConverter(typeof(PolymorphicJSONConverter<IHistoryTransform>))]
- public interface IHistoryTransform
- {
- /// <summary>
- /// Convert a ChatHistory instance to plain text.
- /// </summary>
- /// <param name="history">The ChatHistory instance</param>
- /// <returns></returns>
- string HistoryToText(ChatHistory history);
-
- /// <summary>
- /// Converts plain text to a ChatHistory instance.
- /// </summary>
- /// <param name="role">The role for the author.</param>
- /// <param name="text">The chat history as plain text.</param>
- /// <returns>The updated history.</returns>
- ChatHistory TextToHistory(AuthorRole role, string text);
-
- /// <summary>
- /// Copy the transform.
- /// </summary>
- /// <returns></returns>
- IHistoryTransform Clone();
- }
- }
|