A FastAPI backend for Generative Engine Optimization (GEO) auditing of educational course companies.
- AI Answer Audit: Analyzes Perplexity AI answers for brand and competitor mentions
- Web Evidence Collection: Gathers data from web sources using Tavily API
- Fact-Check Pass: Verifies factual claims about the brand
- Reasoning Analysis: Uses CrewAI with Gemini to generate explanations and recommendations
- Aggregate Scoring: Computes brand mention rates, competitor share, hallucination rates
- Install dependencies:
pip install -r requirements.txt- Set environment variables (optional, defaults provided):
export PERPLEXITY_API_KEY="your-key"
export TAVILY_API_KEY="your-key"
export GEMINI_API_KEY="your-key"- Run the server:
python main.py
# or
uvicorn main:app --reloadInteractive API documentation (Swagger UI).
Health check endpoint.
{
"status": "ok"
}Run a GEO audit for a brand.
Request:
{
"brand_name": "Coursera",
"brand_url": "https://www.coursera.org",
"queries": [
"best online courses for data science",
"top educational platforms"
],
"competitors": ["edX", "Udemy"]
}Response: See the API specification in the code for the full response structure.
main.py: FastAPI application and endpointsservices/perplexity_service.py: Perplexity API integrationservices/tavily_service.py: Tavily search and extract API integrationservices/crewai_service.py: CrewAI agent with Gemini for reasoningservices/audit_processor.py: Main audit workflow orchestration