Module: Legion::Extensions::Rfp::Generate::Runners::Templates

Extended by:
Helpers::Client
Includes:
Helpers::Lex
Included in:
Client
Defined in:
lib/legion/extensions/rfp/generate/runners/templates.rb

Constant Summary collapse

DEFAULT_TEMPLATES =
{
  standard:   { sections: %i[executive_summary company_overview approach timeline pricing], tone: :formal },
  government: { sections: %i[executive_summary compliance technical_approach management staffing pricing],
                tone:     :formal },
  healthcare: { sections: %i[executive_summary clinical_approach quality_measures compliance network
                             implementation pricing], tone: :formal }
}.freeze

Instance Method Summary collapse

Methods included from Helpers::Client

client

Instance Method Details

#apply_template(name:, rfp_data:) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'lib/legion/extensions/rfp/generate/runners/templates.rb', line 30

def apply_template(name:, rfp_data:, **)
  template = DEFAULT_TEMPLATES[name.to_sym]
  return { result: nil, error: "Template not found: #{name}" } unless template

  outline = template[:sections].map do |section|
    { section: section, tone: template[:tone], content: rfp_data[section] }
  end

  { result: outline, template: name, sections: outline.length }
end

#get_template(name:) ⇒ Object



23
24
25
26
27
28
# File 'lib/legion/extensions/rfp/generate/runners/templates.rb', line 23

def get_template(name:, **)
  template = DEFAULT_TEMPLATES[name.to_sym]
  return { result: nil, error: "Template not found: #{name}" } unless template

  { result: template, name: name }
end

#list_templatesObject



19
20
21
# File 'lib/legion/extensions/rfp/generate/runners/templates.rb', line 19

def list_templates(**)
  { result: DEFAULT_TEMPLATES.keys, count: DEFAULT_TEMPLATES.keys.length }
end

#suggest_template(rfp_text:) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/legion/extensions/rfp/generate/runners/templates.rb', line 41

def suggest_template(rfp_text:, **)
  text_lower = rfp_text.downcase
  suggested = if text_lower.match?(/\b(?:medicare|medicaid|clinical|hipaa|phi|health)\b/)
                :healthcare
              elsif text_lower.match?(/\b(?:federal|government|agency|cfr|far|dfars)\b/)
                :government
              else
                :standard
              end

  { result: suggested, confidence: :heuristic }
end