Skip to content

trulens.core.schema.select

trulens.core.schema.select

Serializable selector-related classes.

Classes

Select

Utilities for creating selectors using Lens and aliases/shortcuts.

Attributes
Tru class-attribute instance-attribute
Tru: Lens = Lens()

Selector for the tru wrapper (TruLlama, TruChain, etc.).

Record class-attribute instance-attribute
Record: Lens = __record__

Selector for the record.

App class-attribute instance-attribute
App: Lens = __app__

Selector for the app.

RecordInput class-attribute instance-attribute
RecordInput: Lens = main_input

Selector for the main app input.

RecordOutput class-attribute instance-attribute
RecordOutput: Lens = main_output

Selector for the main app output.

RecordCalls class-attribute instance-attribute
RecordCalls: Lens = app

Selector for the calls made by the wrapped app.

Laid out by path into components.

RecordCall class-attribute instance-attribute
RecordCall: Lens = calls[-1]

Selector for the first called method (last to return).

RecordArgs class-attribute instance-attribute
RecordArgs: Lens = args

Selector for the whole set of inputs/arguments to the first called / last method call.

RecordRets class-attribute instance-attribute
RecordRets: Lens = rets

Selector for the whole output of the first called / last returned method call.

RecordSpans class-attribute instance-attribute
RecordSpans: Lens = spans

EXPERIMENTAL(otel-tracing): OTEL spans produced during tracing of a record.

This can include spans not created by trulens.

Functions
path_and_method staticmethod
path_and_method(select: Lens) -> Tuple[Lens, str]

If select names in method as the last attribute, extract the method name and the selector without the final method name.

dequalify staticmethod
dequalify(lens: Lens) -> Lens

If the given selector qualifies record or app, remove that qualification.

context staticmethod
context(app: Optional[Any] = None) -> Lens

DEPRECATED: Select the context (retrieval step outputs) of the given app.

for_record staticmethod
for_record(lens: Lens) -> Lens

Add the Record prefix to the beginning of the given lens.

for_app staticmethod
for_app(lens: Lens) -> Lens

Add the App prefix to the beginning of the given lens.

is_for_record_spans staticmethod
is_for_record_spans(lens: Lens) -> bool

Check if the given lens is for the spans of a record.

render_for_dashboard staticmethod
render_for_dashboard(lens: Lens) -> str

Render the given lens for use in dashboard to help user specify feedback functions.