Session
Session¶
BaseMessage¶
director.core.session.BaseMessage
pydantic-model
¶
Bases: BaseModel
Base message class for the input/output message. All the input/output messages will be inherited from this class.
Config:
arbitrary_types_allowed:Trueuse_enum_values:Truevalidate_default:True
Fields:
-
session_id(str) -
conv_id(str) -
msg_type(MsgType) -
actions(List[str]) -
agents(List[str]) -
content(List[Union[dict, TextContent, ImageContent, VideoContent, VideosContent, SearchResultsContent]]) -
status(MsgStatus) -
msg_id(str)
InputMessage¶
director.core.session.InputMessage
pydantic-model
¶
Bases: BaseMessage
Input message from the user. This class is used to create the input message from the user.
Output Message¶
director.core.session.OutputMessage
pydantic-model
¶
Bases: BaseMessage
Output message from the director. This class is used to create the output message from the director.
Fields:
-
db(BaseDB) -
msg_type(MsgType) -
status(MsgStatus)
Context Message¶
director.core.session.ContextMessage
pydantic-model
¶
Bases: BaseModel
Context message class. This class is used to create the context message for the reasoning context.
Config:
arbitrary_types_allowed:Truevalidate_default:Trueuse_enum_values:True
Fields:
-
content(Optional[Union[List[dict], str]]) -
tool_calls(Optional[List[dict]]) -
tool_call_id(Optional[str]) -
role(RoleTypes)
to_llm_msg
¶
Convert the context message to the llm message.
Source code in backend/director/core/session.py
Session¶
director.core.session.Session
¶
A class to manage and interact with a session in the database. The session is used to store the conversation and reasoning context messages.
Source code in backend/director/core/session.py
save_context_messages
¶
Save the reasoning context messages to the database.
Source code in backend/director/core/session.py
get_context_messages
¶
Get the reasoning context messages from the database.
Source code in backend/director/core/session.py
create
¶
new_message
¶
Returns a new input/output message object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
msg_type |
MsgType
|
The type of the message, input or output. |
output
|
kwargs |
dict
|
The message attributes. |
{}
|
Returns:
| Type | Description |
|---|---|
Union[InputMessage, OutputMessage]
|
The input/output message object. |
Source code in backend/director/core/session.py
get
¶
Get the session from the database.
get_all
¶
delete
¶
emit_event
¶
Emits a structured WebSocket event to notify all clients about updates.