Class: Ollama::Response::Message::ToolCall::Function
- Inherits:
-
Object
- Object
- Ollama::Response::Message::ToolCall::Function
- Defined in:
- lib/ollama/response.rb
Overview
Function wrapper for accessing function fields
Instance Method Summary collapse
- #arguments ⇒ Object
- #description ⇒ Object
-
#initialize(data) ⇒ Function
constructor
A new instance of Function.
- #name ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(data) ⇒ Function
Returns a new instance of Function.
194 195 196 |
# File 'lib/ollama/response.rb', line 194 def initialize(data) @data = data end |
Instance Method Details
#arguments ⇒ Object
206 207 208 209 210 211 212 213 |
# File 'lib/ollama/response.rb', line 206 def arguments args = @data["arguments"] || @data[:arguments] return {} unless args args.is_a?(String) ? JSON.parse(args) : args rescue JSON::ParserError {} end |
#description ⇒ Object
202 203 204 |
# File 'lib/ollama/response.rb', line 202 def description @data["description"] || @data[:description] end |
#name ⇒ Object
198 199 200 |
# File 'lib/ollama/response.rb', line 198 def name @data["name"] || @data[:name] end |
#to_h ⇒ Object
215 216 217 |
# File 'lib/ollama/response.rb', line 215 def to_h @data end |