@google/genai 1.50.1 → 1.52.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 +12 -12
- package/dist/genai.d.ts +199 -101
- package/dist/index.cjs +207 -146
- package/dist/index.mjs +208 -147
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +235 -156
- package/dist/node/index.mjs +236 -157
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +199 -101
- package/dist/tokenizer/node.cjs +15 -1
- package/dist/tokenizer/node.d.ts +1 -1
- package/dist/tokenizer/node.mjs +15 -1
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +130 -117
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +97 -24
- package/dist/vertex_internal/index.js +130 -117
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +201 -145
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +199 -101
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
The Google Gen AI JavaScript SDK is designed for
|
|
12
12
|
TypeScript and JavaScript developers to build applications powered by Gemini. The SDK
|
|
13
13
|
supports both the [Gemini Developer API](https://ai.google.dev/gemini-api/docs)
|
|
14
|
-
and [
|
|
14
|
+
and [Gemini Enterprise Agent Platform](https://docs.cloud.google.com/gemini-enterprise-agent-platform).
|
|
15
15
|
|
|
16
16
|
The Google Gen AI SDK is designed to work with Gemini 2.0+ features.
|
|
17
17
|
|
|
@@ -29,7 +29,7 @@ We recommend using our Code Generation instructions [`codegen_instructions.md`](
|
|
|
29
29
|
|
|
30
30
|
1. Node.js version 20 or later
|
|
31
31
|
|
|
32
|
-
### The following are required for
|
|
32
|
+
### The following are required for Gemini Enterprise Agent Platform users (excluding Vertex AI Studio)
|
|
33
33
|
1. [Select](https://console.cloud.google.com/project) or [create](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project) a Google Cloud project.
|
|
34
34
|
1. [Enable billing for your project](https://cloud.google.com/billing/docs/how-to/modify-project).
|
|
35
35
|
1. [Enable the Vertex AI API](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com).
|
|
@@ -77,7 +77,7 @@ main();
|
|
|
77
77
|
|
|
78
78
|
The Google Gen AI SDK provides support for both the
|
|
79
79
|
[Google AI Studio](https://ai.google.dev/gemini-api/docs) and
|
|
80
|
-
[
|
|
80
|
+
[Gemini Enterprise Agent Platform](https://cloud.google.com/vertex-ai/generative-ai/docs/learn/overview)
|
|
81
81
|
implementations of the Gemini API.
|
|
82
82
|
|
|
83
83
|
### Gemini Developer API
|
|
@@ -104,15 +104,15 @@ import { GoogleGenAI } from '@google/genai';
|
|
|
104
104
|
const ai = new GoogleGenAI({apiKey: 'GEMINI_API_KEY'});
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
-
###
|
|
107
|
+
### Gemini Enterprise Agent Platform
|
|
108
108
|
|
|
109
|
-
Sample code for
|
|
109
|
+
Sample code for Gemini Enterprise Agent Platform initialization:
|
|
110
110
|
|
|
111
111
|
```typescript
|
|
112
112
|
import { GoogleGenAI } from '@google/genai';
|
|
113
113
|
|
|
114
114
|
const ai = new GoogleGenAI({
|
|
115
|
-
|
|
115
|
+
enterprise: true,
|
|
116
116
|
project: 'your_project',
|
|
117
117
|
location: 'your_location',
|
|
118
118
|
});
|
|
@@ -122,7 +122,7 @@ const ai = new GoogleGenAI({
|
|
|
122
122
|
|
|
123
123
|
For NodeJS environments, you can create a client by configuring the necessary
|
|
124
124
|
environment variables. Configuration setup instructions depends on whether
|
|
125
|
-
you're using the Gemini Developer API or the Gemini
|
|
125
|
+
you're using the Gemini Developer API or the Gemini Enterprise Agent Platform.
|
|
126
126
|
|
|
127
127
|
**Gemini Developer API:** Set `GOOGLE_API_KEY` as shown below:
|
|
128
128
|
|
|
@@ -130,11 +130,11 @@ you're using the Gemini Developer API or the Gemini API in Vertex AI.
|
|
|
130
130
|
export GOOGLE_API_KEY='your-api-key'
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
-
**Gemini
|
|
133
|
+
**Gemini Enterprise Agent Platform:** Set `GOOGLE_GENAI_USE_ENTERPRISE`,
|
|
134
134
|
`GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION`, as shown below:
|
|
135
135
|
|
|
136
136
|
```bash
|
|
137
|
-
export
|
|
137
|
+
export GOOGLE_GENAI_USE_ENTERPRISE=true
|
|
138
138
|
export GOOGLE_CLOUD_PROJECT='your-project-id'
|
|
139
139
|
export GOOGLE_CLOUD_LOCATION='us-central1'
|
|
140
140
|
```
|
|
@@ -152,11 +152,11 @@ preview features in the APIs. The stable API endpoints can be selected by
|
|
|
152
152
|
setting the API version to `v1`.
|
|
153
153
|
|
|
154
154
|
To set the API version use `apiVersion`. For example, to set the API version to
|
|
155
|
-
`v1` for
|
|
155
|
+
`v1` for Gemini Enterprise Agent Platform:
|
|
156
156
|
|
|
157
157
|
```typescript
|
|
158
158
|
const ai = new GoogleGenAI({
|
|
159
|
-
|
|
159
|
+
enterprise: true,
|
|
160
160
|
project: 'your_project',
|
|
161
161
|
location: 'your_location',
|
|
162
162
|
apiVersion: 'v1'
|
|
@@ -600,7 +600,7 @@ for (const output of interaction.outputs!) {
|
|
|
600
600
|
This SDK (`@google/genai`) is Google Deepmind’s "vanilla" SDK for its generative
|
|
601
601
|
AI offerings, and is where Google Deepmind adds new AI features.
|
|
602
602
|
|
|
603
|
-
Models hosted either on the [
|
|
603
|
+
Models hosted either on the [Gemini Enterprise Agent 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.
|
|
604
604
|
|
|
605
605
|
Other SDKs may be offering additional AI frameworks on top of this SDK, or may
|
|
606
606
|
be targeting specific project environments (like Firebase).
|