Skip to content

Commit 911c974

Browse files
committed
Add current date to transaction extraction process
The extraction process now incorporates the current date as input, enhancing context for transaction parsing. Updated all relevant method signatures and usage to support this change. Additionally, i18n properties were amended to include a new transaction type field.
1 parent 8a4faf1 commit 911c974

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

fintrack-api/src/main/resources/i18n/messages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ Transaction.failureCode.POSSIBLE_DUPLICATE=Transaction is a possible duplicate a
104104
Transaction.source=Source account
105105
Transaction.tags=Tags
106106
Transaction.to=To account
107+
Transaction.type=Type
107108
TransactionRule.Change=Change
108109
TransactionRule.Column.AMOUNT=Amount
109110
TransactionRule.Column.BUDGET=Change to budget

learning/learning-module-llm/src/main/java/com/jongsoft/finance/llm/AiSuggestionEngine.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import jakarta.inject.Singleton;
1212
import org.slf4j.Logger;
1313

14+
import java.time.LocalDate;
1415
import java.time.format.DateTimeFormatter;
1516
import java.util.Optional;
1617
import java.util.UUID;
@@ -56,7 +57,7 @@ public SuggestionResult makeSuggestions(SuggestionInput transactionInput) {
5657

5758
@Override
5859
public Optional<TransactionResult> extractTransaction(String transactionInput) {
59-
var extracted = transactionExtractorAgent.extractTransaction(UUID.randomUUID(), transactionInput);
60+
var extracted = transactionExtractorAgent.extractTransaction(UUID.randomUUID(), LocalDate.now(), transactionInput);
6061
return Optional.of(new TransactionResult(
6162
extracted.type(),
6263
extracted.date(),

learning/learning-module-llm/src/main/java/com/jongsoft/finance/llm/agent/TransactionExtractorAgent.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import dev.langchain4j.service.UserMessage;
77
import dev.langchain4j.service.V;
88

9+
import java.time.LocalDate;
910
import java.util.UUID;
1011

1112
@SystemMessage({
@@ -43,10 +44,12 @@ public interface TransactionExtractorAgent {
4344
"""
4445
Please extract the transaction details from the following text and return them in the format of a TransactionDTO as described.
4546
Only include fields that can be confidently identified.
47+
The date of today is {{date}}.
4648
Here's the text: {{input}}"""
4749
})
4850
TransactionDTO extractTransaction(
4951
@MemoryId UUID chat,
52+
@V("date") LocalDate date,
5053
@V("input") String input);
5154

5255
}

0 commit comments

Comments
 (0)