mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 20:14:08 +00:00
Generic LLMs improvements (#605)
* Generic LLMs improvements 1. app/models/provider/openai/auto_categorizer.rb:535-540 - If description is blank, now falls back to merchant name 2. app/models/provider/openai/auto_merchant_detector.rb:492-498 - Now includes merchant first, then description (joined with " - ") * FIX linter
This commit is contained in:
@@ -534,7 +534,8 @@ class Provider::Openai::AutoCategorizer
|
||||
# Format transactions in a simpler, more readable way for smaller LLMs
|
||||
def format_transactions_simply
|
||||
transactions.map do |t|
|
||||
"- ID: #{t[:id]}, Amount: #{t[:amount]}, Type: #{t[:classification]}, Description: \"#{t[:description]}\""
|
||||
description = t[:description].presence || t[:merchant].presence || ""
|
||||
"- ID: #{t[:id]}, Amount: #{t[:amount]}, Type: #{t[:classification]}, Description: \"#{description}\""
|
||||
end.join("\n")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -491,7 +491,9 @@ class Provider::Openai::AutoMerchantDetector
|
||||
# Format transactions in a simpler, more readable way for smaller LLMs
|
||||
def format_transactions_simply
|
||||
transactions.map do |t|
|
||||
"- ID: #{t[:id]}, Description: \"#{t[:name] || t[:description]}\""
|
||||
parts = [ t[:merchant], t[:description] ].compact.reject(&:blank?)
|
||||
combined = parts.join(" - ")
|
||||
"- ID: #{t[:id]}, Description: \"#{combined}\""
|
||||
end.join("\n")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user