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.js CHANGED
@@ -31586,6 +31586,19 @@ async function callOpenAIStream(identifier, openAiPayload, openAiConfig, chunkTi
31586
31586
  }
31587
31587
  const azureConfig = openAiConfig.modelConfigMap[model];
31588
31588
  const endpoint = `${openAiConfig.baseUrl}/azure-openai/${azureConfig.resource}/${azureConfig.deployment}/chat/completions?api-version=${azureConfig.apiVersion}`;
31589
+ try {
31590
+ const stringifiedPayload = JSON.stringify({
31591
+ ...openAiPayload,
31592
+ stream: true
31593
+ });
31594
+ const parsedPayload = JSON.parse(stringifiedPayload);
31595
+ } catch (error) {
31596
+ console.error(
31597
+ identifier,
31598
+ "Stream error: Azure OpenAI JSON parsing error:",
31599
+ JSON.stringify(error)
31600
+ );
31601
+ }
31589
31602
  response = await fetch(endpoint, {
31590
31603
  method: "POST",
31591
31604
  headers: {
@@ -31696,7 +31709,7 @@ async function callOpenAIStream(identifier, openAiPayload, openAiConfig, chunkTi
31696
31709
  console.error(
31697
31710
  identifier,
31698
31711
  "Stream error: OpenAI error:",
31699
- json.error
31712
+ json.error && JSON.stringify(json.error)
31700
31713
  );
31701
31714
  const error = new Error("Stream error: OpenAI error");
31702
31715
  error.data = json.error;