×
Community Blog Quickly Building a RAG Service on Compute Nest with LLM on PAI-EAS and AnalyticDB for PostgreSQL

Quickly Building a RAG Service on Compute Nest with LLM on PAI-EAS and AnalyticDB for PostgreSQL

This article describes how to create a RAG service using Compute Nest with LLMs on PAI-EAS, AnalyticDB for PostgreSQL as the vector store, Gradio for ...

1

Introduction

This guide will walk you through the process of creating a Retrieval-Augmented Generation (RAG) service using Compute Nest with Large Language Models (LLM) on Alibaba Cloud's Platform for AI – Elastic Algorithm Service (PAI-EAS), AnalyticDB for PostgreSQL as the vector store, Gradio for the web UI, and Langchain for orchestration.

Prerequisites

  • An active Alibaba Cloud account
  • Familiarity with cloud services and AI models

Step 1: Alibaba Cloud Account Setup

Ensure you have an Alibaba Cloud account. Sign up here if you still need to do so.

Step 2: Access Compute Nest

Find the service GenAI-LLM-RAG in Alibaba Cloud->Console->Compute Nest with your Alibaba Cloud credentials. And press the Offical Use.

2

Step 3: Set Up an Instance and Its Parameters

Set up the necessary parameters of the instance:

3

  1. Enter the service instance name
  2. Choose Elastic Computing Services (ECS) parameters. Recommended to choose ecs.c6.2xlarge. In this case, the uploaded document will be faster
  3. Insert instance password

Step 4: Create a PAI-EAS Service for LLM

Deploy a pre-trained LLM on PAI-EAS:

  1. Choose the suitable LLM from the menu.
  2. Set the instance type
  3. Deploy and note the API endpoint.

4

Step 5: Setup AnalyticDB for PostgreSQL

  1. Choose the AnalyticDB for PostgreSQL instance specification.
  2. Segment Storage Size: The size of the documents could be decided depending on your knowledge.
  3. The default DB username is kbsuser. Usually, the database name will be the same as the user name. Feel free to put another username.
  4. You need to create a strong password, for instance. Note: not use in a password symbol "@"

5

Step 6: WebUI Credential and Network Configuration

1.  The default username is admin. You could choose another username.

2.  You need to create a strong password, for instance.

6

3.  As VPC can be chosen from existing VPC. To create a new VPC, you can activate the slider and put related information.

4.  After, press Next: Confirm Order.

7

Step 7: Integrate Gradio for Web UI

Create a web UI with Gradio:

  1. Set up Gradio.
  2. Connect it to the backend services (PAI-EAS, vector store).

Step 8: Deploy Your RAG Service

After checking all related information and accepting the Terms of Service by pressing Create Now, the service can be deployed. Need to wait for a while to finish all the steps.

8

Using the RAG Service

9

General Question Answering

Users can ask questions through the Gradio web UI, and the LLM will process and provide answers.

Uploading Documents for Retrieval Augmentation

Users can upload documents converted into vector store and save them in AnalyticDB for PostgreSQL.

Modifying the Service via ECS

Authorized users can access ECS to make changes or updates to the service.

Additional Resources

For more detailed information, check the following documentation:

Additional tutorials:

By following this guide, you should be able to set up a functional RAG service on Compute Nest, leveraging the powerful features of PAI-EAS, AnalyticDB, Gradio, and Langchain.

0 1 0
Share on

Farruh

30 posts | 21 followers

You may also like

Comments

Farruh

30 posts | 21 followers

Related Products