Skip to main content

A module for AI assistant functionalities (version 1)

Project description

Magic Assistant Library

A Python library for building conversational AI assistants with support for dynamic tools, token counting, and time monitoring.

Overview

Magic Assistant Library provides a framework for creating AI assistants using LangChain with support for multiple LLM providers including Google's Gemini and DeepSeek. The library handles conversation management, tool integration, token counting, and session monitoring.

Features

  • Support for multiple LLM providers (Gemini, DeepSeek)
  • Dynamic tool integration and management
  • Token counting and usage tracking
  • Conversation history management
  • Idle time monitoring
  • Session management with customizable duration
  • Async support for modern applications

Requirements

  • Python >=3.10
  • Dependencies:
    • langchain>=0.3.23
    • langchain-community>=0.3.21
    • langchain-google-genai>=2.0.1
    • langchain-deepseek>=0.1.2
    • loguru>=0.7.0

Installation

pip install magicai

Quick Start

from MagicAI import AIAgent

# Configure the assistant
config = {
    "agent_name": "MyAssistant",
    "avatar": "default",
    "do_not_talk_about": ["restricted topics"],
    "agent_task_prompt": "Your task description here",
    "initial_prompt": "Initial conversation prompt",
    "session_id": "unique_session_id",
    "task_variables": {},
    "llm": "gemini-2.0-flash",  # or "deepseek-*"
    "llm_api": "your_api_key"
}

# Create assistant instance
assistant = AIAgent(config)

# Start conversation
await assistant.start()

Tool Integration

The library supports custom tool integration through the ToolManager class:

tools_dict = [{
    "name": "tool_name",
    "api_url": "https://api.example.com/endpoint",
    "schema": {"type": "object", "properties": {}},
    "description": "Tool description"
}]

assistant = AIAgent(config, tools_dict=tools_dict)

Callbacks

The library supports various callbacks for monitoring and control:

  • Tool call notifications
  • Idle time monitoring
  • Session end handling
  • Agent response tracking

Contributing

Contributions are welcome! Please feel free to submit pull requests.

License

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

Author

Version

Current version: 0.1.0 (Alpha)

PIP token : pypi-AgEIcHlwaS5vcmcCJDMzMmY4ODFiLWI2N2QtNDUwZC1hMzRkLTUyMWI5MWZkZGM0NAACFFsxLFsibWFnaWNzb2Z0LWFpIl1dAAIsWzIsWyIxZDYxZDgyOC01MTg5LTRiOWItYTY4ZS0wMzY4MGYyOWY5OWIiXV0AAAYgHgPteDFsFSe_WETLSdlSWi1xUWaD06Y7HoNDUTkGP_g

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

magicsoft_ai-0.1.5.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

magicsoft_ai-0.1.5-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file magicsoft_ai-0.1.5.tar.gz.

File metadata

  • Download URL: magicsoft_ai-0.1.5.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for magicsoft_ai-0.1.5.tar.gz
Algorithm Hash digest
SHA256 c4d457ab2a529e9c6efbe551d29a07e6ad3b89efbd3a33183ab589230302a266
MD5 7eb96a49336fc2c94da0a6eb412c41be
BLAKE2b-256 a22fd057e4a65b69004a10978c6f0bc6a8fac0722e9a90e34f89928b73b1694b

See more details on using hashes here.

File details

Details for the file magicsoft_ai-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: magicsoft_ai-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for magicsoft_ai-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3e4afeed634cfa9bd29e5d9ee9727cb8b4e7e426bed6881f3de6db5269311672
MD5 75d814bb5d535b73241d02c8c9d774a5
BLAKE2b-256 dedab0bdf697ceaaf8a1c39b2ecbd0d235de709c5fd9e0458854a0f40a583ddf

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