Change how calls are routed
PATCH
/v1/models/{model}/routing
const url = 'https://api.pensievelabs.co/v1/models/grade-audit/routing';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"mode":"model","threshold":0.8}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://api.pensievelabs.co/v1/models/grade-audit/routing \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "mode": "model", "threshold": 0.8 }'observe records calls only: your own code keeps answering, through capture. model sends
calls to the expert model and falls back under threshold. split sends split_percent of
calls to the model and the rest to your code.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”model
required
string
The model’s slug, such as grade-audit, or its mdl_ id.
Example
grade-auditRequest Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
mode
string
threshold
number
split_percent
integer
Example
{ "mode": "model", "threshold": 0.8}Responses
Section titled “Responses”The routing now in force.
Media typeapplication/json
object
object
required
model
required
string
mode
required
string
threshold
required
Under this confidence a call falls back.
number
split_percent
required
integer | null
updated_at
required
string format: date-time
Example
{ "object": "routing", "mode": "observe"}default
Section titled “default”Something went wrong; error.type says what.
Media typeapplication/json
object
error
required
object
type
required
string
message
required
string
param
The request field the error is about.
string | null
request_id
required
string
Example
{ "error": { "type": "invalid_request" }}