Class: AgentEvalPlanner::Planner

Inherits:
Object
  • Object
show all
Defined in:
lib/agent_eval_planner/planner.rb

Defined Under Namespace

Classes: Result

Constant Summary collapse

DEFAULT_OPTIONS =
{
  team: nil,
  agent_name: nil,
  tools: nil,
  declared_scope: nil,
  out_of_scope: nil,
  harness: "generic"
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(input_path: nil, raw: nil, **options) ⇒ Planner

Returns a new instance of Planner.



16
17
18
19
20
# File 'lib/agent_eval_planner/planner.rb', line 16

def initialize(input_path: nil, raw: nil, **options)
  @input_path = input_path
  @raw = raw
  @options = DEFAULT_OPTIONS.merge(options.compact)
end

Instance Method Details

#callObject

Raises:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/agent_eval_planner/planner.rb', line 22

def call
  analyzer = ContractAnalyzer.new(
    source_path: input_path,
    raw: raw,
    agent_name: options[:agent_name],
    tools: options[:tools],
    declared_scope: options[:declared_scope],
    out_of_scope: options[:out_of_scope],
    harness: options[:harness]
  )

  vectors = VectorCatalog.vectors_for(analyzer)
  raise InputError, "Nenhum vetor aplicável encontrado." if vectors.empty?

  Result.new(
    plan: PlanRenderer.new(analyzer: analyzer, vectors: vectors, team: options[:team]).render,
    suite: SuiteRenderer.new(analyzer: analyzer, vectors: vectors).render,
    remediations: RemediationRenderer.new(analyzer: analyzer, vectors: vectors, team: options[:team]).render,
    analyzer: analyzer,
    vectors: vectors
  )
end