trulens.core.schema.app¶
    Serializable app-related classes.
Classes¶
    Mode of records ingestion.
Specify this using the ingest_mode to App constructors.
Attributes¶
class-attribute
      instance-attribute
  
¶
IMMEDIATE = 'immediate'
Each record is ingested one by one and written to the database. This is the default mode.
class-attribute
      instance-attribute
  
¶
BUFFERED = 'buffered'
Records are buffered and ingested in batches to the database.
    
              Bases: WithClassInfo, SerialModel
Serialized fields of an app here whereas App contains non-serialized fields.
Attributes¶
class-attribute
      instance-attribute
  
¶
    Unique identifier for this app.
Computed deterministically from app_name and app_version. Leaving it here for it to be dumped when serializing. Also making it read-only as it should not be changed after creation.
instance-attribute
  
¶
app_version: AppVersion
Version tag for this app. Default is "base".
class-attribute
      instance-attribute
  
¶
feedback_definitions: Sequence[FeedbackDefinitionID] = []
Feedback functions to evaluate on each record.
class-attribute
      instance-attribute
  
¶
feedback_mode: FeedbackMode = WITH_APP_THREAD
How to evaluate feedback functions upon producing a record.
instance-attribute
  
¶
    Class of the main instrumented object.
Ideally this would be a ClassVar but since we want to check this without instantiating the subclass of AppDefinition that would define it, we cannot use ClassVar.
class-attribute
  
¶
root_callable: FunctionOrMethod
App's main method.
This is to be filled in by subclass.
class-attribute
      instance-attribute
  
¶
initial_app_loader_dump: Optional[SerialBytes] = None
Serialization of a function that loads an app.
Dump is of the initial app state before any invocations. This can be used to create a new session.
Warning
Experimental work in progress.
instance-attribute
  
¶
app_extra_json: JSON
Info to store about the app and to display in dashboard.
This can be used even if app itself cannot be serialized. app_extra_json,
then, can stand in place for whatever data the user might want to keep track
of about the app.
instance-attribute
  
¶
record_ingest_mode: RecordIngestMode = record_ingest_mode
Mode of records ingestion.
instance-attribute
  
¶
tru_class_info: Class
Class information of this pydantic object for use in deserialization.
Using this odd key to not pollute attribute names in whatever class we mix this into. Should be the same as CLASS_INFO.
Functions¶
staticmethod
  
¶
continue_session(
    app_definition_json: JSON, app: Any
) -> AppDefinition
Instantiate the given app with the given state
app_definition_json.
Warning
This is an experimental feature with ongoing work.
| PARAMETER | DESCRIPTION | 
|---|---|
| app_definition_json | The json serialized app. 
                  
                    TYPE:
                       | 
| app | The app to continue the session with. 
                  
                    TYPE:
                       | 
| RETURNS | DESCRIPTION | 
|---|---|
| AppDefinition | A new  | 
staticmethod
  
¶
new_session(
    app_definition_json: JSON,
    initial_app_loader: Optional[Callable] = None,
) -> AppDefinition
Create an app instance at the start of a session.
Warning
This is an experimental feature with ongoing work.
Create a copy of the json serialized app with the enclosed app being initialized to its initial state before any records are produced (i.e. blank memory).
staticmethod
  
¶
get_loadable_apps()
Gets a list of all of the loadable apps.
Warning
This is an experimental feature with ongoing work.
This is those that have initial_app_loader_dump set.
staticmethod
  
¶
load(obj, *args, **kwargs)
Deserialize/load this object using the class information in tru_class_info to lookup the actual class that will do the deserialization.
classmethod
  
¶
model_validate(*args, **kwargs) -> Any
Deserialized a jsonized version of the app into the instance of the class it was serialized from.
Note
This process uses extra information stored in the jsonized object and handled by WithClassInfo.