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

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