Class: RLM::Predict

Inherits:
Object
  • Object
show all
Defined in:
lib/rlm/predict.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(signature, lm: nil, sub_lm: nil, tools: [], skills: [], sandbox: nil, limits: nil, trace_store: nil, validators: [], signatures: []) ⇒ Predict

Returns a new instance of Predict.

Raises:



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rlm/predict.rb', line 8

def initialize(
  signature,
  lm: nil,
  sub_lm: nil,
  tools: [],
  skills: [],
  sandbox: nil,
  limits: nil,
  trace_store: nil,
  validators: [],
  signatures: []
)
  raise ConfigurationError, "signature is required" if signature.nil?

  @signature = signature
  @lm = lm || RLM.config.root_lm
  @sub_lm = sub_lm || RLM.config.sub_lm
  @tools = Array(tools)
  @skills = Array(skills)
  @sandbox = sandbox || RLM.config.sandbox
  @limits = limits || RLM.config.default_limits
  @trace_store = trace_store || RLM.config.trace_store
  @validators = Array(validators)
  @signatures = signatures
end

Instance Attribute Details

#limitsObject (readonly)

Returns the value of attribute limits.



5
6
7
# File 'lib/rlm/predict.rb', line 5

def limits
  @limits
end

#lmObject (readonly)

Returns the value of attribute lm.



5
6
7
# File 'lib/rlm/predict.rb', line 5

def lm
  @lm
end

#sandboxObject (readonly)

Returns the value of attribute sandbox.



5
6
7
# File 'lib/rlm/predict.rb', line 5

def sandbox
  @sandbox
end

#signatureObject (readonly)

Returns the value of attribute signature.



5
6
7
# File 'lib/rlm/predict.rb', line 5

def signature
  @signature
end

#signaturesObject (readonly)

Returns the value of attribute signatures.



5
6
7
# File 'lib/rlm/predict.rb', line 5

def signatures
  @signatures
end

#skillsObject (readonly)

Returns the value of attribute skills.



5
6
7
# File 'lib/rlm/predict.rb', line 5

def skills
  @skills
end

#sub_lmObject (readonly)

Returns the value of attribute sub_lm.



5
6
7
# File 'lib/rlm/predict.rb', line 5

def sub_lm
  @sub_lm
end

#toolsObject (readonly)

Returns the value of attribute tools.



5
6
7
# File 'lib/rlm/predict.rb', line 5

def tools
  @tools
end

#trace_storeObject (readonly)

Returns the value of attribute trace_store.



5
6
7
# File 'lib/rlm/predict.rb', line 5

def trace_store
  @trace_store
end

#validatorsObject (readonly)

Returns the value of attribute validators.



5
6
7
# File 'lib/rlm/predict.rb', line 5

def validators
  @validators
end

Instance Method Details

#call(input = {}) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rlm/predict.rb', line 34

def call(input = {})
  Runtime.new(
    signature: signature,
    input: input,
    lm: lm,
    sub_lm: sub_lm,
    tools: tools,
    skills: skills,
    sandbox: sandbox,
    limits: limits,
    validators: validators,
    signatures: signatures,
    trace_store: trace_store
  ).call
end