from timbal.state.tracing.span import Span
llm_span = Span(
path="agent.llm",
call_id="068c4458383678be800031537a8df42e",
parent_call_id="068c4458382e708f8000cc0f9b19d970",
t0=1640995200000, # Start time (Unix ms)
t1=1640995201000, # End time (Unix ms)
input={
"model": "openai/gpt-4o-mini",
"messages": [{
"role": "user",
"content": [{"type": "text", "text": "Hello"}],
}],
},
output={
"role": "assistant",
"content": [{"type": "text", "text": "Hello! How can I assist you today?"}],
},
usage={
"openai/gpt-4o-mini:input_tokens": 32,
"openai/gpt-4o-mini:output_tokens": 10,
},
metadata={
"type": "LLM",
"model_provider": "openai",
"model_name": "gpt-4o-mini",
"ttft": 1.218775834015105, # Time To First Token
"tps": 103.44992571967803, # Tokens Per Second
},
)