gemini-js
v1.0.2
Published
A package for gemini to simplify use of gemini
Downloads
37
Readme
🤖 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