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.).
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.
_PREFIXES
class-attribute
instance-attribute
¶
_PREFIXES = [
("Select.RecordInput", RecordInput),
("Select.RecordOutput", RecordOutput),
("Select.RecordArgs", RecordArgs),
("Select.RecordRets", RecordRets),
("Select.RecordCalls", RecordCalls),
("Select.RecordCall", RecordCall),
("Select.Record", Record),
("Select.App", App),
]
All prefixes/shorthands defined in this class.
Make sure this list is sorted by longest prefix first as some prefixes are prefixes of others.
Functions¶
path_and_method
staticmethod
¶
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
¶
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.