mirror of
https://github.com/we-promise/sure.git
synced 2026-04-18 03:24:09 +00:00
- Add reconciliation check section to PdfProcessor instructions - Extended JSON response to include reconciliation data - Added reconciliation field to PdfProcessingResult Data.define The LLM now uses available tools (GetAccounts, GetTransactions) to: - Match statement to correct account - Compare closing balance with account balance - Compare transaction counts - Match individual transactions (date ±1 day, amount ±sh.10) - Report new and missing transactions Fixes #1379
51 lines
1.5 KiB
Ruby
51 lines
1.5 KiB
Ruby
module Provider::LlmConcept
|
|
extend ActiveSupport::Concern
|
|
|
|
AutoCategorization = Data.define(:transaction_id, :category_name)
|
|
|
|
def auto_categorize(transactions)
|
|
raise NotImplementedError, "Subclasses must implement #auto_categorize"
|
|
end
|
|
|
|
AutoDetectedMerchant = Data.define(:transaction_id, :business_name, :business_url)
|
|
|
|
def auto_detect_merchants(transactions)
|
|
raise NotImplementedError, "Subclasses must implement #auto_detect_merchants"
|
|
end
|
|
|
|
EnhancedMerchant = Data.define(:merchant_id, :business_url)
|
|
|
|
def enhance_provider_merchants(merchants)
|
|
raise NotImplementedError, "Subclasses must implement #enhance_provider_merchants"
|
|
end
|
|
|
|
PdfProcessingResult = Data.define(:summary, :document_type, :extracted_data, :reconciliation)
|
|
|
|
def supports_pdf_processing?
|
|
false
|
|
end
|
|
|
|
def process_pdf(pdf_content:, family: nil)
|
|
raise NotImplementedError, "Provider does not support PDF processing"
|
|
end
|
|
|
|
ChatMessage = Data.define(:id, :output_text)
|
|
ChatStreamChunk = Data.define(:type, :data, :usage)
|
|
ChatResponse = Data.define(:id, :model, :messages, :function_requests)
|
|
ChatFunctionRequest = Data.define(:id, :call_id, :function_name, :function_args)
|
|
|
|
def chat_response(
|
|
prompt,
|
|
model:,
|
|
instructions: nil,
|
|
functions: [],
|
|
function_results: [],
|
|
streamer: nil,
|
|
previous_response_id: nil,
|
|
session_id: nil,
|
|
user_identifier: nil
|
|
)
|
|
raise NotImplementedError, "Subclasses must implement #chat_response"
|
|
end
|
|
end
|