Class: OpportunityBriefing::Generate

Inherits:
Object
  • Object
show all
Includes:
Service
Defined in:
app/services/opportunity_briefing/generate.rb

Overview

Builds, records, and enqueues one explicit opportunity briefing generation.

Defined Under Namespace

Classes: Result

Constant Summary collapse

MODEL =
'gemini-flash'

Instance Method Summary collapse

Methods included from Service

#attributes_used, #build_result, call, #logger

Methods included from Service::Initializer

#initialize

Instance Method Details

#callObject



19
20
21
22
23
24
25
26
27
28
29
# File 'app/services/opportunity_briefing/generate.rb', line 19

def call
  mark_processing!
  job_id = enqueue
  return queue_rejected unless job_id

  notify_requested
  Result.new(status: :enqueued, enqueued: true, job_id: job_id)
rescue StandardError
  conversation.update!(opportunity_briefing_status: 'failed') if conversation.persisted?
  raise
end