Skip to main content

Unified toolkit for managing and using multiple LLM providers with automatic model detection

Project description

๐Ÿš€ beanllm

Production-ready LLM toolkit with Clean Architecture and unified interface for multiple providers

PyPI version Python 3.11+ License: MIT Tests

beanllm is a comprehensive, production-ready toolkit for building LLM applications with a unified interface across OpenAI, Anthropic, Google, DeepSeek, Perplexity, and Ollama. Built with Clean Architecture and SOLID principles.


๐Ÿ“š Documentation

  • ๐Ÿ’ก Examples - 20+ working examples
  • ๐Ÿ“ฆ PyPI Package - Installation and releases
  • ๐ŸŒ Playground - Full-stack Chat UI
    • Backend: FastAPI + Agentic Chat (์ž๋™ Intent ๋ถ„๋ฅ˜), ์„ธ์…˜๋ณ„ RAG, Redis ์บ์‹ฑ
    • Frontend: Next.js 15 + React 19, Settings, Monitoring Dashboard

โœจ Features Overview

Core Modules (100% Complete)

Module Status Highlights
LLM Providers โœ… 100% 7 providers (OpenAI, Claude, Gemini, DeepSeek, Perplexity, Ollama)
RAG Pipeline โœ… 100% Document loaders, vector stores, hybrid search, rerankers
Embeddings โœ… 100% 11 providers, Matryoshka, Code embeddings
Retrieval โœ… 100% HyDE, MultiQuery, ColBERT, ColPali, 5 rerankers
Evaluation โœ… 99% RAGAS, DeepEval, TruLens, Human-in-the-loop
Vision โœ… 100% SAM3, YOLOv12, Florence-2, Qwen3-VL
Audio โœ… 100% 8 STT engines (Whisper, SenseVoice, Granite)
OCR โœ… 100% 11 engines (PaddleOCR, Qwen2-VL, DeepSeek)
Optimizer โœ… 100% Parameter search, benchmarking, A/B testing
Multi-Agent โœ… 100% Sequential, parallel, hierarchical, debate
Orchestrator โœ… 100% 10 node types, workflow graph, visual builder
Knowledge Graph โœ… 100% Multi NER engines, relation extraction, GraphRAG

Key Capabilities

  • ๐Ÿ”„ Unified Interface - Single API for 7 LLM providers
  • ๐ŸŽ›๏ธ Smart Parameter Adaptation - Auto-convert between providers
  • ๐Ÿ“‘ Advanced PDF Processing - 3-layer architecture (Fast/Accurate/ML)
  • ๐Ÿ—„๏ธ 8 Vector Stores - Chroma, FAISS, Pinecone, Qdrant, Weaviate, Milvus, LanceDB, pgvector
  • ๐Ÿ•ธ๏ธ Graph Workflows - LangGraph-style DAG execution
  • ๐Ÿ›ก๏ธ Production Ready - Retry, circuit breaker, rate limiting, tracing

๐Ÿ“ฆ Installation

# Basic installation
pip install beanllm

# With specific providers
pip install beanllm[openai,anthropic,gemini]

# Full installation
pip install beanllm[all]

# Development
pip install beanllm[dev,all]

Using Poetry

git clone https://github.com/leebeanbin/beanllm.git
cd beanllm
poetry install --extras all

๐Ÿš€ Quick Start

Environment Setup

# .env file
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GEMINI_API_KEY=...
OLLAMA_HOST=http://localhost:11434

๐Ÿ’ฌ Basic Chat

import asyncio
from beanllm import Client

async def main():
    client = Client(model="gpt-4o")
    response = await client.chat(
        messages=[{"role": "user", "content": "Explain quantum computing"}]
    )
    print(response.content)

    # Streaming
    async for chunk in client.stream_chat(
        messages=[{"role": "user", "content": "Tell me a story"}]
    ):
        print(chunk, end="", flush=True)

asyncio.run(main())

๐Ÿ“š RAG in One Line

from beanllm import RAGChain

async def main():
    rag = RAGChain.from_documents("docs/")
    result = await rag.query("What is this about?", include_sources=True)
    print(result.answer)

asyncio.run(main())

๐Ÿ› ๏ธ Tools & Agents

from beanllm import Agent, Tool

@Tool.from_function
def calculator(expression: str) -> str:
    """Evaluate a math expression"""
    return str(eval(expression))

agent = Agent(model="gpt-4o-mini", tools=[calculator])
result = await agent.run("What is 25 * 17?")

๐Ÿ•ธ๏ธ Graph Workflows

from beanllm import StateGraph

graph = StateGraph()
graph.add_node("analyze", analyze_fn)
graph.add_node("improve", improve_fn)
graph.add_conditional_edges("analyze", decide, {"good": "END", "bad": "improve"})
graph.set_entry_point("analyze")

result = await graph.invoke({"input": "Draft proposal"})

๐ŸŽฏ Model Support

LLM Providers

  • OpenAI: GPT-5, GPT-4o, GPT-4.1, GPT-4o-mini
  • Anthropic: Claude Opus 4, Claude Sonnet 4.5
  • Google: Gemini 2.5 Pro/Flash
  • DeepSeek: DeepSeek-V3 (671B MoE)
  • Perplexity: Sonar (real-time web search)
  • Ollama: Local LLM support

Vision Models

  • SAM 3 (zero-shot segmentation)
  • YOLOv12 (object detection)
  • Qwen3-VL, Florence-2

Audio (8 STT Engines)

  • SenseVoice-Small (15x faster, emotion recognition)
  • Granite Speech 8B (WER 5.85%)
  • Whisper V3 Turbo, Distil-Whisper, Parakeet, Canary, Moonshine

Embeddings

  • Qwen3-Embedding-8B (multilingual)
  • OpenAI text-embedding-3
  • Code embeddings, CLIP/SigLIP

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                  Facade Layer                       โ”‚
โ”‚  User-friendly API (Client, RAGChain, Agent)        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                 Handler Layer                       โ”‚
โ”‚  Input validation, error handling                   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                 Service Layer                       โ”‚
โ”‚  Business logic (interfaces + implementations)      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                 Domain Layer                        โ”‚
โ”‚  Core business (entities, rules)                    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                   โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚            Infrastructure Layer                     โ”‚
โ”‚  External systems (providers, vector stores)        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”ง CLI

beanllm list          # List available models
beanllm show gpt-4o   # Show model details
beanllm providers     # Check providers
beanllm summary       # Quick summary

๐Ÿงช Testing

pytest                                    # Run all tests
pytest --cov=src/beanllm --cov-report=html  # With coverage
make quality                              # Full quality check (Ruff, mypy, Bandit, pytest)

๐Ÿ› ๏ธ Development

# Install dev dependencies
pip install -e ".[dev,all]"

# Setup pre-commit hooks
make pre-commit

# Code quality
make quick-fix     # Auto-fix with Black, Ruff
make type-check    # MyPy type checking
make lint          # Ruff linting

๐Ÿ“„ License

MIT License - see LICENSE file.


๐Ÿ™ Acknowledgments

  • LangChain - LLM framework inspiration
  • LangGraph - Graph workflow patterns
  • OpenAI, Anthropic, Google, DeepSeek teams

๐Ÿ“ง Contact


Built with โค๏ธ for the LLM community

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

beanllm-0.3.0.tar.gz (733.3 kB view details)

Uploaded Source

Built Distribution

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

beanllm-0.3.0-py3-none-any.whl (1.0 MB view details)

Uploaded Python 3

File details

Details for the file beanllm-0.3.0.tar.gz.

File metadata

  • Download URL: beanllm-0.3.0.tar.gz
  • Upload date:
  • Size: 733.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for beanllm-0.3.0.tar.gz
Algorithm Hash digest
SHA256 2fb2d8a40b1301f71df0fdf2dc48ae57085715a6b04615a8447e2d9f7f6f5de1
MD5 92e431555719b64f51f8aac2c43f4223
BLAKE2b-256 248eae7700c4bacebf5cdd63ab9d49837d3096de9fad90342eb58ba51f50f0e5

See more details on using hashes here.

File details

Details for the file beanllm-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: beanllm-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for beanllm-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b9bc4b440e4dbef69e875b3122b4ff0841c3c262f3586872d01537081ee1426
MD5 b197a6b50e63f5bbb6434156811252fb
BLAKE2b-256 aa40def62305f81f6c1c2f04098f1541b24d732f4b054a19b2dcd128c7cbd665

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