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
pass{
"event_ids": [
"7f22137a-6911-4ed3-bc36-110f1dde6b66",
"7f22137a-6911-4ed3-bc36-110f1dde6b67"
],
"session_id": "caf77ace-3417-4da4-944d-f4a0688f3c23",
"success": true
}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.
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
pass{
"event_ids": [
"7f22137a-6911-4ed3-bc36-110f1dde6b66",
"7f22137a-6911-4ed3-bc36-110f1dde6b67"
],
"session_id": "caf77ace-3417-4da4-944d-f4a0688f3c23",
"success": true
}Documentation Index
Fetch the complete documentation index at: https://docs.honeyhive.ai/llms.txt
Use this file to discover all available pages before exploring further.
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Was this page helpful?