LLamaSharp/LLama.SemanticKernel
Rinne 6bf010d719
Merge pull request #689 from zsogitbe/master
SemanticKernel: Correcting non-standard way of working with PromptExecutionSettings
2024-05-01 01:52:43 +08:00
..
ChatCompletion Merge pull request #689 from zsogitbe/master 2024-05-01 01:52:43 +08:00
TextCompletion Correcting non-standard way of working with PromptExecutionSettings 2024-04-24 08:06:40 +02:00
TextEmbedding - Swapped embeddings generator to use `llama_decode` 2024-01-31 20:28:53 +00:00
ExtensionMethods.cs Correcting non-standard way of working with PromptExecutionSettings 2024-04-24 08:06:40 +02:00
LLamaSharp.SemanticKernel.csproj release: update release info of packages. 2024-04-06 14:20:36 +08:00
LLamaSharpPromptExecutionSettings.cs Adding Response Format - Correcting non-standard way of working with PromptExecutionSettings 2024-04-27 09:39:40 +02:00
LLamaSharpPromptExecutionSettingsConverter.cs Renaming files to correspond to class names 2024-04-24 08:24:02 +02:00
README.md Fix typos in SemanticKernel README file 2024-01-05 22:21:53 +03:00

README.md

LLamaSharp.SemanticKernel

LLamaSharp.SemanticKernel are connections for SemanticKernel: an SDK for integrating 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:

ITextCompletion

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

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);

ITextEmbeddingGeneration

using var model = LLamaWeights.LoadFromFile(parameters);
var embedding = new LLamaEmbedder(model, parameters);
var kernelWithCustomDb = Kernel.Builder
    .WithLoggerFactory(ConsoleLogger.LoggerFactory)
    .WithAIService<ITextEmbeddingGeneration>("local-llama-embed", new LLamaSharpEmbeddingGeneration(embedding), true)
    .WithMemoryStorage(new VolatileMemoryStore())
    .Build();