Coverage for mindsdb / integrations / libs / realtime_chat_handler.py: 0%
13 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-21 00:36 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-21 00:36 +0000
1from typing import Callable
3from mindsdb.interfaces.chatbot.chatbot_message import ChatBotMessage
4from mindsdb.interfaces.chatbot.chatbot_response import ChatBotResponse
7class RealtimeChatHandler:
8 """Interface to send and receive messages over a chat application (Slack, RocketChat, etc)"""
10 def __init__(self, name: str, on_message: Callable[[ChatBotMessage], None]):
11 self.name = name
12 # Should be called every time a message is received.
13 self.on_message = on_message
15 def connect(self):
16 """Connects to chat application and starts listening for messages."""
17 raise NotImplementedError()
19 def disconnect(self):
20 """Disconnects from the chat application and stops listening for messages."""
21 raise NotImplementedError()
23 def send_message(self, message: ChatBotMessage) -> ChatBotResponse:
24 """
25 Sends a message through the chat application
27 Parameters:
28 message (ChatBotMessage): Message to send
30 Returns:
31 response (ChatBotResponse): Response indicating whether the message was sent successfully
32 """
33 raise NotImplementedError()