190proof 1.0.15 → 1.0.17

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.
package/dist/index.mjs CHANGED
@@ -31520,6 +31520,7 @@ async function callOpenAiWithRetries(identifier, openAiPayload, openAiConfig, re
31520
31520
  openAiPayload.function_call = "none";
31521
31521
  }
31522
31522
  }
31523
+ console.error(error);
31523
31524
  console.error(
31524
31525
  identifier,
31525
31526
  `Retrying due to error: received bad response from OpenAI API [${openAiConfig == null ? void 0 : openAiConfig.service}-${openAiPayload.model}-${openAiConfig == null ? void 0 : openAiConfig.orgId}]: ${error.message} - ${JSON.stringify((_b = error.response) == null ? void 0 : _b.data)}`
@@ -31537,6 +31538,7 @@ async function callOpenAiWithRetries(identifier, openAiPayload, openAiConfig, re
31537
31538
  );
31538
31539
  }
31539
31540
  async function callOpenAIStream(identifier, openAiPayload, openAiConfig, chunkTimeoutMs) {
31541
+ var _a3, _b, _c, _d, _e, _f;
31540
31542
  const functionNames = openAiPayload.functions ? new Set(openAiPayload.functions.map((fn) => fn.name)) : null;
31541
31543
  if (!openAiConfig) {
31542
31544
  const defaultOpenAIBaseUrl = (
@@ -31676,14 +31678,14 @@ async function callOpenAIStream(identifier, openAiPayload, openAiConfig, chunkTi
31676
31678
  );
31677
31679
  continue;
31678
31680
  }
31679
- const dFn = json.choices[0].delta.function_call;
31681
+ const dFn = (_c = (_b = (_a3 = json.choices) == null ? void 0 : _a3[0]) == null ? void 0 : _b.delta) == null ? void 0 : _c.function_call;
31680
31682
  if (dFn) {
31681
31683
  if (dFn.name)
31682
31684
  functionCallName += dFn.name;
31683
31685
  if (dFn.arguments)
31684
31686
  functionCallArgs += dFn.arguments;
31685
31687
  }
31686
- const text = json.choices[0].delta.content;
31688
+ const text = (_f = (_e = (_d = json.choices) == null ? void 0 : _d[0]) == null ? void 0 : _e.delta) == null ? void 0 : _f.content;
31687
31689
  if (text) {
31688
31690
  paragraph += text;
31689
31691
  }