Skip to main content

Minimalist Library for programming with LLMs

Project description

MiniLLMLib

GitHub stars GitHub forks GitHub issues GitHub last commit

PyPI version Docs License: MIT Python


Installation

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

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

Usage

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 for advanced usage, parameter tables, and branching/loom semantics.
  • See the Provider Matrix for supported models and configuration tips.
  • See Troubleshooting for common issues and debugging.

Configuration

Development & Contribution

  • Run tests with:
    pytest tests/
    
  • See Contributing for contribution guidelines.

For more, see the full documentation at minillmlib.readthedocs.io or open an issue on GitHub if you need help.


Release Tagging Reminder

(for maintainers use)

To push a new release tag:

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

minillmlib-0.4.2.tar.gz (101.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

minillmlib-0.4.2-py3-none-any.whl (30.1 kB view details)

Uploaded Python 3

File details

Details for the file minillmlib-0.4.2.tar.gz.

File metadata

  • Download URL: minillmlib-0.4.2.tar.gz
  • Upload date:
  • Size: 101.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for minillmlib-0.4.2.tar.gz
Algorithm Hash digest
SHA256 60442fc323d09710daa66a6995c7e56fdd8716b525a2af3902569df83843c5ba
MD5 338a1d5e24dfee98d7154eb1bc82de01
BLAKE2b-256 91cb39a1fab19677ed2b7440164c41001347625fb85bb505a3e1834100f378c2

See more details on using hashes here.

File details

Details for the file minillmlib-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: minillmlib-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 30.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for minillmlib-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d34b6749adc1832245a6a19e8c5c11db84d9b7ab3280480ef8f2e07a2f132b4d
MD5 a794f94e73bb8311fc6844acb76cd00c
BLAKE2b-256 99a7bdfb49523350e77b6bb3027c96bf7b3a0f1a6ccde0ebf0b5b8abf108b75d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page