MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / initialize_ai_service

Method initialize_ai_service

shared.py:323–346  ·  view source on GitHub ↗

Initialize the AI service

(self)

Source from the content-addressed store, hash-verified

321 from network_intelligence import NetworkIntelligence
322 self.network_intelligence = NetworkIntelligence(self)
323 logger.info("Network intelligence system initialized successfully")
324 except Exception as e:
325 logger.error(f"Failed to initialize network intelligence: {e}")
326 self.network_intelligence = None
327
328 def initialize_ai_service(self):
329 """Initialize the AI service"""
330 try:
331 from ai_service import AIService
332 logger.info("Attempting to initialize AI service...")
333 self.ai_service = AIService(self)
334 if self.ai_service.is_enabled():
335 logger.info("AI service initialized successfully with GPT-5 Nano")
336 else:
337 init_error = getattr(self.ai_service, 'initialization_error', None)
338 if init_error:
339 logger.warning(f"AI service initialized but not enabled: {init_error}")
340 else:
341 logger.info("AI service initialized but not enabled (check configuration)")
342 except ImportError as e:
343 logger.error(f"Failed to import AI service module: {e}")
344 import traceback
345 logger.error(traceback.format_exc())
346 self.ai_service = None
347 except Exception as e:
348 logger.error(f"Failed to initialize AI service: {e}")
349 import traceback

Callers 4

_deferred_initMethod · 0.95
update_configFunction · 0.80
get_ai_statusFunction · 0.80

Calls 5

AIServiceClass · 0.90
infoMethod · 0.80
warningMethod · 0.80
errorMethod · 0.80
is_enabledMethod · 0.45

Tested by

no test coverage detected