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.

ITextStreamTransform.cs 806 B

1234567891011121314151617181920212223242526
  1. using LLama.Common;
  2. using System.Collections.Generic;
  3. using System.Text.Json.Serialization;
  4. namespace LLama.Abstractions
  5. {
  6. /// <summary>
  7. /// Takes a stream of tokens and transforms them.
  8. /// </summary>
  9. [JsonConverter(typeof(PolymorphicJSONConverter<ITextStreamTransform>))]
  10. public interface ITextStreamTransform
  11. {
  12. /// <summary>
  13. /// Takes a stream of tokens and transforms them, returning a new stream of tokens asynchronously.
  14. /// </summary>
  15. /// <param name="tokens"></param>
  16. /// <returns></returns>
  17. IAsyncEnumerable<string> TransformAsync(IAsyncEnumerable<string> tokens);
  18. /// <summary>
  19. /// Copy the transform.
  20. /// </summary>
  21. /// <returns></returns>
  22. ITextStreamTransform Clone();
  23. }
  24. }