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.md 783 B

12345678910111213141516171819202122232425262728293031
  1. # Get embeddings
  2. ```cs
  3. using LLama.Common;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. public class GetEmbeddings
  10. {
  11. public static void Run()
  12. {
  13. Console.Write("Please input your model path: ");
  14. string modelPath = Console.ReadLine();
  15. var embedder = new LLamaEmbedder(new ModelParams(modelPath));
  16. while (true)
  17. {
  18. Console.Write("Please input your text: ");
  19. Console.ForegroundColor = ConsoleColor.Green;
  20. var text = Console.ReadLine();
  21. Console.ForegroundColor = ConsoleColor.White;
  22. Console.WriteLine(string.Join(", ", embedder.GetEmbeddings(text)));
  23. Console.WriteLine();
  24. }
  25. }
  26. }
  27. ```