Class: Nanobot::Config::ToolsConfig

Inherits:
Struct
  • Object
show all
Defined in:
lib/nanobot/config/schema.rb

Overview

Aggregate configuration for all agent tools

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(web: {}, exec: {}, restrict_to_workspace: true) ⇒ ToolsConfig

Returns a new instance of ToolsConfig.

Parameters:

  • web (Hash) (defaults to: {}) —

    web tool settings (nested :search key)

  • exec (Hash) (defaults to: {}) —

    exec tool settings (see ExecToolConfig)

  • restrict_to_workspace (Boolean) (defaults to: true) —

    limit file tools to workspace directory



108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/nanobot/config/schema.rb', line 108

def initialize(web: {}, exec: {}, restrict_to_workspace: true)
  web_config = web.is_a?(Hash) ? web : {}
  exec_config = exec.is_a?(Hash) ? exec : {}

  super(
    web: Struct.new(:search, keyword_init: true).new(
      search: WebSearchConfig.new(**(web_config[:search] || {}))
    ),
    exec: ExecToolConfig.new(**exec_config),
    restrict_to_workspace: restrict_to_workspace
  )
end

Instance Attribute Details

#exec ⇒ Object

Returns the value of attribute exec

Returns:

  • (Object) —

    the current value of exec



104
105
106
# File 'lib/nanobot/config/schema.rb', line 104

def exec
  @exec
end

#restrict_to_workspace ⇒ Object

Returns the value of attribute restrict_to_workspace

Returns:

  • (Object) —

    the current value of restrict_to_workspace



104
105
106
# File 'lib/nanobot/config/schema.rb', line 104

def restrict_to_workspace
  @restrict_to_workspace
end

#web ⇒ Object

Returns the value of attribute web

Returns:

  • (Object) —

    the current value of web



104
105
106
# File 'lib/nanobot/config/schema.rb', line 104

def web
  @web
end