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 749 B

12345678910111213141516171819202122232425
  1. using LLama.Common;
  2. namespace LLama.Examples.NewVersion
  3. {
  4. public class GetEmbeddings
  5. {
  6. public static void Run()
  7. {
  8. Console.Write("Please input your model path: ");
  9. var modelPath = Console.ReadLine();
  10. var embedder = new LLamaEmbedder(new ModelParams(modelPath));
  11. while (true)
  12. {
  13. Console.Write("Please input your text: ");
  14. Console.ForegroundColor = ConsoleColor.Green;
  15. var text = Console.ReadLine();
  16. Console.ForegroundColor = ConsoleColor.White;
  17. Console.WriteLine(string.Join(", ", embedder.GetEmbeddings(text)));
  18. Console.WriteLine();
  19. }
  20. }
  21. }
  22. }