from deeprails import DeepRails
DEEPRAILS_API_KEY = "YOUR_API_KEY"
client = DeepRails(
api_key=DEEPRAILS_API_KEY,
)
monitor_response = client.monitor.retrieve(
monitor_id="mon_xxxxxxxxxxxx"
)
print(monitor_response.data.name)
print(monitor_response.data.status)curl --request GET \
--url https://api.deeprails.com/monitor/{monitor_id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.deeprails.com/monitor/{monitor_id}', 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}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.deeprails.com/monitor/{monitor_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.deeprails.com/monitor/{monitor_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deeprails.com/monitor/{monitor_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"monitor_id": "mon_xxxxxxxxxxxx",
"name": "Test Monitor",
"status": "active",
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:00Z",
"stats": {
"total_evaluations": 1,
"completed_evaluations": 0,
"failed_evaluations": 0,
"queued_evaluations": 0,
"in_progress_evaluations": 1
},
"evaluations": [
{
"evaluation_status": "in_progress",
"run_mode": "fast",
"model_input": {
"user_prompt": "Hello, how are you?",
"system_prompt": "You are a helpful assistant.",
"ground_truth": "The user prefers that you refer to them as 'the user' instead of 'you'.",
"context": [
{
"role": "user",
"content": "Can you help me update my code from 5 years ago to use modern C++ practices?"
}
]
},
"model_output": "I am good, thank you!",
"guardrail_metrics": [
"correctness"
],
"nametag": "Test Evaluation",
"progress": 50,
"error_message": null,
"evaluation_result": null,
"evaluation_total_cost": null,
"created_at": "2025-01-15T10:30:00Z"
}
],
"capabilities": [
{
"capability": "web_search"
}
],
"files": [
{
"file_name": "example.pdf",
"file_id": "file_xxxxxxxxxxxx",
"file_size": 1024
}
],
"description": "A monitor used to test the DeepRails SDK"
}Retrieve a Monitor's Details
Use this endpoint to retrieve the details and evaluations associated with a specific monitor
from deeprails import DeepRails
DEEPRAILS_API_KEY = "YOUR_API_KEY"
client = DeepRails(
api_key=DEEPRAILS_API_KEY,
)
monitor_response = client.monitor.retrieve(
monitor_id="mon_xxxxxxxxxxxx"
)
print(monitor_response.data.name)
print(monitor_response.data.status)curl --request GET \
--url https://api.deeprails.com/monitor/{monitor_id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.deeprails.com/monitor/{monitor_id}', 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}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.deeprails.com/monitor/{monitor_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.deeprails.com/monitor/{monitor_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deeprails.com/monitor/{monitor_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"monitor_id": "mon_xxxxxxxxxxxx",
"name": "Test Monitor",
"status": "active",
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:30:00Z",
"stats": {
"total_evaluations": 1,
"completed_evaluations": 0,
"failed_evaluations": 0,
"queued_evaluations": 0,
"in_progress_evaluations": 1
},
"evaluations": [
{
"evaluation_status": "in_progress",
"run_mode": "fast",
"model_input": {
"user_prompt": "Hello, how are you?",
"system_prompt": "You are a helpful assistant.",
"ground_truth": "The user prefers that you refer to them as 'the user' instead of 'you'.",
"context": [
{
"role": "user",
"content": "Can you help me update my code from 5 years ago to use modern C++ practices?"
}
]
},
"model_output": "I am good, thank you!",
"guardrail_metrics": [
"correctness"
],
"nametag": "Test Evaluation",
"progress": 50,
"error_message": null,
"evaluation_result": null,
"evaluation_total_cost": null,
"created_at": "2025-01-15T10:30:00Z"
}
],
"capabilities": [
{
"capability": "web_search"
}
],
"files": [
{
"file_name": "example.pdf",
"file_id": "file_xxxxxxxxxxxx",
"file_size": 1024
}
],
"description": "A monitor used to test the DeepRails SDK"
}name, description, and its status.The
stats object in the response has counts of the evaluations in each status and an evaluations array containing all evaluation records.Use the optional
limit query parameter to control the number of returned evaluations (defaults to 10).Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The ID of the monitor to retrieve.
Query Parameters
Limit the number of returned evaluations associated with this monitor. Defaults to 10.
Response
Monitor retrieved successfully
A unique monitor ID.
"mon_xxxxxxxxxxxx"
Name of this monitor.
"Test Monitor"
Status of the monitor. Can be active or inactive. Inactive monitors no longer record and evaluate events.
active, inactive "active"
The time the monitor was created in UTC.
"2025-01-15T10:30:00Z"
The most recent time the monitor was modified in UTC.
"2025-01-15T10:30:00Z"
Contains five fields used for stats of this monitor: total evaluations, completed evaluations, failed evaluations, queued evaluations, and in progress evaluations.
Show child attributes
Show child attributes
An array of all evaluations performed by this monitor. Each one corresponds to a separate monitor event.
Show child attributes
Show child attributes
An array of extended AI capabilities associated with this monitor. Can be web_search, file_search, and/or context_awareness.
Show child attributes
Show child attributes
An array of files associated with this monitor.
Show child attributes
Show child attributes
Description of this monitor.
"A monitor used to test the DeepRails SDK"
