TraceHelper

org.llm4s.llmconnect.model.TraceHelper
object TraceHelper

Utility helpers for building Langfuse-compatible trace event JSON objects.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def createEvent(message: Message, uuid: String, traceId: String, idx: Int, now: String, modelName: String, contextMessages: Seq[Message]): Obj

Creates a Langfuse-compatible trace event JSON object for a single conversation message.

Creates a Langfuse-compatible trace event JSON object for a single conversation message.

Value parameters

contextMessages

preceding messages in the conversation, used to resolve tool-call names

idx

sequential index of the event within the trace

message

the conversation message to record (user, system, assistant, or tool)

modelName

name of the LLM model used for generation events

now

ISO-8601 timestamp string representing the event time

traceId

identifier of the parent trace this event belongs to

uuid

unique identifier for the event envelope

Attributes

Returns

a ujson.Obj representing the typed trace event for the given message

def wrapper(uuid: String, now: String, eventType: String, traceId: String, idx: Int, input: Obj, meta: Obj, output: Option[Obj]): Obj

Builds a generic trace-event JSON wrapper object, optionally including an output field.

Builds a generic trace-event JSON wrapper object, optionally including an output field.

Value parameters

eventType

Langfuse event type string (e.g. "event-create", "span-create")

idx

sequential index of the event within the trace

input

JSON object describing the event input payload

meta

JSON object carrying metadata for the event body

now

ISO-8601 timestamp string representing the event time

output

optional JSON object describing the event output; omitted from body when None

traceId

identifier of the parent trace this event belongs to

uuid

unique identifier for the envelope event

Attributes

Returns

a ujson.Obj representing the complete trace event envelope