LLMlight is a Python library for ...
Project description
LLMlight
LLMlight is a Python package for running Large Language Models (LLMs) locally with minimal dependencies. It provides a simple interface to interact with various LLM models, including support for GGUF models and local API endpoints.
🌟 Key Features
- Local LLM Support: Run LLMs locally with minimal dependencies
- Multiple Model Support: Compatible with various models including:
- Hermes-3-Llama-3.2-3B
- Mistral-7B-Grok
- OpenHermes-2.5-Mistral-7B
- Gemma-2-9B-IT
- Flexible Embedding Methods: Support for multiple embedding approaches:
- TF-IDF for structured documents
- Bag of Words (BOW)
- BERT for free text
- BGE-Small
- Advanced Retrieval Methods:
- Naive RAG with fixed chunking
- RSE (Relevant Segment Extraction)
- PDF Processing: Built-in support for reading and processing PDF documents
- Global Reasoning: Advanced reasoning capabilities for complex queries
📚 Documentation & Resources
🚀 Quick Start
Installation
# Install from PyPI
pip install LLMlight
# Install from GitHub
pip install git+https://github.com/erdogant/LLMlight
Basic Usage
from LLMlight import LLMlight
# Initialize with default settings
model = LLMlight()
# Run a simple query
response = model.prompt('What is the capital of France?',
system="You are a helpful assistant.")
# Use with a local GGUF model
model = LLMlight(endpoint='path/to/your/model.gguf')
response = model.prompt('Tell me about quantum computing')
📊 Examples
1. Using with LM Studio
from LLMlight import LLMlight
# Initialize with LM Studio endpoint
model = LLMlight(endpoint="http://localhost:1234/v1/chat/completions")
# Run queries
response = model.prompt('Explain quantum computing in simple terms')
2. Validate Models
from LLMlight import LLMlight
# Initialize model
from LLMlight import LLMlight
model = LLMlight(verbose='info')
modelnames = model.get_available_models(validate=True)
print(modelnames)
3. Processing PDF Documents and Ask Questions
from LLMlight import LLMlight
# Initialize model
model = LLMlight()
# Read and process PDF
model.read_pdf('path/to/document.pdf')
# Query about the document
response = model.prompt('Summarize the main points of this document')
print(response)
4. Global Reasoning
from LLMlight import LLMlight
# Initialize model
model = LLMlight()
# Read and process PDF
model.read_pdf('path/to/document.pdf')
# Query about the document
response = model.prompt('Summarize the main points of this document', global_reasoning=True)
print(response)
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
👥 Contributors
👨💻 Maintainer
- Erdogan Taskesen (@erdogant)
☕ Support
This library is free and open source. If you find it useful, consider supporting its development:
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llmlight-0.2.1.tar.gz.
File metadata
- Download URL: llmlight-0.2.1.tar.gz
- Upload date:
- Size: 27.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f4b3e40b48fa82aed2e93d27624a88e39897ac4f105e4c1dcbe63199d439b76
|
|
| MD5 |
d0c2112747e8bd9542cc36dc33d2c8c2
|
|
| BLAKE2b-256 |
79c8e607b5d78dbfd3d31e938a1c036109ccedb54c4272165ab810f5e0b8dbb4
|
File details
Details for the file llmlight-0.2.1-py3-none-any.whl.
File metadata
- Download URL: llmlight-0.2.1-py3-none-any.whl
- Upload date:
- Size: 29.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a02411d70d0294133950eab151cb39d20b145cf3901c305bfab53a3ba1ae50de
|
|
| MD5 |
f67bd689c1a46e1480ef241522c45a2d
|
|
| BLAKE2b-256 |
83c43f234d3a6fca3f24858371af6669fa87e0c781c3c08be561cc173f536e73
|