mirror of
https://github.com/we-promise/sure.git
synced 2026-04-17 02:54:10 +00:00
* Add AI merchant enhancement and dedup * Enhancements Add error if job is already running add note that we also merge merchants * Allow updating provider website * Review fixes * Update provider_merchant.rb * Linter and fixes * FIX transaction quick menu modal
51 lines
1.4 KiB
Ruby
51 lines
1.4 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)
|
|
|
|
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
|