Arebis.Core.Services.Translation.OpenAI 8.0.2

dotnet add package Arebis.Core.Services.Translation.OpenAI --version 8.0.2
                    
NuGet\Install-Package Arebis.Core.Services.Translation.OpenAI -Version 8.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="Arebis.Core.Services.Translation.OpenAI" Version="8.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Arebis.Core.Services.Translation.OpenAI" Version="8.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Arebis.Core.Services.Translation.OpenAI" />
                    
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 Arebis.Core.Services.Translation.OpenAI --version 8.0.2
                    
#r "nuget: Arebis.Core.Services.Translation.OpenAI, 8.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 Arebis.Core.Services.Translation.OpenAI@8.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=Arebis.Core.Services.Translation.OpenAI&version=8.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Arebis.Core.Services.Translation.OpenAI&version=8.0.2
                    
Install as a Cake Tool

Arebis.Core.Services.Translation.OpenAI

.NET Core translation service implementation based on OpenAI's GPT models.

Translation Services

OpenAITranslationService

Add the OpenAI client library to your .NET project by installing the NuGet package via your IDE or by running the following command in the .NET CLI:

dotnet add package OpenAI

Next, register the ChatClient and OpenAITranslationServices the following way:

builder.Services.AddSingleton<ChatClient>(serviceProvider =>
{
    var apiKey = Environment.GetEnvironmentVariable("OPENAI_API_KEY");
    var model = "gpt-5.2";

    return new ChatClient(model, apiKey);
});

builder.Services.AddTransient<ITranslationService, OpenAITranslationService>();

In configuration, 3 prompts can be overridden:

  • OpenAI:JsonPrompt
  • OpenAI:Translation:TranslationPrompt
  • OpenAI:Translation:FormatPrompt

The JsonPrompt is used to enforce JSON output.

The TranslationPrompt is used to set the overall behavior of the model.

The FormatPrompt is used to specify the output format (JSON schema and languages). The FormatPrompt must contain substitution fields {fromLanguage}, {toLanguages} and {mimeType}.

Here an example containing the default prompts:

{
    "OpenAI": {
        "JsonPrompt": "You are a non-interactive backend processor.
            Respond exclusively with raw JSON. [no prose]
            Any output that is not valid JSON is a failure.
            Never include markdown, comments, or natural language.
            Never engage in dialogue.
            If an error occurs, return { \"error\": \"<description>\" }.",
        "Translation": {
            "TranslationPrompt": "You are a professional translator that translates text from one language to another while preserving the original meaning, tone and context.",
            "FormatPrompt": "Return only the translation in a single machine processable JSON output with for each target language a property named with the language code (e.g. \"fr-FR\")
                and as value the full translated text.
                If the input is valid HTML, translate only the human-readable text nodes to the target languages, keeping the translated text as HTML.
                All tags, attributes, whitespace, entities, and structure must remain unchanged except for translated text nodes.
                Do not normalize, prettify, or reformat the markup.
                No prose. No markdown. No dialogue.
                Translate the following source in \"{fromLanguage}\" with MIME-type \"{mimeType}\" into the following target languages: {toLanguages}:"
        }
    }
}

In a typical scenario, you would only override the TranslationPrompt to provide additional role and context information.

See also:

Related developer resources:

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.

Version Downloads Last Updated
8.0.2 198 2/4/2026
8.0.1 150 2/2/2026
8.0.0 146 1/20/2026