Embed RAG into your App
How to embed Gen AI into an existing application using the Dataworkz RAG API
Introduction
Dataworkz simplifies RAG app development for businesses. Dataworkz offers RAG as a Service so that you can build GenAI applications using proprietary data, utilizing either public LLM APIs or privately hosted open source foundation models.
With Dataworkz's RAG builder, enterprises gain the ability to construct their AI stack — vector database, embedding model, and LLM — and connect with various sources of business data including SaaS, databases and more.
Dataworkz RAG Builder offers a REST API to integrate QnA capabilities into modern web applications. Using this API you can AI-enable your applications and allow users to ask free-form natural language questions of your data and receive high-quality, human-readable response along with the authoritative sources the response originated from. Read on to learn how to AI-enable your applications.
If you would like to see a sample application that you can try, Dataworkz has published a sample app here that demonstrates API integration.
Pre-requisites
A Dataworkz RAG QnA system has already been configured in your account. Use these steps to build a QnA system.
You will need the host name of the Dataworkz RAG service that you are targeting (e.g.
https://genai.dataworkz.com
)An API Key for the target Dataworkz system.
Make sure all Angular CLI dependencies are up to date on your machine
Concepts and Terminology
QnA System - multiple QnA systems can be configured in a single Dataworkz account that provides separation between different systems. Each system can have its own set of documents and data transformation, parameters and configuration. This can be used to power different applications, isolate data from different departments, versions, systems, etc. When you make a query you select the QnA system you want to target.
LLMProvider - Dataworkz RAG Builder makes it easy to configure and work with multiple Large Language Models (LLM) including those from OpenAI, Google Vertex AI and privately hosted Open Source LLMs.
Questions - Users can ask questions from the QnA system. Dataworkz will leverage the power of RAG to generate answers from relevant pieces of content from the data corpus associated with a QnA system.
Monitoring - Dataworkz RAG Builder supports monitoring the performance of the RAG system, provides scores, validates LLM responses to prevent hallucinations, and allows users to provide feedback to questions.
Building a RAG Application
Dataworkz RAG APIs that you can use to build your own AI powered applications are listed below -
Authentication
For all APIs, an API Key must be passed in the Authorization
header of the request. The value of the header should have the form SSWS <api-token>
.
Listing QnA Systems
All QnA systems in an account can be listed using the systems listing API. Depending on your use-case, you can decide to show the systems to the user or pick the appropriate one for subsequent operations using the systemId
returned by this API.
Getting a list of LLMs
All LLMs configured for a system can be retrieved. Questions can be asked from a specific LLM or a user-selected LLM or even from multiple LLMs in order to compare performance and select a more performant (or one with a better cost-performance ratio) LLM as per your use-case. Each LLM instance is identified by its id returned by this API.
Asking a question
Users can ask free-form natural language questions for the selected QnA system powered using Dataworkz RAG. Dataworkz RAG will retrieve appropriate data and augment the LLM prompt to get an easy-to-consume response back to show to the user. In addition, all sources used by the LLM to formulate its response are also returned which allows your application to list authoritative sources.
Use this API for Question and Answer capabilities. You will need the systemId
of the QnA System you are targeting as well the llmProviderId
of the LLM you want to target and the question text.
Getting previously asked questions
You can retrieve previously asked questions, their answers and scores associated with the LLM responses using this API.
To summarize, Dataworkz RAG builder abstracts the operational complexity of building a GenAI app and provides an API for developers to embed the GenAI apps into existing workflows/apps.
Last updated