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

Uploaded Python 3

File details

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

File metadata

  • Download URL: magicsoft_ai-0.1.1.tar.gz
  • Upload date:
  • Size: 12.6 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.1.tar.gz
Algorithm Hash digest
SHA256 d061f0560b254549abf86b25521aaa3cc0ef4f021bda188eb016209f4123527c
MD5 6c579b90e5aba580697c814c930c25a7
BLAKE2b-256 71a8a41e5b87436637adef9ac4a4667216a4b11843f547704ccc06b377306d87

See more details on using hashes here.

File details

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

File metadata

  • Download URL: magicsoft_ai-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c4d05a8468bf8f03eee325cd311d5896b4ef7fb68956425212caa8ffb152c48a
MD5 62ccd880f2b9661030d60671641a8c3d
BLAKE2b-256 164a0d3061aaa19f4b77cfd2c5af6e7a8481eeca6d21d45f16d6c1c42254d28e

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