Browse Source

README, Cleanup

tags/v0.5.1
Tim Miller 2 years ago
parent
commit
d4a57fffef
2 changed files with 26 additions and 3 deletions
  1. +0
    -3
      LLama.Examples/NewVersion/SemanticKernelChat.cs
  2. +26
    -0
      LLama.SemanticKernel/README.md

+ 0
- 3
LLama.Examples/NewVersion/SemanticKernelChat.cs View File

@@ -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<IChatCompletion>("local-llama", new LLamaSharpChatCompletion(ex), true);
//var kernel = builder.Build();

var chatGPT = new LLamaSharpChatCompletion(ex);



+ 26
- 0
LLama.SemanticKernel/README.md View File

@@ -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<ITextCompletion>("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);
```

Loading…
Cancel
Save