Class: TurnKit::ModelRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/turnkit/model_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model:, messages:, tools:, instructions:, thinking: nil, output_schema: nil, metadata: {}, report: nil) ⇒ ModelRequest

Returns a new instance of ModelRequest.



7
8
9
10
11
12
13
14
15
16
# File 'lib/turnkit/model_request.rb', line 7

def initialize(model:, messages:, tools:, instructions:, thinking: nil, output_schema: nil, metadata: {}, report: nil)
  @model = model
  @messages = Array(messages)
  @tools = Array(tools)
  @instructions = instructions.to_s
  @thinking = thinking
  @output_schema = output_schema
  @metadata =  || {}
  @report = report || {}
end

Instance Attribute Details

#instructionsObject (readonly)

Returns the value of attribute instructions.



5
6
7
# File 'lib/turnkit/model_request.rb', line 5

def instructions
  @instructions
end

#messagesObject (readonly)

Returns the value of attribute messages.



5
6
7
# File 'lib/turnkit/model_request.rb', line 5

def messages
  @messages
end

#metadataObject (readonly)

Returns the value of attribute metadata.



5
6
7
# File 'lib/turnkit/model_request.rb', line 5

def 
  @metadata
end

#modelObject (readonly)

Returns the value of attribute model.



5
6
7
# File 'lib/turnkit/model_request.rb', line 5

def model
  @model
end

#output_schemaObject (readonly)

Returns the value of attribute output_schema.



5
6
7
# File 'lib/turnkit/model_request.rb', line 5

def output_schema
  @output_schema
end

#reportObject (readonly)

Returns the value of attribute report.



5
6
7
# File 'lib/turnkit/model_request.rb', line 5

def report
  @report
end

#thinkingObject (readonly)

Returns the value of attribute thinking.



5
6
7
# File 'lib/turnkit/model_request.rb', line 5

def thinking
  @thinking
end

#toolsObject (readonly)

Returns the value of attribute tools.



5
6
7
# File 'lib/turnkit/model_request.rb', line 5

def tools
  @tools
end

Instance Method Details

#to_hObject



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/turnkit/model_request.rb', line 22

def to_h
  {
    "model" => model,
    "messages" => messages,
    "tools" => tool_names,
    "instructions" => instructions,
    "thinking" => thinking,
    "output_schema" => output_schema,
    "metadata" => ,
    "report" => report
  }
end

#tool_namesObject



18
19
20
# File 'lib/turnkit/model_request.rb', line 18

def tool_names
  tools.map(&:tool_name)
end