-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathllm.py
More file actions
22 lines (19 loc) · 670 Bytes
/
Copy pathllm.py
File metadata and controls
22 lines (19 loc) · 670 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from google import genai
import os
client = genai.Client(api_key=os.getenv("GEMINI_API_KEY"))
def suggest_label(issue: dict) -> str:
try:
prompt = (
f"Given this GitHub issue, suggest one label from this list: "
f"bug, enhancement, documentation, question.\n\n"
f"Title: {issue['title']}\n"
f"Body: {issue['body']}\n\n"
f"Reply with just the label name."
)
response = client.models.generate_content(
model="gemini-1.5-flash-8b",
contents=prompt
)
return (response.text or "question").strip()
except Exception:
return "question"