Class: Assistant::GammaToolBuilder::ListThemesTool

Inherits:
RubyLLM::Tool
  • Object
show all
Defined in:
app/services/assistant/gamma_tool_builder.rb

Overview

List available Gamma themes from the workspace.

Instance Method Summary collapse

Instance Method Details

#execute(query: nil, **_) ⇒ String

Returns JSON result payload.

Parameters:

  • query (String, nil) (defaults to: nil)

    search themes by name (case-insensitive)

  • _ (Hash)

    a customizable set of options

Options Hash (**_):

  • :ignored (Object)

    extra keyword arguments are accepted and ignored

Returns:

  • (String)

    JSON result payload



523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
# File 'app/services/assistant/gamma_tool_builder.rb', line 523

def execute(query: nil, **_)
  client = GammaClient.new
  result = client.list_themes(query: query)

  if result.success?
    {
      success:  true,
      themes:   result.data[:themes],
      has_more: result.data[:has_more]
    }.to_json
  else
    { success: false, error: result.error }.to_json
  end
rescue StandardError => e
  { success: false, error: "Failed to list themes: #{e.message}" }.to_json
end

#nameObject



518
# File 'app/services/assistant/gamma_tool_builder.rb', line 518

def name = 'gamma_list_themes'