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.

GetEmbeddings.cs 643 B

123456789101112131415161718192021222324
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using LLama.OldVersion;
  7. namespace LLama.Examples.Old
  8. {
  9. [Obsolete("The entire LLama.OldVersion namespace will be removed")]
  10. public class GetEmbeddings
  11. {
  12. LLama.OldVersion.LLamaEmbedder _embedder;
  13. public GetEmbeddings(string modelPath)
  14. {
  15. _embedder = new LLama.OldVersion.LLamaEmbedder(new LLamaParams(model: modelPath));
  16. }
  17. public void Run(string text)
  18. {
  19. Console.WriteLine(string.Join(", ", _embedder.GetEmbeddings(text)));
  20. }
  21. }
  22. }