@adminforth/completion-adapter-google-gemini 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.
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import pRetry from 'p-retry';
12
12
  import { logger } from "adminforth";
13
13
  export default class CompletionAdapterGoogleGemini {
14
14
  constructor(options) {
15
- this.complete = (content_1, ...args_1) => __awaiter(this, [content_1, ...args_1], void 0, function* (content, stop = ["."], maxTokens = 50) {
15
+ this.complete = (content_1, ...args_1) => __awaiter(this, [content_1, ...args_1], void 0, function* (content, stop = ["."], maxTokens = 50, outputSchema) {
16
16
  const ai = new GoogleGenAI({
17
17
  apiKey: this.options.geminiApiKey,
18
18
  });
@@ -22,7 +22,7 @@ export default class CompletionAdapterGoogleGemini {
22
22
  const response = yield ai.models.generateContent({
23
23
  model: this.options.model || "gemini-3-flash-preview",
24
24
  contents: content,
25
- config: Object.assign({ maxOutputTokens: maxTokens }, this.options.extraRequestBodyParameters),
25
+ config: Object.assign({ responseJsonSchema: outputSchema ? outputSchema : undefined, maxOutputTokens: maxTokens }, this.options.extraRequestBodyParameters),
26
26
  });
27
27
  logger.debug(`Google Gemini SUCCESSFUL API response: ${response}`);
28
28
  return {
package/index.ts CHANGED
@@ -19,7 +19,7 @@ export default class CompletionAdapterGoogleGemini
19
19
  }
20
20
  }
21
21
 
22
- complete = async (content: string, stop = ["."], maxTokens = 50): Promise<{
22
+ complete = async (content: string, stop = ["."], maxTokens = 50, outputSchema?: any): Promise<{
23
23
  content?: string;
24
24
  finishReason?: string;
25
25
  error?: string;
@@ -36,6 +36,7 @@ export default class CompletionAdapterGoogleGemini
36
36
  model: this.options.model || "gemini-3-flash-preview",
37
37
  contents: content,
38
38
  config: {
39
+ responseJsonSchema: outputSchema ? outputSchema : undefined,
39
40
  maxOutputTokens: maxTokens,
40
41
  ...this.options.extraRequestBodyParameters,
41
42
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/completion-adapter-google-gemini",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",