PAI-RAG provides APIs for service management and chat. This topic outlines the API types and calling methods for RAG services deployed with images earlier than v0.3.0.
Limitations
This document applies only to RAG services deployed using image versions earlier than v0.3.0.
Go to the Elastic Algorithm Service (EAS) page and click the RAG service name. On the Overview page, find the image version in the Environment Information section.
Service access address and token
To call a RAG service, you need to get the service access address and token:
-
Log on to the PAI console. Select a region on the top of the page. Then, select the desired workspace and click Elastic Algorithm Service (EAS).
-
Click the name of the target service. In the Basic Information section, click View Endpoint Information.
-
In the Invocation Method dialog box, get the service access address (EAS_SERVICE_URL) and token (EAS_Token).
Important-
Remove the trailing slash (/) from the EAS_SERVICE_URL.
-
To call the service using a public endpoint, the client must have internet access.
-
To call the service using a VPC endpoint, the client must be in the same virtual private cloud (VPC) as the RAG service.
-
Chat API
This service provides an OpenAI-compatible API. To use specific features, configure the required settings on the RAG service WebUI.
Supported features
-
search_web: Enables web search. You must configure web search parameters. -
chat_knowledgebase: Enables knowledge base queries. You must upload knowledge base files. -
chat_llm: Uses only a large language model (LLM) to provide answers. You must configure LLM services. -
chat_agent: Calls agent tools. You must configure agent-related code on the WebUI page. -
chat_db: Queries a database or table. You must configure chat_db-related parameters on the WebUI page.
|
Request details |
|
|
URL |
|
|
Request method |
POST |
|
Request header |
|
|
Sample HTTP body |
Important
|
Management API
Upload knowledge base files
|
Method |
|
|
URL |
|
|
Request method |
POST |
|
Request header |
|
|
Request parameter |
|
Check upload task status
|
Method |
|
|
URL |
|
|
Request method |
GET |
|
Request header |
|
Search the knowledge base
|
Method |
|
|
URL |
|
|
Request method |
POST |
|
Request header |
|
|
Request parameter |
|
Upload a datasheet for Chat_DB
|
Method |
|
|
URL |
|
|
Request method |
POST |
|
Request header |
|
|
Request parameter |
file: The Excel or CSV file to upload. |
Upload Q and A pairs for Chat_DB
|
Method |
|
|
URL |
|
|
Request method |
POST |
|
Request header |
|
|
Request parameter |
|
Load database information
|
Method |
|
|
URL |
|
|
Request method |
POST |
|
Request header |
|
Get knowledge base indexes
|
Method |
|
|
URL |
|
|
Request method |
GET |
|
Request header |
|
Create knowledge base index
|
Method |
|
|
URL |
|
|
Request method |
POST |
|
Request header |
|
|
Request parameters |
|
Update knowledge base index
|
Method |
|
|
URL |
|
|
Request method |
PATCH |
|
Request header |
|
|
Request parameters |
|
Delete knowledge base index
|
Method |
|
|
URL |
|
|
Request method |
DELETE |
|
Request header |
|
|
Request parameters |
index_name: The index name. |
Get RAG configuration
|
Method |
|
|
URL |
|
|
Request method |
GET |
|
Request header |
|
Update RAG configuration
|
Method |
|
|
URL |
|
|
Request method |
PATCH |
|
Request header |
|
|
Request parameter |
new_config: The configuration properties to update. |