Class: RubyLLM::MCP::Configuration::Sampling

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_llm/mcp/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSampling

Returns a new instance of Sampling.



54
55
56
# File 'lib/ruby_llm/mcp/configuration.rb', line 54

def initialize
  set_defaults
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



51
52
53
# File 'lib/ruby_llm/mcp/configuration.rb', line 51

def context
  @context
end

#enabledObject

Returns the value of attribute enabled.



51
52
53
# File 'lib/ruby_llm/mcp/configuration.rb', line 51

def enabled
  @enabled
end

#handler(handler_class = nil, **options) ⇒ Object

Set or get the handler (class or block)

Parameters:

  • handler_class (Class, nil) (defaults to: nil)

    handler class

  • options (Hash)

    options to pass to handler

Returns:

  • (Object)

    the current handler



76
77
78
79
80
81
82
83
84
85
# File 'lib/ruby_llm/mcp/configuration.rb', line 76

def handler(handler_class = nil, **options)
  if handler_class
    @handler = if options.any?
                 { class: handler_class, options: options }
               else
                 handler_class
               end
  end
  @handler
end

#preferred_model(&block) ⇒ Object



67
68
69
70
# File 'lib/ruby_llm/mcp/configuration.rb', line 67

def preferred_model(&block)
  @preferred_model = block if block_given?
  @preferred_model
end

#toolsObject

Returns the value of attribute tools.



51
52
53
# File 'lib/ruby_llm/mcp/configuration.rb', line 51

def tools
  @tools
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


87
88
89
# File 'lib/ruby_llm/mcp/configuration.rb', line 87

def enabled?
  @enabled
end

#guard(&block) ⇒ Object



62
63
64
65
# File 'lib/ruby_llm/mcp/configuration.rb', line 62

def guard(&block)
  @guard = block if block_given?
  @guard
end

#reset!Object



58
59
60
# File 'lib/ruby_llm/mcp/configuration.rb', line 58

def reset!
  set_defaults
end