Metadata-Version: 2.4
Name: minillmlib
Version: 0.4.2
Summary: Minimalist Library for programming with LLMs
Author: Quentin Feuillade--Montixi
License: MIT License
        
        Copyright (c) 2025 Quentin Feuillade--Montixi
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/qfeuilla/MiniLLMLib
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: openai==1.79.0
Requires-Dist: anthropic==0.72.0
Requires-Dist: mistralai==1.7.0
Requires-Dist: requests==2.32.3
Requires-Dist: httpx==0.28.1
Requires-Dist: python-dotenv==1.1.0
Requires-Dist: json_repair==0.44.1
Requires-Dist: pydub==0.25.1
Requires-Dist: pymongo==4.13.0
Provides-Extra: huggingface
Requires-Dist: torch; extra == "huggingface"
Requires-Dist: transformers; extra == "huggingface"
Provides-Extra: dev
Requires-Dist: pytest==8.2.2; extra == "dev"
Dynamic: license-file

# MiniLLMLib

[![GitHub stars](https://img.shields.io/github/stars/qfeuilla/MiniLLMLib?style=social)](https://github.com/qfeuilla/MiniLLMLib/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/qfeuilla/MiniLLMLib?style=social)](https://github.com/qfeuilla/MiniLLMLib/network/members)
[![GitHub issues](https://img.shields.io/github/issues/qfeuilla/MiniLLMLib)](https://github.com/qfeuilla/MiniLLMLib/issues)
[![GitHub last commit](https://img.shields.io/github/last-commit/qfeuilla/MiniLLMLib)](https://github.com/qfeuilla/MiniLLMLib/commits/main)

[![PyPI version](https://img.shields.io/pypi/v/minillmlib.svg)](https://pypi.org/project/minillmlib/)
[![Docs](https://readthedocs.org/projects/minillmlib/badge/?version=latest)](https://minillmlib.readthedocs.io/en/latest/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![Python](https://img.shields.io/pypi/pyversions/minillmlib.svg)](https://pypi.org/project/minillmlib/)

---

## Installation

```bash
pip install minillmlib
# For HuggingFace/local models: (Beta - not well tested)
pip install minillmlib[huggingface]
```

---

A Python library for interacting with various LLM providers (OpenAI, Anthropic, Mistral, HuggingFace, through URL).

Author: Quentin Feuillade--Montixi

## Installation

### From Source
```bash
git clone https://github.com/qfeuilla/MiniLLMLib.git
cd MiniLLMLib
pip install -e .  # Install in editable mode
```

## Usage

```python
import minillmlib as mll

# Create a GeneratorInfo for your model/provider
import os

gi = mll.GeneratorInfo(
    model="gpt-4",
    _format="openai",
    api_key=os.getenv("OPENAI_API_KEY")  # Recommended: use env var for secrets
)

# Create a chat node (conversation root)
chat = mll.ChatNode(content="Hello!", role="user")

# Synchronous completion
response = chat.complete_one(gi)
print(response.content)

# Or asynchronous version
# response = await chat.complete_one_async(gi)

```

## Features

- Unified interface for major LLM providers:
  - OpenAI, Anthropic, Mistral, HuggingFace (local), custom URL (e.g. OpenRouter)
- Thread (linear) and loom (tree/branching) conversation modes
- Synchronous & asynchronous API
- **Multimodal support:**
  - Audio input (WAV/MP3) compatible with OpenRouter
  - Image input (URLs, local paths, base64)
  - Audio output (OpenAI audio models, beta)
- Flexible parameter/config management via `GeneratorInfo` and `GeneratorCompletionParameters`
- Save/load conversation trees
- Extensible: add new models/providers easily

## Documentation

- See the [Usage Guide](https://minillmlib.readthedocs.io/en/latest/usage.html) for advanced usage, parameter tables, and branching/loom semantics.
- See the [Provider Matrix](https://minillmlib.readthedocs.io/en/latest/providers.html) for supported models and configuration tips.
- See [Troubleshooting](https://minillmlib.readthedocs.io/en/latest/troubleshooting.html) for common issues and debugging.

## Configuration

- Set API keys as environment variables for security (see the [Configuration Guide](https://minillmlib.readthedocs.io/en/latest/configuration.html)).

## Development & Contribution

- Run tests with:
  ```bash
  pytest tests/
  ```
- See [Contributing](https://minillmlib.readthedocs.io/en/latest/contributing.html) for contribution guidelines.

---

For more, see the full documentation at [minillmlib.readthedocs.io](https://minillmlib.readthedocs.io/) or open an issue on [GitHub](https://github.com/qfeuilla/MiniLLMLib) if you need help.

---

### Release Tagging Reminder
_(for maintainers use)_

To push a new release tag:
```bash
git add <files you changed>
git commit -m "<your message>"
git tag v<NEW_VERSION> -m "Release v<NEW_VERSION>: <short description>"
git push origin main --tags
```
