Chat

D-Bus interfaces that defines and powers our commands.

class ChatInterface(implementation)[source]

The DBus interface of a query.

Constructor of the class

Parameters:

implementation (DaemonContext) – The implementation context to be used in an interface.

AskQuestion(user_id, message_input)[source]

This method is mainly called by the client to retrieve it’s answer.

Return type:

Dict[str, Variant]

Parameters:
  • user_id (Str) – The identifier of the user.

  • message_input (Structure) – The message input in format of a d-bus structure.

Returns:

The message output in format of a d-bus structure.

Return type:

Structure

CreateChat(user_id, name, description)[source]

Create a new chat session for a given conversation.

Return type:

str

Parameters:
  • user_id (Str) – The identifier of the user.

  • name (Str) – The name of the chat. If not specified, a random name will be given.

  • description (Str) – A description for the chat to identify the context of it.

Returns:

The identifier of the chat session.

Return type:

Str

DeleteAllChatForUser(user_id)[source]

Delete all chats from the user.

Return type:

None

Parameters:

user_id (Str) – The identifier of the user.

Raises:

ChatNotFoundError – In case no chat was found for the current user.

DeleteChatForUser(user_id, name)[source]

Delete a specific chat for a user.

Return type:

None

Parameters:
  • user_id (Str) – The identifier of the user.

  • name (Str) – The name of the chat.

Raises:

ChatNotFoundError – In case no chat was found with the given name for the current user.

GetAllChatFromUser(user_id)[source]

Get all the chat session for a given user.

Return type:

Dict[str, Variant]

Parameters:

user_id (Str) – The identifier of the user.

Returns:

The list of chat sessions.

Return type:

Structure

GetChatId(user_id, name)[source]

Get the chat id for a given user and chat name.

Return type:

str

Parameters:
  • user_id (Str) – The identifier of the user.

  • name (Str) – The name of the chat.

Raises:

ChatNotFound – If the chat is not found.

Returns:

The identifier of the chat session.

Return type:

Str

GetLatestChatFromUser(user_id)[source]

Get the latest chat session for a given user.

Return type:

str

Parameters:

user_id (Str) – The identifier of the user.

Returns:

The identifier of the chat session.

Return type:

Str

IsChatAvailable(user_id, name)[source]

Check if a chat session is available for a given user.

Return type:

bool

Parameters:
  • user_id (Str) – The identifier of the user.

  • name (Str) – The name of the chat.

Returns:

True if the chat session is available, False otherwise.

Return type:

bool

_abc_impl = <_abc._abc_data object>
_verify_caller_authorization(sender, requested_user_id)[source]

Verify that the caller is authorized to access the requested user’s data.

Return type:

None

Parameters:
  • sender – The D-Bus sender.

  • requested_user_id (str) – The user ID being requested in the method call.

Raises:

PermissionError – If the caller’s user ID doesn’t match the requested user ID.

class InferencePayload(content)[source]

The payload to be submitted to the backend for inference.

content: Question
to_dict()[source]

Turn content into dictionary for submission to the backend.

Return type:

dict[str, Any]

Returns:

The content in dictionary format.

Return type:

dict[str, Any]