Siteshcodes commited on
Commit
e48bc80
Β·
1 Parent(s): ff6527e

remove silent fallback in call_model

Browse files
Files changed (1) hide show
  1. inference.py +23 -33
inference.py CHANGED
@@ -106,39 +106,29 @@ def format_bug(obs) -> str:
106
 
107
 
108
  def call_model(client: OpenAI, bug_text: str) -> TriageAction:
109
- try:
110
- completion = client.chat.completions.create(
111
- model=MODEL_NAME,
112
- messages=[
113
- {"role": "system", "content": SYSTEM_PROMPT},
114
- {"role": "user", "content": bug_text},
115
- ],
116
- temperature=TEMPERATURE,
117
- max_tokens=MAX_TOKENS,
118
- stream=False,
119
- )
120
- raw = (completion.choices[0].message.content or "").strip()
121
- if raw.startswith("```"):
122
- raw = raw.split("```")[1]
123
- if raw.startswith("json"):
124
- raw = raw[4:]
125
- data = json.loads(raw)
126
- return TriageAction(
127
- priority=data.get("priority", "P2"),
128
- labels=data.get("labels", ["bug"]),
129
- assigned_team=data.get("assigned_team", "backend"),
130
- milestone=data.get("milestone", "backlog"),
131
- reasoning=data.get("reasoning", ""),
132
- )
133
- except Exception as exc:
134
- print(f"[DEBUG] model call failed: {exc}", flush=True)
135
- return TriageAction(
136
- priority="P2",
137
- labels=["bug"],
138
- assigned_team="backend",
139
- milestone="backlog",
140
- reasoning="fallback due to model error",
141
- )
142
 
143
 
144
  # ── main ──────────────────────────────────────────────────────────────────
 
106
 
107
 
108
  def call_model(client: OpenAI, bug_text: str) -> TriageAction:
109
+ completion = client.chat.completions.create(
110
+ model=MODEL_NAME,
111
+ messages=[
112
+ {"role": "system", "content": SYSTEM_PROMPT},
113
+ {"role": "user", "content": bug_text},
114
+ ],
115
+ temperature=TEMPERATURE,
116
+ max_tokens=MAX_TOKENS,
117
+ stream=False,
118
+ )
119
+ raw = (completion.choices[0].message.content or "").strip()
120
+ if raw.startswith("```"):
121
+ raw = raw.split("```")[1]
122
+ if raw.startswith("json"):
123
+ raw = raw[4:]
124
+ data = json.loads(raw)
125
+ return TriageAction(
126
+ priority=data.get("priority", "P2"),
127
+ labels=data.get("labels", ["bug"]),
128
+ assigned_team=data.get("assigned_team", "backend"),
129
+ milestone=data.get("milestone", "backlog"),
130
+ reasoning=data.get("reasoning", ""),
131
+ )
 
 
 
 
 
 
 
 
 
 
132
 
133
 
134
  # ── main ──────────────────────────────────────────────────────────────────