Production-Ready Python Toolkit for AI Development - LLM wrappers, AI agents, and conversation memory
Project description
Codemni
๐ Production-Ready Python Toolkit for AI Development
A modular collection of production-ready tools for building AI agents, managing LLM interactions, and maintaining conversation context
Features โข Installation โข Modules โข Quick Start โข Documentation
๐ About
Codemni is a comprehensive Python toolkit designed to accelerate AI development with robust, production-ready components. From LLM integrations to intelligent agents with memory, Codemni provides everything you need to build sophisticated AI applications. Built with a focus on:
- โจ Production-Ready: Battle-tested with built-in error handling, retries, and timeouts
- ๐ฏ Modular Design: Use only what you need, keep dependencies minimal
- ๐ง Developer-Friendly: Consistent APIs, clear documentation, and intuitive interfaces
- ๐ค AI-First: Purpose-built for LLM applications and AI agent workflows
- ๐ Performance: Optimized for speed and reliability
- ๐ก๏ธ Robust: Comprehensive exception handling and defensive coding
๐งฉ Modules
๐ค ToolCalling Agent - AI Agent Framework
Powerful and flexible AI agent framework that enables LLMs to intelligently select and execute tools.
Key Features:
- ๐ง Dynamic tool execution based on LLM decisions
- ๐พ Optional conversation memory (4 different strategies)
- ๐จ Custom agent personality/role support
- ๐ Verbose mode for debugging
- ๐ Multi-LLM support (OpenAI, Google Gemini, Anthropic, Groq, Ollama)
- โ ๏ธ Designed for standard models (reasoning models like o1, o3 not supported)
๐ Full Agent Documentation โ
๐พ Memory Module - Conversation History Management
Flexible conversation memory system for maintaining context in multi-turn interactions.
Available Memory Types:
- ๐ ConversationalBufferMemory - Store all messages
- ๐ช ConversationalWindowMemory - Keep last N exchanges
- ๐ซ ConversationalTokenBufferMemory - Limit by token count
- ๐ ConversationalSummaryMemory - Summarize old conversations
Key Features:
- Common API across all memory types
- Easy serialization (save/load)
- Lightweight and efficient
- Integrates seamlessly with ToolCalling Agent
๐ Full Memory Documentation โ
๐ก LLM Module - Large Language Model Wrappers
Production-ready wrappers for popular LLM providers with unified interface.
Supported Providers:
- ๐ท Google Gemini (
gemini-pro,gemini-2.0-flash-exp) - ๐ข OpenAI (
gpt-4,gpt-3.5-turbo,gpt-4-turbo) - ๐ฃ Anthropic Claude (
claude-3-opus,claude-3-sonnet,claude-3-haiku) - โก Groq (
llama3-70b,mixtral-8x7b) - ๐ฆ Ollama (Local models:
llama2,mistral,codellama)
Key Features:
- Automatic retries with exponential backoff
- Configurable timeouts
- Consistent API across all providers
- Both function and class-based interfaces
- Silent operation (no logging)
- Minimal dependencies
๐ Full LLM Documentation โ
๐ฆ Installation
Install from PyPI (Recommended)
# Install the base package
pip install Codemni
# Install with specific LLM providers
pip install Codemni[openai] # OpenAI support
pip install Codemni[anthropic] # Anthropic Claude support
pip install Codemni[groq] # Groq support
pip install Codemni[google] # Google Gemini support
pip install Codemni[ollama] # Ollama (local) support
# Install with all LLM providers
pip install Codemni[all]
Install from Source
# Clone the repository
git clone https://github.com/CodexJitin/Codemni.git
cd Codemni
# Install in development mode
pip install -e .
# Or install with all dependencies
pip install -e .[all]
๐ Quick Start
Installation
pip install Codemni[all] # Install with all LLM providers
ToolCalling Agent - Basic Usage
from Codemni.TOOL_CALLING_AGENT.agent import Create_ToolCalling_Agent
from Codemni.llm.Google_llm import GoogleLLM
# Initialize LLM
llm = GoogleLLM(
model="gemini-2.0-flash-exp",
api_key="YOUR_API_KEY" # or set GOOGLE_API_KEY env var
)
# Create agent
agent = Create_ToolCalling_Agent(llm=llm, verbose=True)
# Define a tool
def calculator(expression):
return str(eval(expression))
# Add tool to agent
agent.add_tool("calculator", "Evaluate mathematical expressions", calculator)
# Use the agent
response = agent.invoke("What is 125 * 48?")
print(response) # Agent will use the calculator tool
ToolCalling Agent with Memory
from Codemni.TOOL_CALLING_AGENT.agent import Create_ToolCalling_Agent
from Codemni.llm.Google_llm import GoogleLLM
from Codemni.memory.conversational_buffer_memory import ConversationalBufferMemory
# Initialize LLM and memory
llm = GoogleLLM(model="gemini-2.0-flash-exp", api_key="YOUR_API_KEY")
memory = ConversationalBufferMemory()
# Create agent with memory
agent = Create_ToolCalling_Agent(llm=llm, memory=memory, verbose=True)
agent.add_tool("calculator", "Evaluate math", calculator)
# Multi-turn conversation with context
response1 = agent.invoke("Calculate 50 + 25") # Returns: 75
response2 = agent.invoke("Now multiply that by 2") # Returns: 150 (remembers 75!)
LLM Module - Basic Usage
from Codemni.llm import google_llm, openai_llm, anthropic_llm
# Google Gemini
response = google_llm(
prompt="Explain quantum computing in simple terms",
model="gemini-pro",
api_key="your-api-key" # or set GOOGLE_API_KEY env var
)
print(response)
# OpenAI GPT
response = openai_llm(
prompt="Write a Python function to calculate fibonacci",
model="gpt-4",
temperature=0.7,
max_tokens=500
)
print(response)
# Anthropic Claude
response = anthropic_llm(
prompt="Explain the concept of recursion",
model="claude-3-sonnet-20240229",
max_tokens=300
)
print(response)
Error Handling
from Codemni.llm import google_llm, GoogleLLMError, GoogleLLMAPIError
try:
response = google_llm(
prompt="Hello, world!",
model="gemini-pro"
)
print(response)
except GoogleLLMAPIError as e:
print(f"API Error: {e}")
except GoogleLLMError as e:
print(f"General Error: {e}")
๐ Configuration
Environment Variables
Set these to avoid hardcoding API keys:
# Linux/Mac
export GOOGLE_API_KEY="your-google-key"
export OPENAI_API_KEY="your-openai-key"
export ANTHROPIC_API_KEY="your-anthropic-key"
export GROQ_API_KEY="your-groq-key"
export OLLAMA_BASE_URL="http://localhost:11434" # Optional
# Windows PowerShell
$env:GOOGLE_API_KEY="your-google-key"
$env:OPENAI_API_KEY="your-openai-key"
Using .env File
# Install python-dotenv
pip install python-dotenv
from dotenv import load_dotenv
load_dotenv()
# Now your environment variables are loaded
from Codemni.llm import google_llm
response = google_llm(prompt="Hello", model="gemini-pro")
๐๏ธ Project Structure
Codemni/
โโโ ๐ README.md # This file - Main documentation
โโโ ๐ LICENSE # License information
โโโ ๐ requirements.txt # Base dependencies
โโโ ๐ __init__.py # Package initialization
โ
โโโ ๏ฟฝ TOOL_CALLING_AGENT/ # AI Agent Module
โ โโโ __init__.py
โ โโโ README.md # Agent documentation
โ โโโ agent.py # Main agent implementation
โ โโโ prompt.py # Prompt templates
โ
โโโ ๏ฟฝ memory/ # Memory Module
โ โโโ __init__.py
โ โโโ README.md # Memory documentation
โ โโโ conversational_buffer_memory.py
โ โโโ conversational_window_memory.py
โ โโโ conversational_token_buffer_memory.py
โ โโโ conversational_summary_memory.py
โ
โโโ ๐ llm/ # LLM Module
โ โโโ __init__.py
โ โโโ README.md # LLM module documentation
โ โโโ Google_llm.py # Google Gemini wrapper
โ โโโ OpenAI_llm.py # OpenAI wrapper
โ โโโ Anthropic_llm.py # Anthropic wrapper
โ โโโ Groq_llm.py # Groq wrapper
โ โโโ Ollama_llm.py # Ollama wrapper
โ
โโโ ๐ core/ # Core utilities
โ โโโ adapter.py # Tool execution adapter
โ
โโโ ๐ assets/ # Assets and media
โโโ codemni-logo.jpg
๐ Documentation
Module Documentation
-
ToolCalling Agent - AI agent framework guide
- Complete API reference for all methods
- Memory integration guide
- Tool definition best practices
- Custom prompt guidelines
- Troubleshooting and examples
-
Memory Module - Conversation memory guide
- Memory type comparison
- Usage examples for each type
- Serialization and persistence
- Integration with agents
-
LLM Module - Comprehensive guide to LLM wrappers
- API reference for all providers
- Advanced usage examples
- Exception handling guide
- Provider-specific notes
โจ Features by Module
ToolCalling Agent
| Feature | Description |
|---|---|
| ๐ค Multi-LLM Support | Works with OpenAI, Google Gemini, Anthropic, Groq, Ollama |
| ๐ง Dynamic Tools | Automatically selects and executes appropriate tools |
| ๐พ Optional Memory | 4 memory strategies for conversation context |
| ๐จ Custom Prompts | Customize agent personality and role |
| ๐ Verbose Mode | Detailed logging for debugging |
| โ ๏ธ Standard Models | Optimized for instruction-following models (not reasoning models) |
Memory Module
| Feature | Description |
|---|---|
| ๐ Buffer Memory | Store all conversation messages |
| ๐ช Window Memory | Keep only recent N exchanges |
| ๐ซ Token Buffer | Limit memory by token count |
| ๐ Summary Memory | Summarize old conversations |
| ๐พ Serialization | Save/load conversation history |
| ๐ Easy Integration | Works seamlessly with agents |
LLM Module
| Feature | Description |
|---|---|
| ๐ Auto Retry | Exponential backoff for transient failures |
| โฑ๏ธ Timeouts | Configurable request timeouts (30-60s) |
| ๐ก๏ธ Error Handling | Clear exception hierarchy per provider |
| ๐ Silent Mode | No logging - clean operation |
| ๐ฆ Minimal Deps | Install only what you need |
| ๐ฏ Unified API | Same interface across all providers |
| โ Validation | Input validation and defensive coding |
| ๐ง Dual Interface | Both function and class-based APIs |
๐ค Contributing
Contributions are welcome! Here's how you can help:
- ๐ด Fork the repository
- ๐ฟ Create a feature branch (
git checkout -b feature/AmazingFeature) - ๐พ Commit your changes (
git commit -m 'Add some AmazingFeature') - ๐ค Push to the branch (
git push origin feature/AmazingFeature) - ๐ Open a Pull Request
Development Guidelines
- Follow existing code style and patterns
- Add tests for new features
- Update documentation
- Keep dependencies minimal
- Maintain backward compatibility
๐ Requirements
- Python 3.8 or higher
- Optional dependencies (install as needed):
openai>=1.0.0- For OpenAI supportanthropic>=0.18.0- For Anthropic supportgroq>=0.4.0- For Groq supportgoogle-generativeai>=0.3.0- For Google Gemini supportollama>=0.1.0- For Ollama support
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ค Author
CodexJitin
- GitHub: @CodexJitin
- Repository: Codemni
๐ Version
Current Version: 1.1.0
Changelog
v1.1.0 (2025-10-25)
- ๐ Added ToolCalling Agent module
- ๐พ Added Memory module with 4 memory strategies
- ๐ง LLM module now supports both function and class-based interfaces
- ๐ Comprehensive documentation for all modules
- โ ๏ธ Added warnings about reasoning model compatibility
v1.0.0 (2025-10-24)
- ๐ Initial release
- โ LLM module with 5 provider support
- โ Production-ready error handling
- โ Comprehensive documentation
๐ Show Your Support
If you find Codemni useful, please consider:
- โญ Starring the repository
- ๐ Reporting bugs
- ๐ก Suggesting new features
- ๐ Contributing code
๐ Support
- ๐ง Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
Made with โค๏ธ by CodexJitin
Empowering developers to build better AI applications
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
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 codemni-1.1.0.tar.gz.
File metadata
- Download URL: codemni-1.1.0.tar.gz
- Upload date:
- Size: 62.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d266e96ab9203b144ab35d76cfdcb4f0c7f739e39e4a9c682110c6e575ef3b6
|
|
| MD5 |
2c2fadc8190250024af326923c4367d9
|
|
| BLAKE2b-256 |
019d9541d4ad32269e95874d3216604e8459ce3345fe6e602b0e737ab091c04b
|
File details
Details for the file codemni-1.1.0-py3-none-any.whl.
File metadata
- Download URL: codemni-1.1.0-py3-none-any.whl
- Upload date:
- Size: 49.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f7c5b7945d7a78f8dba8790c845f59a24398e5ff4f52d2750061499cb443b2f
|
|
| MD5 |
2e79e5174e9a66b5dc82be3369161e1f
|
|
| BLAKE2b-256 |
aab4441b7497bcd9949db68564b558a9ccc367e85b148c28c95eac37f86ca48c
|