ManagedCode.Together
0.0.3
Prefix Reserved
dotnet add package ManagedCode.Together --version 0.0.3
NuGet\Install-Package ManagedCode.Together -Version 0.0.3
<PackageReference Include="ManagedCode.Together" Version="0.0.3" />
paket add ManagedCode.Together --version 0.0.3
#r "nuget: ManagedCode.Together, 0.0.3"
// Install ManagedCode.Together as a Cake Addin #addin nuget:?package=ManagedCode.Together&version=0.0.3 // Install ManagedCode.Together as a Cake Tool #tool nuget:?package=ManagedCode.Together&version=0.0.3
Together .NET SDK
Unofficial C# SDK for Together.ai with Semantic Kernel integration.
Introduction
Together.ai provides access to the latest open-source AI models through a simple API. This SDK offers:
- 🚀 Easy access to Together.ai's API from .NET applications
- 🧠 Seamless integration with Microsoft Semantic Kernel
- 🔧 Chat Completions, Text Generation, Embeddings and Image Generation
- 🌊 Both synchronous and streaming responses
- 🛠 Built-in function calling support
Installation
Choose the package(s) you need:
# Core API client
dotnet add package ManagedCode.Together
# Semantic Kernel integration
dotnet add package ManagedCode.Together.SemanticKernel
Usage Examples
Direct API Usage
using Together;
var client = new TogetherClient("YOUR_API_KEY");
var response = await client.ChatCompletions.CreateAsync(new ChatCompletionRequest
{
Model = "mistralai/Mistral-7B-Instruct-v0.1",
Messages = new[]
{
new ChatCompletionMessage { Role = "user", Content = "Hello!" }
}
});
Semantic Kernel Integration
using Microsoft.SemanticKernel;
using Together.SemanticKernel;
// Initialize kernel with multiple Together.ai capabilities
var kernel = Kernel.CreateBuilder()
.AddTogetherChatCompletion(
"mistralai/Mistral-7B-Instruct-v0.1",
"YOUR_API_KEY"
)
.AddTogetherTextEmbeddingGeneration(
"togethercomputer/m2-bert-80M-2k-retrieval",
"YOUR_API_KEY"
)
.AddTogetherTextToImage(
"stabilityai/stable-diffusion-xl-base-1.0",
"YOUR_API_KEY"
)
.Build();
// Chat completion
var chatResult = await kernel.InvokePromptAsync("What is quantum computing?");
// Generate embeddings
var embeddingService = kernel.GetRequiredService<ITextEmbeddingGenerationService>();
var embeddings = await embeddingService.GenerateEmbeddingsAsync(
["What is quantum computing?"]
);
// Generate images
var imageService = kernel.GetRequiredService<ITextToImageService>();
var images = await imageService.GetImageContentsAsync(
"A cat playing piano",
new TogetherTextToImageExecutionSettings
{
Height = 512,
Width = 512
}
);
📚 Documentation
For more information about available models and features, visit the Together.ai Documentation
💪 Contributing
Contributions are welcome! Feel free to:
- Open issues for bugs or feature requests
- Submit pull requests
- Improve documentation
📄 License
This project is licensed under the MIT License. See the LICENSE file for details.
⭐ Support
If you find this project useful, please give it a star on GitHub!
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net9.0
- Microsoft.Extensions.AI.Abstractions (>= 9.0.1-preview.1.24570.5)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ManagedCode.Together:
Package | Downloads |
---|---|
ManagedCode.Together.SemanticKernel
Together.AI .NET SDK for SemanticKernel |
GitHub repositories
This package is not used by any popular GitHub repositories.