LocalAIRerankingService
Namespace: Wisej.AI.Services
Assembly: Wisej.AI
Represents a service for reranking text inputs using the LocalAI API.
- C#
- VB.NET
public class LocalAIRerankingService : IRerankingService
Public Class LocalAIRerankingService
Inherits IRerankingService
This service communicates with the LocalAI 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
LocalAIRerankingService()
Initializes a new instance of LocalAIRerankingService.
Properties
Model
String: Gets or sets the reranking model for the LocalAI service. (Default: "")
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 service. (Default: "http://localhost:8080/v1/rerank")
Methods
RerankAsync(query, chunks)
Asynchronously reranks the provided chunks based on the specified query.
| Parameter | Type | Description |
|---|---|---|
| query | String | The query used to rerank the chunks. |
| chunks | String[] | 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
| Name | Description |
|---|---|
| IRerankingService | Represents a service for reranking documents based on a given query. |