@contentgrowth/llm-service 0.7.5 → 0.7.6
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentgrowth/llm-service",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6",
|
|
4
4
|
"description": "Unified LLM Service for Content Growth",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"author": "Content Growth",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@google/genai": "^1.
|
|
19
|
-
"openai": "^6.
|
|
18
|
+
"@google/genai": "^1.34.0",
|
|
19
|
+
"openai": "^6.15.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"dotenv": "^17.2.3"
|
|
@@ -113,4 +113,15 @@ export class BaseLLMProvider {
|
|
|
113
113
|
async getVideoGenerationStatus(operationName) {
|
|
114
114
|
throw new Error('Video generation not supported by this provider');
|
|
115
115
|
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Helper to get the last 6 digits of the API key for logging.
|
|
119
|
+
* @returns {string} "..." + last 6 chars, or "not_set"
|
|
120
|
+
*/
|
|
121
|
+
_getMaskedApiKey() {
|
|
122
|
+
const key = this.config.apiKey;
|
|
123
|
+
if (!key) return 'not_set';
|
|
124
|
+
if (key.length <= 6) return '...';
|
|
125
|
+
return '...' + key.slice(-6);
|
|
126
|
+
}
|
|
116
127
|
}
|
|
@@ -186,7 +186,7 @@ export class GeminiProvider extends BaseLLMProvider {
|
|
|
186
186
|
try {
|
|
187
187
|
response = await this.client.models.generateContent(requestOptions);
|
|
188
188
|
} catch (error) {
|
|
189
|
-
console.error(
|
|
189
|
+
console.error(`[GeminiProvider] generateContent failed (API Key: ${this._getMaskedApiKey()}):`, error);
|
|
190
190
|
throw error;
|
|
191
191
|
}
|
|
192
192
|
|
|
@@ -486,7 +486,7 @@ export class GeminiProvider extends BaseLLMProvider {
|
|
|
486
486
|
|
|
487
487
|
return { operationName: operation.name };
|
|
488
488
|
} catch (error) {
|
|
489
|
-
console.error(
|
|
489
|
+
console.error(`[GeminiProvider] startVideoGeneration failed (API Key: ${this._getMaskedApiKey()}):`, error);
|
|
490
490
|
throw error;
|
|
491
491
|
}
|
|
492
492
|
}
|
|
@@ -56,7 +56,13 @@ export class OpenAIProvider extends BaseLLMProvider {
|
|
|
56
56
|
requestPayload.response_format = this._buildResponseFormat(options);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
let response;
|
|
60
|
+
try {
|
|
61
|
+
response = await this.client.chat.completions.create(requestPayload);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error(`[OpenAIProvider] chat completion failed (API Key: ${this._getMaskedApiKey()}):`, error);
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
60
66
|
const message = response.choices[0].message;
|
|
61
67
|
|
|
62
68
|
// Validate that we have EITHER content OR tool calls
|