jarvis-ai-assistant 0.1.32__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. jarvis_ai_assistant-0.1.32/LICENSE +21 -0
  2. jarvis_ai_assistant-0.1.32/MANIFEST.in +4 -0
  3. jarvis_ai_assistant-0.1.32/PKG-INFO +345 -0
  4. jarvis_ai_assistant-0.1.32/README.md +291 -0
  5. jarvis_ai_assistant-0.1.32/pyproject.toml +38 -0
  6. jarvis_ai_assistant-0.1.32/setup.cfg +4 -0
  7. jarvis_ai_assistant-0.1.32/setup.py +39 -0
  8. jarvis_ai_assistant-0.1.32/src/jarvis/__init__.py +3 -0
  9. jarvis_ai_assistant-0.1.32/src/jarvis/__pycache__/__init__.cpython-313.pyc +0 -0
  10. jarvis_ai_assistant-0.1.32/src/jarvis/__pycache__/agent.cpython-313.pyc +0 -0
  11. jarvis_ai_assistant-0.1.32/src/jarvis/__pycache__/main.cpython-313.pyc +0 -0
  12. jarvis_ai_assistant-0.1.32/src/jarvis/__pycache__/models.cpython-313.pyc +0 -0
  13. jarvis_ai_assistant-0.1.32/src/jarvis/__pycache__/tools.cpython-313.pyc +0 -0
  14. jarvis_ai_assistant-0.1.32/src/jarvis/__pycache__/utils.cpython-313.pyc +0 -0
  15. jarvis_ai_assistant-0.1.32/src/jarvis/__pycache__/zte_llm.cpython-313.pyc +0 -0
  16. jarvis_ai_assistant-0.1.32/src/jarvis/agent.py +289 -0
  17. jarvis_ai_assistant-0.1.32/src/jarvis/main.py +148 -0
  18. jarvis_ai_assistant-0.1.32/src/jarvis/models/__init__.py +3 -0
  19. jarvis_ai_assistant-0.1.32/src/jarvis/models/__pycache__/__init__.cpython-313.pyc +0 -0
  20. jarvis_ai_assistant-0.1.32/src/jarvis/models/__pycache__/base.cpython-313.pyc +0 -0
  21. jarvis_ai_assistant-0.1.32/src/jarvis/models/__pycache__/kimi.cpython-313.pyc +0 -0
  22. jarvis_ai_assistant-0.1.32/src/jarvis/models/__pycache__/openai.cpython-313.pyc +0 -0
  23. jarvis_ai_assistant-0.1.32/src/jarvis/models/__pycache__/oyi.cpython-313.pyc +0 -0
  24. jarvis_ai_assistant-0.1.32/src/jarvis/models/__pycache__/registry.cpython-313.pyc +0 -0
  25. jarvis_ai_assistant-0.1.32/src/jarvis/models/base.py +39 -0
  26. jarvis_ai_assistant-0.1.32/src/jarvis/models/kimi.py +389 -0
  27. jarvis_ai_assistant-0.1.32/src/jarvis/models/openai.py +96 -0
  28. jarvis_ai_assistant-0.1.32/src/jarvis/models/oyi.py +271 -0
  29. jarvis_ai_assistant-0.1.32/src/jarvis/models/registry.py +199 -0
  30. jarvis_ai_assistant-0.1.32/src/jarvis/tools/__init__.py +5 -0
  31. jarvis_ai_assistant-0.1.32/src/jarvis/tools/__pycache__/__init__.cpython-313.pyc +0 -0
  32. jarvis_ai_assistant-0.1.32/src/jarvis/tools/__pycache__/base.cpython-313.pyc +0 -0
  33. jarvis_ai_assistant-0.1.32/src/jarvis/tools/__pycache__/bing_search.cpython-313.pyc +0 -0
  34. jarvis_ai_assistant-0.1.32/src/jarvis/tools/__pycache__/calculator.cpython-313.pyc +0 -0
  35. jarvis_ai_assistant-0.1.32/src/jarvis/tools/__pycache__/calculator_tool.cpython-313.pyc +0 -0
  36. jarvis_ai_assistant-0.1.32/src/jarvis/tools/__pycache__/file_ops.cpython-313.pyc +0 -0
  37. jarvis_ai_assistant-0.1.32/src/jarvis/tools/__pycache__/generator.cpython-313.pyc +0 -0
  38. jarvis_ai_assistant-0.1.32/src/jarvis/tools/__pycache__/methodology.cpython-313.pyc +0 -0
  39. jarvis_ai_assistant-0.1.32/src/jarvis/tools/__pycache__/python_script.cpython-313.pyc +0 -0
  40. jarvis_ai_assistant-0.1.32/src/jarvis/tools/__pycache__/rag.cpython-313.pyc +0 -0
  41. jarvis_ai_assistant-0.1.32/src/jarvis/tools/__pycache__/registry.cpython-313.pyc +0 -0
  42. jarvis_ai_assistant-0.1.32/src/jarvis/tools/__pycache__/search.cpython-313.pyc +0 -0
  43. jarvis_ai_assistant-0.1.32/src/jarvis/tools/__pycache__/shell.cpython-313.pyc +0 -0
  44. jarvis_ai_assistant-0.1.32/src/jarvis/tools/__pycache__/sub_agent.cpython-313.pyc +0 -0
  45. jarvis_ai_assistant-0.1.32/src/jarvis/tools/__pycache__/user_confirmation.cpython-313.pyc +0 -0
  46. jarvis_ai_assistant-0.1.32/src/jarvis/tools/__pycache__/user_input.cpython-313.pyc +0 -0
  47. jarvis_ai_assistant-0.1.32/src/jarvis/tools/__pycache__/user_interaction.cpython-313.pyc +0 -0
  48. jarvis_ai_assistant-0.1.32/src/jarvis/tools/__pycache__/webpage.cpython-313.pyc +0 -0
  49. jarvis_ai_assistant-0.1.32/src/jarvis/tools/base.py +23 -0
  50. jarvis_ai_assistant-0.1.32/src/jarvis/tools/file_ops.py +110 -0
  51. jarvis_ai_assistant-0.1.32/src/jarvis/tools/generator.py +172 -0
  52. jarvis_ai_assistant-0.1.32/src/jarvis/tools/methodology.py +145 -0
  53. jarvis_ai_assistant-0.1.32/src/jarvis/tools/registry.py +183 -0
  54. jarvis_ai_assistant-0.1.32/src/jarvis/tools/shell.py +78 -0
  55. jarvis_ai_assistant-0.1.32/src/jarvis/tools/sub_agent.py +82 -0
  56. jarvis_ai_assistant-0.1.32/src/jarvis/utils.py +202 -0
  57. jarvis_ai_assistant-0.1.32/src/jarvis_ai_assistant.egg-info/PKG-INFO +345 -0
  58. jarvis_ai_assistant-0.1.32/src/jarvis_ai_assistant.egg-info/SOURCES.txt +60 -0
  59. jarvis_ai_assistant-0.1.32/src/jarvis_ai_assistant.egg-info/dependency_links.txt +1 -0
  60. jarvis_ai_assistant-0.1.32/src/jarvis_ai_assistant.egg-info/entry_points.txt +2 -0
  61. jarvis_ai_assistant-0.1.32/src/jarvis_ai_assistant.egg-info/requires.txt +11 -0
  62. jarvis_ai_assistant-0.1.32/src/jarvis_ai_assistant.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 skyfire
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ include README.md
2
+ include LICENSE
3
+ include pyproject.toml
4
+ recursive-include src/jarvis *
@@ -0,0 +1,345 @@
1
+ Metadata-Version: 2.2
2
+ Name: jarvis-ai-assistant
3
+ Version: 0.1.32
4
+ Summary: Jarvis: An AI assistant that uses tools to interact with the system
5
+ Home-page: https://github.com/skyfireitdiy/Jarvis
6
+ Author: skyfire
7
+ Author-email: Your Name <your.email@example.com>
8
+ License: MIT License
9
+
10
+ Copyright (c) 2025 skyfire
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in all
20
+ copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
+ SOFTWARE.
29
+ Project-URL: Homepage, https://github.com/skyfireitdiy/Jarvis
30
+ Keywords: jarvis,ai,assistant,tools,automation
31
+ Classifier: License :: OSI Approved :: MIT License
32
+ Classifier: Programming Language :: Python
33
+ Classifier: Programming Language :: Python :: 3
34
+ Classifier: Programming Language :: Python :: 3.8
35
+ Classifier: Programming Language :: Python :: 3.9
36
+ Classifier: Programming Language :: Python :: 3.10
37
+ Classifier: Programming Language :: Python :: 3.11
38
+ Requires-Python: >=3.8
39
+ Description-Content-Type: text/markdown
40
+ License-File: LICENSE
41
+ Requires-Dist: requests>=2.25.1
42
+ Requires-Dist: pyyaml>=5.1
43
+ Requires-Dist: colorama>=0.4.6
44
+ Requires-Dist: prompt_toolkit>=3.0.0
45
+ Requires-Dist: openai>=1.20.0
46
+ Provides-Extra: dev
47
+ Requires-Dist: pytest; extra == "dev"
48
+ Requires-Dist: black; extra == "dev"
49
+ Requires-Dist: isort; extra == "dev"
50
+ Requires-Dist: mypy; extra == "dev"
51
+ Dynamic: author
52
+ Dynamic: home-page
53
+ Dynamic: requires-python
54
+
55
+ <div align="center">
56
+
57
+ # 🤖 Jarvis AI Assistant
58
+
59
+ <p align="center">
60
+ <img src="docs/images/jarvis-logo.png" alt="Jarvis Logo" width="200"/>
61
+ </p>
62
+
63
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
64
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
65
+
66
+ *Your intelligent assistant for development and system interaction*
67
+
68
+ [Features](#features) •
69
+ [Usage](#usage) •
70
+ [Configuration](#configuration) •
71
+ [Extending Jarvis](#-extending-jarvis) •
72
+ [Contributing](#-contributing) •
73
+ [License](#-license)
74
+
75
+ </div>
76
+
77
+ ---
78
+
79
+ ## ✨ Features
80
+
81
+ ### 🧠 Intelligent Agent
82
+ - Self-improving through experience accumulation
83
+ - Automatic methodology generation from successful problem-solving
84
+ - Iterative learning from each interaction
85
+ - Context-aware problem solving
86
+
87
+ ### 🛠️ Extensible Architecture
88
+ - Dynamic tool loading and integration
89
+ - Custom model support with simple interface
90
+ - AI-powered tool generation
91
+ - Hot-reload support for tools and models
92
+
93
+ ### 💡 Smart Features
94
+ - Automated methodology management
95
+ - Problem-specific solution patterns
96
+ - Continuous capability enhancement
97
+ - Learning from past interactions
98
+
99
+ ### 🎨 User Experience
100
+ - Beautiful console output
101
+ - Interactive mode
102
+ - Multi-line input support
103
+ - Progress indicators
104
+ - Colored output
105
+
106
+ ## 🚀 Installation
107
+
108
+ ```bash
109
+ pip install jarvis-ai-assistant
110
+ ```
111
+
112
+ ## 🔧 Configuration
113
+
114
+ Create a `.jarvis_env` file in your home directory with your API keys:
115
+
116
+ ### For Kimi:
117
+ ```bash
118
+ KIMI_API_KEY=your_kimi_api_key_here
119
+ ```
120
+
121
+ ### For OpenAI:
122
+ ```bash
123
+ OPENAI_API_KEY=your_api_key_here
124
+ OPENAI_API_BASE=your_api_base # Optional, defaults to https://api.deepseek.com
125
+ OPENAI_MODEL_NAME=your_model_name # Optional, defaults to deepseek-chat
126
+ ```
127
+
128
+ ## 🎯 Usage
129
+
130
+ ### Basic Usage
131
+ ```bash
132
+ jarvis
133
+ ```
134
+
135
+ ### With Specific Model
136
+ ```bash
137
+ jarvis -m kimi # Use Kimi model
138
+ jarvis -m openai # Use OpenAI model
139
+ ```
140
+
141
+ ### Process Files
142
+ ```bash
143
+ jarvis -f file1.py file2.py # Process specific files
144
+ ```
145
+
146
+ ### Keep Chat History
147
+ ```bash
148
+ jarvis --keep-history # Don't delete chat session after completion
149
+ ```
150
+
151
+ ## 🛠️ Tools
152
+
153
+ ### Built-in Tools
154
+
155
+ | Tool | Description |
156
+ |------|-------------|
157
+ | shell | Execute shell commands |
158
+ | file | File operations (read/write/append) |
159
+ | git | Git operations |
160
+ | methodology | Manage problem-solving methodologies |
161
+
162
+ ### Tool Locations
163
+ - Built-in tools: `src/jarvis/tools/`
164
+ - User tools: `~/.jarvis_tools/`
165
+
166
+ ### Key Features
167
+
168
+ #### 1. Self-Extending Capabilities
169
+ - AI-powered tool generation
170
+ - Automatic integration of new tools
171
+ - Dynamic capability expansion
172
+
173
+ #### 2. Methodology Learning
174
+ - Automatic extraction of problem-solving patterns
175
+ - Continuous methodology refinement
176
+ - Experience-based improvement
177
+
178
+ #### 3. Adaptive Problem Solving
179
+ - Context-aware tool selection
180
+ - Dynamic strategy adjustment
181
+ - Learning from execution results
182
+
183
+ ## �� Extending Jarvis
184
+
185
+ ### Adding New Tools
186
+
187
+ Create a new Python file in `~/.jarvis_tools/` or `src/jarvis/tools/`:
188
+
189
+ ```python
190
+ from typing import Dict, Any
191
+ from jarvis.utils import OutputType, PrettyOutput
192
+
193
+ class CustomTool:
194
+ name = "tool_name" # Tool name for invocation
195
+ description = "Tool description" # Tool purpose
196
+ parameters = { # JSON Schema for parameters
197
+ "type": "object",
198
+ "properties": {
199
+ "param1": {
200
+ "type": "string",
201
+ "description": "Parameter description"
202
+ }
203
+ },
204
+ "required": ["param1"]
205
+ }
206
+
207
+ def execute(self, args: Dict[str, Any]) -> Dict[str, Any]:
208
+ """Execute tool functionality
209
+
210
+ Args:
211
+ args: Parameters passed to the tool
212
+
213
+ Returns:
214
+ Dict with execution results:
215
+ {
216
+ "success": bool,
217
+ "stdout": str, # On success
218
+ "stderr": str, # Optional error details
219
+ "error": str # On failure
220
+ }
221
+ """
222
+ try:
223
+ # Implement tool logic here
224
+ result = "Tool execution result"
225
+ return {
226
+ "success": True,
227
+ "stdout": result
228
+ }
229
+ except Exception as e:
230
+ return {
231
+ "success": False,
232
+ "error": str(e)
233
+ }
234
+ ```
235
+
236
+ ### Adding New Models
237
+
238
+ Create a new Python file in `~/.jarvis_models/`:
239
+
240
+ ```python
241
+ from typing import Dict, List
242
+ from jarvis.models.base import BaseModel
243
+ from jarvis.utils import PrettyOutput, OutputType
244
+
245
+ class CustomModel(BaseModel):
246
+ """Custom model implementation"""
247
+
248
+ model_name = "custom" # Model identifier
249
+
250
+ def __init__(self):
251
+ """Initialize model"""
252
+ # Add your initialization code here
253
+ self.messages = []
254
+ self.system_message = ""
255
+
256
+ def set_system_message(self, message: str):
257
+ """Set system message"""
258
+ self.system_message = message
259
+
260
+ def chat(self, message: str) -> str:
261
+ """Execute chat with the model
262
+
263
+ Args:
264
+ message: User input message
265
+
266
+ Returns:
267
+ str: Model response
268
+ """
269
+ try:
270
+ # Implement chat logic here
271
+ PrettyOutput.print("发送请求...", OutputType.PROGRESS)
272
+
273
+ # Add message to history
274
+ self.messages.append({"role": "user", "content": message})
275
+
276
+ # Get response from your model
277
+ response = "Model response"
278
+
279
+ # Add response to history
280
+ self.messages.append({"role": "assistant", "content": response})
281
+
282
+ return response
283
+
284
+ except Exception as e:
285
+ PrettyOutput.print(f"对话失败: {str(e)}", OutputType.ERROR)
286
+ raise Exception(f"Chat failed: {str(e)}")
287
+
288
+ def name(self) -> str:
289
+ """Return model name"""
290
+ return self.model_name
291
+
292
+ def reset(self):
293
+ """Reset model state"""
294
+ self.messages = []
295
+ if self.system_message:
296
+ self.messages.append({"role": "system", "content": self.system_message})
297
+
298
+ def delete_chat(self) -> bool:
299
+ """Delete current chat session"""
300
+ self.reset()
301
+ return True
302
+ ```
303
+
304
+ ### Development Guidelines
305
+
306
+ 1. **Tool Development**
307
+ - Use descriptive names and documentation
308
+ - Define clear parameter schemas
309
+ - Handle errors gracefully
310
+ - Return standardized results
311
+ - Keep tools focused and simple
312
+
313
+ 2. **Model Development**
314
+ - Implement all required methods
315
+ - Handle streaming responses
316
+ - Manage chat history properly
317
+ - Use proper error handling
318
+ - Follow existing model patterns
319
+
320
+ 3. **Best Practices**
321
+ - Use PrettyOutput for console output
322
+ - Document your code
323
+ - Add type hints
324
+ - Test thoroughly
325
+ - Handle edge cases
326
+
327
+ ## 🤝 Contributing
328
+
329
+ 1. Fork the repository
330
+ 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
331
+ 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
332
+ 4. Push to the branch (`git push origin feature/AmazingFeature`)
333
+ 5. Open a Pull Request
334
+
335
+ ## 📄 License
336
+
337
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
338
+
339
+ ---
340
+
341
+ <div align="center">
342
+
343
+ Made with ❤️ by the Jarvis Team
344
+
345
+ </div>
@@ -0,0 +1,291 @@
1
+ <div align="center">
2
+
3
+ # 🤖 Jarvis AI Assistant
4
+
5
+ <p align="center">
6
+ <img src="docs/images/jarvis-logo.png" alt="Jarvis Logo" width="200"/>
7
+ </p>
8
+
9
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
11
+
12
+ *Your intelligent assistant for development and system interaction*
13
+
14
+ [Features](#features) •
15
+ [Usage](#usage) •
16
+ [Configuration](#configuration) •
17
+ [Extending Jarvis](#-extending-jarvis) •
18
+ [Contributing](#-contributing) •
19
+ [License](#-license)
20
+
21
+ </div>
22
+
23
+ ---
24
+
25
+ ## ✨ Features
26
+
27
+ ### 🧠 Intelligent Agent
28
+ - Self-improving through experience accumulation
29
+ - Automatic methodology generation from successful problem-solving
30
+ - Iterative learning from each interaction
31
+ - Context-aware problem solving
32
+
33
+ ### 🛠️ Extensible Architecture
34
+ - Dynamic tool loading and integration
35
+ - Custom model support with simple interface
36
+ - AI-powered tool generation
37
+ - Hot-reload support for tools and models
38
+
39
+ ### 💡 Smart Features
40
+ - Automated methodology management
41
+ - Problem-specific solution patterns
42
+ - Continuous capability enhancement
43
+ - Learning from past interactions
44
+
45
+ ### 🎨 User Experience
46
+ - Beautiful console output
47
+ - Interactive mode
48
+ - Multi-line input support
49
+ - Progress indicators
50
+ - Colored output
51
+
52
+ ## 🚀 Installation
53
+
54
+ ```bash
55
+ pip install jarvis-ai-assistant
56
+ ```
57
+
58
+ ## 🔧 Configuration
59
+
60
+ Create a `.jarvis_env` file in your home directory with your API keys:
61
+
62
+ ### For Kimi:
63
+ ```bash
64
+ KIMI_API_KEY=your_kimi_api_key_here
65
+ ```
66
+
67
+ ### For OpenAI:
68
+ ```bash
69
+ OPENAI_API_KEY=your_api_key_here
70
+ OPENAI_API_BASE=your_api_base # Optional, defaults to https://api.deepseek.com
71
+ OPENAI_MODEL_NAME=your_model_name # Optional, defaults to deepseek-chat
72
+ ```
73
+
74
+ ## 🎯 Usage
75
+
76
+ ### Basic Usage
77
+ ```bash
78
+ jarvis
79
+ ```
80
+
81
+ ### With Specific Model
82
+ ```bash
83
+ jarvis -m kimi # Use Kimi model
84
+ jarvis -m openai # Use OpenAI model
85
+ ```
86
+
87
+ ### Process Files
88
+ ```bash
89
+ jarvis -f file1.py file2.py # Process specific files
90
+ ```
91
+
92
+ ### Keep Chat History
93
+ ```bash
94
+ jarvis --keep-history # Don't delete chat session after completion
95
+ ```
96
+
97
+ ## 🛠️ Tools
98
+
99
+ ### Built-in Tools
100
+
101
+ | Tool | Description |
102
+ |------|-------------|
103
+ | shell | Execute shell commands |
104
+ | file | File operations (read/write/append) |
105
+ | git | Git operations |
106
+ | methodology | Manage problem-solving methodologies |
107
+
108
+ ### Tool Locations
109
+ - Built-in tools: `src/jarvis/tools/`
110
+ - User tools: `~/.jarvis_tools/`
111
+
112
+ ### Key Features
113
+
114
+ #### 1. Self-Extending Capabilities
115
+ - AI-powered tool generation
116
+ - Automatic integration of new tools
117
+ - Dynamic capability expansion
118
+
119
+ #### 2. Methodology Learning
120
+ - Automatic extraction of problem-solving patterns
121
+ - Continuous methodology refinement
122
+ - Experience-based improvement
123
+
124
+ #### 3. Adaptive Problem Solving
125
+ - Context-aware tool selection
126
+ - Dynamic strategy adjustment
127
+ - Learning from execution results
128
+
129
+ ## �� Extending Jarvis
130
+
131
+ ### Adding New Tools
132
+
133
+ Create a new Python file in `~/.jarvis_tools/` or `src/jarvis/tools/`:
134
+
135
+ ```python
136
+ from typing import Dict, Any
137
+ from jarvis.utils import OutputType, PrettyOutput
138
+
139
+ class CustomTool:
140
+ name = "tool_name" # Tool name for invocation
141
+ description = "Tool description" # Tool purpose
142
+ parameters = { # JSON Schema for parameters
143
+ "type": "object",
144
+ "properties": {
145
+ "param1": {
146
+ "type": "string",
147
+ "description": "Parameter description"
148
+ }
149
+ },
150
+ "required": ["param1"]
151
+ }
152
+
153
+ def execute(self, args: Dict[str, Any]) -> Dict[str, Any]:
154
+ """Execute tool functionality
155
+
156
+ Args:
157
+ args: Parameters passed to the tool
158
+
159
+ Returns:
160
+ Dict with execution results:
161
+ {
162
+ "success": bool,
163
+ "stdout": str, # On success
164
+ "stderr": str, # Optional error details
165
+ "error": str # On failure
166
+ }
167
+ """
168
+ try:
169
+ # Implement tool logic here
170
+ result = "Tool execution result"
171
+ return {
172
+ "success": True,
173
+ "stdout": result
174
+ }
175
+ except Exception as e:
176
+ return {
177
+ "success": False,
178
+ "error": str(e)
179
+ }
180
+ ```
181
+
182
+ ### Adding New Models
183
+
184
+ Create a new Python file in `~/.jarvis_models/`:
185
+
186
+ ```python
187
+ from typing import Dict, List
188
+ from jarvis.models.base import BaseModel
189
+ from jarvis.utils import PrettyOutput, OutputType
190
+
191
+ class CustomModel(BaseModel):
192
+ """Custom model implementation"""
193
+
194
+ model_name = "custom" # Model identifier
195
+
196
+ def __init__(self):
197
+ """Initialize model"""
198
+ # Add your initialization code here
199
+ self.messages = []
200
+ self.system_message = ""
201
+
202
+ def set_system_message(self, message: str):
203
+ """Set system message"""
204
+ self.system_message = message
205
+
206
+ def chat(self, message: str) -> str:
207
+ """Execute chat with the model
208
+
209
+ Args:
210
+ message: User input message
211
+
212
+ Returns:
213
+ str: Model response
214
+ """
215
+ try:
216
+ # Implement chat logic here
217
+ PrettyOutput.print("发送请求...", OutputType.PROGRESS)
218
+
219
+ # Add message to history
220
+ self.messages.append({"role": "user", "content": message})
221
+
222
+ # Get response from your model
223
+ response = "Model response"
224
+
225
+ # Add response to history
226
+ self.messages.append({"role": "assistant", "content": response})
227
+
228
+ return response
229
+
230
+ except Exception as e:
231
+ PrettyOutput.print(f"对话失败: {str(e)}", OutputType.ERROR)
232
+ raise Exception(f"Chat failed: {str(e)}")
233
+
234
+ def name(self) -> str:
235
+ """Return model name"""
236
+ return self.model_name
237
+
238
+ def reset(self):
239
+ """Reset model state"""
240
+ self.messages = []
241
+ if self.system_message:
242
+ self.messages.append({"role": "system", "content": self.system_message})
243
+
244
+ def delete_chat(self) -> bool:
245
+ """Delete current chat session"""
246
+ self.reset()
247
+ return True
248
+ ```
249
+
250
+ ### Development Guidelines
251
+
252
+ 1. **Tool Development**
253
+ - Use descriptive names and documentation
254
+ - Define clear parameter schemas
255
+ - Handle errors gracefully
256
+ - Return standardized results
257
+ - Keep tools focused and simple
258
+
259
+ 2. **Model Development**
260
+ - Implement all required methods
261
+ - Handle streaming responses
262
+ - Manage chat history properly
263
+ - Use proper error handling
264
+ - Follow existing model patterns
265
+
266
+ 3. **Best Practices**
267
+ - Use PrettyOutput for console output
268
+ - Document your code
269
+ - Add type hints
270
+ - Test thoroughly
271
+ - Handle edge cases
272
+
273
+ ## 🤝 Contributing
274
+
275
+ 1. Fork the repository
276
+ 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
277
+ 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
278
+ 4. Push to the branch (`git push origin feature/AmazingFeature`)
279
+ 5. Open a Pull Request
280
+
281
+ ## 📄 License
282
+
283
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
284
+
285
+ ---
286
+
287
+ <div align="center">
288
+
289
+ Made with ❤️ by the Jarvis Team
290
+
291
+ </div>
@@ -0,0 +1,38 @@
1
+ [build-system]
2
+ requires = ["setuptools>=45", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "jarvis-ai-assistant"
7
+ version = "0.1.32"
8
+ description = "Jarvis: An AI assistant that uses tools to interact with the system"
9
+ readme = "README.md"
10
+ authors = [{ name = "Your Name", email = "your.email@example.com" }]
11
+ license = { file = "LICENSE" }
12
+ classifiers = [
13
+ "License :: OSI Approved :: MIT License",
14
+ "Programming Language :: Python",
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.8",
17
+ "Programming Language :: Python :: 3.9",
18
+ "Programming Language :: Python :: 3.10",
19
+ "Programming Language :: Python :: 3.11",
20
+ ]
21
+ keywords = ["jarvis", "ai", "assistant", "tools", "automation"]
22
+ dependencies = [
23
+ "requests>=2.25.1",
24
+ "pyyaml>=5.1",
25
+ "colorama>=0.4.6",
26
+ "prompt_toolkit>=3.0.0",
27
+ "openai>=1.20.0",
28
+ ]
29
+ requires-python = ">=3.8"
30
+
31
+ [project.optional-dependencies]
32
+ dev = ["pytest", "black", "isort", "mypy"]
33
+
34
+ [project.urls]
35
+ Homepage = "https://github.com/skyfireitdiy/Jarvis"
36
+
37
+ [project.scripts]
38
+ jarvis = "jarvis.main:main"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+