Skip to main content

Returns

Returns a list of Trace objects.

Example

from galtea.domain.models.trace import TraceBase, NodeType

traces = [
    TraceBase(
        session_id="YOUR_SESSION_ID",
        name="retrieve_documents",
        node_type=NodeType.RETRIEVER,
        input_data={"query": "product pricing"},
        output_data={"docs": ["doc1", "doc2"]},
        latency_ms=45.2
    ),
    TraceBase(
        session_id="YOUR_SESSION_ID",
        name="generate_response",
        node_type=NodeType.LLM,
        input_data={"prompt": "Summarize pricing"},
        output_data={"response": "The price is $99"},
        latency_ms=320.5
    )
]

created_traces = galtea.traces.create_batch(traces=traces)

Parameters

traces
list[TraceBase]
required
List of trace objects to create. Each trace should include session_id, name, and optionally other fields.

TraceBase Fields

FieldTypeRequiredDescription
session_idstrYesID of the session this trace belongs to
namestrYesName of the traced operation
idstrNoClient-generated ID (auto-generated if not provided)
inference_result_idstrNoID of the inference result this trace belongs to
node_typeNodeTypeNoType: TOOL, CHAIN, RETRIEVER, LLM, CUSTOM. See Node Types
parent_trace_idstrNoID of parent trace
input_datadictNoInput parameters
output_datadictNoOutput result
errorstrNoError message if failed
latency_msfloatNoExecution time in milliseconds
start_timestrNoISO 8601 timestamp when the trace started
end_timestrNoISO 8601 timestamp when the trace ended
metadatadictNoAdditional custom metadata