Skip to content

init

__all__ = ['AbstractAssistantRunRepository', 'AbstractAssistantRunUOW', 'AssistantRunID', 'create', 'new_assistant_run', 'resume_assistant_run'] module-attribute

AbstractAssistantRunRepository

Bases: RepositoryBase[AssistantRunSchema, AssistantRunID], ABC

update_conversation_with_run(conv_uow, conversation_id, assistant_run) async

AbstractAssistantRunUOW

Bases: AbstractDatabaseUnitOfWork, ABC

repository instance-attribute

AssistantRunID

Bases: UniqueIDBase[AssistantRunSchema]

thread_uid instance-attribute

equal_excluding_version_and_deletion(other)

from_schema(schema, exact_version=False) classmethod

create(uow, schema) async

new_assistant_run(assistant_run_uow, conv_uow, read_only_uow, message_search_uow, lg_client, updatable, conversation_id, user_input, interrupt_before=None, interrupt_after=None) async

Run an assistant from scratch (i.e. not a continuation of partially completed run).

This starts a new thread in langgraph. The thread can be resumed later if interrupted.

  • Initializes (creating new pending run on conversation)
  • Runs the assistant
PARAMETER DESCRIPTION
assistant_run_uow

UOW for AssistantRun

TYPE: AbstractAssistantRunUOW

conv_uow

UOW for conversation services (for creating a new assistant_run, and updating conversation at the end)

TYPE: AbstractConversationUnitOfWork

read_only_uow

UOW for read-only services

TYPE: AbstractReadOnlyUnitOfWork

message_search_uow

UOW for message search services

TYPE: MessageSearchUnitOfWork

lg_client

LangGraphClient

TYPE: LGClientProtocol

updatable

Any updatable that will receive updates during the run

TYPE: UpdatableProtocol

conversation_id

Database ID of the conversation

TYPE: ConvID

user_input

User input for the assistant_run

TYPE: str

interrupt_before

Nodes to interrupt before

TYPE: list[str] | None DEFAULT: None

interrupt_after

Nodes to interrupt

TYPE: list[str] | None DEFAULT: None

RETURNS DESCRIPTION
AssistantRunSchema

The new assistant_run schema

TYPE: AssistantRunSchema

resume_assistant_run(assistant_run_uow, conv_uow, read_only_uow, message_search_uow, lg_client, updatable, conversation_id, thread_uid, additional_inputs, interrupt_before=None, interrupt_after=None) async

Resumes a previously interrupted assistant_run.

Effectively resumes the thread in langgraph.

PARAMETER DESCRIPTION
assistant_run_uow

UOW for AssistantRun

TYPE: AbstractAssistantRunUOW

conv_uow

UOW for conversation services (for updating conversation at the end)

TYPE: AbstractConversationUnitOfWork

read_only_uow

UOW for read-only services

TYPE: AbstractReadOnlyUnitOfWork

message_search_uow

UOW for message search services

TYPE: MessageSearchUnitOfWork

lg_client

LangGraphClient

TYPE: LGClientProtocol

updatable

Any updatable that will receive updates during the run

TYPE: UpdatableProtocol

conversation_id

Database ID of the conversation

TYPE: ConvID

thread_uid

The thread ID of the assistant_run to resume

TYPE: UUID | str

additional_inputs

Any additional inputs to resume graph with (i.e. updates to state on resume)

TYPE: str | None

interrupt_before

Nodes to interrupt before

TYPE: list[str] | None DEFAULT: None

interrupt_after

Nodes to interrupt

TYPE: list[str] | None DEFAULT: None