From 133b3f1d50f9c291683baa5d2845efe6658e0e4d Mon Sep 17 00:00:00 2001 From: thecyberlearn Date: Fri, 5 Sep 2025 08:51:50 +0530 Subject: [PATCH] Fix groq initialization by using lazy loading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Comment out global analyzer instance creation at import time - Create BrandPresenceAnalyzer only when analyze_brand_presence() is called - This prevents groq client initialization during Django import phase - Resolves TypeError with proxies argument on module import 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- agents/brand_presence_analyzer.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/agents/brand_presence_analyzer.py b/agents/brand_presence_analyzer.py index 9c697fb..840c5be 100644 --- a/agents/brand_presence_analyzer.py +++ b/agents/brand_presence_analyzer.py @@ -191,8 +191,8 @@ IMPORTANT: } } -# Global analyzer instance -analyzer = BrandPresenceAnalyzer() +# Global analyzer instance - commented out to avoid import-time initialization +# analyzer = BrandPresenceAnalyzer() def analyze_brand_presence(brand_name: str, website_url: str) -> Dict[str, Any]: """ @@ -205,4 +205,6 @@ def analyze_brand_presence(brand_name: str, website_url: str) -> Dict[str, Any]: Returns: Analysis results dictionary """ + # Create analyzer instance when needed to avoid import-time initialization + analyzer = BrandPresenceAnalyzer() return analyzer.analyze_brand_presence(brand_name, website_url) \ No newline at end of file