You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: .github/README.md
+27-5
Original file line number
Diff line number
Diff line change
@@ -67,16 +67,16 @@ That's nearly 4 times less code!
67
67
68
68
</details>
69
69
70
-
And there's no sacrifices either. Gemini AI uses Google's REST API under the hood, so you get simplicity without compromise.
71
-
72
-
And, there's also more!
70
+
There's also more...
73
71
72
+
- ⚡ [**Native REST API**](#inititalization): Simplicity without compromise.
74
73
- 📝 [**Optimized File Uploads**](#optimized-file-uploads): Automatically uses Google's File API when necessary
75
74
- 📁 [**Automatic File Type Detection**](#optimized-file-uploads): Gemini AI will detect MIME types of files automatically
76
-
- 🧩 [**Automatic Request Creation**](): Auto-formats your requests—So you don't have to.
75
+
- 🧩 [**Automatic Request Creation**](#array-form): Auto-formats your requests—So you don't have to.
77
76
78
77
## Table of Contents
79
78
79
+
-[**Installation**](#installation)
80
80
-[**Getting an API Key**](#getting-an-api-key)
81
81
-[**Quickstart**](#quickstart)
82
82
-[**Special Features**](#special-features)
@@ -90,6 +90,16 @@ And, there's also more!
90
90
-[**FAQ**](#faq)
91
91
-[**Contributors**](#contributors)
92
92
93
+
## Installation
94
+
95
+
Install with the following command, or the command for your favorite package manager.
96
+
97
+
```bash
98
+
npm install gemini-ai
99
+
```
100
+
101
+
Gemini AI is a pure ES6 Module, which means you will have to use it with `import`. It is recommended that your project is also ES6, but [look in the FAQ]() for a CJS (`require()`) workaround.
102
+
93
103
## Getting an API Key
94
104
95
105
1. Go to [Google AI Studio's API keys tab](https://aistudio.google.com/app/apikey)
@@ -505,7 +515,7 @@ await gemini.ask([
505
515
506
516
Learn more in the [dedicated section](#uploading-media).
507
517
508
-
### What do I need to do for v2?
518
+
### What do I need to change for v2?
509
519
510
520
> Does everything still work?
511
521
@@ -567,5 +577,17 @@ const gemini = new Gemini(API_KEY, {
567
577
});
568
578
```
569
579
580
+
### How to use Gemini AI in a CJS environment
581
+
582
+
> I got `Error [ERR_REQUIRE_ESM]: require() of ES Module`, what can I do?
583
+
584
+
Gemini AI is a ESM (`import`) only module. It is recommended that you use ESM in your projects too. However, if you must use CJS, you can use dynamic imports. Here's an example:
<palign="center">A special shoutout to developers of and contributors to the <ahref="https://github.com/EvanZhouDev/bard-ai"><code>bard-ai</code></a> and <ahref="https://github.com/EvanZhouDev/palm-api"><code>palm-api</code></a> libraries. Gemini AI's interface is heavily based on what we have developed on these two projects.</p>
0 commit comments