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. |
Get information about reranking providers for the find and rerank command, including supported providers, models, and configuration parameters.
|
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:
FindRerankingProvidersResult - An object representing the full response from the findRerankingProviders Data API command.
The information in the response is arranged as a hierarchy of nested classes, structured like the Data API JSON response. Refer to the following examples or consult the involved classes in the client reference:
Result
FindRerankingProvidersResult(reranking_providers=nvidia)
You can navigate the response by looping, filtering and inspecting nested objects. The actual response depends on the models available for a given database.
Returns:
Promise<FindRerankingProvidersResult> - An object
representing the full response from the findRerankingProviders API command.
The object contains a single key, rerankingProviders, which holds an untyped map with provide names as keys, and objects describing the provider as values.
You can navigate the response by looping, filtering and inspecting nested objects. The actual response depends on the models available for a given database.
Returns:
FindRerankingProvidersResult - An object representing the full response from the findRerankingProviders Data API command.
The object contains a single attribute, rerankingProviders, which holds an untyped map with provider names as keys, and objects describing the provider as values.
You can navigate the response by looping, filtering, and inspecting nested objects. The actual response depends on the models available for a given database.
Returns:
A successful response returns a JSON object describing the reranking providers and settings available for the specified database.
Result
This example response is formatted and edited for clarity.
{
"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
reranking_providers = db_admin.find_reranking_providers()
Parameters:
| Name | Type | Summary |
|---|---|---|
|
|
Filters the available models by status. Default: |
|
|
A timeout, in milliseconds, for the underlying HTTP request.
If not provided, the Database Admin setting is used.
This parameter is aliased as |
const rerankingProviders = await dbAdmin.findRerankingProviders();
Parameters:
| Name | Type | Summary |
|---|---|---|
|
|
Optional.
The options for this operation.
See Properties of |
| Name | Type | Summary |
|---|---|---|
|
ModelLifecycleStatus | "" |
Filters the available models by status. Default: |
|
|
Optional. The client-side timeout for this operation. |
FindRerankingProvidersResult findRerankingProviders();
Parameters:
| 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 to get information about reranking providers for find and rerank command.
Don’t include a keyspace in the request URL.
The application token must have sufficient permissions to perform the requested operations, such as the Database Administrator role.
Parameters:
| 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
find_r_p_result = db_admin.find_reranking_providers()
find_r_p_result
# FindRerankingProvidersResult(reranking_providers=nvidia)
find_r_p_result.reranking_providers.keys()
# dict_keys(['nvidia'])
find_r_p_result.reranking_providers['nvidia']
# RerankingProvider(
# <Default> display_name='Nvidia',
# models=[
# RerankingProviderModel(
# <Default> name='nvidia/llama-3.2-nv-rerankqa-1b-v2'
# )
# ]
# )
find_r_p_result.reranking_providers['nvidia'].display_name
# 'Nvidia'
find_r_p_result.reranking_providers['nvidia'].is_default
# True
find_r_p_result.reranking_providers['nvidia'].parameters
# []
find_r_p_result.reranking_providers['nvidia'].supported_authentication
# {'NONE': RerankingProviderAuthentication(enabled=True, tokens=)}
my_model = find_r_p_result.reranking_providers['nvidia'].models[0]
my_model
# RerankingProviderModel(
# <Default> name='nvidia/llama-3.2-nv-rerankqa-1b-v2'
# )
my_model.is_default
# True
my_model.parameters
# []
import { DataAPIClient } from '@datastax/astra-db-ts'
// Spawn an AstraDbAdmin instance
const admin = new DataAPIClient('TOKEN').admin();
const dbAdmin = admin.dbAdmin('ENDPOINT');
(async function () {
const { rerankingProviders: info } = await dbAdmin.findRerankingProviders();
// { nvidia: { ... }, ... }
console.log(info);
// ['nvidia', ...]
console.log(Object.keys(info))
// { displayName: 'Nvidia', models: [...], ... }
console.log(info.nvidia);
// 'Nvidia'
console.log(info.nvidia.displayName);
// true
console.log(info.nvidia.isDefault);
// []
console.log(info.nvidia.parameters);
// { NONE: { enabled: true, ... } }
console.log(info.nvidia.supportedAuthentication);
// { name: 'nvidia/llama-3.2-nv-rerankqa-1b-v2', parameters: [] }
console.log(info.nvidia.models[0]);
// true
console.log(info.nvidia.models[0].isDefault);
// []
console.log(info.nvidia.models[0].parameters);
})();
import com.datastax.astra.client.DataAPIClient;
import com.datastax.astra.client.admin.DatabaseAdmin;
import com.datastax.astra.client.databases.Database;
import com.datastax.astra.client.databases.commands.results.FindRerankingProvidersResult;
public class FindRerankingProviders {
public static void main(String[] args) {
Database db = new DataAPIClient("TOKEN")
.getDatabase("API_ENDPOINT");
DatabaseAdmin dbAdmin = db
.getDatabaseAdmin();
FindRerankingProvidersResult results = dbAdmin
.findRerankingProviders();
results.getRerankingProviders().forEach((name, provider) -> {;
System.out.println("Provider: " + name);
System.out.println("Display Name: " + provider.getDisplayName());
System.out.println("Is Default: " + provider.getIsDefault());
System.out.println("Parameters: " + provider.getParameters());
System.out.println("Supported Authentication: " + provider.getSupportedAuthentication());
System.out.println("Models: " + provider.getModels());
});
}
}
curl -sS -L -X POST "API_ENDPOINT/api/json/v1" \
--header "Token: APPLICATION_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"findRerankingProviders": {
"options": {
"filterModelStatus": "SUPPORTED"
}
}
}'
You can use | jq to filter the response:
curl -sS -L -X POST "API_ENDPOINT/api/json/v1" \
--header "Token: APPLICATION_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"findRerankingProviders": {
"options": {
"filterModelStatus": "SUPPORTED"
}
}
}' | jq .status.rerankingProviders.MODEL_NAME
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.