Python
import honeyhive
from honeyhive.models import operations
s = honeyhive.HoneyHive(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.events.update_event(request=operations.UpdateEventRequestBody(
event_id='7f22137a-6911-4ed3-bc36-110f1dde6b66',
metadata={
'cost': 0.00008,
'completion_tokens': 23,
'prompt_tokens': 35,
'total_tokens': 58,
},
feedback={
'rating': 5,
},
metrics={
'num_words': 2,
},
outputs={
'role': 'assistant',
'content': 'Hello world',
},
config={
'template': [
{
'role': 'system',
'content': 'Hello, {{ name }}!',
},
],
},
user_properties={
'user_id': '691b1f94-d38c-4e92-b051-5e03fee9ff86',
},
duration=42,
))
if res is not None:
# handle response
passimport { HoneyHive } from "honeyhive";
async function run() {
const sdk = new HoneyHive({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
const res = await sdk.events.updateEvent({
eventId: "<value>",
metadata: {
"key": "<value>",
},
feedback: {
"key": "<value>",
},
metrics: {
"key": "<value>",
},
outputs: {
"key": "<value>",
},
config: {
"key": "<value>",
},
userProperties: {
"key": "<value>",
},
});
if (res.statusCode == 200) {
// handle response
}
}
run();curl --request PUT \
--url https://api.honeyhive.ai/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event_id": "7f22137a-6911-4ed3-bc36-110f1dde6b66",
"metadata": {
"cost": 0.00008,
"completion_tokens": 23,
"prompt_tokens": 35,
"total_tokens": 58
},
"feedback": {
"rating": 5
},
"metrics": {
"num_words": 2
},
"outputs": {
"role": "assistant",
"content": "Hello world"
}
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
event_id: '7f22137a-6911-4ed3-bc36-110f1dde6b66',
metadata: {cost: 0.00008, completion_tokens: 23, prompt_tokens: 35, total_tokens: 58},
feedback: {rating: 5},
metrics: {num_words: 2},
outputs: {role: 'assistant', content: 'Hello world'}
})
};
fetch('https://api.honeyhive.ai/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.honeyhive.ai/events",
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([
'event_id' => '7f22137a-6911-4ed3-bc36-110f1dde6b66',
'metadata' => [
'cost' => 0.00008,
'completion_tokens' => 23,
'prompt_tokens' => 35,
'total_tokens' => 58
],
'feedback' => [
'rating' => 5
],
'metrics' => [
'num_words' => 2
],
'outputs' => [
'role' => 'assistant',
'content' => 'Hello world'
]
]),
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/events"
payload := strings.NewReader("{\n \"event_id\": \"7f22137a-6911-4ed3-bc36-110f1dde6b66\",\n \"metadata\": {\n \"cost\": 0.00008,\n \"completion_tokens\": 23,\n \"prompt_tokens\": 35,\n \"total_tokens\": 58\n },\n \"feedback\": {\n \"rating\": 5\n },\n \"metrics\": {\n \"num_words\": 2\n },\n \"outputs\": {\n \"role\": \"assistant\",\n \"content\": \"Hello world\"\n }\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/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"event_id\": \"7f22137a-6911-4ed3-bc36-110f1dde6b66\",\n \"metadata\": {\n \"cost\": 0.00008,\n \"completion_tokens\": 23,\n \"prompt_tokens\": 35,\n \"total_tokens\": 58\n },\n \"feedback\": {\n \"rating\": 5\n },\n \"metrics\": {\n \"num_words\": 2\n },\n \"outputs\": {\n \"role\": \"assistant\",\n \"content\": \"Hello world\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.honeyhive.ai/events")
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 \"event_id\": \"7f22137a-6911-4ed3-bc36-110f1dde6b66\",\n \"metadata\": {\n \"cost\": 0.00008,\n \"completion_tokens\": 23,\n \"prompt_tokens\": 35,\n \"total_tokens\": 58\n },\n \"feedback\": {\n \"rating\": 5\n },\n \"metrics\": {\n \"num_words\": 2\n },\n \"outputs\": {\n \"role\": \"assistant\",\n \"content\": \"Hello world\"\n }\n}"
response = http.request(request)
puts response.read_bodyEvents
Update an event (deprecated)
Deprecated. Use PUT /v1/events/{event_id} instead.
PUT
/
events
Python
import honeyhive
from honeyhive.models import operations
s = honeyhive.HoneyHive(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.events.update_event(request=operations.UpdateEventRequestBody(
event_id='7f22137a-6911-4ed3-bc36-110f1dde6b66',
metadata={
'cost': 0.00008,
'completion_tokens': 23,
'prompt_tokens': 35,
'total_tokens': 58,
},
feedback={
'rating': 5,
},
metrics={
'num_words': 2,
},
outputs={
'role': 'assistant',
'content': 'Hello world',
},
config={
'template': [
{
'role': 'system',
'content': 'Hello, {{ name }}!',
},
],
},
user_properties={
'user_id': '691b1f94-d38c-4e92-b051-5e03fee9ff86',
},
duration=42,
))
if res is not None:
# handle response
passimport { HoneyHive } from "honeyhive";
async function run() {
const sdk = new HoneyHive({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
const res = await sdk.events.updateEvent({
eventId: "<value>",
metadata: {
"key": "<value>",
},
feedback: {
"key": "<value>",
},
metrics: {
"key": "<value>",
},
outputs: {
"key": "<value>",
},
config: {
"key": "<value>",
},
userProperties: {
"key": "<value>",
},
});
if (res.statusCode == 200) {
// handle response
}
}
run();curl --request PUT \
--url https://api.honeyhive.ai/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event_id": "7f22137a-6911-4ed3-bc36-110f1dde6b66",
"metadata": {
"cost": 0.00008,
"completion_tokens": 23,
"prompt_tokens": 35,
"total_tokens": 58
},
"feedback": {
"rating": 5
},
"metrics": {
"num_words": 2
},
"outputs": {
"role": "assistant",
"content": "Hello world"
}
}
'const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
event_id: '7f22137a-6911-4ed3-bc36-110f1dde6b66',
metadata: {cost: 0.00008, completion_tokens: 23, prompt_tokens: 35, total_tokens: 58},
feedback: {rating: 5},
metrics: {num_words: 2},
outputs: {role: 'assistant', content: 'Hello world'}
})
};
fetch('https://api.honeyhive.ai/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.honeyhive.ai/events",
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([
'event_id' => '7f22137a-6911-4ed3-bc36-110f1dde6b66',
'metadata' => [
'cost' => 0.00008,
'completion_tokens' => 23,
'prompt_tokens' => 35,
'total_tokens' => 58
],
'feedback' => [
'rating' => 5
],
'metrics' => [
'num_words' => 2
],
'outputs' => [
'role' => 'assistant',
'content' => 'Hello world'
]
]),
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/events"
payload := strings.NewReader("{\n \"event_id\": \"7f22137a-6911-4ed3-bc36-110f1dde6b66\",\n \"metadata\": {\n \"cost\": 0.00008,\n \"completion_tokens\": 23,\n \"prompt_tokens\": 35,\n \"total_tokens\": 58\n },\n \"feedback\": {\n \"rating\": 5\n },\n \"metrics\": {\n \"num_words\": 2\n },\n \"outputs\": {\n \"role\": \"assistant\",\n \"content\": \"Hello world\"\n }\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/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"event_id\": \"7f22137a-6911-4ed3-bc36-110f1dde6b66\",\n \"metadata\": {\n \"cost\": 0.00008,\n \"completion_tokens\": 23,\n \"prompt_tokens\": 35,\n \"total_tokens\": 58\n },\n \"feedback\": {\n \"rating\": 5\n },\n \"metrics\": {\n \"num_words\": 2\n },\n \"outputs\": {\n \"role\": \"assistant\",\n \"content\": \"Hello world\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.honeyhive.ai/events")
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 \"event_id\": \"7f22137a-6911-4ed3-bc36-110f1dde6b66\",\n \"metadata\": {\n \"cost\": 0.00008,\n \"completion_tokens\": 23,\n \"prompt_tokens\": 35,\n \"total_tokens\": 58\n },\n \"feedback\": {\n \"rating\": 5\n },\n \"metrics\": {\n \"num_words\": 2\n },\n \"outputs\": {\n \"role\": \"assistant\",\n \"content\": \"Hello world\"\n }\n}"
response = http.request(request)
puts response.read_bodyWas this page helpful?
⌘I

