HuggingFace Commercial Model Free API
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
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 ailite_legacy-0.0.1.tar.gz.
File metadata
- Download URL: ailite_legacy-0.0.1.tar.gz
- Upload date:
- Size: 37.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.0rc1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6008d0126ea2bf5424c8286373fc307190cda7041b9dc76a94539440b0cc45b9
|
|
| MD5 |
5f308e8e65ceb22054571e9183eb57b0
|
|
| BLAKE2b-256 |
b25ae2626ab8981c0a8194b7375b202d4f3866b0fae9405f6344bef352469565
|
File details
Details for the file ailite_legacy-0.0.1-py3-none-any.whl.
File metadata
- Download URL: ailite_legacy-0.0.1-py3-none-any.whl
- Upload date:
- Size: 46.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.0rc1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36c74f4f1b94b5bde47cf53da9a9f7fe7cb71b3eba32aa49d27ed014471c6f7f
|
|
| MD5 |
7bac1774970d0035b8adb875a4607c45
|
|
| BLAKE2b-256 |
8d7214fa8bb8dc3491bc10e9cd4cbedfa029bea2853b6885b8c2cd5a3d9f396a
|