Skip to main content
A score is a number, a yes or no, or a label: from a person, an LLM judge or a test. It can come long after its trace. The examples use an open store (open a store).

Score fields

Rust uses the same names in snake_case; type is score_type.
  • A score replaces the stored score with the same target, name, source, authorId and evalId. So two people, or two runs of an eval, keep one score each.
  • A score with no target or two, a boolean that is not 0 or 1, or a category with no label is an error, and its batch is refused whole.
  • Scores on a session are not in getScores of its traces, and not in anyScore. They go with deleteSession, and when a delete or a drop removes the last trace of the session. deleteTrace leaves them.
To find traces by their scores, use anyScore in findTraces.

Add up scores

Each row has key, count (every score of the group), avg and labels (the count per label). avg is the average of the numbers and booleans; of a boolean, it is the share of true. It is null for a group of categories. The trace side is read when the query runs, so a group follows the trace as it is now. A score with no trace in the store has the key null. To compare two experiments, run the query once per group: for example with traces: { root: { attributes: { experiment: 'A' } } }, then with 'B'. More examples: sessions and scores.

List sessions

A session is a conversation: the traces with one sessionId. A trace’s session is the sessionId of its root span, or else of its earliest span that has one.
  • findSessions gives the newest first, with sums over the traces: traceCount, spanCount, errorCount, tokens and costNanos. It pages by cursor, as the other lists do.
  • A row also has userId (of the earliest trace that has one), firstTraceId and firstInput, lastTraceId and lastOutput (the first 200 characters).
  • The filter takes userId, from and to: the start of the session.
  • getSession gives every trace of the session, oldest first. For a very large session, page findTraces with filter.sessionId.

Read and export

Read whole traces, export to JSON Lines.

Delete and maintain

Delete users, drop old spans, free disk space.