@genesislcap/ai-assistant 15.111.1 → 15.111.2-forms-ai-prompt.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1243,6 +1243,21 @@ var GeminiProvider = class {
1243
1243
  return response.content;
1244
1244
  });
1245
1245
  }
1246
+ promptStructured(systemPrompt, userPrompt, responseSchema) {
1247
+ return __awaiter(this, void 0, void 0, function* () {
1248
+ const raw = yield this.transport.sendStructuredPrompt({
1249
+ systemPrompt,
1250
+ userPrompt,
1251
+ responseSchema
1252
+ });
1253
+ try {
1254
+ return JSON.parse(raw);
1255
+ } catch (e) {
1256
+ logger.error("GeminiProvider promptStructured: failed to parse JSON response", e, raw);
1257
+ throw new Error("AI returned malformed JSON");
1258
+ }
1259
+ });
1260
+ }
1246
1261
  chat(history, userMessage, options) {
1247
1262
  return __awaiter(this, void 0, void 0, function* () {
1248
1263
  return this.transport.sendChatMessage(history, userMessage, options);
@@ -1302,6 +1317,21 @@ var OpenAIProvider = class {
1302
1317
  return this.transport.sendChatMessage(history, userMessage, options);
1303
1318
  });
1304
1319
  }
1320
+ promptStructured(systemPrompt, userPrompt, responseSchema) {
1321
+ return __awaiter(this, void 0, void 0, function* () {
1322
+ const raw = yield this.transport.sendStructuredPrompt({
1323
+ systemPrompt,
1324
+ userPrompt,
1325
+ responseSchema
1326
+ });
1327
+ try {
1328
+ return JSON.parse(raw);
1329
+ } catch (e) {
1330
+ logger.error("OpenAIProvider promptStructured: failed to parse JSON response", e, raw);
1331
+ throw new Error("AI returned malformed JSON");
1332
+ }
1333
+ });
1334
+ }
1305
1335
  };
1306
1336
 
1307
1337
  // ../../foundation-ai/dist/esm/types/config.types.js