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.
195 196 197 |
# File 'lib/ollama/response.rb', line 195 def initialize(data) @data = data end |
Instance Method Details
#arguments ⇒ Object
207 208 209 210 211 212 213 214 |
# File 'lib/ollama/response.rb', line 207 def arguments args = @data["arguments"] || @data[:arguments] return {} unless args args.is_a?(String) ? JSON.parse(args) : args rescue JSON::ParserError {} end |
#description ⇒ Object
203 204 205 |
# File 'lib/ollama/response.rb', line 203 def description @data["description"] || @data[:description] end |
#name ⇒ Object
199 200 201 |
# File 'lib/ollama/response.rb', line 199 def name @data["name"] || @data[:name] end |
#to_h ⇒ Object
216 217 218 |
# File 'lib/ollama/response.rb', line 216 def to_h @data end |