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

Uploaded Python 3

File details

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

File metadata

  • Download URL: magicsoft_ai-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 c64c88e07b06ccb14fcfc113af54ac74114bf4a4ecb503a4b54cf1d2ef40e029
MD5 aff44a652c806759c2d22aa9010fbeeb
BLAKE2b-256 1993c0067c3dd912449e9e974eac99a06d6f5ed093542951cf9519abf8800856

See more details on using hashes here.

File details

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

File metadata

  • Download URL: magicsoft_ai-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 761e42e61a9356f4dc7b013c9c7d4921b0d9beaa7b257c2a9ca1a595729e9244
MD5 74a0daf9a040d691ac360be28735a42e
BLAKE2b-256 c23c6fbca7e804921a8f21ede1be11cd5c2f8592b4f513b352319c1dd2140cfa

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