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)

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.2.tar.gz (12.7 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.2-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: magicsoft_ai-0.1.2.tar.gz
  • Upload date:
  • Size: 12.7 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.2.tar.gz
Algorithm Hash digest
SHA256 154ad9baa563efd6b70deea76de06f43267023461aca69c791147bc6cd0442f6
MD5 37265ed3ecfa676839e4bf31d0e4ecb5
BLAKE2b-256 c50c03f55c5a42a2a738af56952a9158994a7461ada8a3058fc210c4b99f98ed

See more details on using hashes here.

File details

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

File metadata

  • Download URL: magicsoft_ai-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 14.8 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 644b48e15bc4944fc634ad5c73997cde914add7de672aa5495e95174810bb38f
MD5 aebde9cef19ec0b2a767fbee117206ff
BLAKE2b-256 69ee7211fd40d6c25d6b2d31b8a345360af9bd009668c7fa27e9fb96b7077033

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