Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@optimaxer/web-text
Advanced tools
Welcome to the @optimaxer/web-text documentation! This library is a powerful tool designed to bring the benefits of generative AI directly to your web applications. By leveraging a small language model that runs on the end user's device, @optimaxer/web-te
Welcome to the @optimaxer/web-text documentation! This library is a powerful tool designed to bring the benefits of generative AI directly to your web applications. By leveraging a small language model that runs on the end user's device, @optimaxer/web-text allows you to generate high-quality texts with ease. Whether you're looking to create concise summaries, compelling titles, or even entire text sections, this library offers a flexible and efficient solution. Our goal is to simplify the tasks of your employees, reducing their workload and increasing productivity through intelligent text generation.
@optimaxer/web-text is a generative AI library that harnesses the power of a small language model to create various types of text content. The library is designed to operate directly within the user's browser, ensuring quick and secure processing without relying on external servers. This makes it an ideal choice for applications where privacy, speed, and ease of integration are crucial.
By integrating @optimaxer/web-text into your applications, you can provide users with a powerful tool that simplifies content creation, streamlines workflows, and enhances overall productivity.
⚠️ Warning
Due to the restrictions of the Firefox browser, these libraries and functionalities may not work well on Firefox. Please note this limitation.
Getting started with @optimaxer/web-text is straightforward. Follow these steps to integrate the library into your project and start generating text content:
npm install @optimaxer/web-text
This command will add the library to your project's dependencies.
Once the library is installed, you need to set up the Text Generator component. This step involves initializing the Text Generator with the appropriate configurations, including the Small Language Model.
import { TextGenerator } from '@optimaxer/web-text';
You need to specify the model and engine for the form. For example, if you are using gemma
as your model and mediapipe
as your embedding engine, you can set it up like this:
const textGenerator = await textGenerator.setup({
model: 'gemma',
inferenceEngine: 'mediapipe',
mode: 'local'
});
When using the setup function, it's important to select compatible model names and inference engines.
webllm
as the inference engine:phi
, gemma
, gemma2
mediapipe
as the inference engine:gemma
, gemma-cpu
, gemma-gpu
Make sure to select the appropriate combination of model and engine to ensure that the setup function executes successfully.
Now that everything is set up, you can start generating text. Here's how:
To generate a concise summary of a long text, use the generateSummary
method. The second parameter specifies the desired length of the summary:
const summary = await textGenerator.value.generateSummary('Your long text here', 50);
This command will return a summary that captures the key points of the provided text, making it easier for users to digest large amounts of information quickly.
Creating an attention-grabbing title is just as easy. The generateTitle
method can be used to generate a title based on the given text content:
const title = await textGenerator.value.generateTitle('Your text here');
This function is particularly useful for content management systems, blog post generators, or any application where creating compelling titles is essential.
If you need to create a more personalized or context-specific section of text, you can use the generateText
method:
const customText = textGenerator.generateText('Your text here', 'Your custom text type');
💡 When using the
generateText
function, it's important to define thecustomTextType
in a clear and easily understandable manner. Using simple and specific terms like "abstract," "order note," or "subtitle" helps the text generator produce content that closely aligns with your intended output. Avoid overly complex or ambiguous text types, as this could lead to less accurate or relevant generated text. Keeping it straightforward ensures the best results for your custom text sections.
FAQs
Welcome to the @optimaxer/web-text documentation! This library is a powerful tool designed to bring the benefits of generative AI directly to your web applications. By leveraging a small language model that runs on the end user's device, @optimaxer/web-te
We found that @optimaxer/web-text demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.