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 4.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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.");
  25. Console.WriteLine("16: SK Kernel Memory.");
  26. while (true)
  27. {
  28. Console.Write("\nYour choice: ");
  29. int choice = int.Parse(Console.ReadLine());
  30. if (choice == 0)
  31. {
  32. await ChatSessionWithRoleName.Run();
  33. }
  34. else if (choice == 1)
  35. {
  36. await ChatSessionStripRoleName.Run();
  37. }
  38. else if (choice == 2)
  39. {
  40. await InteractiveModeExecute.Run();
  41. }
  42. else if (choice == 3)
  43. {
  44. await InstructModeExecute.Run();
  45. }
  46. else if (choice == 4)
  47. {
  48. await StatelessModeExecute.Run();
  49. }
  50. else if (choice == 5)
  51. {
  52. await SaveAndLoadSession.Run();
  53. }
  54. else if (choice == 6)
  55. {
  56. await LoadAndSaveState.Run();
  57. }
  58. else if (choice == 7)
  59. {
  60. GetEmbeddings.Run();
  61. }
  62. else if (choice == 8)
  63. {
  64. QuantizeModel.Run();
  65. }
  66. else if (choice == 9)
  67. {
  68. await TalkToYourself.Run();
  69. }
  70. else if (choice == 10)
  71. {
  72. await GrammarJsonResponse.Run();
  73. }
  74. else if (choice == 11)
  75. {
  76. await SemanticKernelPrompt.Run();
  77. }
  78. else if (choice == 12)
  79. {
  80. await SemanticKernelChat.Run();
  81. }
  82. else if (choice == 13)
  83. {
  84. await SemanticKernelMemory.Run();
  85. }
  86. else if (choice == 14)
  87. {
  88. await CodingAssistant.Run();
  89. }
  90. else if (choice == 15)
  91. {
  92. await BatchedDecoding.Run();
  93. }
  94. else if (choice == 16)
  95. {
  96. await KernelMemory.Run();
  97. }
  98. else
  99. {
  100. Console.WriteLine("Cannot parse your choice. Please select again.");
  101. continue;
  102. }
  103. break;
  104. }
  105. }
  106. }
  107. }