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

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