Azure Semantic Reranker client library for .NET - version 1.0.0

Azure.Data.AI provides semantic reranking operations for .NET applications.

Version 1.0.0 is the first stable release and targets service API version 2026-10-30.

Getting started

Install the package

Install the client library for .NET with NuGet:

dotnet add package Azure.Data.AI

Prerequisites

  • Azure.Core version 1.64.0 or later. This dependency is installed automatically; if your application references Azure.Core directly or pins it through central package management, update that reference to at least 1.64.0.
  • You must have a Microsoft Azure subscription.
  • A Semantic Reranker endpoint.
  • Either an API key or a Microsoft Entra identity assigned the Semantic Reranker User role on the Microsoft.InferenceService/inferenceAccounts resource.

Authenticate the client

Create a client with an API key:

Uri endpoint = new Uri("<semantic-reranker-endpoint>");
AzureKeyCredential credential = new AzureKeyCredential("<api-key>");
InferenceClient client = new InferenceClient(endpoint, credential);

Or authenticate with a TokenCredential, such as DefaultAzureCredential from Azure.Identity:

Uri endpoint = new Uri("<semantic-reranker-endpoint>");
InferenceClient client = new InferenceClient(endpoint, new DefaultAzureCredential());

The generated bearer-token policy requests the https://dbinference.azure.com/.default scope.

Key concepts

Use InferenceClient.SemanticRerank or SemanticRerankAsync to rerank documents directly. Pass a SemanticRerankingContent instance and read the scores and Metadata from the returned SemanticRerankingResult. For JSON documents, set DocumentType to SemanticRerankingDocumentType.Json and add up to 100 property paths to the TargetPaths collection; the client serializes them as a comma-separated string. The API contract specifies a maximum of 100 paths.

Examples

See Semantic reranking.

Troubleshooting

Service operations throw RequestFailedException when the service returns a non-success status code.

Next steps

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (for example, label, comment). Follow the instructions provided by the bot. You'll only need to do this action once across all repositories using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any other questions or comments.