A simple RAG chatbot supporting multiple LLM providers
Project description
RAGnificentAI - Your Magnificent RAG-Powered Chatbot Toolkit
RAGnificentAI is a Python package that enables developers to quickly build powerful chatbots with seamless tool integration and Retrieval-Augmented Generation (RAG) capabilities, supporting any OpenAI-compatible LLM.
Why RAGnificentAI?
- LLM Agnostic - Works with Groq, OpenAI, Gemini, and any OpenAI-compatible API
- Easy Tool Integration - Add custom functions as tools with minimal code
- Conversation Management - Efficient short-term memory management with summarization technique
- Prompt Customization - Flexible system and summary prompts
- Lightweight - Minimal dependencies, maximum functionality
Installation
- Install using pip:
pip install RAGnificentAI
Quick Start
from RAGnificentAI import ChatAI, AgentParams
def add(x: int, y: int) -> int:
"""Add two numbers together."""
return x + y
tools = [add]
# For OpenAI-compatible endpoints
rag = ChatAI()
chatbot = rag.initiate_chatbot(
params=AgentParams(
model="gpt-3.5-turbo", # Or any other model
api_key="your_api_key",
base_url="https://api.openai.com/v1", # Or your custom endpoint
system_prompt="You are a helpful AI assistant.",
summary_prompt="Summarize the conversation concisely.",
thread_id='1',
tools=tools, # Optional
temperature=0.7 # Optional
)
)
while True:
user_input = input("You (q to quit): ")
if user_input.lower() == 'q':
break
response = chatbot.run(messages=user_input)
print("AI:", response)
Configuration Options
AgentParams
| Parameter | Type | Description | Required |
|---|---|---|---|
model |
str | Model name (e.g. "gpt-3.5-turbo") | Yes |
api_key |
str | Your API key | Yes |
base_url |
str | API base URL (default: OpenAI) | Yes |
system_prompt |
str | Initial system prompt | Yes |
summary_prompt |
str | Prompt for conversation summaries | Yes |
thread_id |
str | Conversation thread identifier | Yes |
user_information |
dict | User metadata for personalization | No |
tools |
list[callable] | Custom tools/functions to integrate | No |
Supported LLM Providers
- OpenAI (including Azure OpenAI)
- Groq
- Gemini
- Any OpenAI-compatible API (LocalAI, vLLM, etc.)
- Anthropic Claude (via OpenAI compatibility layer)
Adding Custom Tools
def multiply(a: int, b: int) -> int:
"""Multiply two numbers together."""
return a * b
def get_weather(city: str) -> str:
"""Get current weather for a given city."""
return f"Weather in {city}: Sunny"
tools = [multiply, get_weather]
New CLI Interface
Example Workflow:
# First-time setup
ragnificentai configure
# Start chatting (uses saved config)
ragnificentai chat
# Override specific settings
ragnificentai chat --model gpt-4 --thread-id special-convo
CLI Features
| Command | Description | Options |
|---|---|---|
chat |
Start interactive chat session | --model, --api-key, --base-url |
configure |
Save default configuration | (interactive wizard) |
version |
Show package version | None |
Best Practices
- Use environment variables for API keys
- Include clear docstrings for your tools
- Use type hints for better tool understanding
- Keep system prompts concise but descriptive
- Handle sensitive user information appropriately
License
RAGnificentAI is licensed under the RAGnificentAI Custom License:
Copyright (c) 2025 [K. M. Abul Farhad-Ibn-Alam]
Permission is hereby granted to any person obtaining a copy of this software
and associated documentation files (the "Software") to use, modify, and distribute
the Software for any purpose, subject to the following conditions:
1. Redistributions must retain this copyright notice.
2. Commercial use requires written permission from the author.
3. The author is not liable for any damages arising from Software use.
All rights not expressly granted are reserved by the author.
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 ragnificentai-1.4.tar.gz.
File metadata
- Download URL: ragnificentai-1.4.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0117131f6a3a2fb3d5b183dcb292d77db77f7d571636fdbd8118aab353edb832
|
|
| MD5 |
4a2efe980723874eff8928ed546e6d4c
|
|
| BLAKE2b-256 |
5db6e102b0419368d51237a84de8451d31e2098257f97f2e60fa280b21d7fc9c
|
File details
Details for the file ragnificentai-1.4-py3-none-any.whl.
File metadata
- Download URL: ragnificentai-1.4-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be621a5a346053d6165c9c3e73e74599832bfa60cd2a0e949bd87f844cf4ce61
|
|
| MD5 |
cb99f40d2462c07741487b3cc5d21503
|
|
| BLAKE2b-256 |
6ea4c33d2fe5a7537385964b97131367840a7a129dfdb97832a4bf20170a499e
|