jarvis-ai-assistant


Namejarvis-ai-assistant JSON
Version 0.1.53 PyPI version JSON
download
home_pagehttps://github.com/skyfireitdiy/Jarvis
SummaryJarvis: An AI assistant that uses tools to interact with the system
upload_time2025-01-17 15:40:10
maintainerNone
docs_urlNone
authorskyfire
requires_python>=3.8
licenseMIT License Copyright (c) 2025 skyfire Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords jarvis ai assistant tools automation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">

# πŸ€– Jarvis AI Assistant

<p align="center">
  <img src="docs/images/jarvis-logo.png" alt="Jarvis Logo" width="200"/>
</p>

[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

*Your intelligent assistant for development and system interaction*

[Features](#features) β€’
[Usage](#usage) β€’
[Configuration](#configuration) β€’
[Extending Jarvis](#-extending-jarvis) β€’
[Contributing](#-contributing) β€’
[License](#-license)

</div>

---

## ✨ Features

### 🧠 Intelligent Agent
- Self-improving through experience accumulation
- Automatic methodology generation from successful problem-solving
- Iterative learning from each interaction
- Context-aware problem solving

### πŸ› οΈ Extensible Architecture
- Dynamic tool loading and integration
- Custom model support with simple interface
- AI-powered tool generation
- Hot-reload support for tools and models

### πŸ’‘ Smart Features
- Automated methodology management
- Problem-specific solution patterns
- Continuous capability enhancement
- Learning from past interactions

### 🎨 User Experience
- Beautiful console output
- Interactive mode
- Multi-line input support
- Progress indicators
- Colored output

## πŸš€ Installation

```bash
pip install jarvis-ai-assistant
```

## πŸ”§ Configuration

Create a `.jarvis_env` file in your home directory with your API keys:

### For Kimi:
```bash
KIMI_API_KEY=your_kimi_api_key_here
```

### For OpenAI:
```bash
OPENAI_API_KEY=your_api_key_here
OPENAI_API_BASE=your_api_base  # Optional, defaults to https://api.deepseek.com
OPENAI_MODEL_NAME=your_model_name  # Optional, defaults to deepseek-chat
```

## 🎯 Usage

### Basic Usage
```bash
jarvis
```

### With Specific Model
```bash
jarvis -p kimi  # Use Kimi platform
jarvis -p openai  # Use OpenAI platform
```

### Process Files
```bash
jarvis -f file1.py file2.py  # Process specific files
```

### Keep Chat History
```bash
jarvis --keep-history  # Don't delete chat session after completion
```

## πŸ› οΈ Tools

### Built-in Tools

| Tool | Description |
|------|-------------|
| execute_shell | Execute system commands and capture output |
| file_operation | File operations (read/write/append/delete) |
| generate_tool | AI-powered tool generation and integration |
| methodology | Experience accumulation and methodology management |
| create_sub_agent | Create specialized sub-agents for specific tasks |

### Tool Locations
- Built-in tools: `src/jarvis/tools/`
- User tools: `~/.jarvis_tools/`

### Key Features

#### 1. Self-Extending Capabilities
- Tool generation through natural language description
- Automatic code generation and integration
- Dynamic capability expansion through sub-agents

#### 2. Methodology Learning
- Automatic experience accumulation from interactions
- Pattern recognition and methodology extraction
- Continuous refinement through usage

#### 3. Adaptive Problem Solving
- Context-aware sub-agent creation
- Dynamic tool composition
- Learning from execution feedback

## 🎯 Extending Jarvis

### Adding New Tools

Create a new Python file in `~/.jarvis_tools/` or `src/jarvis/tools/`:

```python
from typing import Dict, Any
from jarvis.utils import OutputType, PrettyOutput

class CustomTool:
    name = "tool_name"              # Tool name for invocation
    description = "Tool description" # Tool purpose
    parameters = {                  # JSON Schema for parameters
        "type": "object",
        "properties": {
            "param1": {
                "type": "string",
                "description": "Parameter description"
            }
        },
        "required": ["param1"]
    }

    def execute(self, args: Dict[str, Any]) -> Dict[str, Any]:
        """Execute tool functionality
        
        Args:
            args: Parameters passed to the tool
            
        Returns:
            Dict with execution results:
            {
                "success": bool,
                "stdout": str,  # On success
                "stderr": str,  # Optional error details
                "error": str    # On failure
            }
        """
        try:
            # Implement tool logic here
            result = "Tool execution result"
            return {
                "success": True,
                "stdout": result
            }
        except Exception as e:
            return {
                "success": False,
                "error": str(e)
            }
```

### Adding New Models

Create a new Python file in `~/.jarvis_models/`:

```python
from typing import Dict, List
from jarvis.models.base import BaseModel
from jarvis.utils import PrettyOutput, OutputType

class CustomModel(BaseModel):
    """Custom model implementation"""
    
    model_name = "custom"  # Model identifier
    
    def __init__(self):
        """Initialize model"""
        # Add your initialization code here
        self.messages = []
        self.system_message = ""
        
    def set_system_message(self, message: str):
        """Set system message"""
        self.system_message = message
        
    def chat(self, message: str) -> str:
        """Execute chat with the model
        
        Args:
            message: User input message
            
        Returns:
            str: Model response
        """
        try:
            # Implement chat logic here
            PrettyOutput.print("发送请求...", OutputType.PROGRESS)
            
            # Add message to history
            self.messages.append({"role": "user", "content": message})
            
            # Get response from your model
            response = "Model response"
            
            # Add response to history
            self.messages.append({"role": "assistant", "content": response})
            
            return response
            
        except Exception as e:
            PrettyOutput.print(f"对话倱θ΄₯: {str(e)}", OutputType.ERROR)
            raise Exception(f"Chat failed: {str(e)}")
            
    def name(self) -> str:
        """Return model name"""
        return self.model_name
        
    def reset(self):
        """Reset model state"""
        self.messages = []
        if self.system_message:
            self.messages.append({"role": "system", "content": self.system_message})
            
    def delete_chat(self) -> bool:
        """Delete current chat session"""
        self.reset()
        return True
```

### Development Guidelines

1. **Tool Development**
   - Use descriptive names and documentation
   - Define clear parameter schemas
   - Handle errors gracefully
   - Return standardized results
   - Keep tools focused and simple

2. **Model Development**
   - Implement all required methods
   - Handle streaming responses
   - Manage chat history properly
   - Use proper error handling
   - Follow existing model patterns

3. **Best Practices**
   - Use PrettyOutput for console output
   - Document your code
   - Add type hints
   - Test thoroughly
   - Handle edge cases

## 🀝 Contributing

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

## πŸ“„ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---

<div align="center">

Made with ❀️ by the Jarvis Team

</div>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/skyfireitdiy/Jarvis",
    "name": "jarvis-ai-assistant",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "jarvis, ai, assistant, tools, automation",
    "author": "skyfire",
    "author_email": "Your Name <your.email@example.com>",
    "download_url": "https://files.pythonhosted.org/packages/af/87/326a16d4e95351f233ffb92ca2d26aabf8f041456cb9064780eed93f2b5a/jarvis_ai_assistant-0.1.53.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n\n# \ud83e\udd16 Jarvis AI Assistant\n\n<p align=\"center\">\n  <img src=\"docs/images/jarvis-logo.png\" alt=\"Jarvis Logo\" width=\"200\"/>\n</p>\n\n[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n*Your intelligent assistant for development and system interaction*\n\n[Features](#features) \u2022\n[Usage](#usage) \u2022\n[Configuration](#configuration) \u2022\n[Extending Jarvis](#-extending-jarvis) \u2022\n[Contributing](#-contributing) \u2022\n[License](#-license)\n\n</div>\n\n---\n\n## \u2728 Features\n\n### \ud83e\udde0 Intelligent Agent\n- Self-improving through experience accumulation\n- Automatic methodology generation from successful problem-solving\n- Iterative learning from each interaction\n- Context-aware problem solving\n\n### \ud83d\udee0\ufe0f Extensible Architecture\n- Dynamic tool loading and integration\n- Custom model support with simple interface\n- AI-powered tool generation\n- Hot-reload support for tools and models\n\n### \ud83d\udca1 Smart Features\n- Automated methodology management\n- Problem-specific solution patterns\n- Continuous capability enhancement\n- Learning from past interactions\n\n### \ud83c\udfa8 User Experience\n- Beautiful console output\n- Interactive mode\n- Multi-line input support\n- Progress indicators\n- Colored output\n\n## \ud83d\ude80 Installation\n\n```bash\npip install jarvis-ai-assistant\n```\n\n## \ud83d\udd27 Configuration\n\nCreate a `.jarvis_env` file in your home directory with your API keys:\n\n### For Kimi:\n```bash\nKIMI_API_KEY=your_kimi_api_key_here\n```\n\n### For OpenAI:\n```bash\nOPENAI_API_KEY=your_api_key_here\nOPENAI_API_BASE=your_api_base  # Optional, defaults to https://api.deepseek.com\nOPENAI_MODEL_NAME=your_model_name  # Optional, defaults to deepseek-chat\n```\n\n## \ud83c\udfaf Usage\n\n### Basic Usage\n```bash\njarvis\n```\n\n### With Specific Model\n```bash\njarvis -p kimi  # Use Kimi platform\njarvis -p openai  # Use OpenAI platform\n```\n\n### Process Files\n```bash\njarvis -f file1.py file2.py  # Process specific files\n```\n\n### Keep Chat History\n```bash\njarvis --keep-history  # Don't delete chat session after completion\n```\n\n## \ud83d\udee0\ufe0f Tools\n\n### Built-in Tools\n\n| Tool | Description |\n|------|-------------|\n| execute_shell | Execute system commands and capture output |\n| file_operation | File operations (read/write/append/delete) |\n| generate_tool | AI-powered tool generation and integration |\n| methodology | Experience accumulation and methodology management |\n| create_sub_agent | Create specialized sub-agents for specific tasks |\n\n### Tool Locations\n- Built-in tools: `src/jarvis/tools/`\n- User tools: `~/.jarvis_tools/`\n\n### Key Features\n\n#### 1. Self-Extending Capabilities\n- Tool generation through natural language description\n- Automatic code generation and integration\n- Dynamic capability expansion through sub-agents\n\n#### 2. Methodology Learning\n- Automatic experience accumulation from interactions\n- Pattern recognition and methodology extraction\n- Continuous refinement through usage\n\n#### 3. Adaptive Problem Solving\n- Context-aware sub-agent creation\n- Dynamic tool composition\n- Learning from execution feedback\n\n## \ud83c\udfaf Extending Jarvis\n\n### Adding New Tools\n\nCreate a new Python file in `~/.jarvis_tools/` or `src/jarvis/tools/`:\n\n```python\nfrom typing import Dict, Any\nfrom jarvis.utils import OutputType, PrettyOutput\n\nclass CustomTool:\n    name = \"tool_name\"              # Tool name for invocation\n    description = \"Tool description\" # Tool purpose\n    parameters = {                  # JSON Schema for parameters\n        \"type\": \"object\",\n        \"properties\": {\n            \"param1\": {\n                \"type\": \"string\",\n                \"description\": \"Parameter description\"\n            }\n        },\n        \"required\": [\"param1\"]\n    }\n\n    def execute(self, args: Dict[str, Any]) -> Dict[str, Any]:\n        \"\"\"Execute tool functionality\n        \n        Args:\n            args: Parameters passed to the tool\n            \n        Returns:\n            Dict with execution results:\n            {\n                \"success\": bool,\n                \"stdout\": str,  # On success\n                \"stderr\": str,  # Optional error details\n                \"error\": str    # On failure\n            }\n        \"\"\"\n        try:\n            # Implement tool logic here\n            result = \"Tool execution result\"\n            return {\n                \"success\": True,\n                \"stdout\": result\n            }\n        except Exception as e:\n            return {\n                \"success\": False,\n                \"error\": str(e)\n            }\n```\n\n### Adding New Models\n\nCreate a new Python file in `~/.jarvis_models/`:\n\n```python\nfrom typing import Dict, List\nfrom jarvis.models.base import BaseModel\nfrom jarvis.utils import PrettyOutput, OutputType\n\nclass CustomModel(BaseModel):\n    \"\"\"Custom model implementation\"\"\"\n    \n    model_name = \"custom\"  # Model identifier\n    \n    def __init__(self):\n        \"\"\"Initialize model\"\"\"\n        # Add your initialization code here\n        self.messages = []\n        self.system_message = \"\"\n        \n    def set_system_message(self, message: str):\n        \"\"\"Set system message\"\"\"\n        self.system_message = message\n        \n    def chat(self, message: str) -> str:\n        \"\"\"Execute chat with the model\n        \n        Args:\n            message: User input message\n            \n        Returns:\n            str: Model response\n        \"\"\"\n        try:\n            # Implement chat logic here\n            PrettyOutput.print(\"\u53d1\u9001\u8bf7\u6c42...\", OutputType.PROGRESS)\n            \n            # Add message to history\n            self.messages.append({\"role\": \"user\", \"content\": message})\n            \n            # Get response from your model\n            response = \"Model response\"\n            \n            # Add response to history\n            self.messages.append({\"role\": \"assistant\", \"content\": response})\n            \n            return response\n            \n        except Exception as e:\n            PrettyOutput.print(f\"\u5bf9\u8bdd\u5931\u8d25: {str(e)}\", OutputType.ERROR)\n            raise Exception(f\"Chat failed: {str(e)}\")\n            \n    def name(self) -> str:\n        \"\"\"Return model name\"\"\"\n        return self.model_name\n        \n    def reset(self):\n        \"\"\"Reset model state\"\"\"\n        self.messages = []\n        if self.system_message:\n            self.messages.append({\"role\": \"system\", \"content\": self.system_message})\n            \n    def delete_chat(self) -> bool:\n        \"\"\"Delete current chat session\"\"\"\n        self.reset()\n        return True\n```\n\n### Development Guidelines\n\n1. **Tool Development**\n   - Use descriptive names and documentation\n   - Define clear parameter schemas\n   - Handle errors gracefully\n   - Return standardized results\n   - Keep tools focused and simple\n\n2. **Model Development**\n   - Implement all required methods\n   - Handle streaming responses\n   - Manage chat history properly\n   - Use proper error handling\n   - Follow existing model patterns\n\n3. **Best Practices**\n   - Use PrettyOutput for console output\n   - Document your code\n   - Add type hints\n   - Test thoroughly\n   - Handle edge cases\n\n## \ud83e\udd1d Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\n<div align=\"center\">\n\nMade with \u2764\ufe0f by the Jarvis Team\n\n</div>\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2025 skyfire  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Jarvis: An AI assistant that uses tools to interact with the system",
    "version": "0.1.53",
    "project_urls": {
        "Homepage": "https://github.com/skyfireitdiy/Jarvis"
    },
    "split_keywords": [
        "jarvis",
        " ai",
        " assistant",
        " tools",
        " automation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "49f994d013944d70900f438a042cab37773e7e471758c8113ed677c76b9594e1",
                "md5": "d99bd3278278be37f44352414d786146",
                "sha256": "5a91f00b3f7282dc2744c0da6c15fc109c3a78a7a49974d697beb209638e487a"
            },
            "downloads": -1,
            "filename": "jarvis_ai_assistant-0.1.53-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d99bd3278278be37f44352414d786146",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 48632,
            "upload_time": "2025-01-17T15:40:07",
            "upload_time_iso_8601": "2025-01-17T15:40:07.619834Z",
            "url": "https://files.pythonhosted.org/packages/49/f9/94d013944d70900f438a042cab37773e7e471758c8113ed677c76b9594e1/jarvis_ai_assistant-0.1.53-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "af87326a16d4e95351f233ffb92ca2d26aabf8f041456cb9064780eed93f2b5a",
                "md5": "355eccd662e1e574106bb4ce26a9908b",
                "sha256": "2b37ac330ad2b71339e8d7da6c2dd4110a8c9056db0df65b54c3be3ccb615d2c"
            },
            "downloads": -1,
            "filename": "jarvis_ai_assistant-0.1.53.tar.gz",
            "has_sig": false,
            "md5_digest": "355eccd662e1e574106bb4ce26a9908b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 41720,
            "upload_time": "2025-01-17T15:40:10",
            "upload_time_iso_8601": "2025-01-17T15:40:10.506989Z",
            "url": "https://files.pythonhosted.org/packages/af/87/326a16d4e95351f233ffb92ca2d26aabf8f041456cb9064780eed93f2b5a/jarvis_ai_assistant-0.1.53.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-17 15:40:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "skyfireitdiy",
    "github_project": "Jarvis",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "jarvis-ai-assistant"
}
        
Elapsed time: 0.49098s