Submit a Monitor Event
from deeprails import DeepRails
DEEPRAILS_API_KEY = "YOUR_API_KEY"
client = DeepRails(
api_key=DEEPRAILS_API_KEY,
)
monitor_response = client.monitor.submit_event(
monitor_id="mon_xxxxxxxxxxxx",
model_input={
"user_prompt": "What is the capital of France?"
},
model_output="Paris",
run_mode="fast"
)
print(monitor_response)curl --request POST \
--url https://api.deeprails.com/monitor/{monitor_id}/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model_input": {
"user_prompt": "<string>",
"system_prompt": "<string>",
"ground_truth": "<string>",
"context": [
{
"role": "user",
"content": "<string>"
}
]
},
"model_output": "<string>",
"nametag": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model_input: {
user_prompt: '<string>',
system_prompt: '<string>',
ground_truth: '<string>',
context: [{role: 'user', content: '<string>'}]
},
model_output: '<string>',
nametag: '<string>'
})
};
fetch('https://api.deeprails.com/monitor/{monitor_id}/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.deeprails.com/monitor/{monitor_id}/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model_input' => [
'user_prompt' => '<string>',
'system_prompt' => '<string>',
'ground_truth' => '<string>',
'context' => [
[
'role' => 'user',
'content' => '<string>'
]
]
],
'model_output' => '<string>',
'nametag' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.deeprails.com/monitor/{monitor_id}/events"
payload := strings.NewReader("{\n \"model_input\": {\n \"user_prompt\": \"<string>\",\n \"system_prompt\": \"<string>\",\n \"ground_truth\": \"<string>\",\n \"context\": [\n {\n \"role\": \"user\",\n \"content\": \"<string>\"\n }\n ]\n },\n \"model_output\": \"<string>\",\n \"nametag\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.deeprails.com/monitor/{monitor_id}/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model_input\": {\n \"user_prompt\": \"<string>\",\n \"system_prompt\": \"<string>\",\n \"ground_truth\": \"<string>\",\n \"context\": [\n {\n \"role\": \"user\",\n \"content\": \"<string>\"\n }\n ]\n },\n \"model_output\": \"<string>\",\n \"nametag\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deeprails.com/monitor/{monitor_id}/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model_input\": {\n \"user_prompt\": \"<string>\",\n \"system_prompt\": \"<string>\",\n \"ground_truth\": \"<string>\",\n \"context\": [\n {\n \"role\": \"user\",\n \"content\": \"<string>\"\n }\n ]\n },\n \"model_output\": \"<string>\",\n \"nametag\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"event_id": "evt_xxxxxxxxxxxx",
"monitor_id": "mon_xxxxxxxxxxxx",
"created_at": "2025-01-15T10:30:00Z"
}Monitor
Submit a Monitor Event
Use this endpoint to submit a model input and output pair to a monitor for evaluation
POST
/
monitor
/
{monitor_id}
/
events
Submit a Monitor Event
from deeprails import DeepRails
DEEPRAILS_API_KEY = "YOUR_API_KEY"
client = DeepRails(
api_key=DEEPRAILS_API_KEY,
)
monitor_response = client.monitor.submit_event(
monitor_id="mon_xxxxxxxxxxxx",
model_input={
"user_prompt": "What is the capital of France?"
},
model_output="Paris",
run_mode="fast"
)
print(monitor_response)curl --request POST \
--url https://api.deeprails.com/monitor/{monitor_id}/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model_input": {
"user_prompt": "<string>",
"system_prompt": "<string>",
"ground_truth": "<string>",
"context": [
{
"role": "user",
"content": "<string>"
}
]
},
"model_output": "<string>",
"nametag": "<string>"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model_input: {
user_prompt: '<string>',
system_prompt: '<string>',
ground_truth: '<string>',
context: [{role: 'user', content: '<string>'}]
},
model_output: '<string>',
nametag: '<string>'
})
};
fetch('https://api.deeprails.com/monitor/{monitor_id}/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.deeprails.com/monitor/{monitor_id}/events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model_input' => [
'user_prompt' => '<string>',
'system_prompt' => '<string>',
'ground_truth' => '<string>',
'context' => [
[
'role' => 'user',
'content' => '<string>'
]
]
],
'model_output' => '<string>',
'nametag' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.deeprails.com/monitor/{monitor_id}/events"
payload := strings.NewReader("{\n \"model_input\": {\n \"user_prompt\": \"<string>\",\n \"system_prompt\": \"<string>\",\n \"ground_truth\": \"<string>\",\n \"context\": [\n {\n \"role\": \"user\",\n \"content\": \"<string>\"\n }\n ]\n },\n \"model_output\": \"<string>\",\n \"nametag\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.deeprails.com/monitor/{monitor_id}/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model_input\": {\n \"user_prompt\": \"<string>\",\n \"system_prompt\": \"<string>\",\n \"ground_truth\": \"<string>\",\n \"context\": [\n {\n \"role\": \"user\",\n \"content\": \"<string>\"\n }\n ]\n },\n \"model_output\": \"<string>\",\n \"nametag\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deeprails.com/monitor/{monitor_id}/events")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model_input\": {\n \"user_prompt\": \"<string>\",\n \"system_prompt\": \"<string>\",\n \"ground_truth\": \"<string>\",\n \"context\": [\n {\n \"role\": \"user\",\n \"content\": \"<string>\"\n }\n ]\n },\n \"model_output\": \"<string>\",\n \"nametag\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"event_id": "evt_xxxxxxxxxxxx",
"monitor_id": "mon_xxxxxxxxxxxx",
"created_at": "2025-01-15T10:30:00Z"
}Monitor events represent individual LLM usages in your production use case. Whenever you receive a new LLM response, submit an event to this endpoint to have it evaluated.
The request body must include a
Run modes determine the models that power evaluations (fastest to most thorough):
-
-
-
-
-
-
Note:
When you create a monitor event, you’ll receive an event ID. Use this ID to track the event’s progress and retrieve the evaluation results.
The request body must include a
model_input dictionary (containing at least a system_prompt field or a user_prompt field), a model_output string to be evaluated, and a guardrail_metrics array specifying which metrics to evaluate against. Optionally, include the model_used, selected run_mode, and a human-readable nametag. Including the web_search, file_search, and context_awareness fields will allow the evaluation model to use those extended AI capabilities.Run modes determine the models that power evaluations (fastest to most thorough):
-
super_fast - High-speed lightweight checks-
fast - Balanced speed and accuracy (default)-
precision - Deep multi-model analysis-
precision_codex - Code-optimized deep analysis-
precision_max - Exhaustive multi-pass verification-
precision_max_codex - Ultimate code-aware verificationNote:
super_fast does not support Web Search or File Search capabilities. Requests using this mode on monitors with Web Search or File Search enabled will be rejected.When you create a monitor event, you’ll receive an event ID. Use this ID to track the event’s progress and retrieve the evaluation results.
Authorizations
Body
application/json
Run mode for the monitor event. The run mode allows the user to optimize for speed, accuracy, and cost by determining which models are used to evaluate the event. Available run modes (fastest to most thorough): super_fast, fast, precision, precision_codex, precision_max, and precision_max_codex. Defaults to fast. Note: super_fast does not support Web Search or File Search — if your monitor has these capabilities enabled, use a different run mode or edit the monitor to disable them.
Available options:
super_fast, fast, precision, precision_codex, precision_max, precision_max_codex Response
Monitor event created successfully
