Class: Assistant::TechnicalArticleManagementToolBuilder::CreateTool
- Inherits:
-
ManagementTool
- Object
- RubyLLM::Tool
- ManagementTool
- Assistant::TechnicalArticleManagementToolBuilder::CreateTool
- Defined in:
- app/services/assistant/technical_article_management_tool_builder.rb
Overview
Creates one draft in the normal Technical Article workflow.
Instance Method Summary collapse
-
#execute(subject:, solution:, **attributes) ⇒ String
JSON creation result.
-
#name ⇒ String
Stable tool name.
Methods inherited from ManagementTool
Constructor Details
This class inherits a constructor from Assistant::TechnicalArticleManagementToolBuilder::ManagementTool
Instance Method Details
#execute(subject:, solution:, **attributes) ⇒ String
Returns JSON creation result.
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'app/services/assistant/technical_article_management_tool_builder.rb', line 287 def execute(subject:, solution:, **attributes) safely('create') do (:create, ArticleTechnical) employee = require_actor! attrs = attributes.symbolize_keys.slice( :description, :problem_code, :knowledge_role, :product_line_ids, :product_category_ids, :item_ids, :tags ) TechnicalArticleManagementToolBuilder.validate_association_ids!(attrs) article = ArticleTechnical.new( attrs.merge( subject: subject, solution: solution, creator_id: employee.id, original_author: employee, user: employee ) ) article.save! response(article, message: 'Draft created. Review and add evidence before submitting.') end end |
#name ⇒ String
Returns stable tool name.
274 |
# File 'app/services/assistant/technical_article_management_tool_builder.rb', line 274 def name = 'create_technical_article_draft' |