ManagedCode.Together.SemanticKernel 0.0.1

Prefix Reserved
dotnet add package ManagedCode.Together.SemanticKernel --version 0.0.1                
NuGet\Install-Package ManagedCode.Together.SemanticKernel -Version 0.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ManagedCode.Together.SemanticKernel" Version="0.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ManagedCode.Together.SemanticKernel --version 0.0.1                
#r "nuget: ManagedCode.Together.SemanticKernel, 0.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ManagedCode.Together.SemanticKernel as a Cake Addin
#addin nuget:?package=ManagedCode.Together.SemanticKernel&version=0.0.1

// Install ManagedCode.Together.SemanticKernel as a Cake Tool
#tool nuget:?package=ManagedCode.Together.SemanticKernel&version=0.0.1                

Together .NET SDK

.NET NuGet NuGet Downloads License

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.1 103 2/11/2025