Denomica.OpenAI.Extensions
1.0.0-beta.5
dotnet add package Denomica.OpenAI.Extensions --version 1.0.0-beta.5
NuGet\Install-Package Denomica.OpenAI.Extensions -Version 1.0.0-beta.5
<PackageReference Include="Denomica.OpenAI.Extensions" Version="1.0.0-beta.5" />
<PackageVersion Include="Denomica.OpenAI.Extensions" Version="1.0.0-beta.5" />
<PackageReference Include="Denomica.OpenAI.Extensions" />
paket add Denomica.OpenAI.Extensions --version 1.0.0-beta.5
#r "nuget: Denomica.OpenAI.Extensions, 1.0.0-beta.5"
#:package Denomica.OpenAI.Extensions@1.0.0-beta.5
#addin nuget:?package=Denomica.OpenAI.Extensions&version=1.0.0-beta.5&prerelease
#tool nuget:?package=Denomica.OpenAI.Extensions&version=1.0.0-beta.5&prerelease
Denomica.OpenAI.Extensions
Denomica.OpenAI.Extensions
is a library that provides extension methods for working with types in Azure.AI.OpenAI
.
The library originally started with providing functionality for chunking up text into smaller pieces, which is useful for generating embeddings with the OpenAI API. But it will evolve over time to include additional features and utilities for working with OpenAI's API in Azure AI Foundry.
Getting Started
The following sample code illustrates how to quickly get started with the library.
using Denomica.OpenAI.Extensions.Chat;
using Denomica.OpenAI.Extensions.Embeddings;
using Denomica.OpenAI.Extensions.Text;
using Microsoft.Extensions.DependencyInjection;
using OpenAI.Chat;
var provider = new ServiceCollection()
.AddOpenAIExtensions()
.WithChunkingService<LineChunkingService>()
.WithChatModel((opt, sp) =>
{
// Add your chat model configuration here.
})
.WithEmbeddingModel((opt, sp) =>
{
// Add your embedding model configuration here.
})
.Services
.BuildServiceProvider();
var chatProvider = provider.GetRequiredService<ChatProvider>();
var chatResult = await chatProvider.Client.CompleteChatAsync(
new UserChatMessage("Hi! Can I call you Kevin?")
);
var chatContent = chatResult.GetContent().ToList();
var embeddingProvider = provider.GetRequiredService<EmbeddingProvider>();
var embedding = await embeddingProvider.GenerateEmbeddingAsync("Hello World!");
Version Highlights
The main hihglights in the published versions are outlined below.
v1.0.0-beta.5
- Refactored the embedding aggregation logic into a service to enable you to customize aggregation logic.
- Implemented a
WeightedAverageEmbeddingAggregator
service that aggregates embeddings using a weighted average approach based on the number of tokens consumed by each chunk. - The
WeightedAverageEmbeddingAggregator
is the default aggregator used by theEmbeddingProvider
if no other aggregator is configured.
v1.0.0-beta.4
- Changed service registration so that models registered without a key also registers associated services without a key instead of registering them with the model deployment name as key.
- Changed
EmbeddingResponse.Embedding
toEmbeddingResponse.Vector
.
v1.0.0-beta.3
- Added
DeploymentName
property to theEmbeddingProvider
andChatProvider
classes, which returns the name of the model deployment used by the provider.
v1.0.0-beta.2
- Fixed a typo in the readme file.
v1.0.0-beta.1
The initial version of the library includes the following features.
- A text chunking service that chunks text into smaller pieces.
- An
EmbeddingProvider
service class for working with embeddings. - The
EmbeddingProvider
service uses a configured text chunking service to break up text into smaller chunks. - Combines embeddings generated from the text chunks into a single embedding using a weighted average approach where the total number of tokens consumed by each chunk is used as the weight.
- A ChatProvider service class for working with chat completions.
- Dependency injection support for easy configuration of both embedding models and chat completion models.
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. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | 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.1
- Azure.AI.OpenAI (>= 2.1.0)
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
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 |
---|---|---|
1.0.0-beta.5 | 95 | 8/16/2025 |
1.0.0-beta.4 | 42 | 8/16/2025 |
1.0.0-beta.3 | 45 | 8/16/2025 |
1.0.0-beta.2 | 44 | 8/16/2025 |
1.0.0-beta.1 | 46 | 8/16/2025 |