-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf7bfeb
commit dc36dbf
Showing
7 changed files
with
56 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...ction/src/main/java/io/quarkiverse/langchain4j/sample/FraudDetectionContentRetriever.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.quarkiverse.langchain4j.sample; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.microprofile.jwt.JsonWebToken; | ||
import org.jboss.logging.Logger; | ||
|
||
import dev.langchain4j.rag.content.Content; | ||
import dev.langchain4j.rag.content.retriever.ContentRetriever; | ||
import dev.langchain4j.rag.query.Query; | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.inject.Inject; | ||
|
||
@ApplicationScoped | ||
public class FraudDetectionContentRetriever implements ContentRetriever { | ||
private static final Logger log = Logger.getLogger(FraudDetectionContentRetriever.class); | ||
|
||
@Inject | ||
TransactionRepository transactionRepository; | ||
|
||
@Inject | ||
CustomerRepository customerRepository; | ||
|
||
@Override | ||
public List<Content> retrieve(Query query) { | ||
JsonWebToken idToken = (JsonWebToken)query.metadata().chatMemoryId(); | ||
// User the customer name and email to retrive the content and return it as JSON | ||
return List.of(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...ion/src/main/java/io/quarkiverse/langchain4j/sample/FraudDetectionRetrievalAugmentor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.quarkiverse.langchain4j.sample; | ||
|
||
import java.util.function.Supplier; | ||
|
||
import dev.langchain4j.rag.DefaultRetrievalAugmentor; | ||
import dev.langchain4j.rag.RetrievalAugmentor; | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.inject.Inject; | ||
|
||
@ApplicationScoped | ||
public class FraudDetectionRetrievalAugmentor implements Supplier<RetrievalAugmentor> { | ||
|
||
@Inject | ||
FraudDetectionContentRetriever contentRetriever; | ||
|
||
@Override | ||
public RetrievalAugmentor get() { | ||
return DefaultRetrievalAugmentor.builder() | ||
.contentRetriever(contentRetriever) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,11 @@ | |
import java.util.List; | ||
import java.util.Random; | ||
|
||
import io.quarkus.runtime.StartupEvent; | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.enterprise.event.Observes; | ||
import jakarta.transaction.Transactional; | ||
|
||
import io.quarkus.runtime.StartupEvent; | ||
|
||
@ApplicationScoped | ||
public class Setup { | ||
|
||
|
@@ -29,21 +28,18 @@ public void init(@Observes StartupEvent ev, CustomerRepository customers, Transa | |
customer1.name = "Clement Escofier"; | ||
customer1.email = "[email protected]"; | ||
customer1.transactionLimit = 10000; | ||
customer1.distanceLimit = 500; | ||
customers.persist(customer1); | ||
|
||
var customer2 = new Customer(); | ||
customer2.name = "Georgios Andrianakis"; | ||
customer2.email = "[email protected]"; | ||
customer2.transactionLimit = 1000; | ||
customer1.distanceLimit = 300; | ||
customers.persist(customer2); | ||
|
||
var customer3 = new Customer(); | ||
customer3.name = "Sergey Beryozkin"; | ||
customer3.email = "[email protected]"; | ||
customer1.transactionLimit = 500; | ||
customer1.distanceLimit = 100; | ||
customers.persist(customer3); | ||
} | ||
|
||
|