Metadata-Version: 2.4
Name: bhumi
Version: 0.1.2
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Dist: satya>=0.2.1
License-File: LICENSE
Summary: High performance LLM client
Author-email: Rach Pradhan <rach@rachpradhan.com>
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

<p align="center">
  <img src="/assets/bhumi_logo.png" alt="Bhumi Logo" width="1600"/>
</p>

<h1 align="center"><b>Bhumi (भूमि)</b></h1>

# 🌍 **BHUMI - AI Client Setup and Usage Guide** ⚡

## **Introduction**
Bhumi (भूमि) is the Sanskrit word for **Earth**, symbolizing **stability, grounding, and speed**. Just as the Earth moves with unwavering momentum, **Bhumi AI ensures that your inference speed is as fast as nature itself!** 🚀 

Bhumi is an open-source project designed to **optimize and accelerate AI inference** while maintaining simplicity, flexibility, and multi-model support. Whether you're working with **OpenAI, Anthropic, or Gemini**, Bhumi makes switching between providers seamless. Our Rust-based implementation is freely available for anyone to use, study, modify, and integrate into their own libraries - we encourage collaboration and improvements from the community! 

> 💡 **Note to AI Companies**: Feel free to incorporate our performance optimizations into your official libraries! We just ask for appropriate attribution under our Apache 2.0 license.

---

## **1️⃣ Installation**
To install Bhumi, run the following commands:

```bash
pip install bhumi
```


```bash
rm -rf target/wheels/*
pip uninstall bhumi
maturin develop
```

> **Note:** Ensure you have **Rust** and **Python** installed before proceeding.

---

## **2️⃣ Environment Setup**
Before running Bhumi, set up your API keys in your terminal:

```bash
export OPENAI_API_KEY="your-openai-key"
export GEMINI_API_KEY="your-gemini-key"
export ANTHROPIC_API_KEY="your-anthropic-key"
```

---

## **3️⃣ Python Usage**
Here's a basic example to get started with Bhumi:

```python
import os
from bhumi import Bhumi

# Get API keys
OPENAI_KEY = os.environ['OPENAI_API_KEY']
GEMINI_KEY = os.environ['GEMINI_API_KEY']
ANTHROPIC_KEY = os.environ['ANTHROPIC_API_KEY']

# Example prompt
prompt = "Explain what a neural network is in one sentence."

# OpenAI example
openai_client = Bhumi(
    max_concurrent=10,
    provider="openai",
    model="gpt-4o",
    debug=True
)
openai_response = openai_client.completion(
    model="openai/gpt-4o",
    messages=[{"role": "user", "content": prompt}],
    api_key=OPENAI_KEY
)
print("
🌟 OpenAI Response:", openai_response.text)

# Gemini example
gemini_client = Bhumi(
    max_concurrent=10,
    provider="gemini",
    model="gemini-1.5-ultra",
    debug=True
)
gemini_response = gemini_client.completion(
    model="gemini/gemini-1.5-ultra",
    messages=[{"role": "user", "content": prompt}],
    api_key=GEMINI_KEY
)
print("
💡 Gemini Response:", gemini_response.text)

# Anthropic example
anthropic_client = Bhumi(
    max_concurrent=10,
    provider="anthropic",
    model="claude-3-opus",
    debug=True
)
anthropic_response = anthropic_client.completion(
    model="anthropic/claude-3-opus",
    messages=[{"role": "user", "content": prompt}],
    api_key=ANTHROPIC_KEY
)
print("
🤖 Anthropic Response:", anthropic_response.text)
```

---

## **4️⃣ Supported Models**
Bhumi supports **ALL models** from **OpenAI, Anthropic, and Gemini**, giving you full flexibility!

### 🔵 **OpenAI**
- `gpt-4o`, `gpt-4o-mini`, `gpt-4-turbo`, `gpt-3.5-turbo`, and more!

### 🟠 **Anthropic**
- `claude-3-opus`, `claude-3-sonnet`, `claude-3-haiku`, and more!

### 🟢 **Gemini**
- `gemini-1.5-ultra`, `gemini-1.5-pro`, `gemini-1.5-flash`, and more!

---

## ❌ **Current Limitations**
- 🚫 **No Tool Use:** Bhumi does not currently support function calling or tool use.
- 🚫 **No Streaming:** Responses are returned in a single batch; streaming is not yet available.(TODO)

---

## 🎯 **Why Use Bhumi?**
✔ **Open Source:** Apache 2.0 licensed, free for commercial use  
✔ **Community Driven:** Welcomes contributions from individuals and companies  
✔ **Blazing Fast:** **2-3x faster** than alternative solutions  
✔ **Resource Efficient:** Uses **60% less memory** than comparable clients  
✔ **Multi-Model Support:** Easily switch between **OpenAI, Anthropic, and Gemini**  
✔ **Parallel Requests:** Handles **multiple concurrent requests** effortlessly  
✔ **Flexibility:** Debugging and customization options available  
✔ **Production Ready:** Battle-tested in high-throughput environments

---

## 📊 **Real-world Performance**
In production environments, Bhumi has demonstrated:
- **125+ requests/second** sustained throughput
- **99.9% uptime** with automatic error handling
- **Sub-second latency** for most requests
- **Minimal resource footprint** even under heavy load

## 📊 **Benchmark Results**
Our latest benchmarks show significant performance advantages across different metrics:
![alt text](gemini_averaged_comparison_20250131_154711.png)
### ⚡ Response Time
- LiteLLM: 13.79s
- Native: 5.55s
- Bhumi: 4.26s
- Google GenAI: 6.76s

### 🚀 Throughput (Requests/Second)
- LiteLLM: 3.48
- Native: 8.65
- Bhumi: 11.27
- Google GenAI: 7.10

### 💾 Peak Memory Usage (MB)
- LiteLLM: 275.9MB
- Native: 279.6MB
- Bhumi: 284.3MB
- Google GenAI: 284.8MB

These benchmarks demonstrate Bhumi's superior performance, particularly in throughput where it outperforms other solutions by up to 3.2x. While memory usage remains competitive, the significant gains in response time and throughput make Bhumi an excellent choice for high-performance applications.

## 🤝 **Contributing**
We welcome contributions from the community! Whether you're an individual developer or representing a company like Google, OpenAI, or Anthropic, feel free to:

- Submit pull requests
- Report issues
- Suggest improvements
- Share benchmarks
- Integrate our optimizations into your libraries (with attribution)

Check out our [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.

## 📜 **License**
Bhumi is proudly open source under the Apache 2.0 license. This means you can:
- Use it commercially
- Modify it
- Distribute it
- Use it privately
- Use it for patents

All we ask is that you provide appropriate attribution and include the license notice.

---

🌟 **Join our community and help make AI inference faster for everyone!** 🌟

