HUGPI: Unleash the Power of Large Language Models 🚀
HUGPI is a Python library that democratizes access to state-of-the-art language models. By leveraging Hugging Face's freely available large language models, HUGPI empowers developers to build sophisticated AI applications without the need for expensive API subscriptions or complex infrastructure.
🌟 Why HUGPI?
- 🆓 Access cutting-edge AI models at no cost
- 🔧 Unified API inspired by industry standards like OpenAI and Anthropic
- 🛠 Extend model capabilities with custom tools and function calling
- 🌊 Real-time interactions with streaming responses
- 🧠 Effortless conversation management for context-aware applications
HUGPI is your gateway to creating next-generation AI solutions, from chatbots and content generators to advanced reasoning systems and beyond. Harness the full potential of large language models and bring your ideas to life!
📦 Installation
Install HUGPI using pip:
pip install hugpi
🚀 Quick Start
Here's a simple example to get you started with HUGPI:
from hugpi import HUGPIClient
# Initialize the client
email = 'your_huggingface_email@example.com'
password = 'your_huggingface_password'
api_key = f'{email}_{password}'
client = HUGPIClient(model='Qwen/Qwen2.5-72B-Instruct', api_key=api_key)
# Create a simple message
response = client.messages.create(
messages=[{"role": "user", "content": "What is the capital of France?"}],
max_tokens=100
)
print(response.content[0]['text'])
🤖 Available Models
HUGPI supports a wide range of powerful language models:
meta-llama/Meta-Llama-3.1-70B-InstructCohereForAI/c4ai-command-r-plus-08-2024Qwen/Qwen2.5-72B-Instructnvidia/Llama-3.1-Nemotron-70B-Instruct-HFmeta-llama/Llama-3.2-11B-Vision-InstructNousResearch/Hermes-3-Llama-3.1-8Bmistralai/Mistral-Nemo-Instruct-2407microsoft/Phi-3.5-mini-instruct
🛠 Features and Examples
1. Basic Message Creation
Create a simple message and get a response:
response = client.messages.create(
messages=[{"role": "user", "content": "Explain quantum computing in simple terms."}],
max_tokens=150
)
print(response.content[0]['text'])
2. Conversation Management
Maintain context across multiple messages:
conversation = client.messages.create(
messages=[{"role": "user", "content": "Let's talk about space exploration."}],
conversation=True
)
print(conversation.content[0]['text'])
follow_up = client.messages.create(
messages=[{"role": "user", "content": "What are the biggest challenges?"}],
conversation=True
)
print(follow_up.content[0]['text'])
3. Streaming Responses
Get real-time responses for a more interactive experience:
for chunk in client.messages.create(
messages=[{"role": "user", "content": "Write a short story about a time traveler."}],
max_tokens=200,
stream=True
):
print(chunk.content[0]['text'], end='', flush=True)
4. Tool Calling
Extend the model's capabilities with custom functions:
def calculate_area(length: float, width: float):
"""Calculate the area of a rectangle."""
return length * width
def get_current_time():
"""Get the current time."""
from datetime import datetime
return datetime.now().strftime("%H:%M:%S")
response = client.messages.create(
max_tokens=1024,
tools=[calculate_area, get_current_time],
messages=[{"role": "user", "content": "What's the area of a 5x3 rectangle, and what time is it now?"}]
)
print(response.content[0])
5. Model Switching
Easily switch between different models:
client_llama = HUGPIClient('meta-llama/Llama-3.2-11B-Vision-Instruct', api_key=api_key)
client_qwen = HUGPIClient('Qwen/Qwen2.5-72B-Instruct', api_key=api_key)
response_llama = client_llama.messages.create(
messages=[{"role": "user", "content": "Describe the process of photosynthesis."}]
)
print("Llama response:", response_llama.content[0]['text'])
response_qwen = client_qwen.messages.create(
messages=[{"role": "user", "content": "Describe the process of photosynthesis."}]
)
print("Qwen response:", response_qwen.content[0]['text'])
6. Advanced Prompting
Use system messages to set the tone or context for the conversation:
response = client.messages.create(
messages=[
{"role": "system", "content": "You are a helpful assistant with expertise in environmental science."},
{"role": "user", "content": "What are some effective ways to reduce carbon emissions?"}
],
max_tokens=200
)
print(response.content[0]['text'])
7. Error Handling
Implement error handling to manage potential issues:
try:
response = client.messages.create(
messages=[{"role": "user", "content": "Translate this to French: Hello, world!"}],
max_tokens=50
)
print(response.content[0]['text'])
except Exception as e:
print(f"An error occurred: {str(e)}")
📊 Performance and Scalability
HUGPI is designed for high-performance scenarios:
- Optimized API calls
- Support for concurrent requests
🙏 Acknowledgements
HUGPI stands on the shoulders of giants:
- Hugging Face for their commitment to open-source AI and providing access to state-of-the-art language models.
- Transformers library, which forms the backbone of our model interactions.
- hugchat package, whose groundwork in making Hugging Face models more accessible inspired and informed our development.
We extend our heartfelt gratitude to these projects and the entire open-source AI community for making advanced AI accessible to all.
🤝 Contributing
We welcome contributions! Please check out our Contribution Guidelines for more information on how to get started.
📜 License
HUGPI is released under the MIT License. See the LICENSE file for more details.
🌟 Star History
📚 Documentation
For full documentation, visit our official documentation site.
💬 Community and Support
Join our Discord community for discussions, support, and to connect with other HUGPI users.
HUGPI - Empowering developers with cutting-edge language model capabilities. Start building amazing AI-powered applications today! 🚀🤖
Metadata
Release files for hugpi 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| hugpi-0.2.0.tar.gz | 22.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hugpi-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 50.7 kB
Release files / hugpi-0.2.0.tar.gz
| Download URL | hugpi-0.2.0.tar.gz |
|---|---|
| Size | 22.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec2540e7cc319e1534580b53c8226cd23ac74c07f17caa571c5899091cebd520
|
|
BLAKE2b-256 checksum How to use checksums |
7668e0792ca9e6465ab1cf0423c874c77bb06c16fdd0b429e7cd4bd950aa6742
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / hugpi-0.2.0-py3-none-any.whl
| Download URL | hugpi-0.2.0-py3-none-any.whl |
|---|---|
| Size | 28.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d424174b9bd2ba049820511608b1cc2e448f8db6de5929cfd6625f81821cc37c
|
|
BLAKE2b-256 checksum How to use checksums |
39a0eefe23c36219e62d1a0ab947ae22c0a540956d646e1e99af60ac02958b40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Security for hugpi 0.2.0
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.