Find reranking providers
|
Hybrid search, lexical search, and reranking are currently in public preview. Development is ongoing, and the features and functionality are subject to change. Astra DB Serverless, and the use of such, is subject to the DataStax Preview Terms. |
Gets information about reranking providers for the find and rerank command, including supported providers, models, and configuration parameters.
Different databases might have different models available.
|
You need an application token with permission to interact with the target database, such as the Database Administrator role. For more information, see Get endpoint and token. |
Result
-
Python
-
TypeScript
-
Java
-
curl
Returns a FindRerankingProvidersResult object that contains information about the the reranking providers.
The information in the response is arranged as a hierarchy of nested classes:
Returns a promise that resolves to a FindRerankingProvidersResult object that contains information about the the reranking providers.
The object contains a single key, rerankingProviders, which holds an untyped map with provider names as keys, and objects describing the provider as values.
Returns a FindRerankingProvidersResult object that contains information about the the reranking providers.
The object contains a single attribute, rerankingProviders, which holds an untyped map with provider names as keys, and objects describing the provider as values.
Returns an object that contains information about the reranking providers.
Example response, truncated for brevity
{
"status": {
"rerankingProviders": {
"nvidia": {
"isDefault": true,
"displayName": "Nvidia",
"supportedAuthentication": {
"NONE": {
"enabled": true,
"tokens": []
}
},
"models": [
{
"name": "nvidia/llama-3.2-nv-rerankqa-1b-v2",
"isDefault": true,
"url": "https://...",
"properties": null
}
]
}
}
}
}
Parameters
-
Python
-
TypeScript
-
Java
-
curl
Use the find_reranking_providers method, which belongs to the AstraDBDatabaseAdmin class.
Method signature
find_reranking_providers(
*,
filter_model_status: str | ModelStatus,
database_admin_timeout_ms: int,
request_timeout_ms: int,
timeout_ms: int,
) -> FindRerankingProvidersResult
| Name | Type | Summary |
|---|---|---|
|
|
Optional. Filters the available models by status. Default: |
|
|
Optional.
A timeout, in milliseconds, to impose on the underlying API request.
If not provided, the This parameter is aliased as |
Use the findRerankingProviders method, which belongs to the DbAdmin class.
Method signature
async findRerankingProviders(
options?: {
filterModelStatus?: ModelLifecycleStatus | '',
timeout: number | TimeoutDescriptor,
}
): FindRerankingProvidersResult;
| Name | Type | Summary |
|---|---|---|
|
|
Optional.
The options for this operation.
See Properties of |
| Name | Type | Summary |
|---|---|---|
|
|
Optional. Filters the available models by status. Default: |
|
|
Optional. The client-side timeout for this operation. |
Use the findRerankingProviders method, which belongs to the com.datastax.astra.client.admin.DatabaseAdmin class.
Method signature
FindRerankingProvidersResult findRerankingProviders();
FindRerankingProvidersResult findRerankingProviders(FindRerankingProvidersOptions options);
| Name | Type | Summary |
|---|---|---|
|
|
Options for this command, including a filter for the available models by status. By default, the command returns only the supported models. |
Use the findRerankingProviders Data API command.
The application token must have sufficient permissions to perform the requested operations, such as the Database Administrator role.
Command signature
curl -sS -L -X POST "API_ENDPOINT/api/json/v1" \
--header "Token: APPLICATION_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"findRerankingProviders": {
"options": {
"filterModelStatus": "STATUS"
}
}
}'
| Name | Type | Summary |
|---|---|---|
|
|
Optional.
Filters the available models by status.
Can be one of: Default: |
Examples
The following examples demonstrate how to find reranking providers.
-
Python
-
TypeScript
-
Java
-
curl
from astrapy import DataAPIClient
client = DataAPIClient("APPLICATION_TOKEN")
admin = client.get_admin()
database_admin = admin.get_database_admin("API_ENDPOINT")
providers = database_admin.find_reranking_providers()
# Use the raw dict
print(providers.raw_info)
# Or work with the resulting object:
print(providers.reranking_providers.keys())
print(providers.reranking_providers["nvidia"])
print(providers.reranking_providers["nvidia"].models[0])
import { DataAPIClient } from "@datastax/astra-db-ts";
const client = new DataAPIClient("APPLICATION_TOKEN");
const admin = client.admin();
const databaseAdmin = admin.dbAdmin("API_ENDPOINT");
(async function () {
const providers = await databaseAdmin.findRerankingProviders();
console.log(JSON.stringify(providers));
})();
import com.datastax.astra.client.DataAPIClient;
import com.datastax.astra.client.admin.DatabaseAdmin;
import com.datastax.astra.client.core.rerank.RerankProvider;
import com.datastax.astra.client.databases.Database;
import com.datastax.astra.client.databases.commands.results.FindRerankingProvidersResult;
import java.util.Map;
public class Example {
public static void main(String[] args) {
Database database = new DataAPIClient("APPLICATION_TOKEN").getDatabase("API_ENDPOINT");
DatabaseAdmin databaseAdmin = database.getDatabaseAdmin();
FindRerankingProvidersResult result = databaseAdmin.findRerankingProviders();
Map<String, RerankProvider> providers = result.getRerankingProviders();
System.out.println(providers);
}
}
curl -sS -L -X POST "API_ENDPOINT/api/json/v1" \
--header "Token: APPLICATION_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"findRerankingProviders": {
"options": {
"filterModelStatus": "SUPPORTED"
}
}
}'
Client reference
-
Python
-
TypeScript
-
Java
-
curl
For more information, see the client reference.
For more information, see the client reference.
For more information, see the client reference.
Client reference documentation is not applicable for HTTP.