@@ -35,11 +35,11 @@ def __init__(self):
3535 )
3636 self .models = list (config .LLM_MODELS )
3737
38- self ._groq_client = None
39- if config .GROQ_API_KEY :
40- self ._groq_client = OpenAI (
41- api_key = config .GROQ_API_KEY ,
42- base_url = config .GROQ_BASE_URL ,
38+ self ._gemini_client = None
39+ if config .GEMINI_API_KEY :
40+ self ._gemini_client = OpenAI (
41+ api_key = config .GEMINI_API_KEY ,
42+ base_url = config .GEMINI_BASE_URL ,
4343 )
4444
4545 def _call_llm (self , client : OpenAI , model : str ,
@@ -69,7 +69,7 @@ def _call_llm(self, client: OpenAI, model: str,
6969 def summarize (self , title : str , content : str ) -> tuple [str , str ]:
7070 """Summarize lecture content, trying multiple models on failure.
7171
72- If all primary models fail due to content policy, falls back to Groq .
72+ If all primary models fail due to content policy, falls back to Gemini .
7373
7474 Returns:
7575 (summary, model_used) tuple.
@@ -91,18 +91,18 @@ def summarize(self, title: str, content: str) -> tuple[str, str]:
9191 if _is_content_blocked (e ):
9292 content_blocked = True
9393
94- # Fallback: Groq models (when content policy blocks primary models)
95- if content_blocked and self ._groq_client :
96- print ("[Summarizer] Content blocked by primary platform, trying Groq ..." )
97- for model in config .GROQ_MODELS :
94+ # Fallback: Gemini models (when content policy blocks primary models)
95+ if content_blocked and self ._gemini_client :
96+ print ("[Summarizer] Content blocked by primary platform, trying Gemini ..." )
97+ for model in config .GEMINI_MODELS :
9898 try :
9999 result = self ._call_llm (
100- self ._groq_client , model , title , content ,
100+ self ._gemini_client , model , title , content ,
101101 )
102- return (result , f"groq /{ model } " )
102+ return (result , f"gemini /{ model } " )
103103 except Exception as e :
104- print (f"[Summarizer] groq /{ model } failed: { type (e ).__name__ } : { e } " )
105- errors .append (f"groq /{ model } : { e } " )
104+ print (f"[Summarizer] gemini /{ model } failed: { type (e ).__name__ } : { e } " )
105+ errors .append (f"gemini /{ model } : { e } " )
106106
107107 raise RuntimeError (
108108 "All LLM models failed:\n " + "\n " .join (errors )
0 commit comments