Skip to main content

A module for creation of endpoint for the open-sourced LLMs

Project description

📝 XS Module Documentation

The workflow of the XS module, with a tagline : xs makes you access

xs-module.png

This module leverages Flask, Pyngrok, and Waitress to create a simple API endpoint for text generation of all Open Source LLMs.

🚀 Features

  • 🌐 API Endpoint Creation: Easily create an API endpoint to access the text generation function.
  • 🔀 Dynamic Port Allocation: Automatically find an available port to avoid conflicts.
  • 🚧 Ngrok Tunneling: Expose your local server to the internet using Ngrok.
  • 🔄 Flushing Tunnels: Clear previous Ngrok tunnels to avoid the max tunnel limit.

📦 Installation

To use this module, you need to install by the following command :

pip install 'git+https://github.com/xprabhudayal/xs.git'

📋 Tutorials and Usage

1 Watch these videos for better Understanding

LinkedIn Video LinkedIn Video

2. Finding an Available Port

xs.find_port()

It dynamically finds an available port.

3. Forward Function

xs.forward(NGROK_API)

The xs.forward() function sets up the Ngrok tunnel and starts the server using Waitress. NGROK_API is required here.

4. Connect Text Function

xs.connect_text(url, prompt)

The connect_text function allows remote devices to access the API and use the text generation option. It sends a POST request to the API endpoint with the provided data and prints the generated text response.

5. Flushing Tunnels

xs.flush()

The flush function clears all previous Ngrok tunnels. In the free tier, you can have 3 tunnels only! This is useful if you encounter the maximum tunnel limit error from Ngrok.

🔧 Future Features

  • Port Killing: Automatically kill processes using specific ports before starting the server.
  • Enhanced Error Handling: Improve the robustness of error handling mechanisms.

🛠 Troubleshooting

  • Ngrok Tunnel Error: If you encounter a max tunnel limit, use the flush function to clear previous tunnels.
  • JSON Decode Error: Ensure the API response is correctly formatted JSON.

License 📄

This project is licensed under the MIT License.

Contact 📧

For any inquiries, please reach me at : MAIL

Made with 💖 by Prabhudayal

Enjoy using the xs.py module! 🚀

Project details


Download files

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

Source Distribution

llm_xs-1.0.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

llm_xs-1.0.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file llm_xs-1.0.0.tar.gz.

File metadata

  • Download URL: llm_xs-1.0.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for llm_xs-1.0.0.tar.gz
Algorithm Hash digest
SHA256 4d9a75db07aea19505376fc9347bdcb3a93f4da4d69867e4681c9606bb029572
MD5 cb267179670dc102d163eb5b040d6b0b
BLAKE2b-256 2e097fb21c24fe5862cfcbcbd2527b9bb9dc42a67e8d8c9a36a6f13db7c3d648

See more details on using hashes here.

File details

Details for the file llm_xs-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: llm_xs-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for llm_xs-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2bf612fd81e2169bfb585804591ec1bb5d9fc17e9b45accc8191fbca288966af
MD5 737287e8e55e3f76ff66c22cfa168675
BLAKE2b-256 8daacbf84b1c93a7a90ee65b65d9a069092e133a2a447764fb2b6a78ab6d3fea

See more details on using hashes here.

Supported by

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