Skip to content

Service

logger = logging.getLogger(__name__) module-attribute

AbstractAssistantRunUOW

Bases: AbstractDatabaseUnitOfWork, ABC

repository instance-attribute

AssistantRunnerDeps dataclass

assistant_run_uow instance-attribute

conv_uow instance-attribute

lg_client instance-attribute

message_search_uow instance-attribute

read_only_uow instance-attribute

updatable instance-attribute

__init__(read_only_uow, lg_client, updatable, assistant_run_uow, conv_uow, message_search_uow)

AssistantRunnerInput dataclass

interrupt_after = None class-attribute instance-attribute

interrupt_before = None class-attribute instance-attribute

resuming instance-attribute

run instance-attribute

sub_assistant_run_info instance-attribute

thread_uid instance-attribute

user_input instance-attribute

__init__(run, thread_uid, user_input, sub_assistant_run_info, resuming, interrupt_before=None, interrupt_after=None)

SessionDatabaseAssistantRunUOW

Bases: SessionDatabaseUnitOfWork, AbstractAssistantRunUOW

repository_class = SQLAssistantRunRepository class-attribute

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