@google/genai 0.7.0 → 0.9.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/README.md +9 -34
- package/dist/genai.d.ts +530 -57
- package/dist/index.js +1984 -483
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1985 -484
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.js +2028 -526
- package/dist/node/index.js.map +1 -1
- package/dist/node/node.d.ts +530 -57
- package/dist/web/index.mjs +2024 -523
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +530 -57
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -23,7 +23,6 @@ The Google Gen AI SDK is designed to work with Gemini 2.0 features.
|
|
|
23
23
|
> **API Key Security:** Avoid exposing API keys in client-side code.
|
|
24
24
|
> Use server-side implementations in production environments.
|
|
25
25
|
|
|
26
|
-
|
|
27
26
|
## Prerequisites
|
|
28
27
|
|
|
29
28
|
* Node.js version 18 or later
|
|
@@ -58,39 +57,6 @@ async function main() {
|
|
|
58
57
|
main();
|
|
59
58
|
```
|
|
60
59
|
|
|
61
|
-
## Web quickstart
|
|
62
|
-
|
|
63
|
-
The package contents are also available unzipped in the
|
|
64
|
-
`package/` directory of the bucket, so an equivalent web example is:
|
|
65
|
-
|
|
66
|
-
```html
|
|
67
|
-
<!DOCTYPE html>
|
|
68
|
-
<html lang="en">
|
|
69
|
-
<head>
|
|
70
|
-
<meta charset="UTF-8" />
|
|
71
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
72
|
-
<title>Using My Package</title>
|
|
73
|
-
</head>
|
|
74
|
-
<body>
|
|
75
|
-
<script type="module">
|
|
76
|
-
import {GoogleGenAI} from 'https://cdn.jsdelivr.net/npm/@google/genai@latest/+esm'
|
|
77
|
-
|
|
78
|
-
const ai = new GoogleGenAI({apiKey:"GEMINI_API_KEY"});
|
|
79
|
-
|
|
80
|
-
async function main() {
|
|
81
|
-
const response = await ai.models.generateContent({
|
|
82
|
-
model: 'gemini-2.0-flash-001',
|
|
83
|
-
contents: 'Why is the sky blue?',
|
|
84
|
-
});
|
|
85
|
-
console.log(response.text);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
main();
|
|
89
|
-
</script>
|
|
90
|
-
</body>
|
|
91
|
-
</html>
|
|
92
|
-
```
|
|
93
|
-
|
|
94
60
|
## Initialization
|
|
95
61
|
|
|
96
62
|
The Google Gen AI SDK provides support for both the
|
|
@@ -253,3 +219,12 @@ The SDK is curently in a preview launch stage, per [Google's launch stages](http
|
|
|
253
219
|
|
|
254
220
|
> At Preview, products or features are ready for testing by customers. Preview offerings are often publicly announced, but are not necessarily feature-complete, and no SLAs or technical support commitments are provided for these. Unless stated otherwise by Google, Preview offerings are intended for use in test environments only. The average Preview stage lasts about six months.
|
|
255
221
|
|
|
222
|
+
## How is this different from the other Google AI SDKs
|
|
223
|
+
This SDK (`@google/genai`) is Google Deepmind’s "vanilla" SDK for its generative AI offerings, and is where Google Deepmind adds new AI features.
|
|
224
|
+
|
|
225
|
+
Models hosted either on the [Vertex AI platform](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/overview) or the [Gemini Developer platform](https://ai.google.dev/gemini-api/docs) are accessible through this SDK.
|
|
226
|
+
|
|
227
|
+
Other SDKs may be offering additional AI frameworks on top of this SDK, or may be targeting specific project environments (like Firebase).
|
|
228
|
+
|
|
229
|
+
The `@google/generative_language` and `@google-cloud/vertexai` SDKs are previous iterations of this SDK and are no longer receiving new Gemini 2.0+ features.
|
|
230
|
+
|