Skip to main content

A python library for AI personality definition

Project description

Lord of Large Language Models (LoLLMs) Server

Logo

GitHub license GitHub issues GitHub stars GitHub forks Discord Follow me on Twitter Follow Me on YouTube

Lord of Large Language Models (LoLLMs) Server is a text generation server based on large language models. It provides a Flask-based API for generating text using various pre-trained language models. This server is designed to be easy to install and use, allowing developers to integrate powerful text generation capabilities into their applications.

Features

  • Generate text using large language models.
  • Supports multiple personalities for generating text with different styles and tones.
  • Real-time text generation with WebSocket-based communication.
  • RESTful API for listing personalities and adding new personalities.
  • Easy integration with various applications and frameworks.

Installation

You can install LoLLMs Server using pip, the Python package manager. Open your terminal or command prompt and run the following command:

pip install lollms-server

Usage

Once installed, you can start the LoLLMs Server using the lollms-server command followed by the desired parameters.

lollms-server --host <host> --port <port> --config <config_file> --bindings_path <bindings_path> --personalities_path <personalities_path> --models_path <models_path> --binding_name <binding_name> --model_name <model_name> --personality_full_name <personality_full_name>

Parameters

  • --host: The hostname or IP address to bind the server (default: localhost).
  • --port: The port number to run the server (default: 9600).
  • --config: Path to the configuration file (default: None).
  • --bindings_path: The path to the Bindings folder (default: "./bindings_zoo").
  • --personalities_path: The path to the personalities folder (default: "./personalities_zoo").
  • --models_path: The path to the models folder (default: "./models").
  • --binding_name: The default binding to be used (default: "llama_cpp_official").
  • --model_name: The default model name (default: "Manticore-13B.ggmlv3.q4_0.bin").
  • --personality_full_name: The full name of the default personality (default: "personality").

Examples

Start the server with default settings:

lollms-server

Start the server on a specific host and port:

lollms-server --host 0.0.0.0 --port 5000

API Endpoints

WebSocket Events

  • connect: Triggered when a client connects to the server.
  • disconnect: Triggered when a client disconnects from the server.
  • list_personalities: List all available personalities.
  • add_personality: Add a new personality to the server.
  • generate_text: Generate text based on the provided prompt and selected personality.

RESTful API

  • GET /personalities: List all available personalities.
  • POST /personalities: Add a new personality to the server.

Sure! Here are examples of how to communicate with the LoLLMs Server using JavaScript and Python.

JavaScript Example

// Establish a WebSocket connection with the server
const socket = io.connect('http://localhost:9600');

// Event: When connected to the server
socket.on('connect', () => {
  console.log('Connected to the server');

  // Request the list of available personalities
  socket.emit('list_personalities');
});

// Event: Receive the list of personalities from the server
socket.on('personalities_list', (data) => {
  const personalities = data.personalities;
  console.log('Available Personalities:', personalities);

  // Select a personality and send a text generation request
  const selectedPersonality = personalities[0];
  const prompt = 'Once upon a time...';
  socket.emit('generate_text', { personality: selectedPersonality, prompt: prompt });
});

// Event: Receive the generated text from the server
socket.on('text_generated', (data) => {
  const generatedText = data.text;
  console.log('Generated Text:', generatedText);

  // Do something with the generated text
});

// Event: When disconnected from the server
socket.on('disconnect', () => {
  console.log('Disconnected from the server');
});

Python Example

import socketio

# Create a SocketIO client
sio = socketio.Client()

# Event: When connected to the server
@sio.on('connect')
def on_connect():
    print('Connected to the server')

    # Request the list of available personalities
    sio.emit('list_personalities')

# Event: Receive the list of personalities from the server
@sio.on('personalities_list')
def on_personalities_list(data):
    personalities = data['personalities']
    print('Available Personalities:', personalities)

    # Select a personality and send a text generation request
    selected_personality = personalities[0]
    prompt = 'Once upon a time...'
    sio.emit('generate_text', {'personality': selected_personality, 'prompt': prompt})

# Event: Receive the generated text from the server
@sio.on('text_generated')
def on_text_generated(data):
    generated_text = data['text']
    print('Generated Text:', generated_text)

    # Do something with the generated text

# Event: When disconnected from the server
@sio.on('disconnect')
def on_disconnect():
    print('Disconnected from the server')

# Connect to the server
sio.connect('http://localhost:9600')

# Keep the client running
sio.wait()

Make sure to have the necessary dependencies installed for the JavaScript and Python examples. For JavaScript, you need the socket.io-client package, and for Python, you need the python-socketio package.

Contributing

Contributions to the LoLLMs Server project are welcome and appreciated. If you would like to contribute, please follow the guidelines outlined in the CONTRIBUTING.md file.

License

LoLLMs Server is licensed under the Apache 2.0 License. See the LICENSE file for more information.

Repository

The source code for LoLLMs Server can be found on GitHub

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lollms-1.1.10.tar.gz (17.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lollms-1.1.10-py3-none-any.whl (17.5 MB view details)

Uploaded Python 3

File details

Details for the file lollms-1.1.10.tar.gz.

File metadata

  • Download URL: lollms-1.1.10.tar.gz
  • Upload date:
  • Size: 17.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.0

File hashes

Hashes for lollms-1.1.10.tar.gz
Algorithm Hash digest
SHA256 da7f0bac37f1e75e5369c72e1531ef4e9a2e85ecc21015c7345f2641842fffe1
MD5 41cbbe720cfe1ed3852d08eb983fa093
BLAKE2b-256 b21d9fd09d1b31570408ad4427f1313bdd21e049dd862c9149634bfc3e30b3b6

See more details on using hashes here.

File details

Details for the file lollms-1.1.10-py3-none-any.whl.

File metadata

  • Download URL: lollms-1.1.10-py3-none-any.whl
  • Upload date:
  • Size: 17.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.0

File hashes

Hashes for lollms-1.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 4233744a26d43228b753e095f985a8862a172f15027fa3797792f8ab0e7c8b8b
MD5 f69d37645d6605a704a371ea8018c12d
BLAKE2b-256 65360f8cc6220d3eb8a73a4525456f3276567629c1fe6619047caa9a3a8985e1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page