Module: LLM::Anthropic::Utils
- Defined in:
- lib/llm/providers/anthropic/utils.rb
Instance Method Summary collapse
-
#parse_tool_input(input)
⇒ Hash
Normalizes Anthropic tool input to a Hash suitable for kwargs.
Instance Method Details
#parse_tool_input(input) ⇒ Hash
Normalizes Anthropic tool input to a Hash suitable for kwargs.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/llm/providers/anthropic/utils.rb', line 9 def parse_tool_input(input) case input when Hash then input when String parsed = LLM.json.load(input) Hash === parsed ? parsed : {} when nil then {} else input.respond_to?(:to_h) ? input.to_h : {} end rescue *LLM.json.parser_error {} end |