Skip to content

Commit e7842df

Browse files
authored
fix(AI field): fix KeyError exception generating AI formula (baserow#4505)
1 parent 83ac7d7 commit e7842df

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "bug",
3+
"message": "Handle KeyError exception when generating formulas with AI.",
4+
"issue_origin": "github",
5+
"issue_number": null,
6+
"domain": "database",
7+
"bullet_points": [],
8+
"created_at": "2025-12-24"
9+
}

premium/backend/src/baserow_premium/fields/handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def generate_formula_with_ai(
7373
)
7474
try:
7575
return output_parser.parse(response)["formula"]
76-
except (OutputParserException, TypeError) as e:
76+
except (OutputParserException, TypeError, KeyError) as e:
7777
raise AiFieldOutputParserException(
78-
"The model didn't respond with the correct output. " "Please try again."
78+
"The model didn't respond with the correct output. Please try again."
7979
) from e

0 commit comments

Comments
 (0)