import honeyhive
from honeyhive.models import components
s = honeyhive.HoneyHive(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.metrics.update_metric(request=components.MetricEdit(
metric_id='<value>',
))
if res is not None:
# handle response
passimport { HoneyHive } from "honeyhive";
import { MetricEditEventType, MetricEditReturnType, MetricEditType } from "honeyhive/dist/models/components";
async function run() {
const sdk = new HoneyHive({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
const res = await sdk.metrics.updateMetric({
metricId: "<value>",
threshold: {},
});
if (res.statusCode == 200) {
// handle response
}
}
run();curl --request PUT \
--url https://api.honeyhive.ai/metrics \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metric_id": "<string>",
"criteria": "<string>",
"name": "<string>",
"description": "<string>",
"code_snippet": "<string>",
"prompt": "<string>",
"enabled_in_prod": true,
"needs_ground_truth": true,
"threshold": {
"min": 123,
"max": 123
},
"pass_when": true,
"event_name": "<string>"
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metric_id: '<string>',
criteria: '<string>',
name: '<string>',
description: '<string>',
code_snippet: '<string>',
prompt: '<string>',
enabled_in_prod: true,
needs_ground_truth: true,
threshold: {min: 123, max: 123},
pass_when: true,
event_name: '<string>'
})
};
fetch('https://api.honeyhive.ai/metrics', 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.honeyhive.ai/metrics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'metric_id' => '<string>',
'criteria' => '<string>',
'name' => '<string>',
'description' => '<string>',
'code_snippet' => '<string>',
'prompt' => '<string>',
'enabled_in_prod' => true,
'needs_ground_truth' => true,
'threshold' => [
'min' => 123,
'max' => 123
],
'pass_when' => true,
'event_name' => '<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.honeyhive.ai/metrics"
payload := strings.NewReader("{\n \"metric_id\": \"<string>\",\n \"criteria\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"code_snippet\": \"<string>\",\n \"prompt\": \"<string>\",\n \"enabled_in_prod\": true,\n \"needs_ground_truth\": true,\n \"threshold\": {\n \"min\": 123,\n \"max\": 123\n },\n \"pass_when\": true,\n \"event_name\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.honeyhive.ai/metrics")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metric_id\": \"<string>\",\n \"criteria\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"code_snippet\": \"<string>\",\n \"prompt\": \"<string>\",\n \"enabled_in_prod\": true,\n \"needs_ground_truth\": true,\n \"threshold\": {\n \"min\": 123,\n \"max\": 123\n },\n \"pass_when\": true,\n \"event_name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.honeyhive.ai/metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metric_id\": \"<string>\",\n \"criteria\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"code_snippet\": \"<string>\",\n \"prompt\": \"<string>\",\n \"enabled_in_prod\": true,\n \"needs_ground_truth\": true,\n \"threshold\": {\n \"min\": 123,\n \"max\": 123\n },\n \"pass_when\": true,\n \"event_name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyUpdate an existing metric
Edit a metric
import honeyhive
from honeyhive.models import components
s = honeyhive.HoneyHive(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.metrics.update_metric(request=components.MetricEdit(
metric_id='<value>',
))
if res is not None:
# handle response
passimport { HoneyHive } from "honeyhive";
import { MetricEditEventType, MetricEditReturnType, MetricEditType } from "honeyhive/dist/models/components";
async function run() {
const sdk = new HoneyHive({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
const res = await sdk.metrics.updateMetric({
metricId: "<value>",
threshold: {},
});
if (res.statusCode == 200) {
// handle response
}
}
run();curl --request PUT \
--url https://api.honeyhive.ai/metrics \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metric_id": "<string>",
"criteria": "<string>",
"name": "<string>",
"description": "<string>",
"code_snippet": "<string>",
"prompt": "<string>",
"enabled_in_prod": true,
"needs_ground_truth": true,
"threshold": {
"min": 123,
"max": 123
},
"pass_when": true,
"event_name": "<string>"
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metric_id: '<string>',
criteria: '<string>',
name: '<string>',
description: '<string>',
code_snippet: '<string>',
prompt: '<string>',
enabled_in_prod: true,
needs_ground_truth: true,
threshold: {min: 123, max: 123},
pass_when: true,
event_name: '<string>'
})
};
fetch('https://api.honeyhive.ai/metrics', 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.honeyhive.ai/metrics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'metric_id' => '<string>',
'criteria' => '<string>',
'name' => '<string>',
'description' => '<string>',
'code_snippet' => '<string>',
'prompt' => '<string>',
'enabled_in_prod' => true,
'needs_ground_truth' => true,
'threshold' => [
'min' => 123,
'max' => 123
],
'pass_when' => true,
'event_name' => '<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.honeyhive.ai/metrics"
payload := strings.NewReader("{\n \"metric_id\": \"<string>\",\n \"criteria\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"code_snippet\": \"<string>\",\n \"prompt\": \"<string>\",\n \"enabled_in_prod\": true,\n \"needs_ground_truth\": true,\n \"threshold\": {\n \"min\": 123,\n \"max\": 123\n },\n \"pass_when\": true,\n \"event_name\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.honeyhive.ai/metrics")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metric_id\": \"<string>\",\n \"criteria\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"code_snippet\": \"<string>\",\n \"prompt\": \"<string>\",\n \"enabled_in_prod\": true,\n \"needs_ground_truth\": true,\n \"threshold\": {\n \"min\": 123,\n \"max\": 123\n },\n \"pass_when\": true,\n \"event_name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.honeyhive.ai/metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metric_id\": \"<string>\",\n \"criteria\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"code_snippet\": \"<string>\",\n \"prompt\": \"<string>\",\n \"enabled_in_prod\": true,\n \"needs_ground_truth\": true,\n \"threshold\": {\n \"min\": 123,\n \"max\": 123\n },\n \"pass_when\": true,\n \"event_name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Unique identifier of the metric
Criteria for human metrics
Updated name of the metric
Short description of what the metric does
Updated code block for the metric
Updated Evaluator prompt for the metric
Type of the metric - "custom", "model" or "human"
custom, model, human Whether to compute on all production events automatically
Whether a ground truth (on metadata) is required to compute it
The data type of the metric value - "boolean", "float", "string"
boolean, float, string Threshold for numeric metrics to decide passing or failing in tests
Show child attributes
Show child attributes
Threshold for boolean metrics to decide passing or failing in tests
Name of event that the metric is set to be computed on
Type of event that the metric is set to be computed on
model, tool, chain, session Response
Metric updated successfully
Was this page helpful?

