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.d.mts CHANGED
@@ -9,7 +9,8 @@ declare enum GPTModel {
9
9
  GPT35_0125 = "gpt-3.5-turbo-0125",
10
10
  GPT4_1106_PREVIEW = "gpt-4-1106-preview",
11
11
  GPT4_0125_PREVIEW = "gpt-4-0125-preview",
12
- GPT4_0409 = "gpt-4-turbo-2024-04-09"
12
+ GPT4_0409 = "gpt-4-turbo-2024-04-09",
13
+ GPT4O = "gpt-4o"
13
14
  }
14
15
  declare enum GroqModel {
15
16
  LLAMA_3_70B_8192 = "llama3-70b-8192"
package/dist/index.d.ts CHANGED
@@ -9,7 +9,8 @@ declare enum GPTModel {
9
9
  GPT35_0125 = "gpt-3.5-turbo-0125",
10
10
  GPT4_1106_PREVIEW = "gpt-4-1106-preview",
11
11
  GPT4_0125_PREVIEW = "gpt-4-0125-preview",
12
- GPT4_0409 = "gpt-4-turbo-2024-04-09"
12
+ GPT4_0409 = "gpt-4-turbo-2024-04-09",
13
+ GPT4O = "gpt-4o"
13
14
  }
14
15
  declare enum GroqModel {
15
16
  LLAMA_3_70B_8192 = "llama3-70b-8192"
package/dist/index.js CHANGED
@@ -27035,6 +27035,7 @@ var GPTModel = /* @__PURE__ */ ((GPTModel2) => {
27035
27035
  GPTModel2["GPT4_1106_PREVIEW"] = "gpt-4-1106-preview";
27036
27036
  GPTModel2["GPT4_0125_PREVIEW"] = "gpt-4-0125-preview";
27037
27037
  GPTModel2["GPT4_0409"] = "gpt-4-turbo-2024-04-09";
27038
+ GPTModel2["GPT4O"] = "gpt-4o";
27038
27039
  return GPTModel2;
27039
27040
  })(GPTModel || {});
27040
27041
  var GroqModel = /* @__PURE__ */ ((GroqModel2) => {
@@ -31713,7 +31714,7 @@ async function callOpenAIStream(identifier, openAiPayload, openAiConfig, chunkTi
31713
31714
  );
31714
31715
  const error = new Error("Stream error: OpenAI error");
31715
31716
  error.data = json.error;
31716
- error.requestBody = JSON.stringify(openAiPayload);
31717
+ error.requestBody = openAiPayload;
31717
31718
  throw error;
31718
31719
  }
31719
31720
  if (chunkIndex !== 0)
@@ -31944,6 +31945,10 @@ async function prepareGoogleAIPayload(payload) {
31944
31945
  } : void 0
31945
31946
  };
31946
31947
  for (const message of payload.messages) {
31948
+ if (message.role === "system") {
31949
+ preparedPayload.systemInstruction = message.content;
31950
+ continue;
31951
+ }
31947
31952
  const googleAIContentParts = [];
31948
31953
  if (message.content) {
31949
31954
  googleAIContentParts.push({
@@ -31981,7 +31986,7 @@ async function prepareGoogleAIPayload(payload) {
31981
31986
  }
31982
31987
  }
31983
31988
  preparedPayload.messages.push({
31984
- role: message.role === "user" ? "user" : "model",
31989
+ role: message.role === "assistant" ? "model" : message.role,
31985
31990
  parts: googleAIContentParts
31986
31991
  });
31987
31992
  }
@@ -31992,7 +31997,8 @@ async function callGoogleAI(identifier, payload) {
31992
31997
  const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY);
31993
31998
  const model = genAI.getGenerativeModel({
31994
31999
  model: payload.model,
31995
- tools: payload.tools
32000
+ tools: payload.tools,
32001
+ systemInstruction: payload.systemInstruction
31996
32002
  });
31997
32003
  const history = payload.messages.slice(0, -1);
31998
32004
  const lastMessage = payload.messages.slice(-1)[0];
@@ -32134,26 +32140,27 @@ async function prepareOpenAIPayload(payload) {
32134
32140
  });
32135
32141
  }
32136
32142
  for (const file of message.files || []) {
32137
- if (!((_b = file.mimeType) == null ? void 0 : _b.startsWith("image"))) {
32143
+ if ((_b = file.mimeType) == null ? void 0 : _b.startsWith("image")) {
32144
+ if (file.url) {
32145
+ openAIContentBlocks.push({
32146
+ type: "image_url",
32147
+ image_url: {
32148
+ url: file.url
32149
+ }
32150
+ });
32151
+ } else if (file.data) {
32152
+ openAIContentBlocks.push({
32153
+ type: "image_url",
32154
+ image_url: {
32155
+ url: `data:${file.mimeType};base64,${file.data}`
32156
+ }
32157
+ });
32158
+ }
32159
+ } else {
32138
32160
  console.warn(
32139
- "OpenAI API does not support non-image file types. Skipping file."
32161
+ "Skipping file. Type not supported by OpenAI API:",
32162
+ file.mimeType
32140
32163
  );
32141
- continue;
32142
- }
32143
- if (file.url) {
32144
- openAIContentBlocks.push({
32145
- type: "image_url",
32146
- image_url: {
32147
- url: file.url
32148
- }
32149
- });
32150
- } else if (file.data) {
32151
- openAIContentBlocks.push({
32152
- type: "image_url",
32153
- image_url: {
32154
- url: `data:${file.mimeType};base64,${file.data}`
32155
- }
32156
- });
32157
32164
  }
32158
32165
  }
32159
32166
  preparedPayload.messages.push({