A more fun way to interact with Gemini.
await ask("am i deserve better?");
Gem is a simple package that allows you to interact with the Gemini API in a more human-friendly way.
It's like talking to a friend, but in a more professional way. It's simplify the process of sending requests to the Gemini API, so you can focus more on the conversation itself. It's even more simpler than other API wrappers.
π§ This package is still under heavy development. Beware of breaking changes.
It's only require 3 simple steps to get started.
Install the package
npm install @ezralazuardy/gem
Set the environment variables
GEMINI_API_KEY="<YOUR_GEMINI_API_KEY>"
Ask the Gemini.
import { ask } from "@ezralazuardy/gem";
const response = await ask("what is the weather today?");
console.log(response);
Yup, just like that! Simple, right?
For advanced usage, please read the documentation below.
By default, the model used is gemini-pro
. You can change it by setting the GEMINI_MODEL_ID
environment variable.
GEMINI_MODEL_ID="gemini-pro"
Please beware of the pricing and capabilities of each model.
As of v0.0.1
, the following models are available:
gemini-pro
(default)gemini-1.5-pro-latest
Plase refer to these references: Gemini API Models, Gemini API Pricing.
The following features are planned to be implemented in the future.
Supported | Method | Version | Usage |
---|---|---|---|
π’ | ask |
v0.0.1+ |
Generates text for a given prompt. |
π΄ | askByStream |
- |
Streams a text generations. |
π΄ | object |
- |
Generates a typed, structured object for a given prompt. |
π΄ | objectByStream |
- |
Streams a typed, structured object for a given prompt. |
A proper documentation is still in progress π₯²
Written in Typescript. Heavily inspired by Vercel AI and Gemini.