summaryrefslogtreecommitdiff
path: root/src/engine/aiGenerator.ts
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-18 23:23:25 -0500
committerChristian Cleberg <[email protected]>2026-04-18 23:23:25 -0500
commit5d356671364305b590447da577602b3cc55b7179 (patch)
tree32e0fda957b8d07a210ca2107fd109bbb9da0745 /src/engine/aiGenerator.ts
parent6f904cff030f5a5c714af4a38f72b9640a7b62e5 (diff)
downloadbrand-bench-5d356671364305b590447da577602b3cc55b7179.tar.gz
brand-bench-5d356671364305b590447da577602b3cc55b7179.tar.bz2
brand-bench-5d356671364305b590447da577602b3cc55b7179.zip
adjust for ai output structures
Diffstat (limited to 'src/engine/aiGenerator.ts')
-rw-r--r--src/engine/aiGenerator.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/engine/aiGenerator.ts b/src/engine/aiGenerator.ts
index 5648ec9..bd66549 100644
--- a/src/engine/aiGenerator.ts
+++ b/src/engine/aiGenerator.ts
@@ -75,7 +75,10 @@ function buildUserPrompt(inputs: BrandInputs): string {
function validate(raw: unknown): BrandOutputs {
const result = sanitizeOutputs(raw);
- if (!result) throw new Error('Response is not a valid brand output object');
+ if (!result) {
+ const preview = JSON.stringify(raw)?.slice(0, 300) ?? '(unparseable)';
+ throw new Error(`Model returned an unexpected structure. Try a larger model.\n\nGot: ${preview}`);
+ }
return result;
}