Observed since 21 Oct, 11:11 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A simplistic ai for Huggingface llms free hosted models.
AILiteLLM is a lightweight Python wrapper around the Hugging Face Inference API that provides OpenAI-like interface for various open-source language models. It makes it easy to use powerful open-source models with an interface familiar to OpenAI developers.
From PyPI:
pip install ailitellm
From source:
git clone https://github.com/yourusername/ailitellm.git
cd ailitellm
pip install -e .
Development installation:
pip install -e ".[dev]"
from ailitellm import ai, ailite_model
# Simple completion
response = ai("What is the capital of France?")
print(response.choices[0].message.content)
# Using a specific model
response = ai(
"Explain quantum computing",
model=ailite_model("Qwen/Qwen2.5-72B-Instruct")
)
AILiteLLM supports the following models:
Qwen/Qwen2.5-72B-Instruct - Large general purpose modelQwen/QwQ-32B-Preview - Preview version of QwQ modelQwen/Qwen2.5-Coder-32B-Instruct - Specialized for coding tasksNousResearch/Hermes-3-Llama-3.1-8B - Efficient general purpose modelmicrosoft/Phi-3.5-mini-instruct - Lightweight instruction-following modelmessages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Tell me a joke about programming."}
]
response = ai(messages)
for chunk in ai("Write a poem about AI", stream=True):
print(chunk.choices[0].delta.content, end="")
def get_weather(location: str, unit: str = "celsius") -> str:
"""Get the weather for a location"""
pass
response = ai(
"What's the weather in London?",
tools=[get_weather],
tool_choice="auto"
)
response = ai(
"Generate a creative story",
temperature=0.8,
max_tokens=500,
top_p=0.9,
presence_penalty=0.6
)
from ailitellm import AILite
custom_client = AILite(
base_url="your_custom_endpoint",
api_key="your_api_key"
)
try:
response = ai("Your prompt here")
except Exception as e:
print(f"An error occurred: {e}")
ai(messages_or_prompt, **kwargs)Main interface for generating completions.
Key parameters:
messages_or_prompt: List of messages or string promptmodel: Model to use (default: "Qwen/Qwen2.5-72B-Instruct")temperature: Sampling temperature (default: 0)max_tokens: Maximum tokens to generatestream: Enable streaming responsestools: List of functions for tool callingailite_model(model: HFModelType)Helper function to specify model type with proper type checking.
AILiteCustom client class extending OpenAI's base client.
To set up the development environment:
# Clone the repository
git clone https://github.com/yourusername/ailitellm.git
cd ailitellm
# Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest tests/
Contributions are welcome! Please feel free to submit a Pull Request. See CONTRIBUTING.md for guidelines.
If you use AILiteLLM in your research, please cite:
@software{ailitellm2024,
author = {Your Name},
title = {AILiteLLM: OpenAI-compatible Interface for Hugging Face Models},
year = {2024},
publisher = {GitHub},
url = {https://github.com/yourusername/ailitellm}
}
This project is licensed under the MIT License - see the LICENSE file for details.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 0.1.10 | 30 Dec 2024 | 4 |
This describes our collected data; it is not a security assessment.
Observed since 21 Oct, 11:11 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:25b8230662dcf0b469d8b087289dce09cfc796926ea9d96c3073d7d9ccf71606