nemoguardrails.tracing.interaction_types

View as Markdown

Core models for the tracing system.

Module Contents

Classes

NameDescription
InteractionLogDetailed log about the execution of an interaction.
InteractionOutputSimple model for interaction output used in tracer.

Functions

NameDescription
extract_interaction_logExtracts an InteractionLog object from an GenerationLog object.

API

class nemoguardrails.tracing.interaction_types.InteractionLog()

Bases: BaseModel

Detailed log about the execution of an interaction.

activated_rails
List[ActivatedRail]
events
List[dict]
id
str
trace
List[Union[SpanLegacy, SpanOpentelemetry]]
class nemoguardrails.tracing.interaction_types.InteractionOutput()

Bases: BaseModel

Simple model for interaction output used in tracer.

id
str
input
Any
output
Optional[Any]
nemoguardrails.tracing.interaction_types.extract_interaction_log(
interaction_output: nemoguardrails.tracing.interaction_types.InteractionOutput,
generation_log: nemoguardrails.rails.llm.options.GenerationLog,
span_format: str = 'opentelemetry',
enable_content_capture: bool = False
) -> nemoguardrails.tracing.interaction_types.InteractionLog

Extracts an InteractionLog object from an GenerationLog object.

Parameters:

interaction_output
InteractionOutput

The interaction output

generation_log
GenerationLog

The generation log

span_format
strDefaults to 'opentelemetry'

Span format to use (“legacy” or “opentelemetry”)

enable_content_capture
boolDefaults to False

Whether to include content in trace events