Gathering detailed insights and metrics for @fuyun/generative-ai
Gathering detailed insights and metrics for @fuyun/generative-ai
Gathering detailed insights and metrics for @fuyun/generative-ai
Gathering detailed insights and metrics for @fuyun/generative-ai
npm install @fuyun/generative-ai
Typescript
Module System
Min. Node Version
Node Version
NPM Version
Total Downloads
41,463
Last Day
15
Last Week
176
Last Month
755
Last Year
19,403
Minified
Minified + Gzipped
Latest Version
0.21.0
Package Id
@fuyun/generative-ai@0.21.0
Unpacked Size
394.60 kB
Size
63.62 kB
File Count
81
NPM Version
10.8.3
Node Version
20.15.0
Publised On
15 Oct 2024
Cumulative downloads
Total Downloads
Last day
-63.4%
15
Compared to previous day
Last week
-8.3%
176
Compared to previous week
Last month
59.6%
755
Compared to previous month
Last year
-12%
19,403
Compared to previous year
34
The Google AI JavaScript SDK is the easiest way for JavaScript developers to build with the Gemini API. The Gemini API gives you access to Gemini models created by Google DeepMind. Gemini models are built from the ground up to be multimodal, so you can reason seamlessly across text, images, and code.
[!CAUTION] Using the Google AI SDK for JavaScript directly from a client-side app is recommended for prototyping only. If you plan to enable billing, we strongly recommend that you call the Google AI Gemini API only server-side to keep your API key safe. You risk potentially exposing your API key to malicious actors if you embed your API key directly in your JavaScript app or fetch it remotely at runtime.
See the Node.js quickstart for complete code.
1npm install @google/generative-ai
1const { GoogleGenerativeAI } = require("@google/generative-ai"); 2 3const genAI = new GoogleGenerativeAI(process.env.API_KEY); 4 5const model = genAI.getGenerativeModel({ model: "gemini-1.5-flash" });
1const prompt = "Does this look store-bought or homemade?"; 2const image = { 3 inlineData: { 4 data: Buffer.from(fs.readFileSync("cookie.png")).toString("base64"), 5 mimeType: "image/png", 6 }, 7}; 8 9const result = await model.generateContent([prompt, image]); 10console.log(result.response.text());
This repository contains sample Node and web apps demonstrating how the SDK can access and utilize the Gemini model for various use cases.
To try out the sample Node app, follow these steps:
Check out this repository.
git clone https://github.com/google/generative-ai-js
Obtain an API key to use with the Google AI SDKs.
cd into the samples
folder and run npm install
.
Assign your API key to an environment variable: export API_KEY=MY_API_KEY
.
Open the sample file you're interested in. Example: text_generation.js
.
In the runAll()
function, comment out any samples you don't want to run.
Run the sample file. Example: node text_generation.js
.
See the Gemini API Cookbook or ai.google.dev for complete documentation.
See Contributing for more information on contributing to the Google AI JavaScript SDK.
The contents of this repository are licensed under the Apache License, version 2.0.
No vulnerabilities found.
No security vulnerabilities found.