Your intelligent assistant for development and system interaction
Features • Usage • Configuration • Extending Jarvis • Contributing • License
- Self-improving through experience accumulation
- Automatic methodology generation from successful problem-solving
- Iterative learning from each interaction
- Context-aware problem solving
- Dynamic tool loading and integration
- Custom model support with simple interface
- AI-powered tool generation
- Hot-reload support for tools and models
- Automated methodology management
- Problem-specific solution patterns
- Continuous capability enhancement
- Learning from past interactions
- Beautiful console output
- Interactive mode
- Multi-line input support
- Progress indicators
- Colored output
pip install jarvis-ai-assistantCreate a .jarvis_env file in your home directory with your API keys:
KIMI_API_KEY=your_kimi_api_key_hereOPENAI_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-chatjarvisjarvis -p kimi # Use Kimi platform
jarvis -p openai # Use OpenAI platformjarvis -f file1.py file2.py # Process specific filesjarvis --keep-history # Don't delete chat session after completion| 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 |
- Built-in tools:
src/jarvis/tools/ - User tools:
~/.jarvis_tools/
- Tool generation through natural language description
- Automatic code generation and integration
- Dynamic capability expansion through sub-agents
- Automatic experience accumulation from interactions
- Pattern recognition and methodology extraction
- Continuous refinement through usage
- Context-aware sub-agent creation
- Dynamic tool composition
- Learning from execution feedback
Create a new Python file in ~/.jarvis_tools/ or src/jarvis/tools/:
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)
}Create a new Python file in ~/.jarvis_models/:
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-
Tool Development
- Use descriptive names and documentation
- Define clear parameter schemas
- Handle errors gracefully
- Return standardized results
- Keep tools focused and simple
-
Model Development
- Implement all required methods
- Handle streaming responses
- Manage chat history properly
- Use proper error handling
- Follow existing model patterns
-
Best Practices
- Use PrettyOutput for console output
- Document your code
- Add type hints
- Test thoroughly
- Handle edge cases
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by the Jarvis Team
