190proof 1.0.38 → 1.0.40

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
@@ -27029,6 +27029,7 @@ var GPTModel = /* @__PURE__ */ ((GPTModel2) => {
27029
27029
  GPTModel2["GPT4_1106_PREVIEW"] = "gpt-4-1106-preview";
27030
27030
  GPTModel2["GPT4_0125_PREVIEW"] = "gpt-4-0125-preview";
27031
27031
  GPTModel2["GPT4_0409"] = "gpt-4-turbo-2024-04-09";
27032
+ GPTModel2["GPT4O"] = "gpt-4o";
27032
27033
  return GPTModel2;
27033
27034
  })(GPTModel || {});
27034
27035
  var GroqModel = /* @__PURE__ */ ((GroqModel2) => {
@@ -31707,7 +31708,7 @@ async function callOpenAIStream(identifier, openAiPayload, openAiConfig, chunkTi
31707
31708
  );
31708
31709
  const error = new Error("Stream error: OpenAI error");
31709
31710
  error.data = json.error;
31710
- error.requestBody = JSON.stringify(openAiPayload);
31711
+ error.requestBody = openAiPayload;
31711
31712
  throw error;
31712
31713
  }
31713
31714
  if (chunkIndex !== 0)
@@ -31938,6 +31939,10 @@ async function prepareGoogleAIPayload(payload) {
31938
31939
  } : void 0
31939
31940
  };
31940
31941
  for (const message of payload.messages) {
31942
+ if (message.role === "system") {
31943
+ preparedPayload.systemInstruction = message.content;
31944
+ continue;
31945
+ }
31941
31946
  const googleAIContentParts = [];
31942
31947
  if (message.content) {
31943
31948
  googleAIContentParts.push({
@@ -31975,7 +31980,7 @@ async function prepareGoogleAIPayload(payload) {
31975
31980
  }
31976
31981
  }
31977
31982
  preparedPayload.messages.push({
31978
- role: message.role === "user" ? "user" : "model",
31983
+ role: message.role === "assistant" ? "model" : message.role,
31979
31984
  parts: googleAIContentParts
31980
31985
  });
31981
31986
  }
@@ -31986,7 +31991,8 @@ async function callGoogleAI(identifier, payload) {
31986
31991
  const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY);
31987
31992
  const model = genAI.getGenerativeModel({
31988
31993
  model: payload.model,
31989
- tools: payload.tools
31994
+ tools: payload.tools,
31995
+ systemInstruction: payload.systemInstruction
31990
31996
  });
31991
31997
  const history = payload.messages.slice(0, -1);
31992
31998
  const lastMessage = payload.messages.slice(-1)[0];
@@ -32128,26 +32134,27 @@ async function prepareOpenAIPayload(payload) {
32128
32134
  });
32129
32135
  }
32130
32136
  for (const file of message.files || []) {
32131
- if (!((_b = file.mimeType) == null ? void 0 : _b.startsWith("image"))) {
32137
+ if ((_b = file.mimeType) == null ? void 0 : _b.startsWith("image")) {
32138
+ if (file.url) {
32139
+ openAIContentBlocks.push({
32140
+ type: "image_url",
32141
+ image_url: {
32142
+ url: file.url
32143
+ }
32144
+ });
32145
+ } else if (file.data) {
32146
+ openAIContentBlocks.push({
32147
+ type: "image_url",
32148
+ image_url: {
32149
+ url: `data:${file.mimeType};base64,${file.data}`
32150
+ }
32151
+ });
32152
+ }
32153
+ } else {
32132
32154
  console.warn(
32133
- "OpenAI API does not support non-image file types. Skipping file."
32155
+ "Skipping file. Type not supported by OpenAI API:",
32156
+ file.mimeType
32134
32157
  );
32135
- continue;
32136
- }
32137
- if (file.url) {
32138
- openAIContentBlocks.push({
32139
- type: "image_url",
32140
- image_url: {
32141
- url: file.url
32142
- }
32143
- });
32144
- } else if (file.data) {
32145
- openAIContentBlocks.push({
32146
- type: "image_url",
32147
- image_url: {
32148
- url: `data:${file.mimeType};base64,${file.data}`
32149
- }
32150
- });
32151
32158
  }
32152
32159
  }
32153
32160
  preparedPayload.messages.push({