1.0.2 • Published 1 year ago

gemini-js v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

šŸ¤– 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

šŸ™ Acknowledgements

Google's Generative AI Node.js Library

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago