A powerful web content fetcher and processor
Project description
Ailite
A lightweight Python interface for AI model interactions through Hugging Face's infrastructure.
Installation
pip install ailite
Usage
1. Initially SETUP Server Deployment with serve()
Launch your own API server:
from ailite import serve
# Start server on http://0.0.0.0:11435
serve()
1. Quick Start with ai()
The simplest way to get started:
from ailite import ai
response = ai("Explain quantum computing")
print(response)
2. Customization with ai()
from ailite import ai
response = ai(
"Explain quantum computing",
model="nvidia/Llama-3.1-Nemotron-70B-Instruct-HF",
conversation=False
)
3. Streaming Response with ai()
from ailite import ai
# With streaming
for chunk in ai(
"Write a story about space",
stream=True
):
print(chunk, end="")
4. Client Usage with HUGPIClient
For more control over interactions:
from ailite import HUGPIClient
client = HUGPIClient(
api_key="your_email@gmail.com_your_password",
model="nvidia/Llama-3.1-Nemotron-70B-Instruct-HF",
system_prompt="You are a helpful assistant..."
)
# Generate text
response = client.messages.create(
prompt="What is the theory of relativity?",
conversation=True
)
print(response.content[0]["text"])
# Chat conversation
messages = [
{"role": "user", "content": "Hi, how are you?"},
{"role": "assistant", "content": "I'm doing well, how can I help?"},
{"role": "user", "content": "Tell me about AI"}
]
response = client.messages.create(messages=messages)
5. Base Model with HUGPiLLM
For direct model interactions:
from ailite import HUGPiLLM
llm = HUGPiLLM(
hf_email="your_email@gmail.com",
hf_password="your_password",
default_llm=3, # Model index
system_prompt="Custom system instructions here"
)
response = llm.generate("Explain machine learning")
Dependencies
fastapi>=0.68.0
pydantic>=1.8.0
uvicorn>=0.15.0
requests>=2.26.0
License
MIT License - see LICENSE file for details.
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
ailite-5.0.5.tar.gz
(35.7 kB
view details)
Built Distribution
ailite-5.0.5-py3-none-any.whl
(44.6 kB
view details)
File details
Details for the file ailite-5.0.5.tar.gz
.
File metadata
- Download URL: ailite-5.0.5.tar.gz
- Upload date:
- Size: 35.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d46c3965f714fe3c15d624e350000bcdef0f1e9c3e034af104cdce96a59d0e98 |
|
MD5 | ae75e95c10f20c3b62461a3674017d71 |
|
BLAKE2b-256 | 2c2524047bb9d55e12fb6f9222cfe685bb319c8a70646720c8fe14ac4bc7de10 |
File details
Details for the file ailite-5.0.5-py3-none-any.whl
.
File metadata
- Download URL: ailite-5.0.5-py3-none-any.whl
- Upload date:
- Size: 44.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fbbfeb3341e1f20b331d124cf646ff1ab3e3542409539334a20f3eb1479dd4f |
|
MD5 | ae48b3e804eccfc2cf23bbcadb13fd47 |
|
BLAKE2b-256 | 5e0edcfb35512d8ae80b072c3cfb02db9e5f8f8bd5716459c1b3eef6de988147 |