Class: Assistant::GammaToolBuilder::ReworkTool
- Inherits:
-
RubyLLM::Tool
- Object
- RubyLLM::Tool
- Assistant::GammaToolBuilder::ReworkTool
- Includes:
- GammaIdExtractable
- Defined in:
- app/services/assistant/gamma_tool_builder.rb
Overview
Rework an existing Gamma presentation, document, or webpage into a new one.
Instance Method Summary collapse
-
#execute(gamma_id:, prompt:, theme_id: nil, export_as: nil, image_style: nil, **_) ⇒ String
JSON result payload.
- #name ⇒ Object
Instance Method Details
#execute(gamma_id:, prompt:, theme_id: nil, export_as: nil, image_style: nil, **_) ⇒ String
Returns JSON result payload.
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'app/services/assistant/gamma_tool_builder.rb', line 281 def execute(gamma_id:, prompt:, theme_id: nil, export_as: nil, image_style: nil, **_) gamma_id = extract_gamma_id(gamma_id) = image_style.present? ? { style: image_style } : nil client = GammaClient.new result = client.rework_and_wait( gamma_id: gamma_id, prompt: prompt, theme_id: theme_id, export_as: export_as, image_options: ) if result.success? data = result.data response = { success: true, gamma_url: data[:gamma_url], message: "Your reworked gamma is ready! View it here: #{data[:gamma_url]}" } response[:export_url] = data[:export_url] if data[:export_url].present? response[:credits] = data[:credits] if data[:credits].present? response.to_json else { success: false, error: result.error }.to_json end rescue StandardError => e Rails.logger.error("[GammaToolBuilder] gamma_rework failed: #{e.}") { success: false, error: "Gamma rework failed: #{e.}" }.to_json end |
#name ⇒ Object
272 |
# File 'app/services/assistant/gamma_tool_builder.rb', line 272 def name = 'gamma_rework' |