190proof 1.0.29 → 1.0.31

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.js CHANGED
@@ -31702,12 +31702,15 @@ async function callOpenAIStream(identifier, openAiPayload, openAiConfig, chunkTi
31702
31702
  continue;
31703
31703
  }
31704
31704
  const toolCall = (_a3 = json.choices[0].tool_calls) == null ? void 0 : _a3[0];
31705
- if ((toolCall == null ? void 0 : toolCall.index) !== void 0 && toolCall.index === 0) {
31706
- const dFn = toolCall.function;
31707
- if (dFn.name)
31708
- functionCallName += dFn.name;
31709
- if (dFn.arguments)
31710
- functionCallArgs += dFn.arguments;
31705
+ if (toolCall) {
31706
+ const toolCallIndex = toolCall.index || 0;
31707
+ if (toolCallIndex === 0) {
31708
+ const dFn = toolCall.function || {};
31709
+ if (dFn.name)
31710
+ functionCallName += dFn.name;
31711
+ if (dFn.arguments)
31712
+ functionCallArgs += dFn.arguments;
31713
+ }
31711
31714
  }
31712
31715
  const text = (_d = (_c = (_b = json.choices) == null ? void 0 : _b[0]) == null ? void 0 : _c.delta) == null ? void 0 : _d.content;
31713
31716
  if (text) {