GithubHelp home page GithubHelp logo

zakcali / gemini-chat Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 36 KB

nodejs program to send and receive messages, creates message history

HTML 40.32% JavaScript 59.68%
api chat-application gemini-pro javascript nodejs gemini-api

gemini-chat's Introduction

gemini-chat

nodejs program to send and receive messages, and get message history

Install the libraries by entering the following command in the keyboard:

npm install @google/generative-ai socket.io express

Run the program by typing:

node index.js

Open the program by navigating to the following address in any browser:

http://localhost:3000/

if necessary change the system prompt at file systemi.txt you can check if default systemInstruction is working or not by asking:

what is your name?
where do you live?

if you want to see returned candidates on console, unmark following line:

		// console.log(util.inspect(response.candidates, {showHidden: false, depth: null, colors: true}))

to reset the chat, refresh page.

do not forget to set randomness (temperature) between 0.0 to 1.0 according to your needs here:

const generationConfig = {
      temperature: 0.9,
    };

to be able to use this api, you need to get an api from https://makersuite.google.com/app/apikey, and set as environment variable named GEMINI_API_KEY

displays if response.candidates[0].finishReason is not 'STOP'

chat session ends if finish reason is: RECITATION

look at: google-gemini/generative-ai-js#124

Also look at: google-gemini/generative-ai-js#106

if chat session ends because of above reasons, just refresh the web page to start a new chat session

gemini-chat's People

Contributors

zakcali avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.