GigaChat.SemanticKernel 1.0.2

dotnet add package GigaChat.SemanticKernel --version 1.0.2
                    
NuGet\Install-Package GigaChat.SemanticKernel -Version 1.0.2
                    
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="GigaChat.SemanticKernel" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GigaChat.SemanticKernel" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="GigaChat.SemanticKernel" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add GigaChat.SemanticKernel --version 1.0.2
                    
#r "nuget: GigaChat.SemanticKernel, 1.0.2"
                    
#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.
#:package GigaChat.SemanticKernel@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=GigaChat.SemanticKernel&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=GigaChat.SemanticKernel&version=1.0.2
                    
Install as a Cake Tool

GigaChat.SemanticKernel

NuGet License: MIT

Official GigaChat AI integration for Microsoft Semantic Kernel. This package enables seamless use of Sberbank's GigaChat models in Semantic Kernel applications.

Features

  • Chat Completion: IChatCompletionService implementation
  • Text Generation: ITextGenerationService support
  • Text Embeddings: ITextEmbeddingGenerationService (coming soon)
  • Token Counting: Built-in token management
  • Multi-Model Support: GigaChat-Pro, GigaChat-Max, etc.

Installation

dotnet add package GigaChat.SemanticKernel

Quick Start

using Microsoft.SemanticKernel;
using GigaChat.SemanticKernel;

var builder = Kernel.CreateBuilder();

// Configure GigaChat with your API key
builder.AddGigaChat(
    apiKey: "your_api_key_here",
    modelId: "GigaChat-Pro", // Optional (default: GigaChat-Pro)
    endpoint: "https://gigachat.devices.sberbank.ru/api/v1" // Optional
);

var kernel = builder.Build();

// Chat example
var chat = kernel.GetRequiredService<IChatCompletionService>();
var history = new ChatHistory();
history.AddUserMessage("Hello, who are you?");

var response = await chat.GetChatMessageContentAsync(history);
Console.WriteLine(response.Content);

Authentication

  1. Get your API key from GigaChat Developers Portal
  2. Pass it to AddGigaChat():
builder.AddGigaChat("your_api_key_here");

Advanced Configuration

Custom HttpClient

builder.AddGigaChat(
    apiKey: "your_key",
    httpClient: new HttpClient() { Timeout = TimeSpan.FromSeconds(120) }
);

Multiple Models

// Primary model
builder.AddGigaChat("main_api_key", modelId: "GigaChat-Pro");

// Secondary model
builder.Services.AddKeyedSingleton<IChatCompletionService>(
    "GigaChat-Max",
    (_,_) => new GigaChatClient("secondary_key", "GigaChat-Max").CreateChatService()
);

API Reference

Supported Models

Model ID Description
GigaChat Base model
GigaChat-Pro Advanced version (default)
GigaChat-Max Highest capability model
Embeddings Text embedding model

Endpoints

All endpoints follow the official GigaChat API documentation.

Limitations

  • Requires .NET 8+
  • Currently only supports chat completion and text generation
  • Token refresh not yet implemented

Contributing

Pull requests are welcome! For major changes, please open an issue first.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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.