Reading Time: 8 minutes

Years ago, I had a chemistry teacher whose favorite phrase was “garbage in, garbage out”. In context, it was in regards to using a calculator to run calculations for classwork. If you put the wrong numbers in, you’ll get the wrong numbers out, but it is not the calculator’s fault. You just messed up the calculation.

When it comes to making good use of AI within an organization, the same phrase applies. Often, the problem with AI adoption is not the models, it’s getting the data to and out of the model that trips up these initiatives. It’s even more apparent now with LLMs and the struggle to avoid hallucinations in model responses. Fortunately, there’s a solution to many of these problems with integration.

It’s easy to fall into the trap of thinking that AI is different from traditional integration, and to be sure, there are some differences. For instance, AI models are generally far more hardware intensive as compared with more traditional business systems. However, if we frame them like we would with traditional systems, we see they’re more alike than they are different.

AI requires quality data as input, just like other applications. AI needs to be secured, just like other applications. AI requires integration to move the output to other systems, just like other applications. The list goes on and on. 

Anypoint IDE and AI 

Anypoint IDE has been solving these types of integration problems for a long time. Within our development environment, we have a powerful transformation language called DataWeave that allows you to manipulate data into any format or structure you need. For traditional integrations that is often XML or JSON, and AI is much the same. Often we see large arrays of numbers, or vectors, for AI use cases and DataWeave is perfectly capable of transforming those vectors into the expected format on the AI systems. 

Part of MuleSoft’s integration support is supporting more than just traditional integration workflows with REST APIs. To that end, we also support many Asynchronous communication protocols, like Server Sent Events. We allow you to design and implement integrations using the AsyncAPI standard, so you can integrate AI into your business realtime. AsyncAPI is currently used to power basic AI use cases like chat, but also more complex tasks like preventative maintenance or fraud detection.  

Additionally, we provide an easy-to-use, clicks not code experience for integration developers. With Anypoint Platform, you can easily tie your business systems to your AI engines and built robust, production ready integrations in minutes. This allows you to easily drive AI adoption in your organization, lowering the cycle time on these integration projects. 

Retrieval Augmented Generation (RAG) and Anypoint IDE 

With that in mind, let’s take a look at how you can build AI integrations, just like you would build other integrations, with a MuleSoft IDE. The integrations we’re exploring here are a Retrieval Augmented Generation (RAG) use case. We’ll see how we can tie traditional systems in with AI models just like we would any other system. The goal is to create a composable enterprise, and within that AI is just one piece of a much larger puzzle. 

Let’s examine a couple of the flows from our RAG use case. Within this we can see three different systems being interacted with, two of which are AI or AI-related. Looking first at the Message flow, we see a database interaction.

In this case, we’re just doing an Insert on a database, but like you would expect with a MuleSoft built DB integration, we just leverage our Database connector and we’re good to go. The next step is the VectorDBSearch, which is shown in the second flow. This makes an HTTP callout to an AI-related service in its first call, “Embed Query”. We are able to perform a normal DataWeave Transform on the response information and then interact with our database again. Returning to our first flow, we then format the data returned by our subflow, and make a call to our third and final service, OpenAI. 

All of this was built in the MuleSoft IDE over the course of a couple of hours, and it drives a functioning RAG flow that exposes the MuleSoft product documentation (yes, all of it), for question/answer and conversation. This RAG flow is also capable of fact-checking itself, and provides the end-user with relevant source information that the AI used to generate its response. 

AI adoption can be intimidating. Often we’ve been told that these systems are quirky, and don’t behave like normal systems. Fortunately, MuleSoft’s Anypoint Platform makes AI integration and adoption simple for any organization.