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.

TestRunner.cs 3.8 kB

2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. namespace LLama.Examples.NewVersion
  2. {
  3. public class NewVersionTestRunner
  4. {
  5. public static async Task Run()
  6. {
  7. Console.WriteLine("================LLamaSharp Examples (New Version)==================\n");
  8. Console.WriteLine("Please input a number to choose an example to run:");
  9. Console.WriteLine("0: Run a chat session without stripping the role names.");
  10. Console.WriteLine("1: Run a chat session with the role names stripped.");
  11. Console.WriteLine("2: Interactive mode chat by using executor.");
  12. Console.WriteLine("3: Instruct mode chat by using executor.");
  13. Console.WriteLine("4: Stateless mode chat by using executor.");
  14. Console.WriteLine("5: Load and save chat session.");
  15. Console.WriteLine("6: Load and save state of model and executor.");
  16. Console.WriteLine("7: Get embeddings from LLama model.");
  17. Console.WriteLine("8: Quantize the model.");
  18. Console.WriteLine("9: Automatic conversation.");
  19. Console.WriteLine("10: Constrain response to json format using grammar.");
  20. Console.WriteLine("11: Semantic Kernel Prompt.");
  21. Console.WriteLine("12: Semantic Kernel Chat.");
  22. Console.WriteLine("13: Semantic Kernel Memory.");
  23. Console.WriteLine("14: Coding Assistant.");
  24. Console.WriteLine("15: Batch Decoding Benchmark.");
  25. while (true)
  26. {
  27. Console.Write("\nYour choice: ");
  28. int choice = int.Parse(Console.ReadLine());
  29. if (choice == 0)
  30. {
  31. await ChatSessionWithRoleName.Run();
  32. }
  33. else if (choice == 1)
  34. {
  35. await ChatSessionStripRoleName.Run();
  36. }
  37. else if(choice == 2)
  38. {
  39. await InteractiveModeExecute.Run();
  40. }
  41. else if(choice == 3)
  42. {
  43. await InstructModeExecute.Run();
  44. }
  45. else if(choice == 4)
  46. {
  47. await StatelessModeExecute.Run();
  48. }
  49. else if(choice == 5)
  50. {
  51. await SaveAndLoadSession.Run();
  52. }
  53. else if(choice == 6)
  54. {
  55. await LoadAndSaveState.Run();
  56. }
  57. else if(choice == 7)
  58. {
  59. GetEmbeddings.Run();
  60. }
  61. else if(choice == 8)
  62. {
  63. QuantizeModel.Run();
  64. }
  65. else if (choice == 9)
  66. {
  67. await TalkToYourself.Run();
  68. }
  69. else if (choice == 10)
  70. {
  71. await GrammarJsonResponse.Run();
  72. }
  73. else if (choice == 11)
  74. {
  75. await SemanticKernelPrompt.Run();
  76. }
  77. else if (choice == 12)
  78. {
  79. await SemanticKernelChat.Run();
  80. }
  81. else if (choice == 13)
  82. {
  83. await SemanticKernelMemory.Run();
  84. }
  85. else if(choice == 14)
  86. {
  87. await CodingAssistant.Run();
  88. }
  89. else if (choice == 15)
  90. {
  91. await BatchedDecoding.Run();
  92. }
  93. else
  94. {
  95. Console.WriteLine("Cannot parse your choice. Please select again.");
  96. continue;
  97. }
  98. break;
  99. }
  100. }
  101. }
  102. }