190proof 1.0.37 → 1.0.38

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
@@ -31580,6 +31580,19 @@ async function callOpenAIStream(identifier, openAiPayload, openAiConfig, chunkTi
31580
31580
  }
31581
31581
  const azureConfig = openAiConfig.modelConfigMap[model];
31582
31582
  const endpoint = `${openAiConfig.baseUrl}/azure-openai/${azureConfig.resource}/${azureConfig.deployment}/chat/completions?api-version=${azureConfig.apiVersion}`;
31583
+ try {
31584
+ const stringifiedPayload = JSON.stringify({
31585
+ ...openAiPayload,
31586
+ stream: true
31587
+ });
31588
+ const parsedPayload = JSON.parse(stringifiedPayload);
31589
+ } catch (error) {
31590
+ console.error(
31591
+ identifier,
31592
+ "Stream error: Azure OpenAI JSON parsing error:",
31593
+ JSON.stringify(error)
31594
+ );
31595
+ }
31583
31596
  response = await fetch(endpoint, {
31584
31597
  method: "POST",
31585
31598
  headers: {
@@ -31690,7 +31703,7 @@ async function callOpenAIStream(identifier, openAiPayload, openAiConfig, chunkTi
31690
31703
  console.error(
31691
31704
  identifier,
31692
31705
  "Stream error: OpenAI error:",
31693
- json.error
31706
+ json.error && JSON.stringify(json.error)
31694
31707
  );
31695
31708
  const error = new Error("Stream error: OpenAI error");
31696
31709
  error.data = json.error;