@imenam/unified-llm-client 2.0.2 → 2.0.3
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.
|
@@ -77,9 +77,9 @@ class UnifiedLLMClient {
|
|
|
77
77
|
: [typeof message === "string" ? { role: "user", content: message } : message];
|
|
78
78
|
for (const m of messageArray)
|
|
79
79
|
this.checkNotImplementedFeatures(m);
|
|
80
|
-
const messages = yield Promise.all(messageArray.map(m => promptAdapter.formatMessage(m)));
|
|
81
80
|
let finalResponse;
|
|
82
81
|
try {
|
|
82
|
+
const messages = yield Promise.all(messageArray.map(m => promptAdapter.formatMessage(m)));
|
|
83
83
|
if (stream) {
|
|
84
84
|
if (!promptAdapter.streamFromProvider) {
|
|
85
85
|
throw new Error("The current adapter does not support streaming.");
|
|
@@ -57,6 +57,24 @@ function run() {
|
|
|
57
57
|
catch (_b) {
|
|
58
58
|
console.log(" (exception capturée par l'appelant — comportement attendu)");
|
|
59
59
|
}
|
|
60
|
+
// --- Cas 4 : envoi d'image à Gemini avec clé API manquante ---
|
|
61
|
+
console.log("\n=== Test 4 : image Gemini avec clé invalide ===");
|
|
62
|
+
const badKeyImageClient = new __1.UnifiedLLMClient(__1.MODELS.GEMINI_FLASH_2_5, {
|
|
63
|
+
apiKey: "INVALID_KEY_IMAGE_TEST",
|
|
64
|
+
logger,
|
|
65
|
+
});
|
|
66
|
+
try {
|
|
67
|
+
yield badKeyImageClient.chat({
|
|
68
|
+
message: {
|
|
69
|
+
role: "user",
|
|
70
|
+
content: "Que vois-tu sur cette image ?",
|
|
71
|
+
attachedFile: "./media/document.png",
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
catch (_c) {
|
|
76
|
+
console.log(" (exception capturée par l'appelant — comportement attendu)");
|
|
77
|
+
}
|
|
60
78
|
});
|
|
61
79
|
}
|
|
62
80
|
run().catch(console.error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imenam/unified-llm-client",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "A unified interface for multiple LLM providers (OpenAI, Gemini, Anthropic, Qwen) with tool-calling, streaming, and audio support",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|