wip enhance name and docstring

This commit is contained in:
lebaudantoine
2024-11-29 17:51:44 +01:00
parent 2e50ae5bba
commit cb5bfa3d29
2 changed files with 13 additions and 4 deletions
+9 -2
View File
@@ -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)
+4 -2
View File
@@ -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"}