compass.utilities.event_log.EventLog#
- class EventLog(path)[source]#
Bases:
objectAppend-only JSONL event stream for one jurisdiction
A log opened on a file that already holds events (an earlier step of a workflow run as separate search, collect, and extract steps) continues it: events are added after the existing ones, their sequence numbers and elapsed times carry on, and the IDs given out are marked with the run they belong to so they stay unique.
- Parameters:
path (path-like) – File to write events to. It is created if it does not exist, and added to if it does.
Methods
emit(kind, **fields)Append one event, with the current tags
graph_id(description)ID for a decision-tree graph, recorded the first time
ID linking an
llm_requestto itsllm_responsenext_id(prefix)Sequential ID, e.g. linking a request to its response.
schema_id(response_format)ID for a structured-output schema, recorded the first time
Attributes
Whether this log started a new file
- schema_id(response_format)[source]#
ID for a structured-output schema, recorded the first time
Schemas can be large and are often sent with many calls, so each distinct one is written once as an
llm_schemaevent and referred to by ID afterwards.
- graph_id(description)[source]#
ID for a decision-tree graph, recorded the first time
A tree’s graph (every question and branch, including those a run never reaches) is written once as a
decision_tree_graphevent; trees asking the same questions, such as one per page of a document, refer to it by ID.- Parameters:
description (
dict) –nodesandedgesof the graph, as built bycompass.common.tree.describe_graph().