Together.AI.SemanticKernel
1.3.1
dotnet add package Together.AI.SemanticKernel --version 1.3.1
NuGet\Install-Package Together.AI.SemanticKernel -Version 1.3.1
<PackageReference Include="Together.AI.SemanticKernel" Version="1.3.1" />
paket add Together.AI.SemanticKernel --version 1.3.1
#r "nuget: Together.AI.SemanticKernel, 1.3.1"
// Install Together.AI.SemanticKernel as a Cake Addin
#addin nuget:?package=Together.AI.SemanticKernel&version=1.3.1
// Install Together.AI.SemanticKernel as a Cake Tool
#tool nuget:?package=Together.AI.SemanticKernel&version=1.3.1
A unofficial .NET Semantic Kernel integration for Together's API platform.
Getting started:
Prerequisites
If you'd like to use the Together.AI .NET client library you'll need an API key from a developer account at Together's API.
Install the package
Install the client library for .NET with NuGet:
dotnet add package Together.AI.SemanticKernel
Setup TogetherAI Service
To utilize Together's API seamlessly, you'll first need to register the TogetherAITextGenerationService
in IKernelBuilder
The easiest way to do this is by using the AddTogetherAITextGeneration
extension method.
using Microsoft.SemanticKernel;
using Together.AI.SemanticKernel;
string apiKey = "your-api-key-from-together";
// You can omit modelId if you pretend to supply it from SK function parameters.
string? modelId = "togethercomputer/RedPajama-INCITE-7B-Instruct";
var kernel = Kernel.CreateBuilder()
.AddTogetherAITextGeneration(apiKey, modelId)
.Build();
With this setup, you are now equipped to seamlessly continue using SK and its built-in features.
The
AddTogetherAITextGeneration
method supports additional overrides for more precise configuration.
Examples
Looking for Grammar errors
using Microsoft.SemanticKernel;
using Together.AI.SemanticKernel;
var kernel = Kernel.CreateBuilder()
.AddTogetherAITextGeneration(
apiKey: "your-api-key-from-together",
modelId: "Open-Orca/Mistral-7B-OpenOrca")
.Build();
const string promptTemplate =
"<|im_start|> system\nDoes the text contain grammar errors? Answer with (Y/N)\n\n'{{$input}}'\n<|im_end|>\n<|im_start|> assistant\n";
var grammarValidation = kernel.CreateFunctionFromPrompt(promptTemplate);
var result = await kernel.InvokeAsync(grammarValidation, arguments: new()
{
{"input", "I mised the training session this morning"}
});
Console.WriteLine(result);
// Result: 'Y'
More examples can be found in the
Examples folder
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.Http (>= 8.0.0)
- Microsoft.SemanticKernel (>= 1.4.0)
- System.Net.Http.Json (>= 8.0.0)
- Together.AI (>= 1.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.