from deeprails import DeepRails
DEEPRAILS_API_KEY = "YOUR_API_KEY"
client = DeepRails(
api_key=DEEPRAILS_API_KEY,
)
monitor_response = client.monitor.create(
name="Test Monitor",
description="A monitor used to test the DeepRails SDK",
guardrail_metrics=["correctness", "completeness"],
web_search=True,
file_search=["file_xxxxxxxxxxxx"],
context_awareness=True,
)
print(monitor_response)curl --request POST \
--url https://api.deeprails.com/monitor \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"guardrail_metrics": [],
"description": "<string>",
"web_search": false,
"file_search": [
"<string>"
],
"context_awareness": false
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
guardrail_metrics: [],
description: '<string>',
web_search: false,
file_search: ['<string>'],
context_awareness: false
})
};
fetch('https://api.deeprails.com/monitor', 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",
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([
'name' => '<string>',
'guardrail_metrics' => [
],
'description' => '<string>',
'web_search' => false,
'file_search' => [
'<string>'
],
'context_awareness' => false
]),
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"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"guardrail_metrics\": [],\n \"description\": \"<string>\",\n \"web_search\": false,\n \"file_search\": [\n \"<string>\"\n ],\n \"context_awareness\": false\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"guardrail_metrics\": [],\n \"description\": \"<string>\",\n \"web_search\": false,\n \"file_search\": [\n \"<string>\"\n ],\n \"context_awareness\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deeprails.com/monitor")
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 \"name\": \"<string>\",\n \"guardrail_metrics\": [],\n \"description\": \"<string>\",\n \"web_search\": false,\n \"file_search\": [\n \"<string>\"\n ],\n \"context_awareness\": false\n}"
response = http.request(request)
puts response.read_body{
"monitor_id": "mon_xxxxxxxxxxxx",
"status": "active",
"created_at": "2025-01-15T10:30:00Z"
}Create a Monitor
Use this endpoint to create a new monitor to evaluate model inputs and outputs using guardrails
from deeprails import DeepRails
DEEPRAILS_API_KEY = "YOUR_API_KEY"
client = DeepRails(
api_key=DEEPRAILS_API_KEY,
)
monitor_response = client.monitor.create(
name="Test Monitor",
description="A monitor used to test the DeepRails SDK",
guardrail_metrics=["correctness", "completeness"],
web_search=True,
file_search=["file_xxxxxxxxxxxx"],
context_awareness=True,
)
print(monitor_response)curl --request POST \
--url https://api.deeprails.com/monitor \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"guardrail_metrics": [],
"description": "<string>",
"web_search": false,
"file_search": [
"<string>"
],
"context_awareness": false
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
guardrail_metrics: [],
description: '<string>',
web_search: false,
file_search: ['<string>'],
context_awareness: false
})
};
fetch('https://api.deeprails.com/monitor', 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",
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([
'name' => '<string>',
'guardrail_metrics' => [
],
'description' => '<string>',
'web_search' => false,
'file_search' => [
'<string>'
],
'context_awareness' => false
]),
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"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"guardrail_metrics\": [],\n \"description\": \"<string>\",\n \"web_search\": false,\n \"file_search\": [\n \"<string>\"\n ],\n \"context_awareness\": false\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"guardrail_metrics\": [],\n \"description\": \"<string>\",\n \"web_search\": false,\n \"file_search\": [\n \"<string>\"\n ],\n \"context_awareness\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deeprails.com/monitor")
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 \"name\": \"<string>\",\n \"guardrail_metrics\": [],\n \"description\": \"<string>\",\n \"web_search\": false,\n \"file_search\": [\n \"<string>\"\n ],\n \"context_awareness\": false\n}"
response = http.request(request)
puts response.read_body{
"monitor_id": "mon_xxxxxxxxxxxx",
"status": "active",
"created_at": "2025-01-15T10:30:00Z"
}name and a set of guardrail_metrics used for evaluation. Optionally, extended capabilities, like web_search, file_search, and context_awareness, and a description can be included.Once created, the monitor can be used to log and evaluate model outputs against guardrail metrics for LLM use in your production environment.
When you create a monitor, you’ll receive a monitor ID. Use this ID to submit new events to the Monitor for tracking usage, cost, latency, and evaluation scores.
Authorizations
Body
An array of guardrail metrics that the model input and output pair will be evaluated on. For non-enterprise users, these will be limited to correctness, completeness, instruction_adherence, context_adherence, ground_truth_adherence, and/or comprehensive_safety.
correctness, completeness, instruction_adherence, context_adherence, ground_truth_adherence, comprehensive_safety Context includes any structured information that directly relates to the model’s input and expected output—e.g., the recent turn-by-turn history between an AI tutor and a student, facts or state passed through an agentic workflow, or other domain-specific signals your system already knows and wants the model to condition on. This field determines whether to enable context awareness for this monitor's evaluations. Defaults to false.
Response
Monitor created successfully
