From d4a57fffef453014311ca5e2ed6ee122aa168ee8 Mon Sep 17 00:00:00 2001 From: Tim Miller Date: Fri, 1 Sep 2023 10:03:34 +0900 Subject: [PATCH] README, Cleanup --- .../NewVersion/SemanticKernelChat.cs | 3 --- LLama.SemanticKernel/README.md | 26 +++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 LLama.SemanticKernel/README.md diff --git a/LLama.Examples/NewVersion/SemanticKernelChat.cs b/LLama.Examples/NewVersion/SemanticKernelChat.cs index 6d9b4396..9bdbcfec 100644 --- a/LLama.Examples/NewVersion/SemanticKernelChat.cs +++ b/LLama.Examples/NewVersion/SemanticKernelChat.cs @@ -27,9 +27,6 @@ namespace LLama.Examples.NewVersion using var model = LLamaWeights.LoadFromFile(parameters); using var context = model.CreateContext(parameters); var ex = new InteractiveExecutor(context); - //var builder = new KernelBuilder(); - //builder.WithAIService("local-llama", new LLamaSharpChatCompletion(ex), true); - //var kernel = builder.Build(); var chatGPT = new LLamaSharpChatCompletion(ex); diff --git a/LLama.SemanticKernel/README.md b/LLama.SemanticKernel/README.md new file mode 100644 index 00000000..369968b0 --- /dev/null +++ b/LLama.SemanticKernel/README.md @@ -0,0 +1,26 @@ +# LLamaSharp.SemanticKernel + +LLamaSharp.SemanticKernel are connections for [SemanticKernel](https://github.com/microsoft/semantic-kernel): an SDK for intergrating various LLM interfaces into a single implementation. With this, you can add local LLaMa queries as another connection point with your existing connections. + +For reference on how to implement it, view the following examples: + +- [SemanticKernelChat](../LLama.Examples/NewVersion/SemanticKernelChat.cs) +- [SemanticKernelPrompt](../LLama.Examples/NewVersion/SemanticKernelPrompt.cs) + +## ITextCompletion +```csharp +using var model = LLamaWeights.LoadFromFile(parameters); +// LLamaSharpTextCompletion can accept ILLamaExecutor. +var ex = new StatelessExecutor(model, parameters); +var builder = new KernelBuilder(); +builder.WithAIService("local-llama", new LLamaSharpTextCompletion(ex), true); +``` + +## IChatCompletion +```csharp +using var model = LLamaWeights.LoadFromFile(parameters); +using var context = model.CreateContext(parameters); +// LLamaSharpChatCompletion requires InteractiveExecutor, as it's the best fit for the given command. +var ex = new InteractiveExecutor(context); +var chatGPT = new LLamaSharpChatCompletion(ex); +```