@askdb/ai-google 0.1.0-beta.2 → 1.0.0-beta.4
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/README.md +11 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/package.json +10 -5
package/README.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Google Generative AI / Gemini provider adapter for `@askdb/ai`.
|
|
4
4
|
|
|
5
|
+
Pass the adapter to `createAskDb` and AskDB constructs the Google model from your `askdb.config.*`:
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { createAskDb } from "@askdb/client";
|
|
9
|
+
import { googleProvider } from "@askdb/ai-google";
|
|
10
|
+
|
|
11
|
+
const askdb = createAskDb({ config, providers: [googleProvider] });
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Advanced: build a standalone registry to construct a model object outside the client:
|
|
15
|
+
|
|
5
16
|
```ts
|
|
6
17
|
import { createAiRegistry } from "@askdb/ai";
|
|
7
18
|
import { googleProvider } from "@askdb/ai-google";
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,WAAW,CAAC;AAUnB,eAAO,MAAM,cAAc,EAAE,iBAqB5B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { createGoogleGenerativeAI } from "@ai-sdk/google";
|
|
2
|
+
import { resolveBaseConfig, } from "@askdb/ai";
|
|
3
|
+
const ENV_SPEC = {
|
|
4
|
+
apiKeyVars: ["GOOGLE_GENERATIVE_AI_API_KEY", "GOOGLE_AI_API_KEY"],
|
|
5
|
+
modelVars: ["GOOGLE_AI_MODEL"],
|
|
6
|
+
embeddingModelVars: ["GOOGLE_AI_EMBEDDING_MODEL"],
|
|
7
|
+
baseURLVars: ["GOOGLE_AI_BASE_URL"],
|
|
8
|
+
defaultModel: "gemini-2.0-flash",
|
|
9
|
+
};
|
|
2
10
|
export const googleProvider = {
|
|
3
11
|
provider: "google",
|
|
12
|
+
configHint: "For Google Gemini, set ai.provider: \"google\" and ai.providerConfig.google.apiKey in askdb.config.*.",
|
|
13
|
+
resolveConfig(env, options) {
|
|
14
|
+
return resolveBaseConfig("google", env, ENV_SPEC, options);
|
|
15
|
+
},
|
|
4
16
|
createLanguageModel(config) {
|
|
5
17
|
const google = createGoogleGenerativeAI({
|
|
6
18
|
apiKey: config.apiKey,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EACL,iBAAiB,GAGlB,MAAM,WAAW,CAAC;AAEnB,MAAM,QAAQ,GAAoB;IAChC,UAAU,EAAE,CAAC,8BAA8B,EAAE,mBAAmB,CAAC;IACjE,SAAS,EAAE,CAAC,iBAAiB,CAAC;IAC9B,kBAAkB,EAAE,CAAC,2BAA2B,CAAC;IACjD,WAAW,EAAE,CAAC,oBAAoB,CAAC;IACnC,YAAY,EAAE,kBAAkB;CACjC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAsB;IAC/C,QAAQ,EAAE,QAAQ;IAClB,UAAU,EACR,uGAAuG;IACzG,aAAa,CAAC,GAAG,EAAE,OAAO;QACxB,OAAO,iBAAiB,CAAC,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IACD,mBAAmB,CAAC,MAAM;QACxB,MAAM,MAAM,GAAG,wBAAwB,CAAC;YACtC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACvD,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IACD,oBAAoB,CAAC,MAAM;QACzB,MAAM,MAAM,GAAG,wBAAwB,CAAC;YACtC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACvD,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@askdb/ai-google",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
4
|
"description": "AskDB Google Generative AI provider adapter for @askdb/ai.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"askdb",
|
|
@@ -39,12 +39,17 @@
|
|
|
39
39
|
"node": ">=20"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@ai-sdk/google": "^3.0.
|
|
43
|
-
|
|
42
|
+
"@ai-sdk/google": "^3.0.82"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"ai": "^6.0.205",
|
|
46
|
+
"@askdb/ai": "^0.1.0-beta.4"
|
|
44
47
|
},
|
|
45
48
|
"devDependencies": {
|
|
46
|
-
"
|
|
47
|
-
"
|
|
49
|
+
"ai": "^6.0.205",
|
|
50
|
+
"typescript": "^6.0.3",
|
|
51
|
+
"vitest": "^4.1.8",
|
|
52
|
+
"@askdb/ai": "0.1.0-beta.4"
|
|
48
53
|
},
|
|
49
54
|
"scripts": {
|
|
50
55
|
"build": "tsc -p tsconfig.build.json",
|