Flexible LLM interface for Ollama and more
Project description
ZunnoAI
A flexible, modular Python package for using Ollama LLMs (and more in future).
Easily run, batch, and manage local LLMs with a simple interface.
PyPI-ready, extensible, and professional.
๐ Features
- Supports all Ollama models (e.g. gemma, llama, mistral, etc.)
- Easy Python API: Just import and use
- Batch inference: Run multiple prompts at once
- History logging: Track your prompt/response history
- Auto model selection: Use any local Ollama model by name
- Ready for future: HuggingFace/OpenAI support coming soon
- PyPI installable: Clean, modular, and production-ready
๐ฆ Installation
Clone the repo and install locally:
git clone <your-repo-url>
cd zunnoai
pip install .
๐งโ๐ป Usage Examples
List available models
from zunnoai import Zunno
llm = Zunno("gemma:2b")
print("Available models:", llm.list_models())
Run a prompt
from zunnoai import Zunno
llm = Zunno("gemma:2b")
response = llm.run("Tell me a joke about AI.")
print("AI:", response)
Batch prompts
from zunnoai import Zunno
llm = Zunno("gemma:2b")
prompts = ["What is Python?", "What is machine learning?"]
results = llm.run_batch(prompts)
for i, res in enumerate(results):
print(f"Prompt {i+1}: {prompts[i]}\nAI: {res}\n")
Show history
from zunnoai import Zunno
llm = Zunno("gemma:2b")
llm.run("Say hello!")
llm.show_history()
CLI Usage
python -m zunnoai list
python -m zunnoai pull llama3
python -m zunnoai run gemma:2b "What is AI?"
python -m zunnoai --help
---
### 2. **examples/example_usage.py** (Update karo)
```python
from zunnoai import Zunno
# List available models
llm = Zunno("gemma:2b")
print("Available models:", llm.list_models())
# Run a prompt
response = llm.run("Tell me a joke about AI.")
print("AI:", response)
# Batch prompts
prompts = ["What is Python?", "What is machine learning?"]
results = llm.run_batch(prompts)
for i, res in enumerate(results):
print(f"Prompt {i+1}: {prompts[i]}\nAI: {res}\n")
# Show history
llm.show_history()
3. Docstrings (Optional but Professional)
Aap chahein toh Zunno class aur public methods mein docstrings bhi add kar sakte hain, jaise:
class Zunno:
"""
Main interface for using Ollama LLMs via Python or CLI.
"""
def list_models(self):
"""
List all available Ollama models on the local server.
Returns: list of model names (str)
"""
...
4. README.md โ Features, Requirements, Contributing, License (Already Provided)
Aapka README.md already kaafi strong hai, bas usage section ko polish kar lo.
Aap yeh changes kar lo.
Jab ho jaaye, toh batao โ agla step (PyPI publish ya koi aur feature) shuru karenge!
โ๏ธ API Reference
Zunno(model_name, ollama_url=..., output_format=..., log_to_file=..., log_file=...)run(prompt, stream=False, **kwargs)run_batch(prompts, **kwargs)show_history()help()
๐๏ธ Project Structure
zunnoai/ โโโ zunnoai/ โ โโโ core/ โ โโโ models/ โ โโโ api/ โ โโโ utils/ โ โโโ config.py โโโ tests/ โโโ examples/ โโโ setup.py โโโ README.md โโโ LICENSE
๐ Requirements
- Python 3.7+
- Ollama running locally
requestsPython package
๐ ๏ธ Extending
- Add new models in
zunnoai/models/ - Add new APIs in
zunnoai/api/ - Utilities in
zunnoai/utils/
๐ค Contributing
- Fork this repo
- Create a feature branch
- Make your changes
- Submit a pull request
๐ License
MIT License
๐โโ๏ธ Contact
For issues or suggestions, open an issue or contact the maintainer.
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 zunnoai-0.1.0.tar.gz.
File metadata
- Download URL: zunnoai-0.1.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f960ee7a9027a9c8851ea153755f2ac6df13799cbabc6b5e8fe0d79a9749b14
|
|
| MD5 |
0895bb24245bcfd2e6d1d9a3f4a3746c
|
|
| BLAKE2b-256 |
81552edca87bd05df767bd75a3c07b6ace0b5da244c13f20313ecbcd3485678b
|
File details
Details for the file zunnoai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: zunnoai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c6fa150118746eb9d20e18c2f961839155c101c92f939dcbe784bb59ef8307c
|
|
| MD5 |
f09c58cf95ecbe40c7dba362de080d4f
|
|
| BLAKE2b-256 |
3feb49e810e38d140a599dd2f0a5222e4f26b44ce1b250ee51caab9309eaea44
|