Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@onepunya/ez-gemini

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onepunya/ez-gemini

A wrapper for Google Gemini (Gemini Ai) API supporting both CommonJS (CJS) and ECMAScript Modules (ESM).

  • 1.3.0-saitekina
  • latest
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

##@onepunya/ez-gemini

A wrapper for Google Gemini (Gemini Ai) API supporting both CommonJS (CJS) and ECMAScript Modules (ESM).

Installation

Install the package using npm:

npm install @onepunya/ez-gemini

#Usage

CommonJS (CJS)

Create a new file example.js and add the following code to use the package with CommonJS:

const Gemini = require('@onepunya/ez-gemini');

const gemini = new Gemini();

(async () => {
  try {
    const textResponse = await gemini.pro('Hello');
    console.log('Text Response:', textResponse);

    const imageResponse = await gemini.vision('https://example.com/image.jpg', 'Describe this image');
    console.log('Response text:', imageResponse);
  } catch (error) {
    console.error('Error:', error);
  }
})();

ECMAScript Modules (ESM)

Create a new file example.js and add the following code to use the package with ECMAScript Modules:

import Gemini from '@onepunya/ez-gemini';

const gemini = new Gemini();

(async () => {
  try {
    const textResponse = await gemini.pro('Hello');
    console.log('Text Response:', textResponse);

    const imageResponse = await gemini.vision('https://example.com/image.jpg', 'Describe this image');
    console.log('Response text:', imageResponse);
  } catch (error) {
    console.error('Error:', error);
  }
})();
//use personal apikey 
new Gemini(apiKey)

//or leave it blank 
new Gemini() //by default 

##example

const Gemini = require('@onepunya/ez-gemini');
const gemini = new Gemini();

(async () => {
  try {
    const textResponse = await gemini.pro('Hello, world!');
    console.log('Text Response:', textResponse);

    const imageResponse = await gemini.vision('https://example.com/image.jpg', 'What is in this image?');
    console.log('Image Response:', imageResponse);
  } catch (error) {
    console.error('Error:', error);
  }
})();

follow me • githubinstacomunity

licence ISC

Keywords

FAQs

Package last updated on 19 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc