Skip to main content

Core library for LLM chatbot integration with multi-provider support (OpenAI, Anthropic, LangDock, OpenRouter, Mammouth, Azure, Local)

Project description

eq-chatbot-core

License Python PyPI

Core library for LLM chatbot integration with multi-provider support.


English

Overview

eq-chatbot-core is a Python library for integrating Large Language Models (LLMs) into your applications. It provides a unified interface for multiple LLM providers, security features, and RAG (Retrieval-Augmented Generation) capabilities.

Originally developed for Odoo 18 chatbot integration, but works standalone without any Odoo dependencies.

Key Features

  • Multi-Provider Support: OpenAI, Anthropic, Azure AI, LangDock, OpenRouter, Mammouth AI, Local (LM Studio/Ollama)
  • Unified API: Same interface regardless of provider
  • Temperature Safety: Automatic model-specific temperature clamping (GPT-4.1 min=1.0, Claude max=1.0, reasoning models skip)
  • Security:
    • Fernet encryption for API key storage
    • Prompt injection protection
    • File upload validation
  • RAG Pipeline:
    • Text chunking with configurable strategies
    • Embedding generation
    • Vector retrieval integration
  • MCP Client: HTTP/SSE and stdio transports for Model Context Protocol
  • CLI Tool: Command-line interface for provider testing

Installation

# Basic installation
pip install eq-chatbot-core
# Or with UV (recommended)
uv pip install eq-chatbot-core

# With PDF support (for OpenAI/LangDock vision)
pip install eq-chatbot-core[pdf]

# With file validation
pip install eq-chatbot-core[security]

# With Azure AI support
pip install eq-chatbot-core[azure]

# All optional dependencies
pip install eq-chatbot-core[pdf,security,azure,dev]

CLI Usage

# Test provider connection
eq-chatbot test-provider -p openai -k YOUR_API_KEY

# List available models
eq-chatbot list-models -p anthropic -k YOUR_API_KEY

# Show only vision-capable models
eq-chatbot list-models -p langdock -k YOUR_KEY --vision-only

# Output as JSON
eq-chatbot list-models -p openai -k YOUR_KEY --json

# Show package info
eq-chatbot info

Python Usage

from eq_chatbot_core.providers import get_provider

# Initialize provider
provider = get_provider("openai", api_key="sk-...")

# Simple chat completion
response = provider.chat_completion(
    messages=[{"role": "user", "content": "Hello!"}],
    model="gpt-4o"
)
print(response.content)
print(f"Tokens used: {response.total_tokens}")

# Streaming
for chunk in provider.stream_completion(
    messages=[{"role": "user", "content": "Tell me a story"}],
    model="gpt-4o"
):
    print(chunk.content, end="", flush=True)

# List available models
models = provider.list_models()
for model in models:
    print(f"{model.id} - Vision: {model.supports_vision}")

Encryption Example

from eq_chatbot_core.security.encryption import FernetEncryption

# Encrypt API keys for safe storage
encryption = FernetEncryption()
key = encryption.generate_key()

encrypted = encryption.encrypt("sk-your-api-key", key)
decrypted = encryption.decrypt(encrypted, key)

Supported Providers

Provider Models Vision Streaming Temp. Clamping
OpenAI GPT-4, GPT-4o, GPT-4.1, GPT-5, o1, o3, o4 Yes Yes Yes
Anthropic Claude 3, Claude 3.5, Claude 4 Yes Yes Yes
Azure AI GPT-4o, GPT-4.1, o1, o3, o4, Claude, Mistral, Llama, Phi, DeepSeek Depends on model Yes Yes
LangDock All via gateway Yes Yes Yes
OpenRouter 400+ models via gateway Yes Yes Yes
Mammouth AI 30+ models via unified API Yes Yes Yes
Local (LM Studio/Ollama) Local models No Yes No

Deutsch

Überblick

eq-chatbot-core ist eine Python-Bibliothek zur Integration von Large Language Models (LLMs) in Anwendungen. Sie bietet eine einheitliche Schnittstelle für mehrere LLM-Anbieter, Sicherheitsfunktionen und RAG-Fähigkeiten (Retrieval-Augmented Generation).

Ursprünglich für die Odoo 18 Chatbot-Integration entwickelt, funktioniert aber standalone ohne Odoo-Abhängigkeiten.

Hauptfunktionen

  • Multi-Provider-Unterstützung: OpenAI, Anthropic, Azure AI, LangDock, OpenRouter, Mammouth AI, Local (LM Studio/Ollama)
  • Einheitliche API: Gleiche Schnittstelle unabhängig vom Provider
  • Temperature-Sicherheit: Automatisches modellspezifisches Temperature-Clamping (GPT-4.1 min=1.0, Claude max=1.0, Reasoning-Modelle werden übersprungen)
  • Sicherheit:
    • Fernet-Verschlüsselung für API-Key-Speicherung
    • Schutz vor Prompt-Injection
    • Datei-Upload-Validierung
  • RAG-Pipeline:
    • Text-Chunking mit konfigurierbaren Strategien
    • Embedding-Generierung
    • Vektor-Retrieval-Integration
  • MCP-Client: HTTP/SSE und stdio Transports für Model Context Protocol
  • CLI-Tool: Kommandozeilen-Interface für Provider-Tests

Installation

# Basis-Installation
pip install eq-chatbot-core
# Oder mit UV (empfohlen)
uv pip install eq-chatbot-core

# Mit PDF-Unterstützung (für OpenAI/LangDock Vision)
pip install eq-chatbot-core[pdf]

# Mit Datei-Validierung
pip install eq-chatbot-core[security]

# Mit Azure AI Unterstützung
pip install eq-chatbot-core[azure]

# Alle optionalen Abhängigkeiten
pip install eq-chatbot-core[pdf,security,azure,dev]

CLI-Verwendung

# Provider-Verbindung testen
eq-chatbot test-provider -p openai -k YOUR_API_KEY

# Verfügbare Modelle auflisten
eq-chatbot list-models -p anthropic -k YOUR_API_KEY

# Nur Vision-fähige Modelle anzeigen
eq-chatbot list-models -p langdock -k YOUR_KEY --vision-only

# Ausgabe als JSON
eq-chatbot list-models -p openai -k YOUR_KEY --json

# Paket-Informationen anzeigen
eq-chatbot info

Python-Verwendung

from eq_chatbot_core.providers import get_provider

# Provider initialisieren
provider = get_provider("openai", api_key="sk-...")

# Einfache Chat-Completion
response = provider.chat_completion(
    messages=[{"role": "user", "content": "Hallo!"}],
    model="gpt-4o"
)
print(response.content)
print(f"Tokens verwendet: {response.total_tokens}")

# Streaming
for chunk in provider.stream_completion(
    messages=[{"role": "user", "content": "Erzähle mir eine Geschichte"}],
    model="gpt-4o"
):
    print(chunk.content, end="", flush=True)

Technical Information

Field Value
Package Name eq-chatbot-core
Version 1.1.0
Author Equitania Software GmbH
License MIT
Python >=3.10
Homepage https://www.ownerp.com

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

eq_chatbot_core-1.1.0.tar.gz (335.9 kB view details)

Uploaded Source

Built Distribution

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

eq_chatbot_core-1.1.0-py3-none-any.whl (92.8 kB view details)

Uploaded Python 3

File details

Details for the file eq_chatbot_core-1.1.0.tar.gz.

File metadata

  • Download URL: eq_chatbot_core-1.1.0.tar.gz
  • Upload date:
  • Size: 335.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for eq_chatbot_core-1.1.0.tar.gz
Algorithm Hash digest
SHA256 9246000d41fa886cb0d72e88bc78a296a7126ad034feb78c6d3eeaabe46d0bd1
MD5 192ff770c23c01b3047d29d0c35a0c97
BLAKE2b-256 3e54391e30c70a9e64c1348245ffcf53891c6d9ed2cc2658555221b3fb14d139

See more details on using hashes here.

File details

Details for the file eq_chatbot_core-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for eq_chatbot_core-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e54ad2f1472a477f15610d2e845c4e7df32471defc3c60d408157cfb96b15a9b
MD5 6a8336421d218ecae727a48e857a99bf
BLAKE2b-256 082d9c5e1403ce847a222bbd739615fbf8b8fa42abde1ec704f5dae1c4c9ed4d

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