@adminforth/completion-adapter-google-gemini 1.0.4 → 2.0.2

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.js CHANGED
@@ -17,13 +17,12 @@ export default class CompletionAdapterGoogleGemini {
17
17
  apiKey: this.options.geminiApiKey,
18
18
  });
19
19
  const tryToGenerate = () => __awaiter(this, void 0, void 0, function* () {
20
- var _a, _b;
21
20
  logger.debug("Making Google Gemini API call");
22
21
  try {
23
22
  const response = yield ai.models.generateContent({
24
23
  model: this.options.model || "gemini-3-flash-preview",
25
24
  contents: content,
26
- config: Object.assign({ temperature: (_b = (_a = this.options.expert) === null || _a === void 0 ? void 0 : _a.temperature) !== null && _b !== void 0 ? _b : 0.7, maxOutputTokens: maxTokens, stopSequences: stop }, this.options.extraRequestBodyParameters),
25
+ config: Object.assign({ maxOutputTokens: maxTokens }, this.options.extraRequestBodyParameters),
27
26
  });
28
27
  logger.debug(`Google Gemini SUCCESSFUL API response: ${response}`);
29
28
  return {
@@ -32,7 +31,7 @@ export default class CompletionAdapterGoogleGemini {
32
31
  }
33
32
  catch (error) {
34
33
  logger.error(`Error during Google Gemini API call: ${error}`);
35
- throw new Error(`Error during Google Gemini API call: ${error}`);
34
+ throw new Error(`Error during Google Gemini API call: ${JSON.parse(error.message).error.message}`);
36
35
  }
37
36
  });
38
37
  const result = yield pRetry(tryToGenerate, {
package/index.ts CHANGED
@@ -36,9 +36,7 @@ export default class CompletionAdapterGoogleGemini
36
36
  model: this.options.model || "gemini-3-flash-preview",
37
37
  contents: content,
38
38
  config: {
39
- temperature: this.options.expert?.temperature ?? 0.7,
40
39
  maxOutputTokens: maxTokens,
41
- stopSequences: stop,
42
40
  ...this.options.extraRequestBodyParameters,
43
41
  },
44
42
  });
@@ -48,7 +46,7 @@ export default class CompletionAdapterGoogleGemini
48
46
  };
49
47
  } catch (error) {
50
48
  logger.error(`Error during Google Gemini API call: ${error}`);
51
- throw new Error(`Error during Google Gemini API call: ${error}`);
49
+ throw new Error(`Error during Google Gemini API call: ${JSON.parse(error.message).error.message}`);
52
50
  }
53
51
  }
54
52
  const result = await pRetry(tryToGenerate, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/completion-adapter-google-gemini",
3
- "version": "1.0.4",
3
+ "version": "2.0.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
package/types.ts CHANGED
@@ -16,14 +16,4 @@ export interface AdapterOptions {
16
16
  * Additional request body parameters to include in the API request.
17
17
  */
18
18
  extraRequestBodyParameters?: Record<string, unknown>;
19
-
20
- /**
21
- * Expert settings
22
- */
23
- expert?: {
24
- /**
25
- * Temperature (0-1). Lower is more deterministic, higher is more unpredicted creative. Default is 0.7.
26
- */
27
- temperature?: number;
28
- };
29
19
  }