
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
gemini-nano-prompt
Advanced tools
A lightweight wrapper for the Gemini Nano package, designed to simplify interactions and streamline the integration process. This wrapper enhances usability by providing a more intuitive interface for utilizing Gemini Nano's features.
A lightweight wrapper for the Gemini Nano package, designed to simplify interactions and streamline the integration process. This wrapper enhances usability by providing a more intuitive interface for utilizing Gemini Nano's features.
This Wrapper is built on top of the browser's in-built Gemini nano which is window.ai just plug it and start using prompts.
Since this is an experimental feature, for the initial setup please Refer the documentation, Please make sure the code is running in your local browser this setup is not for the server.
To install the Gemini Nano Wrapper, use npm:
npm install gemini-nano-prompt
Let's start, It's simple to use:
import GeminiNano from "gemini-nano-prompt";
let geminiNano = new GeminiNano(); // by default topK : 3 and temperature : 0.8
let response = await geminiNano.prompt("Hi What is Gemini Nano");
console.log("This is a Gemini response :", response);
for Fine tuning
import GeminiNano from "gemini-nano-prompt";
let geminiNano = new GeminiNano( { topK : 8 , temperature : 0. 9 } );
let response = await geminiNano.prompt("Hi What is Gemini Nano");
console.log("This is a Gemini response :", response);
The following are the API Interface:
interface CustomCapabilities {
topK : Number,
temperature : Number
}
constructor(customCapabilities?: CustomCapabilities )
Checks environment for required specification and Create a session for prompting( pass assistant) or summarize(pass summarizer) returns session created sucessfully or not
public async createSession(sessionType: "assistant" | "summarizer" = "assistant"): Promise<boolean>
closes a session : please close session every time for better browser performace
public closeSession(): void
use this for prompting this will automatically checks browser requirement and checks the eligibilty for gemini nano and creates and closes a session for every prompt call
public async prompt(query: string): Promise<{ response: any } | void>
use this for getting summury this will automatically checks browser requirement and checks the eligibilty for gemini nano and creates and closes a session for every prompt call
public async summarizer(query: string): Promise<{ response: any } | void>
import GeminiNano from "gemini-nano-prompt";
class Prompt {
constructor() {}
async getFAQs(listOfTopics, question) {
let geminiNano = new GeminiNano()
let prompt = `Answer the Questions Only related topics which is : ${listOfTopics} The Question is : ${question} if is not relavent topics: ${listOfTopics} Rspond with a Apology note`;
console.log(prompt);
let result = await geminiNano.prompt(prompt)
return result;
}
}
const prompt = new Prompt();
export default prompt
Thank you for considering contributing to My Project! We appreciate your help in making this project better. Here are some guidelines to help you get started.
Clone your forked repository to your local machine using the following command:
git clone [https://github.com/your-username/my-project.git](https://github.com/Rajath2000/gemini-nano-web.git)
npm install
This project is licensed under the ISC License.
ISC License
Copyright (c) [2024] [Rajath M R]
Permission to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, is hereby granted, free of charge, subject to the following conditions:
THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
A lightweight wrapper for the Gemini Nano package, designed to simplify interactions and streamline the integration process. This wrapper enhances usability by providing a more intuitive interface for utilizing Gemini Nano's features.
The npm package gemini-nano-prompt receives a total of 0 weekly downloads. As such, gemini-nano-prompt popularity was classified as not popular.
We found that gemini-nano-prompt demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.