Consumers
In Django Polly, consumers are responsible for handling WebSocket connections and facilitating real-time communication between users and AI models (Parrots).
SmartGPTConsumer
The SmartGPTConsumer is the primary consumer class in Django Polly. It handles WebSocket connections for chat functionality.
Key Features:
Asynchronous message handling
Integration with LLM API for AI responses
Management of SmartConversations
Usage Example:
from django_polly.consumers import SmartGPTConsumer
class MyChatConsumer(SmartGPTConsumer):
async def receive(self, text_data):
# Custom logic here
await super().receive(text_data)
SmartGPTConsumerAdmin
The SmartGPTConsumerAdmin extends SmartGPTConsumer with additional functionality for administrative users.
Key Features:
Enhanced control and monitoring capabilities
Access to advanced LLM parameters
Ability to manage multiple conversations
For more details on implementing and customizing consumers, see the API reference.