Skip to content

Commit 4e36e77

Browse files
Update README.md
1 parent d0c7898 commit 4e36e77

File tree

1 file changed

+5
-100
lines changed

1 file changed

+5
-100
lines changed

README.md

Lines changed: 5 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,9 @@
1-
# Google AI SDK for JavaScript
1+
# [Deprecated] Google AI JavaScript SDK for the Gemini API
22

3-
> [!NOTE] A new Javascript/Typescript SDK, `@google/genai`
4-
> ([github](https://github.com/googleapis/js-genai/tree/main)), is currently
5-
> available in a *preview launch* - designed to work with Gemini 2.0 features
6-
> and support both the Gemini API and the Vertex API.
3+
With Gemini 2.0, we took the chance to create a single unified SDK for all developers who want to use Google's GenAI models (Gemini, Veo, Imagen, etc). As part of that process, we took all of the feedback from this SDK and what developers like about other SDKs in the ecosystem to create the [Google Gen AI SDK](https://github.com/googleapis/js-genai).
74

8-
The Google AI JavaScript SDK is the easiest way for JavaScript developers to
9-
build with the Gemini API. The Gemini API gives you access to Gemini
10-
[models](https://ai.google.dev/models/gemini) created by
11-
[Google DeepMind](https://deepmind.google/technologies/gemini/#introduction).
12-
Gemini models are built from the ground up to be multimodal, so you can reason
13-
seamlessly across text, images, and code.
5+
The full migration guide from the old SDK to new SDK is available in the [Gemini API docs](https://ai.google.dev/gemini-api/docs/migrate).
146

15-
> [!CAUTION] **Using the Google AI SDK for JavaScript directly from a
16-
> client-side app is recommended for prototyping only.** If you plan to enable
17-
> billing, we strongly recommend that you call the Google AI Gemini API only
18-
> server-side to keep your API key safe. You risk potentially exposing your API
19-
> key to malicious actors if you embed your API key directly in your JavaScript
20-
> app or fetch it remotely at runtime.
7+
We won't be adding anything to this SDK or making any further changes. The Gemini API docs are fully updated to show examples of the new Google Gen AI SDK. We know how disruptive an SDK change can be and don't take this change lightly, but our goal is to create an extremely simple and clear path for developers to build with our models so it felt necessary to make this change.
218

22-
## Get started with the Gemini API
23-
24-
1. Go to [Google AI Studio](https://aistudio.google.com/).
25-
2. Login with your Google account.
26-
3. [Create an API key](https://aistudio.google.com/app/apikey). Note that in
27-
Europe the free tier is not available.
28-
4. Try the
29-
[Node.js quickstart](https://ai.google.dev/tutorials/node_quickstart)
30-
31-
## Usage example
32-
33-
See the [Node.js quickstart](https://ai.google.dev/tutorials/node_quickstart)
34-
for complete code.
35-
36-
1. Install the SDK package
37-
38-
```js
39-
npm install @google/generative-ai
40-
```
41-
42-
2. Initialize the model
43-
44-
```js
45-
import { GoogleGenerativeAI } from "@google/generative-ai";
46-
47-
const genAI = new GoogleGenerativeAI(process.env.API_KEY);
48-
49-
const model = genAI.getGenerativeModel({ model: "gemini-1.5-flash" });
50-
```
51-
52-
3. Run a prompt
53-
54-
```js
55-
import * as fs from 'fs';
56-
const prompt = "Does this look store-bought or homemade?";
57-
const image = {
58-
inlineData: {
59-
data: Buffer.from(fs.readFileSync("cookie.png")).toString("base64"),
60-
mimeType: "image/png",
61-
},
62-
};
63-
64-
const result = await model.generateContent([prompt, image]);
65-
console.log(result.response.text());
66-
```
67-
68-
## Try out a sample app
69-
70-
This repository contains sample Node and web apps demonstrating how the SDK can
71-
access and utilize the Gemini model for various use cases.
72-
73-
**To try out the sample Node app, follow these steps:**
74-
75-
1. Check out this repository. \
76-
`git clone https://github.com/google/generative-ai-js`
77-
78-
1. [Obtain an API key](https://makersuite.google.com/app/apikey) to use with
79-
the Google AI SDKs.
80-
81-
2. cd into the `samples` folder and run `npm install`.
82-
83-
3. Assign your API key to an environment variable: `export API_KEY=MY_API_KEY`.
84-
85-
4. Open the sample file you're interested in. Example: `text_generation.js`.
86-
In the `runAll()` function, comment out any samples you don't want to run.
87-
88-
5. Run the sample file. Example: `node text_generation.js`.
89-
90-
## Documentation
91-
92-
See the
93-
[Gemini API Cookbook](https://github.com/google-gemini/gemini-api-cookbook/) or
94-
[ai.google.dev](https://ai.google.dev) for complete documentation. For the API reference docs, please refer to [JavaScript SDK Reference](https://github.com/google-gemini/generative-ai-js/blob/main/docs/reference/main/index.md).
95-
96-
## Contributing
97-
98-
See [Contributing](/docs/contributing.md) for more information on contributing
99-
to the Google AI JavaScript SDK.
100-
101-
## License
102-
103-
The contents of this repository are licensed under the
104-
[Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
9+
Thank you for building with Gemini and [let us know](https://discuss.ai.google.dev/c/gemini-api/4) if you need any help!

0 commit comments

Comments
 (0)