Python
import honeyhive
from honeyhive.models import components, operations
s = honeyhive.HoneyHive(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.events.create_event_batch(request=operations.CreateEventBatchRequestBody(
events=[
components.CreateEventRequest(
project='Simple RAG',
source='playground',
event_name='Model Completion',
event_type=components.CreateEventRequestEventType.MODEL,
event_id='7f22137a-6911-4ed3-bc36-110f1dde6b66',
session_id='caf77ace-3417-4da4-944d-f4a0688f3c23',
parent_id='caf77ace-3417-4da4-944d-f4a0688f3c23',
children_ids=[
'<value>',
],
config={
'model': 'gpt-3.5-turbo',
'version': 'v0.1',
'provider': 'openai',
'hyperparameters': {
'temperature': 0,
'top_p': 1,
'max_tokens': 1000,
'presence_penalty': 0,
'frequency_penalty': 0,
'stop': [
'<value>',
],
'n': 1,
},
'template': [
{
'role': 'system',
'content': 'Answer the user\'s question only using provided context.
Context: {{ context }}',
},
{
'role': 'user',
'content': '{{question}}',
},
],
'type': 'chat',
},
inputs={
'context': 'Hello world',
'question': 'What is in the context?',
'chat_history': [
{
'role': 'system',
'content': 'Answer the user\'s question only using provided context.
Context: Hello world',
},
{
'role': 'user',
'content': 'What is in the context?',
},
],
},
outputs={
'role': 'assistant',
'content': 'Hello world',
},
error=None,
start_time=1714978764301,
end_time=1714978765301,
duration=999.8056,
metadata={
'cost': 0.00008,
'completion_tokens': 23,
'prompt_tokens': 35,
'total_tokens': 58,
},
feedback={
},
metrics={
'Answer Faithfulness': 5,
'Answer Faithfulness_explanation': 'The AI assistant\'s answer is a concise and accurate description of Ramp\'s API. It provides a clear explanation of what the API does and how developers can use it to integrate Ramp\'s financial services into their own applications. The answer is faithful to the provided context.',
'Number of words': 18,
},
user_properties={
'user': 'google-oauth2|111840237613341303366',
},
),
],
))
if res.object is not None:
# handle response
passimport { HoneyHive } from "honeyhive";
import { CreateEventRequestEventType } from "honeyhive/dist/models/components";
async function run() {
const sdk = new HoneyHive({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
const res = await sdk.events.createEventBatch({
events: [
{
project: "Simple RAG",
source: "playground",
eventName: "Model Completion",
eventType: CreateEventRequestEventType.Model,
eventId: "7f22137a-6911-4ed3-bc36-110f1dde6b66",
sessionId: "caf77ace-3417-4da4-944d-f4a0688f3c23",
parentId: "caf77ace-3417-4da4-944d-f4a0688f3c23",
childrenIds: [
"<value>",
],
config: {
"model": "gpt-3.5-turbo",
"version": "v0.1",
"provider": "openai",
"hyperparameters": {
"temperature": 0,
"top_p": 1,
"max_tokens": 1000,
"presence_penalty": 0,
"frequency_penalty": 0,
"stop": [
"<value>",
],
"n": 1,
},
"template": [
{
"role": "system",
"content": "Answer the user's question only using provided context.
Context: {{ context }}",
},
{
"role": "user",
"content": "{{question}}",
},
],
"type": "chat",
},
inputs: {
"context": "Hello world",
"question": "What is in the context?",
"chat_history": [
{
"role": "system",
"content": "Answer the user's question only using provided context.
Context: Hello world",
},
{
"role": "user",
"content": "What is in the context?",
},
],
},
outputs: {
"role": "assistant",
"content": "Hello world",
},
error: null,
startTime: 1714978764301,
endTime: 1714978765301,
duration: 999.8056,
metadata: {
"cost": 0.00008,
"completion_tokens": 23,
"prompt_tokens": 35,
"total_tokens": 58,
},
feedback: {
},
metrics: {
"Answer Faithfulness": 5,
"Answer Faithfulness_explanation": "The AI assistant's answer is a concise and accurate description of Ramp's API. It provides a clear explanation of what the API does and how developers can use it to integrate Ramp's financial services into their own applications. The answer is faithful to the provided context.",
"Number of words": 18,
},
userProperties: {
"user": "google-oauth2|111840237613341303366",
},
},
],
});
if (res.statusCode == 200) {
// handle response
}
}
run();curl --request POST \
--url https://api.honeyhive.ai/events/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"events": [
{
"project": "Simple RAG",
"event_type": "model",
"event_name": "Model Completion",
"source": "playground",
"session_id": "caf77ace-3417-4da4-944d-f4a0688f3c23",
"event_id": "7f22137a-6911-4ed3-bc36-110f1dde6b66",
"parent_id": "caf77ace-3417-4da4-944d-f4a0688f3c23",
"children_ids": [],
"config": {
"model": "gpt-3.5-turbo",
"version": "v0.1",
"provider": "openai",
"hyperparameters": {
"temperature": 0,
"top_p": 1,
"max_tokens": 1000,
"presence_penalty": 0,
"frequency_penalty": 0,
"stop": [],
"n": 1
},
"template": [
{
"role": "system",
"content": "Answer the user's question only using provided context.\n\nContext: {{ context }}"
},
{
"role": "user",
"content": "{{question}}"
}
],
"type": "chat"
},
"inputs": {
"context": "Hello world",
"question": "What is in the context?",
"chat_history": [
{
"role": "system",
"content": "Answer the user's question only using provided context.\n\nContext: Hello world"
},
{
"role": "user",
"content": "What is in the context?"
}
]
},
"outputs": {
"role": "assistant",
"content": "Hello world"
},
"error": null,
"start_time": 1714978764301,
"end_time": 1714978765301,
"duration": 999.8056,
"metadata": {
"cost": 0.00008,
"completion_tokens": 23,
"prompt_tokens": 35,
"total_tokens": 58
},
"feedback": {},
"metrics": {
"Answer Faithfulness": 5,
"Answer Faithfulness_explanation": "The AI assistant's answer is a concise and accurate description of Ramp's API. It provides a clear explanation of what the API does and how developers can use it to integrate Ramp's financial services into their own applications. The answer is faithful to the provided context.",
"Number of words": 18
},
"user_properties": {
"user": "google-oauth2|111840237613341303366"
}
}
],
"is_single_session": true
}
EOFconst options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
events: [
{
project: 'Simple RAG',
event_type: 'model',
event_name: 'Model Completion',
source: 'playground',
session_id: 'caf77ace-3417-4da4-944d-f4a0688f3c23',
event_id: '7f22137a-6911-4ed3-bc36-110f1dde6b66',
parent_id: 'caf77ace-3417-4da4-944d-f4a0688f3c23',
children_ids: [],
config: {
model: 'gpt-3.5-turbo',
version: 'v0.1',
provider: 'openai',
hyperparameters: {
temperature: 0,
top_p: 1,
max_tokens: 1000,
presence_penalty: 0,
frequency_penalty: 0,
stop: [],
n: 1
},
template: [
{
role: 'system',
content: 'Answer the user\'s question only using provided context.\n\nContext: {{ context }}'
},
{role: 'user', content: '{{question}}'}
],
type: 'chat'
},
inputs: {
context: 'Hello world',
question: 'What is in the context?',
chat_history: [
{
role: 'system',
content: 'Answer the user\'s question only using provided context.\n\nContext: Hello world'
},
{role: 'user', content: 'What is in the context?'}
]
},
outputs: {role: 'assistant', content: 'Hello world'},
error: null,
start_time: 1714978764301,
end_time: 1714978765301,
duration: 999.8056,
metadata: {cost: 0.00008, completion_tokens: 23, prompt_tokens: 35, total_tokens: 58},
feedback: {},
metrics: {
'Answer Faithfulness': 5,
'Answer Faithfulness_explanation': 'The AI assistant\'s answer is a concise and accurate description of Ramp\'s API. It provides a clear explanation of what the API does and how developers can use it to integrate Ramp\'s financial services into their own applications. The answer is faithful to the provided context.',
'Number of words': 18
},
user_properties: {user: 'google-oauth2|111840237613341303366'}
}
],
is_single_session: true
})
};
fetch('https://api.honeyhive.ai/events/batch', 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/batch",
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([
'events' => [
[
'project' => 'Simple RAG',
'event_type' => 'model',
'event_name' => 'Model Completion',
'source' => 'playground',
'session_id' => 'caf77ace-3417-4da4-944d-f4a0688f3c23',
'event_id' => '7f22137a-6911-4ed3-bc36-110f1dde6b66',
'parent_id' => 'caf77ace-3417-4da4-944d-f4a0688f3c23',
'children_ids' => [
],
'config' => [
'model' => 'gpt-3.5-turbo',
'version' => 'v0.1',
'provider' => 'openai',
'hyperparameters' => [
'temperature' => 0,
'top_p' => 1,
'max_tokens' => 1000,
'presence_penalty' => 0,
'frequency_penalty' => 0,
'stop' => [
],
'n' => 1
],
'template' => [
[
'role' => 'system',
'content' => 'Answer the user\'s question only using provided context.
Context: {{ context }}'
],
[
'role' => 'user',
'content' => '{{question}}'
]
],
'type' => 'chat'
],
'inputs' => [
'context' => 'Hello world',
'question' => 'What is in the context?',
'chat_history' => [
[
'role' => 'system',
'content' => 'Answer the user\'s question only using provided context.
Context: Hello world'
],
[
'role' => 'user',
'content' => 'What is in the context?'
]
]
],
'outputs' => [
'role' => 'assistant',
'content' => 'Hello world'
],
'error' => null,
'start_time' => 1714978764301,
'end_time' => 1714978765301,
'duration' => 999.8056,
'metadata' => [
'cost' => 0.00008,
'completion_tokens' => 23,
'prompt_tokens' => 35,
'total_tokens' => 58
],
'feedback' => [
],
'metrics' => [
'Answer Faithfulness' => 5,
'Answer Faithfulness_explanation' => 'The AI assistant\'s answer is a concise and accurate description of Ramp\'s API. It provides a clear explanation of what the API does and how developers can use it to integrate Ramp\'s financial services into their own applications. The answer is faithful to the provided context.',
'Number of words' => 18
],
'user_properties' => [
'user' => 'google-oauth2|111840237613341303366'
]
]
],
'is_single_session' => true
]),
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/batch"
payload := strings.NewReader("{\n \"events\": [\n {\n \"project\": \"Simple RAG\",\n \"event_type\": \"model\",\n \"event_name\": \"Model Completion\",\n \"source\": \"playground\",\n \"session_id\": \"caf77ace-3417-4da4-944d-f4a0688f3c23\",\n \"event_id\": \"7f22137a-6911-4ed3-bc36-110f1dde6b66\",\n \"parent_id\": \"caf77ace-3417-4da4-944d-f4a0688f3c23\",\n \"children_ids\": [],\n \"config\": {\n \"model\": \"gpt-3.5-turbo\",\n \"version\": \"v0.1\",\n \"provider\": \"openai\",\n \"hyperparameters\": {\n \"temperature\": 0,\n \"top_p\": 1,\n \"max_tokens\": 1000,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 0,\n \"stop\": [],\n \"n\": 1\n },\n \"template\": [\n {\n \"role\": \"system\",\n \"content\": \"Answer the user's question only using provided context.\\n\\nContext: {{ context }}\"\n },\n {\n \"role\": \"user\",\n \"content\": \"{{question}}\"\n }\n ],\n \"type\": \"chat\"\n },\n \"inputs\": {\n \"context\": \"Hello world\",\n \"question\": \"What is in the context?\",\n \"chat_history\": [\n {\n \"role\": \"system\",\n \"content\": \"Answer the user's question only using provided context.\\n\\nContext: Hello world\"\n },\n {\n \"role\": \"user\",\n \"content\": \"What is in the context?\"\n }\n ]\n },\n \"outputs\": {\n \"role\": \"assistant\",\n \"content\": \"Hello world\"\n },\n \"error\": null,\n \"start_time\": 1714978764301,\n \"end_time\": 1714978765301,\n \"duration\": 999.8056,\n \"metadata\": {\n \"cost\": 0.00008,\n \"completion_tokens\": 23,\n \"prompt_tokens\": 35,\n \"total_tokens\": 58\n },\n \"feedback\": {},\n \"metrics\": {\n \"Answer Faithfulness\": 5,\n \"Answer Faithfulness_explanation\": \"The AI assistant's answer is a concise and accurate description of Ramp's API. It provides a clear explanation of what the API does and how developers can use it to integrate Ramp's financial services into their own applications. The answer is faithful to the provided context.\",\n \"Number of words\": 18\n },\n \"user_properties\": {\n \"user\": \"google-oauth2|111840237613341303366\"\n }\n }\n ],\n \"is_single_session\": true\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.honeyhive.ai/events/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n {\n \"project\": \"Simple RAG\",\n \"event_type\": \"model\",\n \"event_name\": \"Model Completion\",\n \"source\": \"playground\",\n \"session_id\": \"caf77ace-3417-4da4-944d-f4a0688f3c23\",\n \"event_id\": \"7f22137a-6911-4ed3-bc36-110f1dde6b66\",\n \"parent_id\": \"caf77ace-3417-4da4-944d-f4a0688f3c23\",\n \"children_ids\": [],\n \"config\": {\n \"model\": \"gpt-3.5-turbo\",\n \"version\": \"v0.1\",\n \"provider\": \"openai\",\n \"hyperparameters\": {\n \"temperature\": 0,\n \"top_p\": 1,\n \"max_tokens\": 1000,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 0,\n \"stop\": [],\n \"n\": 1\n },\n \"template\": [\n {\n \"role\": \"system\",\n \"content\": \"Answer the user's question only using provided context.\\n\\nContext: {{ context }}\"\n },\n {\n \"role\": \"user\",\n \"content\": \"{{question}}\"\n }\n ],\n \"type\": \"chat\"\n },\n \"inputs\": {\n \"context\": \"Hello world\",\n \"question\": \"What is in the context?\",\n \"chat_history\": [\n {\n \"role\": \"system\",\n \"content\": \"Answer the user's question only using provided context.\\n\\nContext: Hello world\"\n },\n {\n \"role\": \"user\",\n \"content\": \"What is in the context?\"\n }\n ]\n },\n \"outputs\": {\n \"role\": \"assistant\",\n \"content\": \"Hello world\"\n },\n \"error\": null,\n \"start_time\": 1714978764301,\n \"end_time\": 1714978765301,\n \"duration\": 999.8056,\n \"metadata\": {\n \"cost\": 0.00008,\n \"completion_tokens\": 23,\n \"prompt_tokens\": 35,\n \"total_tokens\": 58\n },\n \"feedback\": {},\n \"metrics\": {\n \"Answer Faithfulness\": 5,\n \"Answer Faithfulness_explanation\": \"The AI assistant's answer is a concise and accurate description of Ramp's API. It provides a clear explanation of what the API does and how developers can use it to integrate Ramp's financial services into their own applications. The answer is faithful to the provided context.\",\n \"Number of words\": 18\n },\n \"user_properties\": {\n \"user\": \"google-oauth2|111840237613341303366\"\n }\n }\n ],\n \"is_single_session\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.honeyhive.ai/events/batch")
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 \"events\": [\n {\n \"project\": \"Simple RAG\",\n \"event_type\": \"model\",\n \"event_name\": \"Model Completion\",\n \"source\": \"playground\",\n \"session_id\": \"caf77ace-3417-4da4-944d-f4a0688f3c23\",\n \"event_id\": \"7f22137a-6911-4ed3-bc36-110f1dde6b66\",\n \"parent_id\": \"caf77ace-3417-4da4-944d-f4a0688f3c23\",\n \"children_ids\": [],\n \"config\": {\n \"model\": \"gpt-3.5-turbo\",\n \"version\": \"v0.1\",\n \"provider\": \"openai\",\n \"hyperparameters\": {\n \"temperature\": 0,\n \"top_p\": 1,\n \"max_tokens\": 1000,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 0,\n \"stop\": [],\n \"n\": 1\n },\n \"template\": [\n {\n \"role\": \"system\",\n \"content\": \"Answer the user's question only using provided context.\\n\\nContext: {{ context }}\"\n },\n {\n \"role\": \"user\",\n \"content\": \"{{question}}\"\n }\n ],\n \"type\": \"chat\"\n },\n \"inputs\": {\n \"context\": \"Hello world\",\n \"question\": \"What is in the context?\",\n \"chat_history\": [\n {\n \"role\": \"system\",\n \"content\": \"Answer the user's question only using provided context.\\n\\nContext: Hello world\"\n },\n {\n \"role\": \"user\",\n \"content\": \"What is in the context?\"\n }\n ]\n },\n \"outputs\": {\n \"role\": \"assistant\",\n \"content\": \"Hello world\"\n },\n \"error\": null,\n \"start_time\": 1714978764301,\n \"end_time\": 1714978765301,\n \"duration\": 999.8056,\n \"metadata\": {\n \"cost\": 0.00008,\n \"completion_tokens\": 23,\n \"prompt_tokens\": 35,\n \"total_tokens\": 58\n },\n \"feedback\": {},\n \"metrics\": {\n \"Answer Faithfulness\": 5,\n \"Answer Faithfulness_explanation\": \"The AI assistant's answer is a concise and accurate description of Ramp's API. It provides a clear explanation of what the API does and how developers can use it to integrate Ramp's financial services into their own applications. The answer is faithful to the provided context.\",\n \"Number of words\": 18\n },\n \"user_properties\": {\n \"user\": \"google-oauth2|111840237613341303366\"\n }\n }\n ],\n \"is_single_session\": true\n}"
response = http.request(request)
puts response.read_body{
"event_ids": [
"7f22137a-6911-4ed3-bc36-110f1dde6b66",
"7f22137a-6911-4ed3-bc36-110f1dde6b67"
],
"session_id": "caf77ace-3417-4da4-944d-f4a0688f3c23",
"success": true
}{
"event_ids": [
"7f22137a-6911-4ed3-bc36-110f1dde6b66",
"7f22137a-6911-4ed3-bc36-110f1dde6b67"
],
"errors": [
"Could not create event due to missing inputs",
"Could not create event due to missing source"
],
"success": true
}Events
Create a batch of events (deprecated)
Deprecated. Use POST /v1/events/batch instead. The legacy route accepts the deprecated is_single_session and session aliases and lets per-event objects carry the deprecated project field; the v1 route rejects all three at the SDK boundary.
POST
/
events
/
batch
Python
import honeyhive
from honeyhive.models import components, operations
s = honeyhive.HoneyHive(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.events.create_event_batch(request=operations.CreateEventBatchRequestBody(
events=[
components.CreateEventRequest(
project='Simple RAG',
source='playground',
event_name='Model Completion',
event_type=components.CreateEventRequestEventType.MODEL,
event_id='7f22137a-6911-4ed3-bc36-110f1dde6b66',
session_id='caf77ace-3417-4da4-944d-f4a0688f3c23',
parent_id='caf77ace-3417-4da4-944d-f4a0688f3c23',
children_ids=[
'<value>',
],
config={
'model': 'gpt-3.5-turbo',
'version': 'v0.1',
'provider': 'openai',
'hyperparameters': {
'temperature': 0,
'top_p': 1,
'max_tokens': 1000,
'presence_penalty': 0,
'frequency_penalty': 0,
'stop': [
'<value>',
],
'n': 1,
},
'template': [
{
'role': 'system',
'content': 'Answer the user\'s question only using provided context.
Context: {{ context }}',
},
{
'role': 'user',
'content': '{{question}}',
},
],
'type': 'chat',
},
inputs={
'context': 'Hello world',
'question': 'What is in the context?',
'chat_history': [
{
'role': 'system',
'content': 'Answer the user\'s question only using provided context.
Context: Hello world',
},
{
'role': 'user',
'content': 'What is in the context?',
},
],
},
outputs={
'role': 'assistant',
'content': 'Hello world',
},
error=None,
start_time=1714978764301,
end_time=1714978765301,
duration=999.8056,
metadata={
'cost': 0.00008,
'completion_tokens': 23,
'prompt_tokens': 35,
'total_tokens': 58,
},
feedback={
},
metrics={
'Answer Faithfulness': 5,
'Answer Faithfulness_explanation': 'The AI assistant\'s answer is a concise and accurate description of Ramp\'s API. It provides a clear explanation of what the API does and how developers can use it to integrate Ramp\'s financial services into their own applications. The answer is faithful to the provided context.',
'Number of words': 18,
},
user_properties={
'user': 'google-oauth2|111840237613341303366',
},
),
],
))
if res.object is not None:
# handle response
passimport { HoneyHive } from "honeyhive";
import { CreateEventRequestEventType } from "honeyhive/dist/models/components";
async function run() {
const sdk = new HoneyHive({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});
const res = await sdk.events.createEventBatch({
events: [
{
project: "Simple RAG",
source: "playground",
eventName: "Model Completion",
eventType: CreateEventRequestEventType.Model,
eventId: "7f22137a-6911-4ed3-bc36-110f1dde6b66",
sessionId: "caf77ace-3417-4da4-944d-f4a0688f3c23",
parentId: "caf77ace-3417-4da4-944d-f4a0688f3c23",
childrenIds: [
"<value>",
],
config: {
"model": "gpt-3.5-turbo",
"version": "v0.1",
"provider": "openai",
"hyperparameters": {
"temperature": 0,
"top_p": 1,
"max_tokens": 1000,
"presence_penalty": 0,
"frequency_penalty": 0,
"stop": [
"<value>",
],
"n": 1,
},
"template": [
{
"role": "system",
"content": "Answer the user's question only using provided context.
Context: {{ context }}",
},
{
"role": "user",
"content": "{{question}}",
},
],
"type": "chat",
},
inputs: {
"context": "Hello world",
"question": "What is in the context?",
"chat_history": [
{
"role": "system",
"content": "Answer the user's question only using provided context.
Context: Hello world",
},
{
"role": "user",
"content": "What is in the context?",
},
],
},
outputs: {
"role": "assistant",
"content": "Hello world",
},
error: null,
startTime: 1714978764301,
endTime: 1714978765301,
duration: 999.8056,
metadata: {
"cost": 0.00008,
"completion_tokens": 23,
"prompt_tokens": 35,
"total_tokens": 58,
},
feedback: {
},
metrics: {
"Answer Faithfulness": 5,
"Answer Faithfulness_explanation": "The AI assistant's answer is a concise and accurate description of Ramp's API. It provides a clear explanation of what the API does and how developers can use it to integrate Ramp's financial services into their own applications. The answer is faithful to the provided context.",
"Number of words": 18,
},
userProperties: {
"user": "google-oauth2|111840237613341303366",
},
},
],
});
if (res.statusCode == 200) {
// handle response
}
}
run();curl --request POST \
--url https://api.honeyhive.ai/events/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"events": [
{
"project": "Simple RAG",
"event_type": "model",
"event_name": "Model Completion",
"source": "playground",
"session_id": "caf77ace-3417-4da4-944d-f4a0688f3c23",
"event_id": "7f22137a-6911-4ed3-bc36-110f1dde6b66",
"parent_id": "caf77ace-3417-4da4-944d-f4a0688f3c23",
"children_ids": [],
"config": {
"model": "gpt-3.5-turbo",
"version": "v0.1",
"provider": "openai",
"hyperparameters": {
"temperature": 0,
"top_p": 1,
"max_tokens": 1000,
"presence_penalty": 0,
"frequency_penalty": 0,
"stop": [],
"n": 1
},
"template": [
{
"role": "system",
"content": "Answer the user's question only using provided context.\n\nContext: {{ context }}"
},
{
"role": "user",
"content": "{{question}}"
}
],
"type": "chat"
},
"inputs": {
"context": "Hello world",
"question": "What is in the context?",
"chat_history": [
{
"role": "system",
"content": "Answer the user's question only using provided context.\n\nContext: Hello world"
},
{
"role": "user",
"content": "What is in the context?"
}
]
},
"outputs": {
"role": "assistant",
"content": "Hello world"
},
"error": null,
"start_time": 1714978764301,
"end_time": 1714978765301,
"duration": 999.8056,
"metadata": {
"cost": 0.00008,
"completion_tokens": 23,
"prompt_tokens": 35,
"total_tokens": 58
},
"feedback": {},
"metrics": {
"Answer Faithfulness": 5,
"Answer Faithfulness_explanation": "The AI assistant's answer is a concise and accurate description of Ramp's API. It provides a clear explanation of what the API does and how developers can use it to integrate Ramp's financial services into their own applications. The answer is faithful to the provided context.",
"Number of words": 18
},
"user_properties": {
"user": "google-oauth2|111840237613341303366"
}
}
],
"is_single_session": true
}
EOFconst options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
events: [
{
project: 'Simple RAG',
event_type: 'model',
event_name: 'Model Completion',
source: 'playground',
session_id: 'caf77ace-3417-4da4-944d-f4a0688f3c23',
event_id: '7f22137a-6911-4ed3-bc36-110f1dde6b66',
parent_id: 'caf77ace-3417-4da4-944d-f4a0688f3c23',
children_ids: [],
config: {
model: 'gpt-3.5-turbo',
version: 'v0.1',
provider: 'openai',
hyperparameters: {
temperature: 0,
top_p: 1,
max_tokens: 1000,
presence_penalty: 0,
frequency_penalty: 0,
stop: [],
n: 1
},
template: [
{
role: 'system',
content: 'Answer the user\'s question only using provided context.\n\nContext: {{ context }}'
},
{role: 'user', content: '{{question}}'}
],
type: 'chat'
},
inputs: {
context: 'Hello world',
question: 'What is in the context?',
chat_history: [
{
role: 'system',
content: 'Answer the user\'s question only using provided context.\n\nContext: Hello world'
},
{role: 'user', content: 'What is in the context?'}
]
},
outputs: {role: 'assistant', content: 'Hello world'},
error: null,
start_time: 1714978764301,
end_time: 1714978765301,
duration: 999.8056,
metadata: {cost: 0.00008, completion_tokens: 23, prompt_tokens: 35, total_tokens: 58},
feedback: {},
metrics: {
'Answer Faithfulness': 5,
'Answer Faithfulness_explanation': 'The AI assistant\'s answer is a concise and accurate description of Ramp\'s API. It provides a clear explanation of what the API does and how developers can use it to integrate Ramp\'s financial services into their own applications. The answer is faithful to the provided context.',
'Number of words': 18
},
user_properties: {user: 'google-oauth2|111840237613341303366'}
}
],
is_single_session: true
})
};
fetch('https://api.honeyhive.ai/events/batch', 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/batch",
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([
'events' => [
[
'project' => 'Simple RAG',
'event_type' => 'model',
'event_name' => 'Model Completion',
'source' => 'playground',
'session_id' => 'caf77ace-3417-4da4-944d-f4a0688f3c23',
'event_id' => '7f22137a-6911-4ed3-bc36-110f1dde6b66',
'parent_id' => 'caf77ace-3417-4da4-944d-f4a0688f3c23',
'children_ids' => [
],
'config' => [
'model' => 'gpt-3.5-turbo',
'version' => 'v0.1',
'provider' => 'openai',
'hyperparameters' => [
'temperature' => 0,
'top_p' => 1,
'max_tokens' => 1000,
'presence_penalty' => 0,
'frequency_penalty' => 0,
'stop' => [
],
'n' => 1
],
'template' => [
[
'role' => 'system',
'content' => 'Answer the user\'s question only using provided context.
Context: {{ context }}'
],
[
'role' => 'user',
'content' => '{{question}}'
]
],
'type' => 'chat'
],
'inputs' => [
'context' => 'Hello world',
'question' => 'What is in the context?',
'chat_history' => [
[
'role' => 'system',
'content' => 'Answer the user\'s question only using provided context.
Context: Hello world'
],
[
'role' => 'user',
'content' => 'What is in the context?'
]
]
],
'outputs' => [
'role' => 'assistant',
'content' => 'Hello world'
],
'error' => null,
'start_time' => 1714978764301,
'end_time' => 1714978765301,
'duration' => 999.8056,
'metadata' => [
'cost' => 0.00008,
'completion_tokens' => 23,
'prompt_tokens' => 35,
'total_tokens' => 58
],
'feedback' => [
],
'metrics' => [
'Answer Faithfulness' => 5,
'Answer Faithfulness_explanation' => 'The AI assistant\'s answer is a concise and accurate description of Ramp\'s API. It provides a clear explanation of what the API does and how developers can use it to integrate Ramp\'s financial services into their own applications. The answer is faithful to the provided context.',
'Number of words' => 18
],
'user_properties' => [
'user' => 'google-oauth2|111840237613341303366'
]
]
],
'is_single_session' => true
]),
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/batch"
payload := strings.NewReader("{\n \"events\": [\n {\n \"project\": \"Simple RAG\",\n \"event_type\": \"model\",\n \"event_name\": \"Model Completion\",\n \"source\": \"playground\",\n \"session_id\": \"caf77ace-3417-4da4-944d-f4a0688f3c23\",\n \"event_id\": \"7f22137a-6911-4ed3-bc36-110f1dde6b66\",\n \"parent_id\": \"caf77ace-3417-4da4-944d-f4a0688f3c23\",\n \"children_ids\": [],\n \"config\": {\n \"model\": \"gpt-3.5-turbo\",\n \"version\": \"v0.1\",\n \"provider\": \"openai\",\n \"hyperparameters\": {\n \"temperature\": 0,\n \"top_p\": 1,\n \"max_tokens\": 1000,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 0,\n \"stop\": [],\n \"n\": 1\n },\n \"template\": [\n {\n \"role\": \"system\",\n \"content\": \"Answer the user's question only using provided context.\\n\\nContext: {{ context }}\"\n },\n {\n \"role\": \"user\",\n \"content\": \"{{question}}\"\n }\n ],\n \"type\": \"chat\"\n },\n \"inputs\": {\n \"context\": \"Hello world\",\n \"question\": \"What is in the context?\",\n \"chat_history\": [\n {\n \"role\": \"system\",\n \"content\": \"Answer the user's question only using provided context.\\n\\nContext: Hello world\"\n },\n {\n \"role\": \"user\",\n \"content\": \"What is in the context?\"\n }\n ]\n },\n \"outputs\": {\n \"role\": \"assistant\",\n \"content\": \"Hello world\"\n },\n \"error\": null,\n \"start_time\": 1714978764301,\n \"end_time\": 1714978765301,\n \"duration\": 999.8056,\n \"metadata\": {\n \"cost\": 0.00008,\n \"completion_tokens\": 23,\n \"prompt_tokens\": 35,\n \"total_tokens\": 58\n },\n \"feedback\": {},\n \"metrics\": {\n \"Answer Faithfulness\": 5,\n \"Answer Faithfulness_explanation\": \"The AI assistant's answer is a concise and accurate description of Ramp's API. It provides a clear explanation of what the API does and how developers can use it to integrate Ramp's financial services into their own applications. The answer is faithful to the provided context.\",\n \"Number of words\": 18\n },\n \"user_properties\": {\n \"user\": \"google-oauth2|111840237613341303366\"\n }\n }\n ],\n \"is_single_session\": true\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.honeyhive.ai/events/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n {\n \"project\": \"Simple RAG\",\n \"event_type\": \"model\",\n \"event_name\": \"Model Completion\",\n \"source\": \"playground\",\n \"session_id\": \"caf77ace-3417-4da4-944d-f4a0688f3c23\",\n \"event_id\": \"7f22137a-6911-4ed3-bc36-110f1dde6b66\",\n \"parent_id\": \"caf77ace-3417-4da4-944d-f4a0688f3c23\",\n \"children_ids\": [],\n \"config\": {\n \"model\": \"gpt-3.5-turbo\",\n \"version\": \"v0.1\",\n \"provider\": \"openai\",\n \"hyperparameters\": {\n \"temperature\": 0,\n \"top_p\": 1,\n \"max_tokens\": 1000,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 0,\n \"stop\": [],\n \"n\": 1\n },\n \"template\": [\n {\n \"role\": \"system\",\n \"content\": \"Answer the user's question only using provided context.\\n\\nContext: {{ context }}\"\n },\n {\n \"role\": \"user\",\n \"content\": \"{{question}}\"\n }\n ],\n \"type\": \"chat\"\n },\n \"inputs\": {\n \"context\": \"Hello world\",\n \"question\": \"What is in the context?\",\n \"chat_history\": [\n {\n \"role\": \"system\",\n \"content\": \"Answer the user's question only using provided context.\\n\\nContext: Hello world\"\n },\n {\n \"role\": \"user\",\n \"content\": \"What is in the context?\"\n }\n ]\n },\n \"outputs\": {\n \"role\": \"assistant\",\n \"content\": \"Hello world\"\n },\n \"error\": null,\n \"start_time\": 1714978764301,\n \"end_time\": 1714978765301,\n \"duration\": 999.8056,\n \"metadata\": {\n \"cost\": 0.00008,\n \"completion_tokens\": 23,\n \"prompt_tokens\": 35,\n \"total_tokens\": 58\n },\n \"feedback\": {},\n \"metrics\": {\n \"Answer Faithfulness\": 5,\n \"Answer Faithfulness_explanation\": \"The AI assistant's answer is a concise and accurate description of Ramp's API. It provides a clear explanation of what the API does and how developers can use it to integrate Ramp's financial services into their own applications. The answer is faithful to the provided context.\",\n \"Number of words\": 18\n },\n \"user_properties\": {\n \"user\": \"google-oauth2|111840237613341303366\"\n }\n }\n ],\n \"is_single_session\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.honeyhive.ai/events/batch")
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 \"events\": [\n {\n \"project\": \"Simple RAG\",\n \"event_type\": \"model\",\n \"event_name\": \"Model Completion\",\n \"source\": \"playground\",\n \"session_id\": \"caf77ace-3417-4da4-944d-f4a0688f3c23\",\n \"event_id\": \"7f22137a-6911-4ed3-bc36-110f1dde6b66\",\n \"parent_id\": \"caf77ace-3417-4da4-944d-f4a0688f3c23\",\n \"children_ids\": [],\n \"config\": {\n \"model\": \"gpt-3.5-turbo\",\n \"version\": \"v0.1\",\n \"provider\": \"openai\",\n \"hyperparameters\": {\n \"temperature\": 0,\n \"top_p\": 1,\n \"max_tokens\": 1000,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 0,\n \"stop\": [],\n \"n\": 1\n },\n \"template\": [\n {\n \"role\": \"system\",\n \"content\": \"Answer the user's question only using provided context.\\n\\nContext: {{ context }}\"\n },\n {\n \"role\": \"user\",\n \"content\": \"{{question}}\"\n }\n ],\n \"type\": \"chat\"\n },\n \"inputs\": {\n \"context\": \"Hello world\",\n \"question\": \"What is in the context?\",\n \"chat_history\": [\n {\n \"role\": \"system\",\n \"content\": \"Answer the user's question only using provided context.\\n\\nContext: Hello world\"\n },\n {\n \"role\": \"user\",\n \"content\": \"What is in the context?\"\n }\n ]\n },\n \"outputs\": {\n \"role\": \"assistant\",\n \"content\": \"Hello world\"\n },\n \"error\": null,\n \"start_time\": 1714978764301,\n \"end_time\": 1714978765301,\n \"duration\": 999.8056,\n \"metadata\": {\n \"cost\": 0.00008,\n \"completion_tokens\": 23,\n \"prompt_tokens\": 35,\n \"total_tokens\": 58\n },\n \"feedback\": {},\n \"metrics\": {\n \"Answer Faithfulness\": 5,\n \"Answer Faithfulness_explanation\": \"The AI assistant's answer is a concise and accurate description of Ramp's API. It provides a clear explanation of what the API does and how developers can use it to integrate Ramp's financial services into their own applications. The answer is faithful to the provided context.\",\n \"Number of words\": 18\n },\n \"user_properties\": {\n \"user\": \"google-oauth2|111840237613341303366\"\n }\n }\n ],\n \"is_single_session\": true\n}"
response = http.request(request)
puts response.read_body{
"event_ids": [
"7f22137a-6911-4ed3-bc36-110f1dde6b66",
"7f22137a-6911-4ed3-bc36-110f1dde6b67"
],
"session_id": "caf77ace-3417-4da4-944d-f4a0688f3c23",
"success": true
}{
"event_ids": [
"7f22137a-6911-4ed3-bc36-110f1dde6b66",
"7f22137a-6911-4ed3-bc36-110f1dde6b67"
],
"errors": [
"Could not create event due to missing inputs",
"Could not create event due to missing source"
],
"success": true
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Was this page helpful?
⌘I

