File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,23 +34,24 @@ def _zero_shot(prompt: str) -> str:
3434 Core LLM call function to summarize repository topics using a zero-shot prompt.
3535 Returns a direct text summary.
3636 """
37- client = openai .OpenAI (
38- api_key = os .getenv ("OPENAI_API_KEY" ),
39- base_url = os .getenv ("OPENAI_BASE_URL" ),
40- )
41-
42- chat_completion = client .chat .completions .create (
43- messages = [
44- {
45- 'role' : 'user' ,
46- 'content' : prompt ,
47- }
48- ],
49- model = os .getenv ("MODEL_NAME" , "qwen-plus" ),
50- )
51-
52- summary = chat_completion .choices [0 ].message .content
53- return summary .strip () if summary else UNKNOWN_SUMMARY
37+ try :
38+ client = openai .OpenAI (
39+ api_key = os .getenv ("OPENAI_API_KEY" ),
40+ base_url = os .getenv ("OPENAI_BASE_URL" ),
41+ )
42+ chat_completion = client .chat .completions .create (
43+ messages = [
44+ {
45+ 'role' : 'user' ,
46+ 'content' : prompt ,
47+ }
48+ ],
49+ model = os .getenv ("MODEL_NAME" , "qwen-plus" ),
50+ )
51+ content = chat_completion .choices [0 ].message .content
52+ return content .strip () if content else UNKNOWN_SUMMARY
53+ except Exception :
54+ return UNKNOWN_SUMMARY
5455
5556def summarize_repos_for_working (repos : List [Dict [str , str ]]) -> str :
5657 """
You can’t perform that action at this time.
0 commit comments