const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: '<string>',
documents: ['<string>'],
model: '<string>',
top_n: 2,
return_documents: true,
filename: '<string>',
name: '<string>',
fallbacks: [{model: '<string>'}],
retry: {count: 3, on_codes: [429, 500, 502, 503, 504]},
plugins: [
{
id: 'pii_redaction',
language: '<string>',
regions: ['<string>'],
entities: ['<string>'],
entity_thresholds: {},
threshold: 0.5
}
],
orq: {
name: '<string>',
fallbacks: [{model: 'openai/gpt-5.4-mini'}],
retry: {count: 3, on_codes: [429, 500, 502, 503, 504]},
load_balancer: {
type: 'weight_based',
models: [
{model: 'openai/gpt-4o', weight: 0.7},
{model: 'anthropic/claude-3-5-sonnet', weight: 0.3}
]
},
fallback_on_codes: [499]
},
fallback_on_codes: [499]
})
};
fetch('https://my.orq.ai/v2/router/rerank', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));