Class: Session
Defined in: src/lib/logger/components/session.ts:46 Represents a user or system session containing multiple traces (back and forth interactions). Sessions provide a high-level grouping mechanism for related activities, typically representing a user interaction session, conversation, etc. Sessions can contain multiple traces and support feedback collection. SessionExamples
Extends
Constructors
Constructor
new Session(Defined in: src/lib/logger/components/session.ts:60 Creates a new session log entry.config,writer):Session
Parameters
config
SessionConfig
Configuration object defining the session
writer
LogWriter
Log writer instance for persisting session data
Returns
Session
Example
Overrides
EvaluatableBaseContainer.constructor
Accessors
evaluate
Get Signature
get evaluate(): EvaluateContainer
Defined in: src/lib/logger/components/base.ts:248
Gets the evaluation methods for this container.
Example
Returns
EvaluateContainer
Evaluation methods for configuring and triggering evaluations
Inherited from
EvaluatableBaseContainer.evaluate
id
Get Signature
get id(): string
Defined in: src/lib/logger/components/base.ts:80
Gets the unique identifier for this container.
Returns
string
The container’s unique ID
Inherited from
EvaluatableBaseContainer.id
Methods
addMetadata()
addMetadata(Defined in: src/lib/logger/components/base.ts:124 Adds metadata to this container for additional context and debugging. Any data type could be added as the value in the metadata record.metadata):void
Parameters
metadata
Record<string, unknown>
Key-value pairs of metadata
Returns
void
void
Example
Inherited from
EvaluatableBaseContainer.addMetadata
addTag()
addTag(Defined in: src/lib/logger/components/base.ts:94 Adds a tag to this container for categorization and filtering.key,value):void
Parameters
key
string
The tag key
value
string
The tag value
Returns
void
void
Example
Inherited from
EvaluatableBaseContainer.addTag
data()
data(): any
Defined in: src/lib/logger/components/base.ts:191
Returns the current data state of this container.
Returns
any
The container’s data.
Inherited from
EvaluatableBaseContainer.data
end()
end(): void
Defined in: src/lib/logger/components/base.ts:163
Marks this container as ended and records the end timestamp.
Returns
void
void
Example
Inherited from
EvaluatableBaseContainer.end
feedback()
feedback(Defined in: src/lib/logger/components/session.ts:82 Adds feedback to this session from users.feedback):void
Parameters
feedback
Feedback object containing score and optional commentcomment?
string
Optional textual feedback or comments
score
number
Numerical score for the session (1-5)
Returns
void
void
Examples
trace()
trace(Defined in: src/lib/logger/components/session.ts:111 Creates a new trace within this session.config):Trace
Parameters
config
TraceConfig
Configuration for the new trace
Returns
Trace
A new trace instance associated with this session
Example
addMetadata_()
Defined in: src/lib/logger/components/base.ts:144 Static method to add metadata to any container by ID.staticaddMetadata_(writer,entity,id,metadata):void
Parameters
writer
LogWriter
The log writer instance
entity
Entity
The entity type
id
string
The container ID
metadata
Record<string, unknown>
The metadata to add
Returns
void
void
Inherited from
EvaluatableBaseContainer.addMetadata_
addTag_()
Defined in: src/lib/logger/components/base.ts:108 Static method to add a tag to any container by ID.staticaddTag_(writer,entity,id,key,value):void
Parameters
writer
LogWriter
The log writer instance
entity
Entity
The entity type
id
string
The container ID
key
string
The tag key
value
string
The tag value
Returns
void
void
Inherited from
EvaluatableBaseContainer.addTag_
end_()
Defined in: src/lib/logger/components/base.ts:177 Static method to end any container by ID.staticend_(writer,entity,id,data?):void
Parameters
writer
LogWriter
The log writer instance
entity
Entity
The entity type
id
string
The container ID
data?
any
Optional additional data to include with the end event
Returns
void
void
Inherited from
EvaluatableBaseContainer.end_
evaluate_()
Defined in: src/lib/logger/components/base.ts:260 Static method to get evaluation methods for any evaluatable container by ID.staticevaluate_(writer,entity,id):EvaluateContainer
Parameters
writer
LogWriter
The log writer instance
entity
Entity
The entity type
id
string
The container ID
Returns
EvaluateContainer
Evaluation methods for configuring and triggering evaluations
Inherited from
EvaluatableBaseContainer.evaluate_
feedback_()
Defined in: src/lib/logger/components/session.ts:96 Static method to add feedback to any session by ID.staticfeedback_(writer,id,feedback):void
Parameters
writer
LogWriter
The log writer instance
id
string
The session ID
feedback
Feedback object containing score and optional commentcomment?
string
Optional textual feedback
score
number
Numerical score for the session
Returns
void
void
trace_()
Defined in: src/lib/logger/components/session.ts:129 Static method to create a trace associated with any session by ID.statictrace_(writer,id,config):Trace
Parameters
writer
LogWriter
The log writer instance
id
string
The session ID
config
TraceConfig
Configuration for the new trace
Returns
Trace
A new trace instance