@core-ai/google-genai 0.22.0 → 0.24.0
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 +16 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -51,7 +51,14 @@ var THINKING_LEVEL_CAPABILITIES = createCapabilities({
|
|
|
51
51
|
mode: "always-on"
|
|
52
52
|
});
|
|
53
53
|
var MODEL_CAPABILITIES = {
|
|
54
|
+
"gemini-3.8-flash": THINKING_LEVEL_CAPABILITIES,
|
|
55
|
+
"gemini-3.7-flash": THINKING_LEVEL_CAPABILITIES,
|
|
56
|
+
"gemini-3.6-flash": THINKING_LEVEL_CAPABILITIES,
|
|
57
|
+
"gemini-3.5-flash": THINKING_LEVEL_CAPABILITIES,
|
|
58
|
+
"gemini-3.5-flash-lite": THINKING_LEVEL_CAPABILITIES,
|
|
54
59
|
"gemini-3.1-pro": THINKING_LEVEL_CAPABILITIES,
|
|
60
|
+
"gemini-3.1-pro-preview": THINKING_LEVEL_CAPABILITIES,
|
|
61
|
+
"gemini-3.1-flash-lite": THINKING_LEVEL_CAPABILITIES,
|
|
55
62
|
"gemini-3.1-flash-lite-preview": THINKING_LEVEL_CAPABILITIES,
|
|
56
63
|
"gemini-3-pro": THINKING_LEVEL_CAPABILITIES,
|
|
57
64
|
"gemini-2.5-pro": REQUIRED_THINKING_BUDGET_CAPABILITIES,
|
|
@@ -777,6 +784,7 @@ import {
|
|
|
777
784
|
ContextLengthExceededError,
|
|
778
785
|
ModelOverloadedError,
|
|
779
786
|
ProviderError,
|
|
787
|
+
ProviderQuotaExceededError,
|
|
780
788
|
RateLimitError,
|
|
781
789
|
ServiceUnavailableError,
|
|
782
790
|
getErrorMessage,
|
|
@@ -795,8 +803,8 @@ function wrapGoogleError(error, provider = "google") {
|
|
|
795
803
|
const statusCode = error instanceof ApiError ? error.status : getHttpStatusCode(error, ["status"]);
|
|
796
804
|
const body = tryParseGoogleApiErrorBody(message);
|
|
797
805
|
const effectiveHttp = statusCode ?? toNumericHttpCode(body);
|
|
798
|
-
const options = { statusCode: effectiveHttp, cause: error };
|
|
799
806
|
const status = body?.status?.toUpperCase();
|
|
807
|
+
const options = { statusCode: effectiveHttp, code: status, cause: error };
|
|
800
808
|
const combinedText = `${body?.message ?? ""} ${message}`;
|
|
801
809
|
const contextLength = getContextLengthDetails(combinedText);
|
|
802
810
|
if (contextLength) {
|
|
@@ -805,6 +813,9 @@ function wrapGoogleError(error, provider = "google") {
|
|
|
805
813
|
...contextLength
|
|
806
814
|
});
|
|
807
815
|
}
|
|
816
|
+
if (effectiveHttp === 402) {
|
|
817
|
+
return new ProviderQuotaExceededError(message, provider, options);
|
|
818
|
+
}
|
|
808
819
|
if (indicatesGoogleOverload(combinedText, effectiveHttp)) {
|
|
809
820
|
return new ModelOverloadedError(message, provider, options);
|
|
810
821
|
}
|
|
@@ -938,7 +949,10 @@ function createGoogleGenAIChatModel(client, modelId, provider = "google") {
|
|
|
938
949
|
);
|
|
939
950
|
return createChatStream(
|
|
940
951
|
async () => transformStream(await callGenerateContentStreamApi(request)),
|
|
941
|
-
{
|
|
952
|
+
{
|
|
953
|
+
signal: options.signal,
|
|
954
|
+
mapError: (error) => wrapGoogleError(error, provider)
|
|
955
|
+
}
|
|
942
956
|
);
|
|
943
957
|
}
|
|
944
958
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@core-ai/google-genai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "Google GenAI provider package for @core-ai/core-ai",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Omnifact (https://omnifact.ai)",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"test:watch": "vitest"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@core-ai/core-ai": "^0.
|
|
48
|
+
"@core-ai/core-ai": "^0.24.0",
|
|
49
49
|
"@google/genai": "^1.42.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|