Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

How to Make a RAG Application With LangChain4j

Retrieval-augmented generation, or RAG, introduces some serious capabilities to your large language models (LLMs). These applications can answer questions about your specific corpus of knowledge, while leveraging all the nuance and sophistication of a traditional LLM.

This tutorial will take you through the ins and outs of creating a Q&A chatbot using RAG. The application will:

  1. Retrieve data from a MongoDB Atlas database.
  2. Embed and store documents as vector embeddings.
  3. Use LangChain4j to query the database and augment LLM prompts with the retrieved data.
  4. Enable secure, scalable, and efficient AI-powered applications.

If you want to see the completed application, it is available in the GitHub repository.

Read More

Data Modeling for Java Developers: Structuring With PostgreSQL and MongoDB

Application and system designs have always been considered the most essential step in application development. All the later steps and technologies to be used depend on how the system has been designed. If you are a Java developer, choosing the right approach can mean distinguishing between a rigid, complex schema and a nimble, scalable solution. If you are a Java developer who works with PostgreSQL or other relational databases, you understand the pain of representing the many-to-many relationships between the tables.

This tutorial will ease your pain with these or other relationships defined in databases by making use of a document database, MongoDB.

In this article, we’ll understand both approaches, contrasting PostgreSQL’s relational rigour with MongoDB’s document-oriented simplicity. You’ll learn how to weigh trade-offs like ACID compliance versus scalability and discover why MongoDB’s design might save you time.

Read More

Building a Real-Time AI Fraud Detection System with Spring Kafka and MongoDB

In this tutorial, we’ll build a real-time fraud detection system using MongoDB Atlas Vector Search, Apache Kafka, and AI-generated embeddings. We’ll demonstrate how MongoDB Atlas Vector Search can be used to detect anomalies in a stream of financial transactions by analyzing a user’s transaction history and identifying suspicious behavior based on LLM-generated embeddings.

Our solution will monitor MongoDB Change Streams using the Java synchronous driver, triggering vector searches on each new transaction to detect potential fraud. While this approach works well for our demo, and for many use cases, we’ll also discuss its limitations. Throughout the tutorial, I’ll cover alternative strategies to optimize performance, whether you need higher transaction throughput, faster fraud detection, or a more scalable architecture.

Read More

Serverless Development with AWS Lambda and MongoDB Atlas Using Java

So you need to build an application that will scale with demand and a database to scale with it? It might make sense to explore serverless functions, like those offered by AWS Lambda, and a cloud database like MongoDB Atlas.

Serverless functions are great because you can implement very specific logic in the form of a function and the infrastructure will scale automatically to meet the demand of your users. This will spare you from having to spend potentially large amounts of money on always on, but not always needed, infrastructure. Pair this with an elastically scalable database like MongoDB Atlas, and you’ve got an amazing thing in the works.

In this tutorial, we’re going to explore how to create a serverless function with AWS Lambda and MongoDB, but we’re going to focus on using Java, one of the available AWS Lambda runtimes.

Read More

Extend Legacy Java Android Applications With NativeScript And Angular

As some of you might know, before I started developing cross platform mobile applications using Ionic Framework and NativeScript, I was developing Android applications using nothing more than the Android SDK and Java. I still have one of my first applications, SQLTool, for sale in Google Play, and it was written with Java and Android. When building mobile applications, frameworks like NativeScript are incredibly attractive to web developers because they can use a common set of web design and development skills. However, NativeScript can be equally attractive to development teams writing Android applications with Java.

With NativeScript you can actually build a “polyglot” type application where parts are Java and parts are NativeScript with Angular. To be clear, I’m not talking about rewriting your Java application into modules wrapped in JavaScript like plugins. I’m saying that you can take your 100% Android with Java application and add Activities or Fragments built with NativeScript.

So why is this useful?

Imagine being on a small Android development team with more things to be done than there is time in the day. These Android developers would rather die than use a cross platform framework, but you have plenty of web developers floating around your company. In this scenario, the two worlds can collide and maybe the web developers can create lower (or higher) priority components for the Android application without having to convert the whole application to Android with Java or to NativeScript with Angular.

Read More

Support iBeacons In Your Native Android Mobile App

I play around with iBeacons quite frequently. I created my own Internet of Things (IoT) iBeacon project as well as an AngularJS wrapper for using iBeacons in an Ionic Framework application. This time around I figured I’d take my iBeacon adventure to the next level and try to use them in a native Android mobile application.

Using the AltBeacon library by Radius Networks we can easily add iBeacon monitoring and ranging support to our native Android application. We’re going to see how to scan for a variety of proximity beacons and display them within an application.

Read More

TPDP Episode #3: Developer Tools that can Make You More Productive Towards Your Next Release

In this episode of The Polyglot Developer Podcast I sit down with two of my good friends, Raymond Camden and Simon Reimler, and discuss developer tools and strategies for being successful. Episode #3: Developer Tools that can Make You More Productive Towards Your Next Release covers a lot of ground and is broken up into three main sections:

  1. What tools are used for planning, prior to development and design
  2. What tools are used for developing and designing an application all the way to release
  3. What tools are used for maintaining and driving the success of a released application

This podcast episode is not specific to any programming language or release platform. In other words, whether your a web developer, mobile app developer, or game designer, you will be able to find this information valuable.

Read More