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

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