Skip to main content

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.

Metadata

Release files for ailite-legacy 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ailite-legacy 0.0.1
File Size Uploaded Provenance
ailite_legacy-0.0.1.tar.gz 37.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ailite-legacy 0.0.1
File Interpreter ABI Platform
ailite_legacy-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 84.2 kB

Release files / ailite_legacy-0.0.1.tar.gz

Download URL ailite_legacy-0.0.1.tar.gz
Size 37.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6008d0126ea2bf5424c8286373fc307190cda7041b9dc76a94539440b0cc45b9
BLAKE2b-256 checksum
How to use checksums
b25ae2626ab8981c0a8194b7375b202d4f3866b0fae9405f6344bef352469565
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.0rc1

Release files / ailite_legacy-0.0.1-py3-none-any.whl

Download URL ailite_legacy-0.0.1-py3-none-any.whl
Size 46.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36c74f4f1b94b5bde47cf53da9a9f7fe7cb71b3eba32aa49d27ed014471c6f7f
BLAKE2b-256 checksum
How to use checksums
8d7214fa8bb8dc3491bc10e9cd4cbedfa029bea2853b6885b8c2cd5a3d9f396a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.0rc1

Security for ailite-legacy 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page