Class: Cadenya::Models::ToolSets::ToolSpec

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/cadenya/models/tool_sets/tool_spec.rb,
sig/cadenya/models/tool_sets/tool_spec.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(config:, description:, parameters:, requires_approval:, llm_tool_name: nil) ⇒ Object

Some parameter documentations has been truncated, see Cadenya::Models::ToolSets::ToolSpec for more details.

Parameters:

  • config (Cadenya::Models::ToolSets::ToolSpecConfig)

    Config defines the adapter to use for the tool.

  • description (String)
  • parameters (Hash{Symbol=>Object})

    The tool's JSON Schema, as handed to the LLM. Required, but may be the

  • requires_approval (Boolean)
  • llm_tool_name (String) (defaults to: nil)

    The name provided to the LLM, which may differ from the metadata.name on the too



# File 'lib/cadenya/models/tool_sets/tool_spec.rb', line 43

Instance Attribute Details

#configCadenya::Models::ToolSets::ToolSpecConfig

Config defines the adapter to use for the tool. This is used to determine how the tool is called. For example, if the tool is an HTTP tool, the adapter will be Http. If the tool is an inline tool, the adapter will be Inline.

Parameters:

  • value (Cadenya::ToolSets::ToolSpecConfig)

Returns:



13
# File 'lib/cadenya/models/tool_sets/tool_spec.rb', line 13

required :config, -> { Cadenya::ToolSets::ToolSpecConfig }

#descriptionString

Parameters:

  • value (String)

Returns:

  • (String)


18
# File 'lib/cadenya/models/tool_sets/tool_spec.rb', line 18

required :description, String

#llm_tool_nameString?

The name provided to the LLM, which may differ from the metadata.name on the tool. LLMs have specific length and format requirements, and tool set sources may not comply with them, so Cadenya does its best to format names into a usable format.

Parameters:

  • (String)

Returns:

  • (String, nil)


41
# File 'lib/cadenya/models/tool_sets/tool_spec.rb', line 41

optional :llm_tool_name, String, api_name: :llmToolName

#parametersHash{Symbol=>Object}

The tool's JSON Schema, as handed to the LLM. Required, but may be the empty object {} for a tool that takes no arguments. Requiring it rather than defaulting it means a misspelled field name (inputSchema, say) is a 400 instead of a silently parameterless tool.

Parameters:

  • value (::Hash[Symbol, top])

Returns:

  • (Hash{Symbol=>Object})


27
# File 'lib/cadenya/models/tool_sets/tool_spec.rb', line 27

required :parameters, Cadenya::Internal::Type::HashOf[Cadenya::Internal::Type::Unknown]

#requires_approvalBoolean

Parameters:

  • value (Boolean)

Returns:

  • (Boolean)


32
# File 'lib/cadenya/models/tool_sets/tool_spec.rb', line 32

required :requires_approval, Cadenya::Internal::Type::Boolean, api_name: :requiresApproval

Instance Method Details

#to_hash{

Returns:

  • ({)


34
# File 'sig/cadenya/models/tool_sets/tool_spec.rbs', line 34

def to_hash: -> {