@core-ai/google-genai 0.7.0 → 0.7.1
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 +23 -23
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -17,6 +17,9 @@ import {
|
|
|
17
17
|
import { getProviderMetadata, zodSchemaToJsonSchema } from "@core-ai/core-ai";
|
|
18
18
|
|
|
19
19
|
// src/model-capabilities.ts
|
|
20
|
+
import {
|
|
21
|
+
stripModelDateSuffix
|
|
22
|
+
} from "@core-ai/core-ai";
|
|
20
23
|
var DEFAULT_CAPABILITIES = {
|
|
21
24
|
reasoning: {
|
|
22
25
|
thinkingParam: "thinkingBudget",
|
|
@@ -61,39 +64,36 @@ var MODEL_CAPABILITIES = {
|
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
};
|
|
67
|
+
var GOOGLE_THINKING_LEVEL_MAP = {
|
|
68
|
+
minimal: "LOW",
|
|
69
|
+
low: "LOW",
|
|
70
|
+
medium: "LOW",
|
|
71
|
+
high: "HIGH",
|
|
72
|
+
max: "HIGH"
|
|
73
|
+
};
|
|
74
|
+
var GOOGLE_THINKING_BUDGET_MAP = {
|
|
75
|
+
minimal: 1024,
|
|
76
|
+
low: 4096,
|
|
77
|
+
medium: 16384,
|
|
78
|
+
high: 32768,
|
|
79
|
+
max: 32768
|
|
80
|
+
};
|
|
64
81
|
function getGoogleModelCapabilities(modelId) {
|
|
65
82
|
const normalizedModelId = normalizeModelId(modelId);
|
|
66
83
|
return MODEL_CAPABILITIES[normalizedModelId] ?? DEFAULT_CAPABILITIES;
|
|
67
84
|
}
|
|
68
85
|
function normalizeModelId(modelId) {
|
|
69
|
-
return modelId
|
|
86
|
+
return stripModelDateSuffix(modelId);
|
|
70
87
|
}
|
|
71
88
|
function toGoogleThinkingLevel(effort) {
|
|
72
|
-
|
|
73
|
-
return "HIGH";
|
|
74
|
-
}
|
|
75
|
-
return "LOW";
|
|
89
|
+
return GOOGLE_THINKING_LEVEL_MAP[effort];
|
|
76
90
|
}
|
|
77
91
|
function toGoogleThinkingBudget(effort) {
|
|
78
|
-
|
|
79
|
-
return 1024;
|
|
80
|
-
}
|
|
81
|
-
if (effort === "low") {
|
|
82
|
-
return 4096;
|
|
83
|
-
}
|
|
84
|
-
if (effort === "medium") {
|
|
85
|
-
return 16384;
|
|
86
|
-
}
|
|
87
|
-
return 32768;
|
|
92
|
+
return GOOGLE_THINKING_BUDGET_MAP[effort];
|
|
88
93
|
}
|
|
89
94
|
|
|
90
95
|
// src/object-utils.ts
|
|
91
|
-
|
|
92
|
-
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
93
|
-
return value;
|
|
94
|
-
}
|
|
95
|
-
return {};
|
|
96
|
-
}
|
|
96
|
+
import { asObject } from "@core-ai/core-ai";
|
|
97
97
|
|
|
98
98
|
// src/provider-options.ts
|
|
99
99
|
import { z } from "zod";
|
|
@@ -377,7 +377,7 @@ function createGenerateRequest(modelId, options) {
|
|
|
377
377
|
...options.tools && Object.keys(options.tools).length > 0 ? { tools: convertTools(options.tools) } : {},
|
|
378
378
|
...options.toolChoice ? { toolConfig: convertToolChoice(options.toolChoice) } : {},
|
|
379
379
|
...mapSamplingToConfig(options),
|
|
380
|
-
...mapReasoningToConfig(modelId, options
|
|
380
|
+
...mapReasoningToConfig(modelId, options),
|
|
381
381
|
...mapGoogleProviderOptionsToConfig(googleOptions),
|
|
382
382
|
...options.signal ? { abortSignal: options.signal } : {}
|
|
383
383
|
};
|
|
@@ -559,7 +559,7 @@ async function* transformStream(stream) {
|
|
|
559
559
|
usage
|
|
560
560
|
};
|
|
561
561
|
}
|
|
562
|
-
function mapReasoningToConfig(modelId, options
|
|
562
|
+
function mapReasoningToConfig(modelId, options) {
|
|
563
563
|
if (!options.reasoning) {
|
|
564
564
|
return {};
|
|
565
565
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@core-ai/google-genai",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Google GenAI provider package for @core-ai/core-ai",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Omnifact (https://omnifact.ai)",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"test:watch": "vitest"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@core-ai/core-ai": "^0.7.
|
|
46
|
+
"@core-ai/core-ai": "^0.7.1",
|
|
47
47
|
"@google/genai": "^1.42.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|