Create an eval scenario
curl --request POST \
--url https://app.miyon.ai/api/v1/evals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Opening hours",
"cases": [
{
"name": "asks for hours",
"turns": [
{
"user_input": "When are you open?",
"assistant_contains_any": [
"9",
"nine"
]
}
]
}
],
"agent_id": 42
}
'import requests
url = "https://app.miyon.ai/api/v1/evals"
payload = {
"name": "Opening hours",
"cases": [
{
"name": "asks for hours",
"turns": [
{
"user_input": "When are you open?",
"assistant_contains_any": ["9", "nine"]
}
]
}
],
"agent_id": 42
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Opening hours',
cases: [
{
name: 'asks for hours',
turns: [{user_input: 'When are you open?', assistant_contains_any: ['9', 'nine']}]
}
],
agent_id: 42
})
};
fetch('https://app.miyon.ai/api/v1/evals', 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://app.miyon.ai/api/v1/evals",
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' => 'Opening hours',
'cases' => [
[
'name' => 'asks for hours',
'turns' => [
[
'user_input' => 'When are you open?',
'assistant_contains_any' => [
'9',
'nine'
]
]
]
]
],
'agent_id' => 42
]),
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://app.miyon.ai/api/v1/evals"
payload := strings.NewReader("{\n \"name\": \"Opening hours\",\n \"cases\": [\n {\n \"name\": \"asks for hours\",\n \"turns\": [\n {\n \"user_input\": \"When are you open?\",\n \"assistant_contains_any\": [\n \"9\",\n \"nine\"\n ]\n }\n ]\n }\n ],\n \"agent_id\": 42\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://app.miyon.ai/api/v1/evals")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Opening hours\",\n \"cases\": [\n {\n \"name\": \"asks for hours\",\n \"turns\": [\n {\n \"user_input\": \"When are you open?\",\n \"assistant_contains_any\": [\n \"9\",\n \"nine\"\n ]\n }\n ]\n }\n ],\n \"agent_id\": 42\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.miyon.ai/api/v1/evals")
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\": \"Opening hours\",\n \"cases\": [\n {\n \"name\": \"asks for hours\",\n \"turns\": [\n {\n \"user_input\": \"When are you open?\",\n \"assistant_contains_any\": [\n \"9\",\n \"nine\"\n ]\n }\n ]\n }\n ],\n \"agent_id\": 42\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"name": "<string>",
"slug": "<string>",
"active": true,
"cases": [
{
"id": 123,
"name": "<string>",
"position": 123,
"mode": "scripted",
"turns": [
{
"id": 123,
"name": "<string>",
"position": 123,
"user_input": "<string>",
"no_more_events": true,
"original_assistant_response": "<string>",
"assistant_intent": "<string>",
"assistant_contains": [
"<string>"
],
"assistant_contains_any": [
"<string>"
],
"assistant_not_contains": [
"<string>"
],
"tool_calls": [
{
"name": "<string>",
"arguments_contains": {}
}
],
"source": {
"conversation_id": 123,
"conversation_name": "<string>",
"imported_at": "2023-11-07T05:31:56Z"
}
}
],
"context": "<string>",
"source": {
"conversation_id": 123,
"conversation_name": "<string>",
"imported_at": "2023-11-07T05:31:56Z"
},
"user_persona": "<string>",
"opening_message": "<string>",
"max_turns": 123,
"goal_intent": "<string>",
"goal_tool_calls": [
{
"name": "<string>"
}
]
}
],
"recent_runs": [
{
"id": 123,
"status": "pending",
"sequence_number": 123,
"total_cases": 123,
"passed_cases": 123,
"failed_cases": 123,
"started_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"duration": 123,
"results": "<unknown>",
"error_message": "<string>"
}
],
"runs_pagination": {
"current_page": 123,
"total_pages": 123,
"total_entries": 123
},
"agent_id": 123,
"description": "<string>",
"number_id": 123,
"number_name": "<string>",
"meta": {
"caller_model": "<string>",
"judge_model": "<string>",
"mock_responses": {},
"tool_variants": [
{
"name": "<string>",
"prompt_override": "<string>",
"system_override": "<string>",
"model_override": "<string>",
"temperature_override": "<string>",
"tool_overrides": {}
}
]
},
"latest_run": {
"id": 123,
"status": "pending",
"total_cases": 123,
"passed_cases": 123,
"failed_cases": 123,
"completed_at": "2023-11-07T05:31:56Z"
},
"agent_name": "<string>"
}Evals
Create an eval scenario
Create a scenario with at least one case. slug is generated from name.
POST
/
api
/
v1
/
evals
Create an eval scenario
curl --request POST \
--url https://app.miyon.ai/api/v1/evals \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Opening hours",
"cases": [
{
"name": "asks for hours",
"turns": [
{
"user_input": "When are you open?",
"assistant_contains_any": [
"9",
"nine"
]
}
]
}
],
"agent_id": 42
}
'import requests
url = "https://app.miyon.ai/api/v1/evals"
payload = {
"name": "Opening hours",
"cases": [
{
"name": "asks for hours",
"turns": [
{
"user_input": "When are you open?",
"assistant_contains_any": ["9", "nine"]
}
]
}
],
"agent_id": 42
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Opening hours',
cases: [
{
name: 'asks for hours',
turns: [{user_input: 'When are you open?', assistant_contains_any: ['9', 'nine']}]
}
],
agent_id: 42
})
};
fetch('https://app.miyon.ai/api/v1/evals', 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://app.miyon.ai/api/v1/evals",
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' => 'Opening hours',
'cases' => [
[
'name' => 'asks for hours',
'turns' => [
[
'user_input' => 'When are you open?',
'assistant_contains_any' => [
'9',
'nine'
]
]
]
]
],
'agent_id' => 42
]),
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://app.miyon.ai/api/v1/evals"
payload := strings.NewReader("{\n \"name\": \"Opening hours\",\n \"cases\": [\n {\n \"name\": \"asks for hours\",\n \"turns\": [\n {\n \"user_input\": \"When are you open?\",\n \"assistant_contains_any\": [\n \"9\",\n \"nine\"\n ]\n }\n ]\n }\n ],\n \"agent_id\": 42\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://app.miyon.ai/api/v1/evals")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Opening hours\",\n \"cases\": [\n {\n \"name\": \"asks for hours\",\n \"turns\": [\n {\n \"user_input\": \"When are you open?\",\n \"assistant_contains_any\": [\n \"9\",\n \"nine\"\n ]\n }\n ]\n }\n ],\n \"agent_id\": 42\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.miyon.ai/api/v1/evals")
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\": \"Opening hours\",\n \"cases\": [\n {\n \"name\": \"asks for hours\",\n \"turns\": [\n {\n \"user_input\": \"When are you open?\",\n \"assistant_contains_any\": [\n \"9\",\n \"nine\"\n ]\n }\n ]\n }\n ],\n \"agent_id\": 42\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"name": "<string>",
"slug": "<string>",
"active": true,
"cases": [
{
"id": 123,
"name": "<string>",
"position": 123,
"mode": "scripted",
"turns": [
{
"id": 123,
"name": "<string>",
"position": 123,
"user_input": "<string>",
"no_more_events": true,
"original_assistant_response": "<string>",
"assistant_intent": "<string>",
"assistant_contains": [
"<string>"
],
"assistant_contains_any": [
"<string>"
],
"assistant_not_contains": [
"<string>"
],
"tool_calls": [
{
"name": "<string>",
"arguments_contains": {}
}
],
"source": {
"conversation_id": 123,
"conversation_name": "<string>",
"imported_at": "2023-11-07T05:31:56Z"
}
}
],
"context": "<string>",
"source": {
"conversation_id": 123,
"conversation_name": "<string>",
"imported_at": "2023-11-07T05:31:56Z"
},
"user_persona": "<string>",
"opening_message": "<string>",
"max_turns": 123,
"goal_intent": "<string>",
"goal_tool_calls": [
{
"name": "<string>"
}
]
}
],
"recent_runs": [
{
"id": 123,
"status": "pending",
"sequence_number": 123,
"total_cases": 123,
"passed_cases": 123,
"failed_cases": 123,
"started_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"duration": 123,
"results": "<unknown>",
"error_message": "<string>"
}
],
"runs_pagination": {
"current_page": 123,
"total_pages": 123,
"total_entries": 123
},
"agent_id": 123,
"description": "<string>",
"number_id": 123,
"number_name": "<string>",
"meta": {
"caller_model": "<string>",
"judge_model": "<string>",
"mock_responses": {},
"tool_variants": [
{
"name": "<string>",
"prompt_override": "<string>",
"system_override": "<string>",
"model_override": "<string>",
"temperature_override": "<string>",
"tool_overrides": {}
}
]
},
"latest_run": {
"id": 123,
"status": "pending",
"total_cases": 123,
"passed_cases": 123,
"failed_cases": 123,
"completed_at": "2023-11-07T05:31:56Z"
},
"agent_name": "<string>"
}Preview
The Evals API is in preview and may change. Access is currently limited
to Early Access Program (EAP) participants.
Autorisierungen
Body
application/json
Request body for create and replace. id, slug, active and position are ignored if sent.
Antwort
The created scenario.
Full scenario as returned by get, create, replace and duplicate.