aia 0.9.11 → 0.9.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.version +1 -1
- data/CHANGELOG.md +66 -2
- data/README.md +133 -4
- data/docs/advanced-prompting.md +721 -0
- data/docs/cli-reference.md +582 -0
- data/docs/configuration.md +347 -0
- data/docs/contributing.md +332 -0
- data/docs/directives-reference.md +490 -0
- data/docs/examples/index.md +277 -0
- data/docs/examples/mcp/index.md +479 -0
- data/docs/examples/prompts/analysis/index.md +78 -0
- data/docs/examples/prompts/automation/index.md +108 -0
- data/docs/examples/prompts/development/index.md +125 -0
- data/docs/examples/prompts/index.md +333 -0
- data/docs/examples/prompts/learning/index.md +127 -0
- data/docs/examples/prompts/writing/index.md +62 -0
- data/docs/examples/tools/index.md +292 -0
- data/docs/faq.md +414 -0
- data/docs/guides/available-models.md +366 -0
- data/docs/guides/basic-usage.md +477 -0
- data/docs/guides/chat.md +474 -0
- data/docs/guides/executable-prompts.md +417 -0
- data/docs/guides/first-prompt.md +454 -0
- data/docs/guides/getting-started.md +455 -0
- data/docs/guides/image-generation.md +507 -0
- data/docs/guides/index.md +46 -0
- data/docs/guides/models.md +507 -0
- data/docs/guides/tools.md +856 -0
- data/docs/index.md +173 -0
- data/docs/installation.md +238 -0
- data/docs/mcp-integration.md +612 -0
- data/docs/prompt_management.md +579 -0
- data/docs/security.md +629 -0
- data/docs/tools-and-mcp-examples.md +1186 -0
- data/docs/workflows-and-pipelines.md +563 -0
- data/examples/tools/mcp/github_mcp_server.json +11 -0
- data/examples/tools/mcp/imcp.json +7 -0
- data/lib/aia/chat_processor_service.rb +19 -3
- data/lib/aia/config/base.rb +224 -0
- data/lib/aia/config/cli_parser.rb +409 -0
- data/lib/aia/config/defaults.rb +88 -0
- data/lib/aia/config/file_loader.rb +131 -0
- data/lib/aia/config/validator.rb +184 -0
- data/lib/aia/config.rb +10 -860
- data/lib/aia/directive_processor.rb +27 -372
- data/lib/aia/directives/configuration.rb +114 -0
- data/lib/aia/directives/execution.rb +37 -0
- data/lib/aia/directives/models.rb +178 -0
- data/lib/aia/directives/registry.rb +120 -0
- data/lib/aia/directives/utility.rb +70 -0
- data/lib/aia/directives/web_and_file.rb +71 -0
- data/lib/aia/prompt_handler.rb +23 -3
- data/lib/aia/ruby_llm_adapter.rb +307 -128
- data/lib/aia/session.rb +27 -14
- data/lib/aia/utility.rb +12 -8
- data/lib/aia.rb +11 -2
- data/lib/extensions/ruby_llm/.irbrc +56 -0
- data/mkdocs.yml +165 -0
- metadata +77 -20
- /data/{images → docs/assets/images}/aia.png +0 -0
data/docs/guides/chat.md
ADDED
@@ -0,0 +1,474 @@
|
|
1
|
+
# Chat Mode Guide
|
2
|
+
|
3
|
+
AIA's chat mode provides interactive conversations with AI models, maintaining context and supporting advanced features like multi-model interactions, tool usage, and persistent sessions.
|
4
|
+
|
5
|
+
## Starting a Chat Session
|
6
|
+
|
7
|
+
### Basic Chat
|
8
|
+
```bash
|
9
|
+
# Start an interactive chat session
|
10
|
+
aia --chat
|
11
|
+
|
12
|
+
# Start chat with a specific model
|
13
|
+
aia --chat --model gpt-4
|
14
|
+
|
15
|
+
# Start chat with initial context
|
16
|
+
aia --chat --role assistant my_context.txt
|
17
|
+
```
|
18
|
+
|
19
|
+
### Chat with Initial Prompts
|
20
|
+
```bash
|
21
|
+
# Begin chat after processing a prompt
|
22
|
+
aia --chat my_initial_prompt
|
23
|
+
|
24
|
+
# Chat with system prompt
|
25
|
+
aia --chat --system_prompt helpful_assistant
|
26
|
+
|
27
|
+
# Chat with role-based context
|
28
|
+
aia --chat --role code_expert debugging_session
|
29
|
+
```
|
30
|
+
|
31
|
+
## Chat Interface
|
32
|
+
|
33
|
+
### Basic Commands
|
34
|
+
Once in chat mode, you can use these commands:
|
35
|
+
|
36
|
+
- **Regular messages**: Type normally and press Enter
|
37
|
+
- **`/help`**: Show available chat commands
|
38
|
+
- **`/exit`** or **`/quit`**: End the chat session
|
39
|
+
- **`/clear`**: Clear conversation history
|
40
|
+
- **`/save filename.md`**: Save conversation to file
|
41
|
+
- **`/model model_name`**: Switch AI model
|
42
|
+
- **`/temperature 0.8`**: Adjust creativity level
|
43
|
+
- **`/tools`**: List available tools
|
44
|
+
- **`/context`**: Show current context
|
45
|
+
|
46
|
+
### Special Features
|
47
|
+
|
48
|
+
#### Multi-line Input
|
49
|
+
```
|
50
|
+
You: ```
|
51
|
+
This is a multi-line input.
|
52
|
+
You can write code, long explanations,
|
53
|
+
or complex queries across multiple lines.
|
54
|
+
```
|
55
|
+
|
56
|
+
#### File Upload During Chat
|
57
|
+
```
|
58
|
+
You: Please analyze this file:
|
59
|
+
//include my_data.csv
|
60
|
+
|
61
|
+
What patterns do you see?
|
62
|
+
```
|
63
|
+
|
64
|
+
#### Code Execution
|
65
|
+
```
|
66
|
+
The current date and time is:
|
67
|
+
//ruby Time.now
|
68
|
+
|
69
|
+
Files in the current directory are:
|
70
|
+
//shell ls -la
|
71
|
+
|
72
|
+
which files are over 1 week old?
|
73
|
+
```
|
74
|
+
|
75
|
+
## Advanced Chat Features
|
76
|
+
|
77
|
+
### Multi-Model Conversations
|
78
|
+
|
79
|
+
#### Consensus Mode
|
80
|
+
```bash
|
81
|
+
# Start chat with multiple models seeking consensus
|
82
|
+
aia --chat --model "gpt-4,claude-3-sonnet,gemini-pro" --consensus
|
83
|
+
|
84
|
+
# Models will collaborate to provide unified responses
|
85
|
+
```
|
86
|
+
|
87
|
+
#### Parallel Responses
|
88
|
+
```bash
|
89
|
+
# Get responses from multiple models simultaneously
|
90
|
+
aia --chat --model "gpt-4,claude-3-sonnet" --no-consensus
|
91
|
+
|
92
|
+
# You'll see separate responses from each model
|
93
|
+
```
|
94
|
+
|
95
|
+
#### Model Comparison
|
96
|
+
```
|
97
|
+
You: Compare these approaches to solving the problem:
|
98
|
+
//compare "Explain recursion vs iteration" --models gpt-4,claude-3-sonnet
|
99
|
+
|
100
|
+
Which explanation is clearer?
|
101
|
+
```
|
102
|
+
|
103
|
+
### Context Management
|
104
|
+
|
105
|
+
#### Persistent Context
|
106
|
+
AIA maintains conversation context automatically:
|
107
|
+
```
|
108
|
+
You: I'm working on a Python web application using Flask.
|
109
|
+
AI: Great! Flask is an excellent choice for web development...
|
110
|
+
|
111
|
+
You: How do I handle user authentication?
|
112
|
+
AI: For your Flask application, here are several authentication options...
|
113
|
+
```
|
114
|
+
|
115
|
+
#### Context Inspection
|
116
|
+
```
|
117
|
+
You: /context
|
118
|
+
# Shows current conversation history and metadata
|
119
|
+
```
|
120
|
+
|
121
|
+
#### Context Clearing
|
122
|
+
```
|
123
|
+
You: /clear
|
124
|
+
# Clears conversation history while keeping session active
|
125
|
+
|
126
|
+
You: /new
|
127
|
+
# Starts a completely fresh session
|
128
|
+
```
|
129
|
+
|
130
|
+
### Tool Integration in Chat
|
131
|
+
|
132
|
+
#### Enabling Tools
|
133
|
+
```bash
|
134
|
+
# Start chat with specific tools
|
135
|
+
aia --chat --tools ./my_tools.rb
|
136
|
+
|
137
|
+
# Start with tool directory
|
138
|
+
aia --chat --tools ./tools/
|
139
|
+
|
140
|
+
# Restrict tool access
|
141
|
+
aia --chat --tools ./tools/ --allowed_tools "file_reader,calculator"
|
142
|
+
```
|
143
|
+
|
144
|
+
#### Using Tools in Conversation
|
145
|
+
```
|
146
|
+
You: Can you analyze the performance metrics in this log file?
|
147
|
+
//tools performance_analyzer
|
148
|
+
//include /var/log/app.log
|
149
|
+
|
150
|
+
AI: I'll analyze the performance data using the performance analyzer tool...
|
151
|
+
```
|
152
|
+
|
153
|
+
#### Tool Discovery
|
154
|
+
```
|
155
|
+
You: /tools
|
156
|
+
Available Tools:
|
157
|
+
- file_analyzer: Analyze file contents and structure
|
158
|
+
- web_scraper: Extract data from web pages
|
159
|
+
- calculator: Perform complex mathematical calculations
|
160
|
+
```
|
161
|
+
|
162
|
+
## Chat Session Types
|
163
|
+
|
164
|
+
### Code Review Session
|
165
|
+
```bash
|
166
|
+
# Start specialized code review chat
|
167
|
+
aia --chat --role code_expert --system_prompt code_reviewer
|
168
|
+
|
169
|
+
You: I need help reviewing this Python function:
|
170
|
+
//include my_function.py
|
171
|
+
|
172
|
+
AI: I'll review this code for bugs, performance issues, and best practices...
|
173
|
+
|
174
|
+
You: What about security concerns?
|
175
|
+
AI: Looking at the security aspects of your function...
|
176
|
+
|
177
|
+
You: Can you suggest unit tests for this?
|
178
|
+
AI: Here are comprehensive unit tests for your function...
|
179
|
+
```
|
180
|
+
|
181
|
+
### Data Analysis Session
|
182
|
+
```bash
|
183
|
+
# Start data analysis chat with tools
|
184
|
+
aia --chat --tools ./analysis_tools/ --model claude-3-sonnet
|
185
|
+
|
186
|
+
You: I have a dataset I need to analyze:
|
187
|
+
//include data.csv
|
188
|
+
|
189
|
+
AI: I can help you analyze this dataset. Let me start by examining its structure...
|
190
|
+
|
191
|
+
You: Focus on the correlation between sales and marketing spend
|
192
|
+
AI: I'll analyze the correlation using statistical tools...
|
193
|
+
```
|
194
|
+
|
195
|
+
### Writing Session
|
196
|
+
```bash
|
197
|
+
# Start creative writing session
|
198
|
+
aia --chat --model gpt-4 --temperature 1.2 --role creative_writer
|
199
|
+
|
200
|
+
You: Help me write a technical blog post about microservices
|
201
|
+
AI: I'd be happy to help! Let's start by outlining the key points...
|
202
|
+
|
203
|
+
You: Make it more engaging for developers
|
204
|
+
AI: Here's how we can make it more engaging...
|
205
|
+
```
|
206
|
+
|
207
|
+
### Learning Session
|
208
|
+
```bash
|
209
|
+
# Start educational chat
|
210
|
+
aia --chat --role teacher --system_prompt patient_explainer
|
211
|
+
|
212
|
+
You: Explain how blockchain works, but I'm completely new to this
|
213
|
+
AI: Let me explain blockchain in simple terms, starting from the basics...
|
214
|
+
|
215
|
+
You: Can you give me a practical example?
|
216
|
+
AI: Absolutely! Let's use a simple example everyone can relate to...
|
217
|
+
```
|
218
|
+
|
219
|
+
## Voice and Audio Features
|
220
|
+
|
221
|
+
### Text-to-Speech
|
222
|
+
```bash
|
223
|
+
# Enable speech output
|
224
|
+
aia --chat --speak
|
225
|
+
|
226
|
+
# Choose specific voice
|
227
|
+
aia --chat --speak --voice nova
|
228
|
+
|
229
|
+
# Use high-quality speech model
|
230
|
+
aia --chat --speak --speech_model tts-1-hd
|
231
|
+
```
|
232
|
+
|
233
|
+
### Audio Input
|
234
|
+
```bash
|
235
|
+
# Use speech-to-text for input
|
236
|
+
aia --chat --transcription_model whisper-1 audio_input.wav
|
237
|
+
```
|
238
|
+
|
239
|
+
### Interactive Voice Chat
|
240
|
+
```bash
|
241
|
+
# Full voice interaction
|
242
|
+
aia --chat --speak --voice echo --transcription_model whisper-1
|
243
|
+
|
244
|
+
# Great for hands-free operation or accessibility
|
245
|
+
```
|
246
|
+
|
247
|
+
## Session Management
|
248
|
+
|
249
|
+
### Saving Conversations
|
250
|
+
```
|
251
|
+
# Within chat
|
252
|
+
You: /save project_discussion.md
|
253
|
+
Conversation saved to project_discussion.md
|
254
|
+
|
255
|
+
# Or with full path
|
256
|
+
You: /save /path/to/conversations/analysis_session.md
|
257
|
+
```
|
258
|
+
|
259
|
+
### Loading Previous Context
|
260
|
+
```bash
|
261
|
+
# Start chat with previous conversation
|
262
|
+
aia --chat --include previous_session.md
|
263
|
+
|
264
|
+
# This loads the conversation as context
|
265
|
+
```
|
266
|
+
|
267
|
+
### Session Configuration
|
268
|
+
```
|
269
|
+
# Change model mid-conversation
|
270
|
+
You: /model gpt-4
|
271
|
+
Switched to gpt-4
|
272
|
+
|
273
|
+
# Adjust creativity
|
274
|
+
You: /temperature 0.3
|
275
|
+
Temperature set to 0.3 (more focused)
|
276
|
+
|
277
|
+
# Enable verbose mode
|
278
|
+
You: /verbose on
|
279
|
+
Verbose mode enabled
|
280
|
+
```
|
281
|
+
|
282
|
+
## Chat Workflows
|
283
|
+
|
284
|
+
### Research and Analysis Workflow
|
285
|
+
1. **Information Gathering**: Load documents and data
|
286
|
+
2. **Initial Analysis**: Ask broad questions
|
287
|
+
3. **Deep Dive**: Focus on specific areas
|
288
|
+
4. **Synthesis**: Combine insights
|
289
|
+
5. **Documentation**: Save findings
|
290
|
+
|
291
|
+
```
|
292
|
+
You: I'm researching market trends in AI development
|
293
|
+
//include market_report.pdf
|
294
|
+
//include competitor_analysis.csv
|
295
|
+
|
296
|
+
AI: I'll help you analyze these market trends...
|
297
|
+
|
298
|
+
You: What are the key growth drivers?
|
299
|
+
AI: Based on the data, here are the main growth drivers...
|
300
|
+
|
301
|
+
You: How do our competitors compare?
|
302
|
+
AI: Looking at the competitive landscape...
|
303
|
+
|
304
|
+
You: /save ai_market_research.md
|
305
|
+
```
|
306
|
+
|
307
|
+
### Development Workflow
|
308
|
+
1. **Code Review**: Analyze existing code
|
309
|
+
2. **Problem Solving**: Debug issues
|
310
|
+
3. **Implementation**: Write new features
|
311
|
+
4. **Testing**: Create test cases
|
312
|
+
5. **Documentation**: Generate docs
|
313
|
+
|
314
|
+
```
|
315
|
+
You: Let's review and improve this API endpoint:
|
316
|
+
//include api_endpoint.py
|
317
|
+
|
318
|
+
AI: I'll review this endpoint for potential improvements...
|
319
|
+
|
320
|
+
You: It's running slowly, can you identify bottlenecks?
|
321
|
+
AI: I see several performance issues...
|
322
|
+
|
323
|
+
You: Help me optimize the database queries
|
324
|
+
AI: Here are optimized versions of your queries...
|
325
|
+
|
326
|
+
You: Generate unit tests for the optimized version
|
327
|
+
AI: Here are comprehensive unit tests...
|
328
|
+
```
|
329
|
+
|
330
|
+
## Customization and Configuration
|
331
|
+
|
332
|
+
### Chat-Specific Configuration
|
333
|
+
```yaml
|
334
|
+
# ~/.aia/chat_config.yml
|
335
|
+
chat:
|
336
|
+
default_model: gpt-4
|
337
|
+
save_conversations: true
|
338
|
+
conversation_dir: ~/aia_conversations
|
339
|
+
auto_save_interval: 300 # seconds
|
340
|
+
max_context_length: 16000
|
341
|
+
show_token_count: true
|
342
|
+
|
343
|
+
speech:
|
344
|
+
enabled: false
|
345
|
+
voice: alloy
|
346
|
+
auto_play: true
|
347
|
+
|
348
|
+
tools:
|
349
|
+
auto_discover: true
|
350
|
+
default_paths: [~/.aia/tools, ./tools]
|
351
|
+
security_mode: safe
|
352
|
+
```
|
353
|
+
|
354
|
+
### Custom Chat Commands
|
355
|
+
You can define custom chat commands by creating tool functions:
|
356
|
+
|
357
|
+
```ruby
|
358
|
+
# ~/.aia/tools/chat_commands.rb
|
359
|
+
class ChatCommands < RubyLLM::Tool
|
360
|
+
def summarize_conversation
|
361
|
+
# Custom command to summarize the current conversation
|
362
|
+
"<%= AIA.chat.context.summarize %>"
|
363
|
+
end
|
364
|
+
|
365
|
+
def export_code_snippets
|
366
|
+
# Extract and export all code snippets from conversation
|
367
|
+
"<%= AIA.chat.extract_code_blocks %>"
|
368
|
+
end
|
369
|
+
end
|
370
|
+
```
|
371
|
+
|
372
|
+
## Troubleshooting Chat Mode
|
373
|
+
|
374
|
+
### Common Issues
|
375
|
+
|
376
|
+
#### Context Too Long
|
377
|
+
```
|
378
|
+
Error: Context exceeds maximum length
|
379
|
+
```
|
380
|
+
**Solution**: Use `/clear` to clear history or `/context trim` to keep recent messages only.
|
381
|
+
|
382
|
+
#### Model Not Responding
|
383
|
+
```
|
384
|
+
Error: Model timeout or connection error
|
385
|
+
```
|
386
|
+
**Solution**: Check your internet connection and API keys, try switching models.
|
387
|
+
|
388
|
+
#### Tool Not Found
|
389
|
+
```
|
390
|
+
Error: Tool 'my_tool' not found
|
391
|
+
```
|
392
|
+
**Solution**: Verify tool paths with `/tools` and check tool file syntax.
|
393
|
+
|
394
|
+
### Performance Optimization
|
395
|
+
|
396
|
+
#### Reduce Token Usage
|
397
|
+
- Clear context regularly with `/clear`
|
398
|
+
- Use shorter, more focused messages
|
399
|
+
- Summarize long conversations periodically
|
400
|
+
|
401
|
+
#### Improve Response Speed
|
402
|
+
- Use faster models for simple queries
|
403
|
+
- Cache frequently used context
|
404
|
+
- Optimize tool implementations
|
405
|
+
|
406
|
+
#### Memory Management
|
407
|
+
```bash
|
408
|
+
# Monitor memory usage
|
409
|
+
aia --chat --debug --verbose
|
410
|
+
|
411
|
+
# Use memory-efficient models
|
412
|
+
aia --chat --model gpt-3.5-turbo
|
413
|
+
```
|
414
|
+
|
415
|
+
## Best Practices
|
416
|
+
|
417
|
+
### Effective Chat Techniques
|
418
|
+
1. **Be Specific**: Clear, detailed questions get better responses
|
419
|
+
2. **Provide Context**: Include relevant information upfront
|
420
|
+
3. **Iterate**: Build on previous responses for deeper insights
|
421
|
+
4. **Use Tools**: Leverage tools for data processing and analysis
|
422
|
+
5. **Save Progress**: Regular saves prevent loss of valuable insights
|
423
|
+
|
424
|
+
### Security Considerations
|
425
|
+
1. **Sensitive Data**: Avoid sharing confidential information
|
426
|
+
2. **Tool Access**: Restrict tool permissions appropriately
|
427
|
+
3. **Session Management**: Clear sensitive conversations
|
428
|
+
4. **API Keys**: Keep credentials secure
|
429
|
+
|
430
|
+
### Productivity Tips
|
431
|
+
1. **Keyboard Shortcuts**: Learn and use available shortcuts
|
432
|
+
2. **Template Messages**: Create reusable message templates
|
433
|
+
3. **Model Selection**: Choose appropriate models for different tasks
|
434
|
+
4. **Batch Operations**: Process multiple items in single conversations
|
435
|
+
|
436
|
+
## Integration with Other AIA Features
|
437
|
+
|
438
|
+
### Pipeline Integration
|
439
|
+
```bash
|
440
|
+
# Start chat after pipeline completion
|
441
|
+
aia --pipeline "data_prep,analysis" --chat dataset.csv
|
442
|
+
|
443
|
+
# Process results in chat mode
|
444
|
+
```
|
445
|
+
|
446
|
+
### Configuration Integration
|
447
|
+
```bash
|
448
|
+
# Use predefined configurations in chat
|
449
|
+
aia --config_file chat_setup.yml --chat
|
450
|
+
|
451
|
+
# Override specific settings
|
452
|
+
aia --chat --temperature 0.9 --max_tokens 3000
|
453
|
+
```
|
454
|
+
|
455
|
+
### Output Integration
|
456
|
+
```bash
|
457
|
+
# Save chat output to file
|
458
|
+
aia --chat --out_file discussion.md --markdown
|
459
|
+
|
460
|
+
# Append to existing files
|
461
|
+
aia --chat --out_file project_log.md --append
|
462
|
+
```
|
463
|
+
|
464
|
+
## Related Documentation
|
465
|
+
|
466
|
+
- [Getting Started](getting-started.md) - Basic AIA usage
|
467
|
+
- [Working with Models](models.md) - Model selection and configuration
|
468
|
+
- [Tools Integration](tools.md) - Using and creating tools
|
469
|
+
- [CLI Reference](../cli-reference.md) - Command-line options
|
470
|
+
- [Configuration](../configuration.md) - Setup and customization
|
471
|
+
|
472
|
+
---
|
473
|
+
|
474
|
+
Chat mode is one of AIA's most powerful features. Experiment with different models, tools, and workflows to find what works best for your use cases!
|