Service
logger = logging.getLogger(__name__)
module-attribute
AbstractConversationUnitOfWork
Bases: AbstractDatabaseUnitOfWork, ABC
repository
instance-attribute
SessionDatabaseConversationUnitOfWork
Bases: SessionDatabaseUnitOfWork, AbstractConversationUnitOfWork
repository_class = SQLConversationRepository
class-attribute
instance-attribute
branch(conv_uow, conv_id)
async
Create a new branch conversation from the given conversation.
I.e., a new instance of the conversation (with new uid) that shares the same history as the original conversation. New: - conversation_uid - version reset to 0 - title: [branched] + original title
Same: - message_history - default_assistant - (pending)assistant_runs - created_at/last_updated at - etc.
complete_assistant_run(uow, assistant_run, sub_assistant_state_datas=None)
async
Saves the completed assistant run to the conversation (or branched conversation).
Moves assistant run from pending to completed in the conversation.
If the assistant run is behind the conversation, a new branch is created, and it is added to that.
create(uow, schema)
async
create_new_assistant_run(uow, assistant_run_uow, conv_id)
async
Creates a new assistant run for the conversation (adding to pending assistant runs).
Returns the updated conversation and new assistant run.