From cb5bfa3d29e08a39bbda9f1f06af7dac8c73381a Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Wed, 27 Nov 2024 11:59:32 +0100 Subject: [PATCH] wip enhance name and docstring --- src/summary/summary/celery_worker.py | 11 +++++++++-- src/summary/summary/main.py | 6 ++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/summary/summary/celery_worker.py b/src/summary/summary/celery_worker.py index 213ba699..768f34e6 100644 --- a/src/summary/summary/celery_worker.py +++ b/src/summary/summary/celery_worker.py @@ -61,8 +61,15 @@ def post_with_retries(url, data): @celery.task(max_retries=1) -def send_push_notification(filename: str, email: str, sub: str): - """Mock push notification.""" +def process_audio_transcribe_summarize(filename: str, email: str, sub: str): + """Process an audio file by transcribing it and generating a summary. + + This Celery task performs the following operations: + 1. Retrieves the audio file from MinIO storage + 2. Transcribes the audio using OpenAI-compliant API's ASR model + 3. Generates a summary of the transcription using OpenAI-compliant API's LLM + 4. Sends the results via webhook + """ logger.info("Notification received") logger.debug("filename: %s", filename) diff --git a/src/summary/summary/main.py b/src/summary/summary/main.py index ca6d72fb..3673796e 100644 --- a/src/summary/summary/main.py +++ b/src/summary/summary/main.py @@ -4,7 +4,7 @@ from celery.result import AsyncResult from fastapi import Depends, FastAPI from pydantic import BaseModel -from .celery_worker import send_push_notification +from .celery_worker import process_audio_transcribe_summarize from .security import verify_token app = FastAPI() @@ -33,7 +33,9 @@ class NotificationRequest(BaseModel): @app.post("/push") async def notify(request: NotificationRequest, token: str = Depends(verify_token)): """Push a notification.""" - task = send_push_notification.delay(request.filename, request.email, request.sub) + task = process_audio_transcribe_summarize.delay( + request.filename, request.email, request.sub + ) return {"task_id": task.id, "message": "Notification sent"}