Skip to main content
POST
/
events
/
model
Python
import honeyhive
from honeyhive.models import components, operations

s = honeyhive.HoneyHive(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
)


res = s.events.create_model_event(request=operations.CreateModelEventRequestBody(
    model_event=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_id": "7f22137a-6911-4ed3-bc36-110f1dde6b66",
  "success": true
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model_event
object
Example:
{
"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": null,
"source": "playground",
"event_name": "Model Completion",
"hyperparameters": {
"temperature": 0,
"top_p": 1,
"max_tokens": 1000,
"presence_penalty": 0,
"frequency_penalty": 0,
"stop": [],
"n": 1
},
"template": [
{
"role": "system",
"content": "Hello, {{ name }}!"
}
],
"template_inputs": { "name": "world" },
"tools": {
"type": "function",
"function": {
"name": "get_current_weather",
"description": "Get the current weather",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. San Francisco, CA"
},
"format": {
"type": "string",
"enum": ["celsius", "fahrenheit"],
"description": "The temperature unit to use. Infer this from the users location."
}
},
"required": ["location", "format"]
}
}
},
"tool_choice": "none",
"response_format": { "type": "text" }
}

Response

200 - application/json

Model event created

event_id
string
success
boolean
I