npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lollms_client_js

v1.0.5

Published

A client for lollms server

Downloads

6

Readme

LoLLMs Client JS Detailed Guide

GitHub license npm version Build Status

Dive deeper into the capabilities of the LoLLMs Client JS library 🌌, crafted for developers by ParisNeo. This detailed guide will cover the methods provided by the library, including how to use them and their parameters, to empower your applications with cutting-edge AI text generation.

Installation

Ensure you have Node.js installed, then add LoLLMs Client JS to your project:

npm install lollms_client_js

Initialization

Start by importing and initializing the LollmsClient:

const LollmsClient = require('lollms_client_js');

// Initialize the client with your LoLLMs host and the model name.
const client = new LollmsClient('http://your-lollms-host.com', 'modelName');

Methods Overview

The LollmsClient provides several methods for interacting with the LoLLMs backend:

  • generateText()
  • generate_completion()
  • listMountedPersonalities()
  • listModels()

generateText(prompt, options)

Generates text based on a given prompt and options.

Parameters:

  • prompt (String): The input text to generate further content.
  • options (Object): Optional parameters to customize the request. Includes:
    • stream (Boolean): Whether to stream the response.
    • temperature (Number): Controls randomness.
    • topK (Number): Filters the top K candidates before sampling.
    • topP (Number): Nucleus sampling.
    • repeatPenalty (Number): Penalty for repetition.
    • repeatLastN (Number): Number of tokens to check for repetition.
    • seed (Number): Random seed for reproducibility.
    • nThreads (Number): Number of threads to use.

Example:

client.generateText("Hi there, how can I assist you today?", { temperature: 0.9 }).then(response => {
  console.log(response);
});

generate_completion(prompt, options)

Generates a completion for a given prompt with detailed control over the generation process.

Parameters:

Similar to generateText, but with an additional completionFormat parameter to specify the format of the generated completion.

Example:

client.generate_completion("The future of AI in robotics is", { temperature: 0.7, completionFormat: "vllm instruct" }).then(completion => {
  console.log(completion);
});

listMountedPersonalities()

Lists all mounted personalities available on the LoLLMs server.

Example:

client.listMountedPersonalities().then(personalities => {
  console.log(personalities);
});

listModels()

Lists all models available for text generation on the LoLLMs server.

Example:

client.listModels().then(models => {
  console.log(models);
});

Contributing

Your contributions are welcome! Follow the steps below to contribute:

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

TasksLibrary Documentation

The TasksLibrary is a JavaScript library designed to simplify and streamline the use of the LoLLMs (Lord Of Large Language Models) Client for common text processing tasks such as translation and summarization. This documentation provides an overview of the library's functionality and how to utilize it in your projects.

Getting Started

To use the TasksLibrary, you first need an instance of the LollmsClient. This client is responsible for communicating with the LoLLMs service, sending prompts, and receiving generated text.

Installation

Ensure you have the LollmsClient JavaScript class available in your project. The TasksLibrary class then needs to be included in your project:

import { LollmsClient } from './path/to/lollms_client_js.js';
import { TasksLibrary } from './path/to/lollms_client_js.js';

Initialization

Create an instance of the LollmsClient with your service configuration:

const lollmsClient = new LollmsClient(
  'your_host_address',
  'your_model_name',
  // Other parameters as needed
);

Then, instantiate the TasksLibrary with the LollmsClient instance:

const tasksLibrary = new TasksLibrary(lollmsClient);

Features

The TasksLibrary currently supports the following features:

Text Translation

Translate a chunk of text to a specified language without altering the original meaning or adding extraneous information.

Usage

tasksLibrary.translateTextChunk(textChunk, outputLanguage)
  .then(translatedText => {
    console.log(translatedText);
  })
  .catch(error => {
    console.error(error);
  });

Text Summarization

Summarize a given text chunk in a concise manner, ensuring all key points are covered without introducing new information.

Usage

tasksLibrary.summarizeText(textChunk, summaryLength)
  .then(summary => {
    console.log(summary);
  })
  .catch(error => {
    console.error(error);
  });

Parameters

  • textChunk: The text to be processed.
  • outputLanguage: (For translation) The target language for the translation.
  • summaryLength: (For summarization) The desired length of the summary. Can be "short", "medium", or "long".
  • hostAddress, modelName, temperature, maxGenerationSize: Additional parameters for customization and optimization of the task.

Conclusion

The TasksLibrary is a powerful tool for developers working with text processing in the context of AI and robotics. By leveraging the capabilities of LoLLMs, it offers an easy and efficient way to perform complex tasks such as translation and summarization.

For more information and updates, follow the project's GitHub repository or join our community on Discord.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Contact

Reach out to ParisNeo for any questions or suggestions:

Project Repository: https://github.com/ParisNeo/lollms_client_js

Thank you for choosing LoLLMs Client JS for your project. Happy coding!

See ya 👋


This extended guide provides a closer look at the capabilities and usage of the `LollmsClient` methods, offering developers a clear understanding of how to leverage the library for their applications.