Skip to main content

Production-Ready Python Toolkit for AI Development - LLM wrappers, AI agents, and conversation memory

Project description

Codemni

Codemni Logo

๐Ÿš€ Production-Ready Python Toolkit for AI Development

Python 3.8+ License: MIT GitHub

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:

  1. ๐Ÿด Fork the repository
  2. ๐ŸŒฟ Create a feature branch (git checkout -b feature/AmazingFeature)
  3. ๐Ÿ’พ Commit your changes (git commit -m 'Add some AmazingFeature')
  4. ๐Ÿ“ค Push to the branch (git push origin feature/AmazingFeature)
  5. ๐Ÿ”€ 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 support
    • anthropic>=0.18.0 - For Anthropic support
    • groq>=0.4.0 - For Groq support
    • google-generativeai>=0.3.0 - For Google Gemini support
    • ollama>=0.1.0 - For Ollama support

๐Ÿ“„ License

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


๐Ÿ‘ค Author

CodexJitin


๐Ÿ”– 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


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

codemni-1.1.0.tar.gz (62.7 kB view details)

Uploaded Source

Built Distribution

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

codemni-1.1.0-py3-none-any.whl (49.4 kB view details)

Uploaded Python 3

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

Hashes for codemni-1.1.0.tar.gz
Algorithm Hash digest
SHA256 5d266e96ab9203b144ab35d76cfdcb4f0c7f739e39e4a9c682110c6e575ef3b6
MD5 2c2fadc8190250024af326923c4367d9
BLAKE2b-256 019d9541d4ad32269e95874d3216604e8459ce3345fe6e602b0e737ab091c04b

See more details on using hashes here.

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

Hashes for codemni-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8f7c5b7945d7a78f8dba8790c845f59a24398e5ff4f52d2750061499cb443b2f
MD5 2e79e5174e9a66b5dc82be3369161e1f
BLAKE2b-256 aab4441b7497bcd9949db68564b558a9ccc367e85b148c28c95eac37f86ca48c

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