×
Community Blog Starter Guide | Build a RAG Service on Compute Nest with LLM on PAI-EAS and AnalyticDB for PostgreSQL in One Click

Starter Guide | Build a RAG Service on Compute Nest with LLM on PAI-EAS and AnalyticDB for PostgreSQL in One Click

This tutorial describes how to build a RAG service using Compute Nest with LLM on Alibaba Cloud's PAI-EAS and AnalyticDB for PostgreSQL.

This article focuses on one-click deployment through the Alibaba Cloud console. If you need to use scripting for automated deployment, you can refer to this article that uses Terraform.

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

  1. An active Alibaba Cloud account
  2. 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, consult the following:

  1. Compute Nest Documentation
  2. Alibaba Cloud PAI-EAS Documentation
  3. AnalyticDB for PostgreSQL Documentation
  4. Gradio Documentation
  5. LangChain Documentation

Additional Tutorials

  1. Empowering Generative AI with Alibaba Cloud PAI's Advanced LLM and LangChain Features
  2. Solution 1B: How to Use ECS + PAI + AnalyticDB for PostgreSQL to Build a Llama2 Solution
  3. Tutorial: Building an Exciting Journey for Your GenAI Application with Llama 2, AnalyticDB, PAI-EAS
  4. Mastering Generative AI - Run Llama2 Models on Alibaba Cloud's PAI with Ease
  5. Next-Level Conversations: LLM + VectorDB with Alibaba Cloud Is Customizable and Cost-Efficient

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.

Reference

https://www.alibabacloud.com/blog/quickly-building-a-rag-service-on-compute-nest-with-llm-on-pai-eas-and-analyticdb-for-postgresql_600783

0 1 0
Share on

ApsaraDB

443 posts | 93 followers

You may also like

Comments

ApsaraDB

443 posts | 93 followers

Related Products