190proof 1.0.39 → 1.0.41
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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -31580,7 +31580,12 @@ async function callOpenAIStream(identifier, openAiPayload, openAiConfig, chunkTi
|
|
|
31580
31580
|
);
|
|
31581
31581
|
}
|
|
31582
31582
|
const azureConfig = openAiConfig.modelConfigMap[model];
|
|
31583
|
-
|
|
31583
|
+
let endpoint;
|
|
31584
|
+
if (azureConfig.endpoint) {
|
|
31585
|
+
endpoint = `${azureConfig.endpoint}/${azureConfig.deployment}/chat/completions?api-version=${azureConfig.apiVersion}`;
|
|
31586
|
+
} else {
|
|
31587
|
+
endpoint = `${openAiConfig.baseUrl}/azure-openai/${azureConfig.resource}/${azureConfig.deployment}/chat/completions?api-version=${azureConfig.apiVersion}`;
|
|
31588
|
+
}
|
|
31584
31589
|
try {
|
|
31585
31590
|
const stringifiedPayload = JSON.stringify({
|
|
31586
31591
|
...openAiPayload,
|
|
@@ -31939,6 +31944,10 @@ async function prepareGoogleAIPayload(payload) {
|
|
|
31939
31944
|
} : void 0
|
|
31940
31945
|
};
|
|
31941
31946
|
for (const message of payload.messages) {
|
|
31947
|
+
if (message.role === "system") {
|
|
31948
|
+
preparedPayload.systemInstruction = message.content;
|
|
31949
|
+
continue;
|
|
31950
|
+
}
|
|
31942
31951
|
const googleAIContentParts = [];
|
|
31943
31952
|
if (message.content) {
|
|
31944
31953
|
googleAIContentParts.push({
|
|
@@ -31976,7 +31985,7 @@ async function prepareGoogleAIPayload(payload) {
|
|
|
31976
31985
|
}
|
|
31977
31986
|
}
|
|
31978
31987
|
preparedPayload.messages.push({
|
|
31979
|
-
role: message.role === "
|
|
31988
|
+
role: message.role === "assistant" ? "model" : message.role,
|
|
31980
31989
|
parts: googleAIContentParts
|
|
31981
31990
|
});
|
|
31982
31991
|
}
|
|
@@ -31987,7 +31996,8 @@ async function callGoogleAI(identifier, payload) {
|
|
|
31987
31996
|
const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY);
|
|
31988
31997
|
const model = genAI.getGenerativeModel({
|
|
31989
31998
|
model: payload.model,
|
|
31990
|
-
tools: payload.tools
|
|
31999
|
+
tools: payload.tools,
|
|
32000
|
+
systemInstruction: payload.systemInstruction
|
|
31991
32001
|
});
|
|
31992
32002
|
const history = payload.messages.slice(0, -1);
|
|
31993
32003
|
const lastMessage = payload.messages.slice(-1)[0];
|