← Back to Skills Marketplace
sdk-team

Alibabacloud Bailian Rag Knowledgebase

by alibabacloud-skills-team · GitHub ↗ · v0.0.2 · MIT-0
cross-platform ⚠ suspicious
149
Downloads
0
Stars
0
Active Installs
2
Versions
Install in OpenClaw
/install alibabacloud-bailian-rag-knowledgebase
Description
Alibaba Cloud Bailian Knowledge Base Retrieval Tool. Use Alibaba Cloud Bailian SDK to query and retrieve knowledge base content. Use when: User needs to quer...
README (SKILL.md)

\r \r

Bailian Knowledge Base Retrieval\r

\r This Skill provides query and retrieval capabilities for Alibaba Cloud Bailian Knowledge Base, supporting intelligent selection across multiple knowledge bases.\r \r

🚀 Initial Setup (Required for First-time Use)\r

\r

1. Install Dependencies\r

\r

npm install\r
```\r
\r
This will install all dependencies defined in package.json:\r
- `@alicloud/bailian20231229` - Bailian Knowledge Base SDK\r
- `@alicloud/modelstudio20260210` - Modelstudio Workspace SDK\r
- `@alicloud/openapi-client` - OpenAPI Client\r
\r
### 2. Configure Alibaba Cloud Credentials\r
\r
This tool uses the Alibaba Cloud default credential chain, supporting multiple credential configuration methods (in order of priority):\r
\r
**Method 1: Alibaba Cloud CLI (Recommended)**\r
```bash\r
# Configure credentials using Alibaba Cloud CLI\r
aliyun configure\r
```\r
\r
**Method 2: Configuration File**\r
Alibaba Cloud SDK will automatically read credential configuration from `~/.aliyun/config.json` or `~/.acs/credentials`.\r
\r
**Note:** \r
- For first-time use, if credentials are not detected, guide users to configure using `aliyun configure`\r
- Do not explicitly handle user's AK/SK credentials, rely on Alibaba Cloud default credential chain\r
\r
### 3. Important Prerequisite: Activate Bailian and Knowledge Base Service\r
\r
**Before using this skill, you must first activate the knowledge base service in the Alibaba Cloud Bailian console!**\r
\r
1. Visit [Bailian Knowledge Base page](https://bailian.console.aliyun.com/cn-beijing/?tab=app#/knowledge-base)\r
2. Click the **"Activate Now"** button\r
3. Confirm activation and wait for the service to take effect (usually 1-2 minutes)\r
\r
### 4. Important Prerequisite: Guide Users to Grant Permissions in Alibaba Cloud Access Control and Bailian\r
\r
**Before using this skill, you must grant the following permissions to the previously configured AK, otherwise calls will fail and may cause 403 errors**\r
\r
#### 1) RAM Permission Grant\r
1. Visit [Alibaba Cloud RAM Access Control](https://ram.console.aliyun.com/users)\r
2. Select the RAM user corresponding to the AK, click the "Add Permission" button, select **AliyunBailianFullAccess** and **AliyunModelStudioReadOnlyAccess** permission in the permission policy, and confirm to add the permission.\r
#### 2) Bailian Workspace Permission Grant\r
1. Visit [Alibaba Cloud Bailian Permission Management](https://bailian.console.aliyun.com/cn-beijing?tab=app#/authority)\r
2. If the RAM user corresponding to the AK does not exist, click **"Add User"** in the upper right corner of the page, select the corresponding RAM user and click confirm to add.\r
3. Click **"Permission Management"** on the right side of the RAM user corresponding to the AK, click edit, and grant knowledge base related permissions.\r
4. There is a 30s effective time after configuration, please wait patiently for a while.\r
\r
## Available Scripts\r
\r
All scripts are located in the `scripts/` directory:\r
\r
| Script | Purpose | Parameters |\r
|--------|---------|------------|\r
| `check_env.js` | Check environment configuration | None |\r
| `list_workspace.js` | Query workspace list | `[maxResults]` |\r
| `list_indices.js` | Query knowledge base list | `workspaceId pageNumber pageSize` |\r
| `retrieve.js` | Retrieve from specified knowledge base | `workspaceId indexId query` |\r
\r
## Workflow\r
\r
### Step 1: Environment Check\r
\r
Run `scripts/check_env.js` to check:\r
- Whether npm packages are installed\r
- Whether environment variables are configured\r
\r
If not ready, prompt the user:\r
- Packages not installed → Run `npm install` to install all dependencies in package.json\r
- Missing environment variables → Guide user to configure\r
\r
### Step 2: Get Workspace ID\r
\r
**Do not directly ask the user for workspaceId**, instead automatically get the workspace list through the script.\r
\r
Run `scripts/list_workspace.js` to get all available workspaces:\r
\r
```bash\r
node scripts/list_workspace.js\r
```\r
\r
Return format:\r
```json\r
{\r
  "workspaces": [\r
    {\r
      "workspaceId": "llm-bpp1p29i34jvoybx",\r
      "name": "Main Account Space"\r
    },\r
    {\r
      "workspaceId": "llm-hcghrtsbma82bwks",\r
      "name": "Podcast"\r
    }\r
  ]\r
}\r
```\r
\r
**Processing Logic:**\r
1. Get the workspace list\r
2. If there is only one workspace, use it automatically and inform the user\r
3. If there are multiple workspaces, display the list for user to select\r
4. Record user selection to avoid repeated inquiries (until user wants to switch)\r
\r
### Step 3: Query Knowledge Base List\r
\r
For each workspace, run `scripts/list_indices.js workspaceId pageNumber pageSize` to get the knowledge base list.\r
\r
**Batch Retrieval Strategy:**\r
1. Get all workspace lists from Step 2\r
2. Iterate through each workspace, call `list_indices.js` to retrieve its knowledge bases\r
3. Merge all knowledge base results, annotate the workspace they belong to\r
4. pageNumber starts from 1, pageSize defaults to 100, if current page is not fully retrieved then continue to retrieve next page\r
\r
**Examples:**\r
```bash\r
# Get knowledge bases from the first workspace\r
node scripts/list_indices.js llm-bpp1p29i34jvoybx 1 100\r
\r
# Get knowledge bases from the second workspace\r
node scripts/list_indices.js llm-hcghrtsbma82bwks 1 100\r
```\r
\r
Return format:\r
```json\r
[\r
  {\r
    "indexId": "qf91w6402d",\r
    "name": "Product Documentation",\r
    "description": "Contains product user manuals, API documentation, etc."\r
  },\r
  {\r
    "indexId": "ip93d2pyvz",\r
    "name": "Customer Service Q&A",\r
    "description": "FAQ, customer service scripts"\r
  }\r
]\r
```\r
\r
### Step 4: Intelligent Knowledge Base Selection\r
\r
Based on the user's question and knowledge base descriptions, select **1-3 most relevant knowledge bases** for retrieval.\r
\r
Selection Strategy:\r
- Match keywords (keywords in question vs knowledge base name/description)\r
- Prioritize knowledge bases that explicitly contain relevant fields in their descriptions\r
- If uncertain, select all or let user manually select\r
\r
### Step 5: Execute Retrieval\r
\r
For each selected knowledge base, run `scripts/retrieve.js workspaceId indexId query`.\r
\r
Return format, content inside each chunk represents chunk content, doc_name represents source document, score represents match score, title represents chunk section title:\r
```json\r
{\r
  "indexId": "6fd13emwyj",\r
  "chunks": [\r
    {\r
      "content": "C. A small ball collides with a wall at 10 m/s, and bounces back with the same speed of 10 m/s. The magnitude of the ball's velocity change is 20 m/s. D. When an object's acceleration is positive, its velocity must increase. Example 1√ Problem Situation: As shown in the figure, Figure 2. Question 1. In the previous class, we drew the velocity-time relationship graph using a dot timer. Can you find the acceleration from it? 3. The ______________ from the v-t graph determines the magnitude of acceleration. Slope. 2. The slope value of the v-t graph represents: Acceleration value. 1. Calculate the magnitude of acceleration from the v-t graph. 4. If the v-t graph line is a sloping straight line, then the object's velocity changes uniformly, its acceleration is constant, and it moves with uniformly accelerated motion. Example 2. The three lines a, b, c in Figure 1.4-6 describe the motion of three objects A, B, C. First make a preliminary judgment about which object has the greatest acceleration, then calculate their accelerations based on the data in the graph, and explain the direction of acceleration. Analysis: Slope represents acceleration, acceleration tilts to the upper right, acceleration is positive, tilts to the lower right, acceleration is negative; so a and b are accelerating, c is decelerating, the object with the greatest acceleration, i.e., the steepest slope, is a. Description of velocity change - Acceleration. 1. Physical meaning: Describes how fast an object's velocity changes. 2. Definition: The ratio of the change in velocity to the time taken for that change. 3. Definition formula: 4. Vector nature: 5. Acceleration and velocity. Acceleration and velocity change. 6. Viewing acceleration from v-t graph: The slope value of the graph represents the acceleration value. Direction of a, accelerating motion. Direction of a, decelerating motion. Same as v0 direction.",\r
      "score": 0.6040189862251282,\r
      "doc_name": "Description of velocity change acceleration pptx-18 pages",\r
      "title": ""\r
    },\r
    {\r
      "content": "Section 4: Description of velocity change rate - Acceleration. High school physics, compulsory course 1, chapter 1. Learning objectives: Task 1: Understand the physical meaning of acceleration, be able to state the definition formula and unit of acceleration. Task 2: Be able to describe the relationship between the direction of acceleration and the direction of velocity. Task 3: Be able to distinguish between velocity, velocity change, and velocity change rate (acceleration). Understand variable speed motion. Task 4: Be able to determine acceleration from v-t graphs. 1. What is the reason for the distance between each car's final speed of 100 km/h? 2. What is the difference in their acceleration process motion? 3. Can you accurately compare the performance of these cars? Different rates of velocity change || Initial velocity (km/h) | Final velocity (km/h) | Time taken (s) | | A car start | 0 | 100 | 8.02 | | B car start | 0 | 100 | 9.53 | | C car start | 0 | 100 | 5.43 | | D car start | 0 | 100 | 4.47 | Table 1: Racing car 0~100 km/h sprint record. 4. With precise data, how to accurately compare the acceleration rate of cars? 5. Which car has the fastest velocity change? 6. Can you use other ways to compare the rate of velocity change? Observe the self-study draft Table 1, which object's velocity changes faster, A or B? | Time/s | 0 | 5 | 10 | 15 | | A v/(m·s-1) | 20 | 25 | 30 | 35 | | B v/(m·s-1) | 10 | 30 | 50 | 70 | | C v/(m·s-1) | 35 | 30 | 25 | 20 | | D v/(m·s-1) | 50 | 35 | 20 | 5 | Self-study draft Table 1: | Change | | 10 | | 40 |",\r
      "score": 0.6966111660003662,\r
      "doc_name": "Description of velocity change acceleration pptx-18 pages",\r
      "title": ""\r
    }\r
  ]\r
}\r
```\r
\r
### Step 6: Integrate Answer\r
\r
Based on retrieval results:\r
1. Sort by relevance (score descending)\r
2. Extract key information\r
3. Organize answer in natural language\r
4. Please annotate the information source at the end of the generated answer (knowledge base name; document name; section name), can reference multiple documents and sections.\r
\r
## Common Permission Errors:\r
```\r
{\r
  "code": "Index.NoWorkspacePermissions",\r
  "message": "No workspace permissions can be used, workspace: ssss",\r
  "requestId": "05072729-7958-5FE7-8F97-B54032231CCD",\r
  "status": "403"\r
}\r
```\r
If you see the above message, there may be 2 reasons: 1. The workspace does not exist. 2. The user has not completed the 2-step authorization above, please guide to check permissions and workspace existence.\r
\r
## Usage Example\r
\r
**User:** "What authentication methods does our product support?"\r
\r
**Flow:**\r
1. Check environment → Ready\r
2. Get workspaceId → `ws-123456`\r
3. Query knowledge base → Returns 3 knowledge bases\r
4. Select knowledge base → "Product Documentation" (most relevant)\r
5. Retrieve → Get authentication-related document chunks\r
6. Answer → "According to product documentation, OAuth2.0, SAML, and API Key authentication methods are supported..."\r
\r
## Notes\r
\r
- Confirm workspaceId is correct before each retrieval\r
- When retrieving from multiple knowledge bases, merge results and deduplicate\r
- Sort retrieval results by score, prioritize high-relevance content\r
- Credential configuration relies on Alibaba Cloud default credential chain, do not explicitly handle AK/SK
Usage Guidance
This skill appears to do what it says: it runs local Node scripts that call Alibaba Cloud Bailian and ModelStudio SDKs and uses the SDK's default credential chain. Before installing: (1) Review package.json (not included here) to confirm npm dependencies are expected; npm install will pull packages from the registry. (2) Do not paste raw AK/SK into untrusted interfaces — configure credentials via 'aliyun configure' or well-known config files. (3) Prefer creating a RAM user with minimal permissions (at least sfm:ListIndices, sfm:Retrieve, maas:ListWorkspaces) rather than granting broad system policies if you want tighter security. (4) Run the scripts in a controlled environment or sandbox if you are unsure. If you want higher assurance, request the package.json and perform an audit of the specific npm package versions before installing.
Capability Analysis
Type: OpenClaw Skill Name: alibabacloud-bailian-rag-knowledgebase Version: 0.0.2 The skill bundle provides a legitimate interface for interacting with Alibaba Cloud Bailian RAG (Retrieval-Augmented Generation) services. The scripts (check_env.js, list_indices.js, list_workspace.js, and retrieve.js) use official Alibaba Cloud SDKs and follow security best practices by utilizing the default credential chain rather than requesting raw secrets. The code includes input validation for workspace IDs and queries to prevent injection, and the instructions in SKILL.md are strictly aligned with the tool's stated purpose of knowledge base retrieval.
Capability Tags
requires-sensitive-credentials
Capability Assessment
Purpose & Capability
Name/description match the code and instructions: scripts call Bailian and ModelStudio SDKs to list workspaces, list indices, and retrieve knowledge-base content. One minor metadata mismatch: the registry metadata shows no required env vars, but SKILL.md and the scripts expect Alibaba Cloud credentials via the SDK's default credential chain (configured via aliyun CLI or config files). This is expected for the stated purpose.
Instruction Scope
SKILL.md instructions are confined to installing npm deps, configuring Alibaba Cloud credentials, and running the provided scripts. The runtime instructions do not instruct reading unrelated host files or transmitting data to unknown endpoints; the scripts use Alibaba Cloud SDKs and the default credential chain only.
Install Mechanism
No remote downloads or archive extraction are used. The skill is instruction+script-based and expects 'npm install' to pull official @alicloud packages from npm. This is a standard, low-risk install pattern, but npm packages will be installed locally.
Credentials
The skill requires Alibaba Cloud credentials via the default credential chain (aliyun CLI or config files) which is appropriate. The documentation recommends granting system policies (AliyunBailianFullAccess and AliyunModelStudioReadOnlyAccess); those are broader than the minimal listed API actions (sfm:ListIndices, sfm:Retrieve, maas:ListWorkspaces). Consider applying least-privilege RAM policies or a custom policy scoped to the required actions.
Persistence & Privilege
Skill is not always-enabled, does not request persistent platform privileges, and does not attempt to modify other skills or system-wide agent settings. It only runs local scripts when invoked.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install alibabacloud-bailian-rag-knowledgebase
  3. After installation, invoke the skill by name or use /alibabacloud-bailian-rag-knowledgebase
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v0.0.2
- Improved script logic in list_indices.js, list_workspace.js, and retrieve.js for better retrieval and workspace management. - Enhanced documentation in SKILL.md for clarity on setup, permissions, and workflow. - No changes to the user-facing interface or workflow steps.
v0.0.1
Initial release: Alibaba Cloud Bailian Knowledge Base Retrieval Tool - Enables querying and retrieving content from Alibaba Cloud Bailian Knowledge Bases. - Requires npm dependencies and Alibaba Cloud credential setup. - Guides users to activate the Bailian service and configure necessary permissions. - Provides scripts for checking environment, listing workspaces and knowledge bases, and retrieving content. - Supports intelligent selection of relevant knowledge bases based on user queries. - Designed for users needing to search, retrieve, or answer questions from their Bailian knowledge repositories.
Metadata
Slug alibabacloud-bailian-rag-knowledgebase
Version 0.0.2
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 2
Frequently Asked Questions

What is Alibabacloud Bailian Rag Knowledgebase?

Alibaba Cloud Bailian Knowledge Base Retrieval Tool. Use Alibaba Cloud Bailian SDK to query and retrieve knowledge base content. Use when: User needs to quer... It is an AI Agent Skill for Claude Code / OpenClaw, with 149 downloads so far.

How do I install Alibabacloud Bailian Rag Knowledgebase?

Run "/install alibabacloud-bailian-rag-knowledgebase" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Alibabacloud Bailian Rag Knowledgebase free?

Yes, Alibabacloud Bailian Rag Knowledgebase is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Alibabacloud Bailian Rag Knowledgebase support?

Alibabacloud Bailian Rag Knowledgebase is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Alibabacloud Bailian Rag Knowledgebase?

It is built and maintained by alibabacloud-skills-team (@sdk-team); the current version is v0.0.2.

💬 Comments