{"id":13560524,"url":"https://github.com/atc-net/atc-semantic-kernel","last_synced_at":"2025-10-06T09:30:31.746Z","repository":{"id":236138797,"uuid":"791993741","full_name":"atc-net/atc-semantic-kernel","owner":"atc-net","description":"Connectors and plugins for integrating large language models via Semantic Kernel","archived":false,"fork":false,"pushed_at":"2024-05-31T09:38:40.000Z","size":90,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-01-14T11:59:53.193Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://atc-net.github.io/repository/atc-semantic-kernel","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atc-net.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-25T19:10:10.000Z","updated_at":"2024-12-31T08:31:52.000Z","dependencies_parsed_at":"2024-05-07T07:26:05.539Z","dependency_job_id":"35162ba9-f1b4-4c9c-832a-161826589a95","html_url":"https://github.com/atc-net/atc-semantic-kernel","commit_stats":null,"previous_names":["atc-net/atc-semantic-kernel"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atc-net%2Fatc-semantic-kernel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atc-net%2Fatc-semantic-kernel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atc-net%2Fatc-semantic-kernel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atc-net%2Fatc-semantic-kernel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atc-net","download_url":"https://codeload.github.com/atc-net/atc-semantic-kernel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235515428,"owners_count":19002481,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:00:45.856Z","updated_at":"2025-10-06T09:30:26.453Z","avatar_url":"https://github.com/atc-net.png","language":"C#","readme":"# Introduction\n\nThis repository contains various connectors and plugins for integrating Large Language Models (LLMs) via Semantic Kernel.\n\n# Table of Content\n\n- [Introduction](#introduction)\n- [Table of Content](#table-of-content)\n- [SemanticKernel Connectors](#semantickernel-connectors)\n  - [Atc.SemanticKernel.Connectors.Ollama](#atcsemantickernelconnectorsollama)\n    - [Wire-Up Using KernelBuilder/ServiceCollection Extensions](#wire-up-using-kernelbuilderservicecollection-extensions)\n      - [Setup with KernelBuilder](#setup-with-kernelbuilder)\n      - [Setup with ServiceCollection](#setup-with-servicecollection)\n    - [Examples](#examples)\n      - [Using the OllamaChatCompletionService](#using-the-ollamachatcompletionservice)\n      - [Using the OllamaTextGenerationService](#using-the-ollamatextgenerationservice)\n      - [Using the OllamaTextEmbeddingGenerationService](#using-the-ollamatextembeddinggenerationservice)\n- [Requirements](#requirements)\n- [How to contribute](#how-to-contribute)\n\n# SemanticKernel Connectors\n\n## Atc.SemanticKernel.Connectors.Ollama\n\n[![NuGet Version](https://img.shields.io/nuget/v/atc.semantickernel.connectors.ollama.svg?logo=nuget\u0026style=for-the-badge)](https://www.nuget.org/packages/atc.semantickernel.connectors.ollama)\n\nThe `Atc.SemanticKernel.Connectors.Ollama` package contains a connector for integrating with [Ollama](https://ollama.com/) .\n\nIt supports the following capabilities by implementing the interfaces (`IChatCompletionService`, `ITextGenerationService`, `ITextEmbeddingGenerationService`)\n\n\u003e Note: Embedding generation is marked as experimental in Semantic Kernel\n\n### Wire-Up Using KernelBuilder/ServiceCollection Extensions\n\nTo seamlessly integrate Ollama services into your application, you can utilize the provided [`KernelBuilder`](src/Atc.SemanticKernel.Connectors.Ollama/Extensions/OllamaKernelBuilderExtensions.cs) and [`ServiceCollection`](src/Atc.SemanticKernel.Connectors.Ollama/Extensions/OllamaServiceCollectionExtensions.cs) extension methods. These methods simplify the setup process and ensure that the Ollama services are correctly configured and ready to use within your application's service architecture.\n\nBoth methods ensure that the Ollama services are added to the application's service collection and configured according to the specified parameters, making them available throughout your application via dependency injection.\n\nThe configuration examples below utilizes the application's settings (typically defined in appsettings.json) to configure each Ollama service with appropriate endpoints and model identifiers.\n\n#### Setup with KernelBuilder\n\nThe `KernelBuilder` extensions allow for fluent configuration and registration of services. Here’s how you can wire up Ollama services using `KernelBuilder`:\n\n```csharp\nvar builder = WebApplication.CreateBuilder(args);\n\n// Add Kernel services\nbuilder.Services.AddKernel()\n    .AddOllamaTextGeneration(\n        builder.Configuration[\"Ollama:Endpoint\"],\n        builder.Configuration[\"Ollama:Model\"])\n    .AddOllamaChatCompletion(\n        builder.Configuration[\"Ollama:Endpoint\"],\n        builder.Configuration[\"Ollama:Model\"])\n    .AddOllamaTextEmbeddingGeneration(\n        builder.Configuration[\"Ollama:Endpoint\"],\n        builder.Configuration[\"Ollama:Model\"]);\n```\n\n#### Setup with ServiceCollection\n\nAlternatively, if you're configuring services directly through `IServiceCollection`, here's how you can add Ollama services:\n\n```csharp\nvar builder = WebApplication.CreateBuilder(args);\n\n// Configure Ollama services directly\nbuilder.Services\n    .AddOllamaTextGeneration(\n        builder.Configuration[\"Ollama:Endpoint\"],\n        builder.Configuration[\"Ollama:Model\"])\n    .AddOllamaChatCompletion(\n        builder.Configuration[\"Ollama:Endpoint\"],\n        builder.Configuration[\"Ollama:Model\"])\n    .AddOllamaTextEmbeddingGeneration(\n        builder.Configuration[\"Ollama:Endpoint\"],\n        builder.Configuration[\"Ollama:Model\"]);\n```\n\n### Examples\n\n#### Using the OllamaChatCompletionService\n\nTo utilize the `OllamaChatCompletionService` for chat completions, you can initialize it with an `OllamaApiClient` or a custom API endpoint, and a model ID. Below is an example of how to use the service to handle chat sessions.\n\n```csharp\nvar chatCompletionService = kernel.GetRequiredService\u003cIChatCompletionService\u003e();\nvar history = new ChatHistory();\n\n// Add needed messages to current chat history\nhistory.AddSystemMessage(\"...\");\nhistory.AddUserMessage(input);\n\nvar chatResponse = await chat.GetChatMessageContentsAsync(history);\nConsole.WriteLine(chatResponse[^1].Content);\n```\n\n#### Using the OllamaTextGenerationService\n\nThe `OllamaTextGenerationService` offers text generation capabilities using a specified model. This service can be initialized using an `OllamaApiClient` or a custom API endpoint, and a model ID. Below is an example of how to use the service to handle text generation.\n\n```csharp\nvar textGen = kernel.GetRequiredService\u003cITextGenerationService\u003e();\nvar response = await textGen.GetTextContentsAsync(\"The weather in January in Denmark is usually \");\nConsole.WriteLine(response[^1].Text);\n```\n\n#### Using the OllamaTextEmbeddingGenerationService\n\nThe OllamaTextEmbeddingGenerationService provides functionality to generate text embeddings. This service can be initiated with an `OllamaApiClient` or a custom endpoint, and model ID. Below is an example of how to use the service to handle text generation.\n\n```csharp\n#pragma warning disable SKEXP0001\nvar embeddingGenerationService = kernel.GetRequiredService\u003cITextEmbeddingGenerationService\u003e();\n#pragma warning restore SKEXP0001\n\nList\u003cstring\u003e texts = [\"Hello\"];\n\nvar embeddings = await embeddingGenerationService.GenerateEmbeddingsAsync(texts);\nConsole.WriteLine($\"Embeddings Length: {embeddings.Count}\");\n```\n\n# Requirements\n\n* [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)\n* [Ollama](https://ollama.com/) with one or more downloaded models\n\n# How to contribute\n\n[Contribution Guidelines](https://atc-net.github.io/introduction/about-atc#how-to-contribute)\n\n[Coding Guidelines](https://atc-net.github.io/introduction/about-atc#coding-guidelines)\n","funding_links":[],"categories":["Plugins"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatc-net%2Fatc-semantic-kernel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatc-net%2Fatc-semantic-kernel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatc-net%2Fatc-semantic-kernel/lists"}