v1

latestOpenAPI 3.1.02026-07-1320186461.3 KB

Record Trace Log

Log a (LLM) span to visualize inference results, or chains.

post/api/parea/v1/trace_log

Request body

inputsobject nullable

Key-value pair inputs of this trace. Note, there is a special field to capture messages in LLM calls. You can still use it in the case of LLM calls to track the key-value pairs for prompt templates.

outputstring nullable

Response of this step/log/function. If response isn’t a string, it needs to be serialized to a string.

targetstring nullable

The target or “gold standard” response for the inputs of this log.

latencynumber nullable

Latency of this log in seconds.

time_to_first_tokennumber nullable

If this was a LLM call, this will contain the time taken to generate the first token.

input_tokensinteger nullable

If this was a LLM call, this will contain the number of tokens in the input.

output_tokensinteger nullable

If this was a LLM call, this will contain the number of tokens in the output.

total_tokensinteger nullable

If this was a LLM call, this will contain the total number of tokens in the input and output.

costnumber nullable

If this was a LLM call, this will contain the cost of the call.

trace_idstring required

UUID of the trace log. Ex: e3267953-a16f-47f5-b37e-622dbb29d730

start_timestampstring required

Start timestamp

parent_trace_idstring nullable

If given, current trace will be a child of this trace. If current child is not a child, parent_trace_id should be equal to trace_id

root_trace_idstring nullable

This is the UUID of the root trace/span of this trace. If current trace is the root trace, root_trace_id must be equal to trace_id

project_namestring nullable

Name of the project with which the trace/log should be associated with. Must be provided if project_uuid is not provided

statusstring nullable

If the trace was a success or error

errorstring nullable

If status=error, this should contain any additional information such as the stacktrace

output_for_eval_metricsstring nullable

If provided, will be used as output for any specified evaluation metric.

evaluation_metric_namesstring[] nullable

Names of evaluation metrics deployed on Parea which should be applied to this log.

feedback_scorenumber nullable

Any captured (user) feedback on this log

apply_eval_fracnumber nullable

If specified, evals given with evaluation_metric_names will be applied to this log with this fraction.

log_sample_ratenumber nullable

If specified, this log and its entire associated trace will logged with this probability. Must be between 0 and 1 (incl.). Defaults to 1.0 (i.e., keeping all logs)

deployment_idstring nullable

Optionally, provide the ID of the used deployed prompt in this log.

cache_hitboolean

If the cache was hit for this log.

trace_namestring nullable

The name of this span.

childrenstring[] nullable

UUIDs of any children.

children_idsinteger[] nullable

IDs of any children. Will be automatically populated.

end_timestampstring nullable

End timestamp of span.

end_user_identifierstring nullable

Unique identifier for a end-user.

session_idstring nullable

Unique identifier for a session. Can you be used to associated multiple logs in e.g. chat applications.

metadataobject nullable

Any additional key-value pairs which provide context or are useful for filtering.

tagsstring[] nullable

List of tags which provide additional context or are useful for filtering.

experiment_uuidstring nullable

If given, will be used to associate this log with an experiment.

annotationsobject nullable

Any annotations on log which were collected on Parea frontend. It maps annoation criterion ID to a dictionary mapping user_id (Parea user ID) to annotation.

depthinteger

Depth/level of nestedness of span in overall trace. Root-level trace is 0 and it always increments by 1.

execution_orderinteger

The execution number of span in trace. It starts with 0 and increments by 1 with every span.

evaluation_metric_idsinteger[] nullable

Deprecated

fill_childrenboolean

Deprecated

project_uuidstring nullable

UUID of project with which this log is associated. Will be automatically filled-in by SDKs

organization_idstring nullable

Organization ID associated with Parea API key. Will be automatically determined from API key

Example request

{
  "depth": 0,
  "end_timestamp": "2024-05-30 13:48:35",
  "execution_order": 0,
  "inputs": {
    "x": "Golang",
    "y": "Fiber"
  },
  "metadata": {
    "purpose": "testing"
  },
  "output": "Some logged output",
  "parent_trace_id": "<<SAME_UUID>>",
  "project_name": "default",
  "root_trace_id": "<<SAME_UUID>>",
  "start_timestamp": "2024-05-30 13:48:34",
  "status": "success",
  "trace_id": "<<UUID>>",
  "trace_name": "test"
}

Response

Successful Response

{"stackTrail":"paths:/api/parea/v1/trace_log:post:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}