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-AgEIcHlwaS5vcmcCJDYyMTk3YThiLTQ4YzEtNGMwMS05ZDVhLTBhMTZhODUzODg4ZQACFFsxLFsibWFnaWNzb2Z0LWFpIl1dAAIsWzIsWyIxZDYxZDgyOC01MTg5LTRiOWItYTY4ZS0wMzY4MGYyOWY5OWIiXV0AAAYgeEZiJcHqa3iSVwYLirX_yw8Sj74773MjMz_L7_ZxIyQ

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.4.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.4-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: magicsoft_ai-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 5a2cb19da32d2d7ae5c1a6805acc899409d93b45c29af061d833f99fc8b2bda2
MD5 8127d6a0ac2dd12ae0a5afd2c17f5a5f
BLAKE2b-256 431f49e18c4dc24a829885218b4b88908979f2615360bf3121e39a2e8720043f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: magicsoft_ai-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d9fdd9dafcdc2a2d1f49cb5bc2e73feb3820c67563fd4506907aae0f90b60a73
MD5 4cf4dd7c3903778de8c7a67a487a5776
BLAKE2b-256 409dafd0541be790f8593c83f6fa8955196baecbddfc710f7d3824a6299ee1ce

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