import honeyhive
from honeyhive.models import components, operations
s = honeyhive.HoneyHive(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.events.create_model_event_batch(request=operations.CreateModelEventBatchRequestBody(
model_events=[
components.CreateModelEvent(
project='New Project',
model='gpt-4o',
provider='openai',
messages=[
{
'role': 'system',
'content': 'Hello, world!',
},
],
response={
'role': 'assistant',
'content': 'Hello, world!',
},
duration=42,
usage={
'prompt_tokens': 10,
'completion_tokens': 10,
'total_tokens': 20,
},
cost=0.00008,
error=None,
source='playground',
event_name='Model Completion',
hyperparameters={
'temperature': 0,
'top_p': 1,
'max_tokens': 1000,
'presence_penalty': 0,
'frequency_penalty': 0,
'stop': [
'<value>',
],
'n': 1,
},
template=[
{
'role': 'system',
'content': 'Hello, {{ name }}!',
},
],
template_inputs={
'name': 'world',
},
tools=[
{
'key': '<value>',
},
],
tool_choice='none',
response_format={
'type': 'text',
},
),
],
))
if res.object is not None:
# handle response
pass{
"event_ids": [
"7f22137a-6911-4ed3-bc36-110f1dde6b66",
"7f22137a-6911-4ed3-bc36-110f1dde6b67"
],
"success": true
}Please refer to our instrumentation guide for detailed information
import honeyhive
from honeyhive.models import components, operations
s = honeyhive.HoneyHive(
bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)
res = s.events.create_model_event_batch(request=operations.CreateModelEventBatchRequestBody(
model_events=[
components.CreateModelEvent(
project='New Project',
model='gpt-4o',
provider='openai',
messages=[
{
'role': 'system',
'content': 'Hello, world!',
},
],
response={
'role': 'assistant',
'content': 'Hello, world!',
},
duration=42,
usage={
'prompt_tokens': 10,
'completion_tokens': 10,
'total_tokens': 20,
},
cost=0.00008,
error=None,
source='playground',
event_name='Model Completion',
hyperparameters={
'temperature': 0,
'top_p': 1,
'max_tokens': 1000,
'presence_penalty': 0,
'frequency_penalty': 0,
'stop': [
'<value>',
],
'n': 1,
},
template=[
{
'role': 'system',
'content': 'Hello, {{ name }}!',
},
],
template_inputs={
'name': 'world',
},
tools=[
{
'key': '<value>',
},
],
tool_choice='none',
response_format={
'type': 'text',
},
),
],
))
if res.object is not None:
# handle response
pass{
"event_ids": [
"7f22137a-6911-4ed3-bc36-110f1dde6b66",
"7f22137a-6911-4ed3-bc36-110f1dde6b67"
],
"success": true
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Show child attributes
Project associated with the event
Model name
Model provider
Messages passed to the model
Final output JSON of the event
How long the event took in milliseconds
Usage statistics of the model
Cost of the model completion
Any error description if event failed
Source of the event - production, staging, etc
Name of the event
Hyperparameters used for the model
Template used for the model
Inputs for the template
Tools used for the model
Tool choice for the model
Response format for the model
Was this page helpful?