1.0.2 ⢠Published 1 year ago
gemini-js v1.0.2
š¤ Simplify Your Interaction with Google's Gemini AI
This npm package provides a straightforward way to generate content using Google's powerful Gemini Pro model with just an API key.
š Features
- Easy setup with just an API key
- Direct access to Gemini Pro model
- Simple, promise-based API
- Built-in error handling
š Installation
Install the package using npm:
npm install gemini-js
š Getting Started
Obtain your API key from the Google AI Studio. Import and use the package in your code:
const { generateContent } = require('gemini-js');
async function main() {
const apiKey = 'YOUR_API_KEY_HERE';
const prompt = 'Write a short story about a robot learning to love.';
try {
const result = await generateContent(apiKey, prompt);
console.log(result);
} catch (error) {
console.error('Failed to generate content:', error);
}
}
main();
š ļø API
generateContent(apiKey, prompt)
Generates content using Google's Gemini Pro model.
apiKey
(string, required): Your Google AI API key.prompt
(string, required): The text prompt for content generation.
Returns: A Promise that resolves to the generated text content.
š Security
Never share your API key publicly or commit it to version control. Consider using environment variables or a secure key management service.
š Links
- Google AI Studio - Get your API key
- Gemini AI Documentation - Learn more about Gemini AI
š Acknowledgements
Google's Generative AI Node.js Library