Class: MockServer::LLM::ToolUse
- Inherits:
-
Object
- Object
- MockServer::LLM::ToolUse
- Defined in:
- lib/mockserver/llm.rb
Overview
ToolUse
Instance Method Summary collapse
-
#initialize(name = nil) ⇒ ToolUse
constructor
A new instance of ToolUse.
- #to_h ⇒ Hash
-
#with_arguments(args) ⇒ self
Accepts a JSON string (matching the Java API) or any value, which is serialised to a JSON string.
- #with_id(id) ⇒ self
- #with_name(name) ⇒ self
Constructor Details
#initialize(name = nil) ⇒ ToolUse
Returns a new instance of ToolUse.
68 69 70 71 72 |
# File 'lib/mockserver/llm.rb', line 68 def initialize(name = nil) @name = name @id = nil @arguments = nil end |
Instance Method Details
#to_h ⇒ Hash
95 96 97 |
# File 'lib/mockserver/llm.rb', line 95 def to_h LLM.omit_nil('id' => @id, 'name' => @name, 'arguments' => @arguments) end |
#with_arguments(args) ⇒ self
Accepts a JSON string (matching the Java API) or any value, which is serialised to a JSON string.
89 90 91 92 |
# File 'lib/mockserver/llm.rb', line 89 def with_arguments(args) @arguments = args.is_a?(String) ? args : JSON.generate(args) self end |
#with_id(id) ⇒ self
75 76 77 78 |
# File 'lib/mockserver/llm.rb', line 75 def with_id(id) @id = id self end |
#with_name(name) ⇒ self
81 82 83 84 |
# File 'lib/mockserver/llm.rb', line 81 def with_name(name) @name = name self end |