Skip to main content

PineconeRerankingService

Namespace: Wisej.AI.Services

Assembly: Wisej.AI

Represents a service for reranking text inputs using the Pinecone API.

public class PineconeRerankingService : IRerankingService

This service communicates with the Pinecone API to rerank text inputs based on a specified query. It allows configuration of the API endpoint, API key, model, API version, and the number of top documents to return.

Constructors

PineconeRerankingService()

Initializes a new instance of PineconeRerankingService.

Properties

ApiKey

String: Gets or sets the API key for the Pinecone service. (Default: null)

ApiVersion

String: Gets or sets the API version used for requests. (Default: "2025-04")

Model

String: Gets or sets the reranking model for the Pinecone service. (Default: "pinecone-rerank-v0")

TopN

Int32: Gets or sets the maximum number of documents to return in the reranked response. If set to 0 it will return all the documents in the input. (Default: 10)

URL

String: Gets or sets the URL of the Pinecone service. (Default: "https://api.pinecone.io/rerank")

Methods

GetApiKey()

Retrieves the API key for the Pinecone service.

Returns: String. The API key for the Pinecone service.

RerankAsync(query, chunks)

Asynchronously reranks the provided chunks based on the specified query.

ParameterTypeDescription
queryStringThe query used to rerank the chunks.
chunksString[]The array of text inputs to be reranked.

Returns: Task<String[]>. A task that represents the asynchronous operation. The task result contains an array of reranked text inputs.

Implements

NameDescription
IRerankingServiceRepresents a service for reranking documents based on a given query.