rails_ai 0.2.2 → 0.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7ba2db7126f51bd399c88d11c9c65a1f24c2086c0f89cf55eb0093f8106a37d
4
- data.tar.gz: deeded3d4d941ceb60057080219a9a56b26765070eaab273d194a85be54c67da
3
+ metadata.gz: 12fd9806ebab3a6d0f461ecc96a964eeee0f60656505374590e9fe12668ec587
4
+ data.tar.gz: 45e691a4d1de94de3db0ab1019690141d0d2f70bda24e32b629cf101763fd0a4
5
5
  SHA512:
6
- metadata.gz: a739e1b3d9fc22e925ac7f7ec4d7640afe98ac901e4626bfe860c3464be652afd7c030ce4d96dc3fd972bb85885c731c33b606c939e76c451c87a6f4923a1dbd
7
- data.tar.gz: 0c6f9e313357be636994364b36a839cc836db4ae004c09743ccb5415a2504621bf20070a0e59bf934bfdc279c847af6545d2480fcd70b92f9b02569211189570
6
+ metadata.gz: 787ac2d9154679ec0cb78f27b754812f06cefb1944e159d24726c070fc45dc5a7227c39f9eea3fbc841271e53eafa476a62358c772fd123be41e72557de70a53
7
+ data.tar.gz: '04892840f6787408f1a9b12cc3f09fa562b05578d947f709a10f4826975685fab7b744030cd1f5da81f9012772c38611a13e4b57427a2f59c303ff5339b13556'
data/CHANGELOG.md ADDED
@@ -0,0 +1,310 @@
1
+ # Changelog
2
+
3
+ All notable changes to the Rails AI gem will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.2.3] - 2024-09-21
9
+
10
+ ### Fixed
11
+ - Fixed `create_agent_team` method to use correct parameter name (`collaboration_strategy` instead of `strategy`)
12
+ - Resolved `ArgumentError: unknown keyword: :strategy` in agent team creation
13
+ - Improved agent task execution to return meaningful AI-generated results instead of just task confirmation
14
+
15
+ ### Changed
16
+ - Updated agent demo to show actual AI responses from collaborative agent work
17
+ - Enhanced agent controller to simulate multi-agent collaboration with specialized prompts
18
+
19
+ ## [0.2.2] - 2024-09-21
20
+
21
+ ### Fixed
22
+ - Fixed streaming demo EventSource MIME type error by properly handling GET requests for Server-Sent Events
23
+ - Resolved `CookieOverflow` error by implementing file-based storage for large AI responses
24
+ - Fixed compressed response display by adding Zlib decompression in streaming controller
25
+ - Updated streaming view to handle plain text responses instead of expecting JSON
26
+
27
+ ### Changed
28
+ - Improved streaming response handling with proper decompression of compressed chunks
29
+ - Enhanced error handling for streaming connections
30
+ - Updated demo controller to use file storage instead of session for large responses
31
+
32
+ ## [0.2.1] - 2024-09-21
33
+
34
+ ### Added
35
+ - Web search integration with `WebSearch` module supporting Google Search and DuckDuckGo
36
+ - `chat_with_web_search` method for real-time information retrieval
37
+ - Support for current, latest, today, now, recent, weather, news, stock, price keywords
38
+ - Web search fallback to regular chat if search fails
39
+
40
+ ### Fixed
41
+ - Fixed `ArgumentError: unknown keyword: :num_results` in web search integration
42
+ - Resolved method visibility issues with `validate_messages` method
43
+ - Fixed file loading conflicts between duplicate `InputValidator` classes
44
+
45
+ ### Changed
46
+ - Updated demo app to use GPT-4o instead of non-existent GPT-5
47
+ - Enhanced chat demo with web search checkbox option
48
+ - Improved error handling for web search failures
49
+
50
+ ## [0.2.0] - 2024-09-21
51
+
52
+ ### Added
53
+ - Comprehensive security framework with input validation, rate limiting, and content sanitization
54
+ - Secure HTTP client with SSL/TLS enforcement and security headers
55
+ - API key management with encryption and secure storage
56
+ - SSRF protection and secure file handling
57
+ - Audit logging for security events
58
+ - Custom security scanner with vulnerability detection
59
+ - CI/CD security monitoring with multiple security tools
60
+
61
+ ### Fixed
62
+ - Fixed syntax error with extra `end` keyword in main module
63
+ - Resolved character encoding issues with UTF-8 conversion
64
+ - Fixed method visibility and file loading conflicts
65
+
66
+ ### Security
67
+ - Implemented input validation for text, file paths, URLs, and Base64 data
68
+ - Added rate limiting per user and endpoint
69
+ - Content sanitization to prevent XSS and injection attacks
70
+ - Secure file handling with path validation and size limits
71
+ - API security with SSL/TLS enforcement and error handling
72
+ - SSRF protection with URL validation and host blocking
73
+
74
+ ## [0.1.9] - 2024-09-21
75
+
76
+ ### Fixed
77
+ - Fixed CI validation errors by excluding `.gem` files from gemspec
78
+ - Resolved `NoMethodError: undefined method 'megabytes'` by adding ActiveSupport dependency
79
+ - Fixed method visibility issues with `validate_messages` method
80
+
81
+ ### Changed
82
+ - Updated gemspec to exclude generated files and security reports
83
+ - Added `activesupport` dependency for numeric extensions
84
+ - Improved error handling and method accessibility
85
+
86
+ ## [0.1.8] - 2024-09-21
87
+
88
+ ### Fixed
89
+ - Fixed `NoMethodError: undefined method 'validate_messages'` by making method public
90
+ - Resolved method visibility conflicts in security module
91
+ - Fixed file loading order issues
92
+
93
+ ### Changed
94
+ - Updated security module to properly load input validator
95
+ - Improved method accessibility and error handling
96
+
97
+ ## [0.1.7] - 2024-09-21
98
+
99
+ ### Fixed
100
+ - Fixed `NoMethodError: undefined method 'validate_messages'` in chat functionality
101
+ - Resolved method visibility issues in security module
102
+ - Fixed file loading conflicts between duplicate classes
103
+
104
+ ### Changed
105
+ - Updated security module to use proper file loading
106
+ - Improved error handling and method accessibility
107
+
108
+ ## [0.1.6] - 2024-09-21
109
+
110
+ ### Fixed
111
+ - Fixed `NoMethodError: undefined method 'validate_messages'` by updating security module
112
+ - Resolved method visibility issues
113
+ - Fixed file loading conflicts
114
+
115
+ ### Changed
116
+ - Updated security module to properly load input validator
117
+ - Improved method accessibility
118
+
119
+ ## [0.1.5] - 2024-09-21
120
+
121
+ ### Fixed
122
+ - Fixed `NoMethodError: undefined method 'validate_messages'` by updating security module
123
+ - Resolved method visibility conflicts
124
+ - Fixed file loading order issues
125
+
126
+ ### Changed
127
+ - Updated security module to use proper file loading
128
+ - Improved method accessibility
129
+
130
+ ## [0.1.4] - 2024-09-21
131
+
132
+ ### Fixed
133
+ - Fixed `NoMethodError: undefined method 'validate_messages'` by making method public
134
+ - Resolved method visibility issues in security module
135
+ - Fixed file loading conflicts
136
+
137
+ ### Changed
138
+ - Updated security module to properly load input validator
139
+ - Improved method accessibility
140
+
141
+ ## [0.1.3] - 2024-09-21
142
+
143
+ ### Fixed
144
+ - Fixed `NoMethodError: undefined method 'validate_messages'` by making method public
145
+ - Resolved method visibility issues in security module
146
+ - Fixed file loading conflicts
147
+
148
+ ### Changed
149
+ - Updated security module to properly load input validator
150
+ - Improved method accessibility
151
+
152
+ ## [0.1.2] - 2024-09-21
153
+
154
+ ### Fixed
155
+ - Fixed CI validation errors by excluding `.gem` files from gemspec
156
+ - Resolved `NoMethodError: undefined method 'megabytes'` by adding ActiveSupport dependency
157
+ - Fixed method visibility issues
158
+
159
+ ### Changed
160
+ - Updated gemspec to exclude generated files
161
+ - Added `activesupport` dependency for numeric extensions
162
+ - Improved error handling
163
+
164
+ ## [0.1.1] - 2024-09-21
165
+
166
+ ### Fixed
167
+ - Fixed `NoMethodError: undefined method 'megabytes'` by adding ActiveSupport dependency
168
+ - Resolved method visibility issues in security module
169
+ - Fixed file loading conflicts
170
+
171
+ ### Changed
172
+ - Added `activesupport` dependency for numeric extensions
173
+ - Updated security module to properly load input validator
174
+ - Improved method accessibility
175
+
176
+ ## [0.1.0] - 2024-09-21
177
+
178
+ ### Added
179
+ - Initial release of Rails AI gem
180
+ - Multi-provider support for OpenAI, Anthropic (Claude), and Google Gemini
181
+ - Direct API integration without external gem dependencies
182
+ - Full multimodal capabilities (text, image, video, audio, embeddings)
183
+ - Context awareness with UserContext, WindowContext, and ImageContext
184
+ - Performance optimizations with caching, connection pooling, and batch processing
185
+ - Agent AI system with BaseAgent, specialized agents, and team collaboration
186
+ - Memory system with importance-based retention and search
187
+ - Message bus for inter-agent communication
188
+ - Task queue with priority-based management and deduplication
189
+ - Specialized agents: ResearchAgent, CreativeAgent, TechnicalAgent, CoordinatorAgent
190
+ - Agent teams with various collaboration strategies
191
+ - Agent Manager for centralized system management
192
+ - Comprehensive security framework
193
+ - Input validation and sanitization
194
+ - Rate limiting and content filtering
195
+ - Secure file handling and API security
196
+ - SSRF protection and API key management
197
+ - Audit logging and error handling
198
+ - Custom security scanner
199
+ - CI/CD security monitoring
200
+ - Legal protection framework for Canadian jurisdiction
201
+ - Commercial license template and monitoring system
202
+ - Comprehensive documentation and wiki
203
+ - Rails 5.2+ compatibility with Ruby 3+ support
204
+ - MIT License with non-commercial use restrictions
205
+
206
+ ### Features
207
+ - **Text Generation**: Support for GPT-4o, GPT-4, GPT-3.5-turbo, Claude, and Gemini models
208
+ - **Image Generation**: DALL-E 3, DALL-E 2, and Gemini image generation
209
+ - **Image Analysis**: Vision models for image understanding and analysis
210
+ - **Video Generation**: Video creation and editing capabilities
211
+ - **Audio Processing**: Speech generation and audio transcription
212
+ - **Embeddings**: Vector embeddings for semantic search and similarity
213
+ - **Streaming**: Real-time streaming responses for better user experience
214
+ - **Caching**: Intelligent caching system for improved performance
215
+ - **Context Awareness**: User, window, and image context integration
216
+ - **Agent System**: Autonomous AI agents with collaboration capabilities
217
+ - **Security**: Comprehensive security framework with multiple protection layers
218
+ - **Performance**: Optimized for speed with connection pooling and batch processing
219
+ - **Monitoring**: Continuous monitoring for security and unauthorized use
220
+ - **Legal Protection**: Canadian legal framework with commercial licensing
221
+
222
+ ### Technical Details
223
+ - **Rails Compatibility**: Rails 5.2, 6.x, 7.x, 8.x
224
+ - **Ruby Compatibility**: Ruby 3.0+
225
+ - **Dependencies**: Minimal external dependencies for maximum compatibility
226
+ - **Performance**: Optimized for speed with caching and connection pooling
227
+ - **Security**: Multiple security layers with input validation and sanitization
228
+ - **Monitoring**: Continuous monitoring with CI/CD integration
229
+ - **Documentation**: Comprehensive documentation and wiki
230
+ - **Legal**: Non-commercial license with commercial licensing available
231
+
232
+ ### Breaking Changes
233
+ - None in initial release
234
+
235
+ ### Deprecated
236
+ - None in initial release
237
+
238
+ ### Removed
239
+ - None in initial release
240
+
241
+ ### Security
242
+ - Comprehensive security framework implemented
243
+ - Input validation and sanitization
244
+ - Rate limiting and content filtering
245
+ - Secure file handling and API security
246
+ - SSRF protection and API key management
247
+ - Audit logging and error handling
248
+ - Custom security scanner
249
+ - CI/CD security monitoring
250
+
251
+ ### Performance
252
+ - Intelligent caching system
253
+ - Connection pooling for HTTP requests
254
+ - Batch processing capabilities
255
+ - Lazy loading for improved performance
256
+ - Performance monitoring and optimization
257
+ - Memory management and optimization
258
+
259
+ ### Documentation
260
+ - Comprehensive README with usage examples
261
+ - Complete API documentation
262
+ - Installation and setup guides
263
+ - Contributing guidelines
264
+ - Security documentation
265
+ - Legal protection guide
266
+ - Commercial license template
267
+ - GitHub wiki with detailed documentation
268
+
269
+ ### Legal
270
+ - MIT License with non-commercial use restrictions
271
+ - Commercial licensing available for $999/year
272
+ - Canadian legal framework
273
+ - Copyright protection and monitoring
274
+ - Cease and desist templates
275
+ - Legal protection guide
276
+
277
+ ---
278
+
279
+ ## Version History Summary
280
+
281
+ - **0.2.3**: Fixed agent team creation and improved task execution
282
+ - **0.2.2**: Fixed streaming demo and cookie overflow issues
283
+ - **0.2.1**: Added web search integration and real-time information
284
+ - **0.2.0**: Added comprehensive security framework
285
+ - **0.1.9**: Fixed CI validation and ActiveSupport dependencies
286
+ - **0.1.8**: Fixed method visibility and file loading issues
287
+ - **0.1.7**: Fixed validate_messages method accessibility
288
+ - **0.1.6**: Updated security module and method accessibility
289
+ - **0.1.5**: Fixed method visibility and file loading conflicts
290
+ - **0.1.4**: Made validate_messages method public
291
+ - **0.1.3**: Fixed method visibility issues
292
+ - **0.1.2**: Fixed CI validation and added ActiveSupport dependency
293
+ - **0.1.1**: Fixed megabytes method and added ActiveSupport dependency
294
+ - **0.1.0**: Initial release with comprehensive AI capabilities
295
+
296
+ ## Contributing
297
+
298
+ Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to this project.
299
+
300
+ ## License
301
+
302
+ This project is licensed under the MIT License with Non-Commercial Use Restrictions - see the [LICENSE](LICENSE) file for details.
303
+
304
+ ## Support
305
+
306
+ For support, please open an issue on GitHub or contact the maintainer at amahdanieljack@gmail.com.
307
+
308
+ ## Commercial Licensing
309
+
310
+ For commercial use, please contact amahdanieljack@gmail.com for licensing information. Commercial license fee: $999/year.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAi
4
- VERSION = "0.2.2"
4
+ VERSION = "0.2.4"
5
5
  end
data/lib/rails_ai.rb CHANGED
@@ -151,7 +151,7 @@ module RailsAi
151
151
 
152
152
  # Agent teams
153
153
  def create_agent_team(name, agents, strategy: :round_robin)
154
- agent_manager.create_agent_team(name, agents, strategy: strategy)
154
+ agent_manager.create_agent_team(name, agents, collaboration_strategy: strategy)
155
155
  end
156
156
 
157
157
  def orchestrate_collaboration(task, agent_names)
@@ -534,3 +534,32 @@ require_relative "rails_ai/web_search"
534
534
  end
535
535
  end
536
536
  end
537
+
538
+ # Response cleaning utility
539
+ def self.clean_response(raw_response)
540
+ return nil if raw_response.nil?
541
+
542
+ # Convert to string
543
+ response = raw_response.to_s
544
+
545
+ # Ensure UTF-8 encoding
546
+ response = response.encode('UTF-8', 'UTF-8', invalid: :replace, undef: :replace, replace: '?')
547
+
548
+ # Remove any control characters that might cause issues
549
+ response = response.gsub(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/, '')
550
+
551
+ response
552
+ end
553
+
554
+ # Enhanced chat method with automatic response cleaning
555
+ def self.chat_clean(prompt_or_messages, model: config.default_model, **opts)
556
+ raw_response = chat(prompt_or_messages, model: model, **opts)
557
+ clean_response(raw_response)
558
+ end
559
+
560
+ # Enhanced web search chat with automatic response cleaning
561
+ def self.chat_with_web_search_clean(prompt, model: config.default_model, **opts)
562
+ raw_response = chat_with_web_search(prompt, model: model, **opts)
563
+ clean_response(raw_response)
564
+ end
565
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Amah
@@ -279,6 +279,7 @@ files:
279
279
  - ".rspec_status"
280
280
  - AGENT_GUIDE.md
281
281
  - Appraisals
282
+ - CHANGELOG.md
282
283
  - COMMERCIAL_LICENSE_TEMPLATE.md
283
284
  - FEATURES.md
284
285
  - LEGAL_PROTECTION_GUIDE.md