Assistants & Copilotes
Chatbots contextuels (support) et copilotes admin (actions contrôlées).
DRF · Tools/Function calling · Audit ROI: très élevé Effort: moyen Complexité: moyenne
Architecture de référence
UI chat → /api/assistant → Router intents → Tools (lecture DB, création ticket) → Journalisation & approbations.
Quick Wins
tool: get_order_status python
def get_order_status(user, order_id: int):
# check ownership + requête read-only
return {'id': order_id, 'status': 'shipped'}views.py — /api/assistant python
from rest_framework.decorators import api_view
from rest_framework.response import Response
@api_view(['POST'])
def assistant(request):
msg = request.data.get('msg','')
# 1) classer intent ; 2) appeler tool ; 3) formater réponse
return Response({'reply': '…', 'actions': []})