init
__all__ = ['AgentModel', 'CondenseSettingsModel', 'ConfigMetadataMixin', 'ConfigModelBase', 'ContextSettingsModel', 'ExampleConfigModel', 'LLMSettingsModel', 'LanggraphSettingsModel', 'OptionsModel', 'PersonalitySettingsModel']
module-attribute
AgentModel
Bases: ConfigModelBase
For storing information for a full Agent (e.g. options + tools etc.).
schema_class = AgentSchema
class-attribute
sub_assistants_names = mapped_column(StrArrayType)
class-attribute
instance-attribute
sub_assistants_types = mapped_column(StrArrayType)
class-attribute
instance-attribute
sub_assistants_user_ids = mapped_column(IntArrayType)
class-attribute
instance-attribute
tools = mapped_column(ToolsType)
class-attribute
instance-attribute
field_column_overrides()
classmethod
fully_load_model_options()
classmethod
model_from_schema(schema)
classmethod
to_schema(skip_validation=False)
CondenseSettingsModel
Bases: ConfigModelBase
schema_class = CondenseSettingsSchema
class-attribute
ConfigMetadataMixin
Model for storing metadata about a control group.
Note: backrefs made from ControlGroupModelBase (i.e. all ControlGroupModels make a backref to this model)
copied_from_name = mapped_column(String(100), nullable=True)
class-attribute
instance-attribute
copied_from_type
instance-attribute
name = mapped_column(String(100), nullable=True)
class-attribute
instance-attribute
type
instance-attribute
user_id = mapped_column(ForeignKey('users.id'), nullable=True)
class-attribute
instance-attribute
user_id_for_constraint = mapped_column(nullable=False, server_default='-1')
class-attribute
instance-attribute
__admin_repr__(request)
meta_to_schema()
Convert the SQLAlchemy model to the associated pydantic schema.
set_meta_from_schema(model, schema)
classmethod
Create a new model from the given schema.
ConfigModelBase
Bases: VersionedMixin, ConfigMetadataMixin, ModelWithSchema
__abstract__ = True
class-attribute
instance-attribute
id = mapped_column(primary_key=True)
class-attribute
instance-attribute
schema_class
class-attribute
__admin_repr__(request)
__init_subclass__(**kwargs)
classmethod
Set up the columns and relationships for the model based on the pydantic schema.
Schema determined by the schema_class class attribute.
__table_args__()
classmethod
__tablename__()
Generate predictable table names based on the schema class name.
Note: Refactoring class names will require alembic migrations to rename the tables
field_column_overrides()
classmethod
Override this method to define custom columns for fields in the schema.
Or to implement the fields that cannot be set up automatically.
Note: Set field to None to skip setting up a column for that field. Can then handle directly in the subclass.
Example:
@classmethod
def field_column_overrides(cls) -> dict[str, Column]:
return {
"some_field": Column(String(32), nullable=False)
}
model_from_schema(schema)
classmethod
Convert to a model.
to_schema(skip_validation=False)
Convert the SQLAlchemy model to the associated pydantic schema.
ContextSettingsModel
Bases: ConfigModelBase
schema_class = ContextSettingsSchema
class-attribute
ExampleConfigModel
Bases: ConfigModelBase
schema_class = ExampleConfigSchema
class-attribute
instance-attribute
field_column_overrides()
classmethod
LLMSettingsModel
Bases: ConfigModelBase
schema_class = LLMSettingsSchema
class-attribute
LanggraphSettingsModel
Bases: ConfigModelBase
schema_class = LanggraphSettingsSchema
class-attribute
OptionsModel
Bases: ConfigModelBase
Model equivalent of the OptionsSchema.
For storing the options that affect chat requests (e.g. when to condense messages, what to add to system prompt, etc.).
If the Options are a named set of options (e.g. a preset or user-defined set of options), then updating them will result in updated options for all chats that use them. This is possibly undesirable in some circumstances, but in general it is probably preferable (i.e. updates to options are likely to be positive even retroactively).
Unnamed options (e.g. modifications from default without saving under a name) are stored uniquely so that they will not change retroactively.
schema_class = OptionsSchema
class-attribute
uid = mapped_column(unique=True, index=True, default=lambda: uuid.uuid4())
class-attribute
instance-attribute
PersonalitySettingsModel
Bases: ConfigModelBase