Class: Sage::ReportProcessor
- Inherits:
-
Object
- Object
- Sage::ReportProcessor
- Includes:
- ActionView::RecordIdentifier
- Defined in:
- lib/sage/report_processor.rb
Instance Attribute Summary collapse
-
#prompt ⇒ Object
readonly
Returns the value of attribute prompt.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#raw_response_content ⇒ Object
readonly
Returns the value of attribute raw_response_content.
-
#stream_target_id ⇒ Object
readonly
Returns the value of attribute stream_target_id.
Instance Method Summary collapse
- #database_schema_context ⇒ Object
-
#initialize(query:, prompt:, stream_target_id:) ⇒ ReportProcessor
constructor
A new instance of ReportProcessor.
- #model_scopes_context ⇒ Object
- #process ⇒ Object
- #system_prompt ⇒ Object
Constructor Details
#initialize(query:, prompt:, stream_target_id:) ⇒ ReportProcessor
Returns a new instance of ReportProcessor.
11 12 13 14 15 |
# File 'lib/sage/report_processor.rb', line 11 def initialize(query:, prompt:, stream_target_id:) @query = query @prompt = prompt @stream_target_id = stream_target_id end |
Instance Attribute Details
#prompt ⇒ Object (readonly)
Returns the value of attribute prompt.
9 10 11 |
# File 'lib/sage/report_processor.rb', line 9 def prompt @prompt end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
9 10 11 |
# File 'lib/sage/report_processor.rb', line 9 def query @query end |
#raw_response_content ⇒ Object (readonly)
Returns the value of attribute raw_response_content.
9 10 11 |
# File 'lib/sage/report_processor.rb', line 9 def raw_response_content @raw_response_content end |
#stream_target_id ⇒ Object (readonly)
Returns the value of attribute stream_target_id.
9 10 11 |
# File 'lib/sage/report_processor.rb', line 9 def stream_target_id @stream_target_id end |
Instance Method Details
#database_schema_context ⇒ Object
35 36 37 |
# File 'lib/sage/report_processor.rb', line 35 def database_schema_context Sage::DatabaseSchemaContext.new.build_context end |
#model_scopes_context ⇒ Object
39 40 41 |
# File 'lib/sage/report_processor.rb', line 39 def model_scopes_context Sage::ModelScopesContext.new.build_context end |
#process ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/sage/report_processor.rb', line 17 def process response = generate_llm_response Rails.logger.info "LLM Response: #{response.inspect}" Rails.logger.info "LLM Response content: #{response.content.inspect}" @raw_response_content = response.content parsed_response = parse_response(response) Rails.logger.info "Parsed response: #{parsed_response.inspect}" { summary: parsed_response[:summary], sql: parsed_response[:sql] } end |
#system_prompt ⇒ Object
31 32 33 |
# File 'lib/sage/report_processor.rb', line 31 def system_prompt build_system_prompt end |