trygithubactions / api /routers /show_analytics.py
subashpoudel's picture
Implemented the analytics too in orchestrator
8ce97f0
import logging
from fastapi import APIRouter
from api.stored_data import stored_data
from src.genai.orchestration_agent.utils.utils import AnalyticsViewer
app_logger = logging.getLogger("app_logger")
error_logger = logging.getLogger("error_logger")
router=APIRouter()
@router.get("/show-analytics")
def show_analytics_endpoint():
try:
response = AnalyticsViewer(stored_data['business_details']).show_analytics()
app_logger.info('Influencer Analytics returned by orchestrator.')
return {'response': response}
except Exception as e:
error_logger.error(f'Unable to extract influencer analytics: {e}')
raise