Class: Chocomint::Tools::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/chocomint/tools/base.rb

Overview

ツールの共通インターフェース (DESIGN §7)。 call は必ず { exit_code:, stdout:, stderr:, duration_ms: } を返す。

Instance Method Summary collapse

Instance Method Details

#call(_args) ⇒ Object

Raises:

  • (NotImplementedError)


17
18
19
# File 'lib/chocomint/tools/base.rb', line 17

def call(_args)
  raise NotImplementedError
end

#descriptionObject



30
31
32
# File 'lib/chocomint/tools/base.rb', line 30

def description
  ""
end

#nameObject

Raises:

  • (NotImplementedError)


8
9
10
# File 'lib/chocomint/tools/base.rb', line 8

def name
  raise NotImplementedError
end

#schemaObject

json_schemer 用の JSON Schema (arguments の検証に使う)。

Raises:

  • (NotImplementedError)


13
14
15
# File 'lib/chocomint/tools/base.rb', line 13

def schema
  raise NotImplementedError
end

#to_tool_definitionObject

Anthropic Messages API の tools 配列に渡す形式。



22
23
24
25
26
27
28
# File 'lib/chocomint/tools/base.rb', line 22

def to_tool_definition
  {
    "name" => name,
    "description" => description,
    "input_schema" => schema
  }
end