← 返回 Skills 市场
sdk-team

Alibabacloud Analyticdb Postgresql Knowledgebase Ops

作者 alibabacloud-skills-team · GitHub ↗ · v0.0.1 · MIT-0
cross-platform ✓ 安全检测通过
142
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install alibabacloud-analyticdb-postgresql-knowledgebase-ops
功能描述
ADBPG Knowledge Base Management: Create knowledge bases, upload documents, search, Q&A. Triggers: "knowledge base", "document library", "document upload", "k...
使用说明 (SKILL.md)

ADBPG Knowledge Base Management

Build enterprise knowledge bases in three steps: Create Knowledge Base → Upload Documents → Search & Q&A

The system automatically handles document parsing, chunking, vectorization, and index building. Users only need to focus on business logic.

Architecture: ADBPG Instance + Namespace + DocumentCollection + Vector Index + LLM Service

Core Concepts

  • Knowledge Base: Container for documents, automatically manages vector indexes (corresponds to DocumentCollection in API)
  • Document: Files uploaded to the knowledge base, supports PDF/Word/Markdown/HTML/JSON/CSV/images, etc.
  • Q&A: Intelligent conversation based on knowledge base + large language model

Environment Setup

[MUST] CLI User-Agent — Every aliyun CLI command invocation must include: --user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-knowledgebase-ops

[MUST] Enable AI-Mode — AI-mode is required for Agent Skill execution. Run the following commands before any CLI invocation:

aliyun configure ai-mode enable
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-knowledgebase-ops"

[MUST] Disable AI-Mode at EVERY exit point — Before delivering the final response for ANY reason, always disable AI-mode first. This applies to ALL exit paths: workflow success, workflow failure, error/exception, user cancellation, session end, or any other scenario where no further CLI commands will be executed. AI-mode is only used for Agent Skill invocation scenarios and MUST NOT remain enabled after the skill stops running.

aliyun configure ai-mode disable

Pre-check: Aliyun CLI >= 3.3.3 required Run aliyun version to verify >= 3.3.3. If not installed or version too low, run curl -fsSL https://aliyuncli.alicdn.com/setup.sh | bash to install/update, or see references/cli-installation-guide.md for installation instructions. Then [MUST] run aliyun configure set --auto-plugin-install true to enable automatic plugin installation. Then [MUST] run aliyun plugin update to ensure that any existing plugins on your local machine are always up-to-date.

Pre-check: Alibaba Cloud Credentials Required

Security Rules:

  • NEVER read, echo, or print credential material (including environment-based secrets)
  • NEVER ask the user to paste long-lived secrets directly in the conversation or command line
  • NEVER use aliyun configure set with literal credential values
  • ONLY use aliyun configure list to check credential status
aliyun configure list

Check the output for a valid profile (AK, STS, or OAuth identity).

If no valid profile exists, STOP here.

  1. Obtain credentials from Alibaba Cloud Console
  2. Configure credentials outside of this session (via aliyun configure in terminal or environment variables in shell profile)
  3. Return and re-run after aliyun configure list shows a valid profile

Verify CLI Credentials

aliyun gpdb describe-regions --user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-knowledgebase-ops

Script dependencies (Python)

scripts/upload_document_local.py uses the Alibaba Cloud Python SDK. Declare dependencies in requirements.txt. Install before running the script:

pip install -r requirements.txt

Requires Python 3.7+ (same baseline as Alibaba Cloud SDK for Python).


RAM Permissions

[MUST] RAM Permission Pre-check: Before executing operations, verify current user has required permissions. Use ram-permission-diagnose skill to check permissions, then compare against references/ram-policies.md. If any permission is missing, abort and prompt user.


Parameter Confirmation

IMPORTANT: Parameter Confirmation — Before executing any command or API call, ALL user-customizable parameters (e.g., RegionId, instance names, CIDR blocks, passwords, domain names, resource specifications, etc.) MUST be confirmed with the user. Do NOT assume or use default values without explicit user approval.

Parameter Required/Optional Description Default Value
biz-region-id Required Region ID cn-hangzhou
db-instance-id Required Instance ID (format: gp-xxxxx) -
manager-account Required Manager account name -
manager-account-password Required Manager account password -
namespace Optional Namespace name public
namespace-password Required Namespace password -
collection Required Knowledge base name -
embedding-model Optional Embedding model text-embedding-v4
dimension Optional Vector dimension 1024

Note: If the knowledge base is created in a custom namespace, all subsequent operations must specify the same namespace parameter.

For interaction guidelines, smart defaults, and best practices, see references/interaction-guidelines.md.

Documentation placeholders: CLI examples use strings like \x3Cmanager-account-password> and \x3Cnamespace-password>. Replace them with real values from the user; never commit or log real passwords in docs, tickets, or chat.


Timeout Configuration

Timeout Rules: All operations must complete within reasonable time limits.

  • Standard operations: ≤10 seconds (create/list/query)
  • Upload document async: No timeout limit (async job, poll every 5-10s)

CLI Timeout Settings:

# Add --ConnectTimeout and --ReadTimeout to all commands
aliyun gpdb create-document-collection \
  --biz-region-id cn-hangzhou \
  --db-instance-id gp-xxxxx \
  --manager-account admin_user \
  --manager-account-password '\x3Cmanager-account-password>' \
  --namespace ns_my_knowledge_base \
  --collection my_knowledge_base \
  --embedding-model text-embedding-v4 \
  --dimension 1024 \
  --user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-knowledgebase-ops \
  --ConnectTimeout 10 \
  --ReadTimeout 10

Python SDK (default credential chain + timeouts + User-Agent):

Use CredentialClient() with no arguments so the SDK resolves credentials via the default chain (same sources as the CLI). Do not parse credential files or pass raw keys in skill code. Set user_agent and HTTP timeouts on Config (milliseconds).

from alibabacloud_credentials.client import Client as CredentialClient
from alibabacloud_gpdb20160503.client import Client
from alibabacloud_tea_openapi.models import Config

client = Client(Config(
    credential=CredentialClient(),
    region_id='cn-hangzhou',
    endpoint='gpdb.aliyuncs.com',
    connect_timeout=10000,
    read_timeout=10000,
    user_agent='AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-knowledgebase-ops',
))

Core Workflow

1. Knowledge Base Management

Create Knowledge Base

Pre-checks (run in order; not silent idempotency):

  • Duplicate names: If a create step is run again when the resource already exists, the API returns a clear error (e.g. conflict / already exists). Do not create duplicate resources; interpret already-exists-style errors as “this step is satisfied” only when the response clearly indicates the resource is present, then continue the workflow.
  • Retries / ClientToken: For network-level retries (e.g. timeout), use ClientToken when the API or aliyun gpdb exposes it for that subcommand—check aliyun gpdb \x3Csubcommand> --help. The examples below omit it when the plugin does not list it globally.
# 1. Initialize vector database
aliyun gpdb init-vector-database \
  --biz-region-id cn-hangzhou \
  --db-instance-id gp-xxxxx \
  --manager-account admin_user \
  --manager-account-password '\x3Cmanager-account-password>' \
  --user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-knowledgebase-ops

# 2. Create namespace (naming rule: ns_{collection}, public is forbidden)
aliyun gpdb create-namespace \
  --biz-region-id cn-hangzhou \
  --db-instance-id gp-xxxxx \
  --manager-account admin_user \
  --manager-account-password '\x3Cmanager-account-password>' \
  --namespace ns_my_knowledge_base \
  --namespace-password '\x3Cnamespace-password>' \
  --user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-knowledgebase-ops

Important: CreateNamespace MUST be executed before CreateDocumentCollection

Create knowledge base:

# 3. Create knowledge base (in the previously created namespace)
aliyun gpdb create-document-collection \
  --biz-region-id cn-hangzhou \
  --db-instance-id gp-xxxxx \
  --manager-account admin_user \
  --manager-account-password '\x3Cmanager-account-password>' \
  --namespace ns_my_knowledge_base \
  --collection my_knowledge_base \
  --embedding-model text-embedding-v4 \
  --dimension 1024 \
  --user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-knowledgebase-ops

List Knowledge Bases

aliyun gpdb list-document-collections \
  --biz-region-id cn-hangzhou \
  --db-instance-id gp-xxxxx \
  --namespace ns_my_knowledge_base \
  --namespace-password '\x3Cnamespace-password>' \
  --user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-knowledgebase-ops

List Namespaces

aliyun gpdb list-namespaces \
  --biz-region-id cn-hangzhou \
  --db-instance-id gp-xxxxx \
  --manager-account admin_user \
  --manager-account-password '\x3Cmanager-account-password>' \
  --user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-knowledgebase-ops

2. Document Management

Upload Document (Public URL)

aliyun gpdb upload-document-async \
  --biz-region-id cn-hangzhou \
  --db-instance-id gp-xxxxx \
  --namespace ns_my_knowledge_base \
  --namespace-password '\x3Cnamespace-password>' \
  --collection my_knowledge_base \
  --file-name "user_manual.pdf" \
  --file-url "https://example.com/user_manual.pdf" \
  --document-loader-name ADBPGLoader \
  --chunk-size 500 \
  --chunk-overlap 50 \
  --user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-knowledgebase-ops

Upload Document (Local File - SDK)

Local files use Python SDK upload_document_async_advance. Do not paste multi-line Python into the skill; use the packaged script only (default credential chain, user_agent, Config timeouts, and RuntimeOptions timeouts — see scripts/upload_document_local.py).

python3 scripts/upload_document_local.py \
  --region-id cn-hangzhou \
  --db-instance-id gp-xxxxx \
  --namespace ns_my_knowledge_base \
  --namespace-password '\x3Cnamespace-password>' \
  --collection my_knowledge_base \
  --file /path/to/local/file.pdf

See scripts/upload_document_local.py.

Poll Upload Progress

aliyun gpdb get-upload-document-job \
  --biz-region-id cn-hangzhou \
  --db-instance-id gp-xxxxx \
  --namespace ns_my_knowledge_base \
  --namespace-password '\x3Cnamespace-password>' \
  --collection my_knowledge_base \
  --job-id "job-xxxxx" \
  --user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-knowledgebase-ops

List Documents

aliyun gpdb list-documents \
  --biz-region-id cn-hangzhou \
  --db-instance-id gp-xxxxx \
  --namespace ns_my_knowledge_base \
  --namespace-password '\x3Cnamespace-password>' \
  --collection my_knowledge_base \
  --user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-knowledgebase-ops

3. Search & Q&A

Search Knowledge Base

aliyun gpdb query-content \
  --biz-region-id cn-hangzhou \
  --db-instance-id gp-xxxxx \
  --namespace ns_my_knowledge_base \
  --namespace-password '\x3Cnamespace-password>' \
  --collection my_knowledge_base \
  --content "How to configure database parameters?" \
  --topk 10 \
  --rerank-factor 5 \
  --user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-knowledgebase-ops

Knowledge Base Q&A

aliyun gpdb chat-with-knowledge-base \
  --biz-region-id cn-hangzhou \
  --db-instance-id gp-xxxxx \
  --model-params '{"Model":"qwen-max","Messages":[{"Role":"user","Content":"User question"}]}' \
  --knowledge-params '{"SourceCollection":[{"Collection":"my_knowledge_base","Namespace":"ns_my_knowledge_base","NamespacePassword":"\x3Cnamespace-password>","QueryParams":{"TopK":10}}]}' \
  --user-agent AlibabaCloud-Agent-Skills/alibabacloud-analyticdb-postgresql-knowledgebase-ops

Reference Links

Document Content
references/cli-installation-guide.md CLI Installation Guide
references/ram-policies.md RAM Permissions List
references/related-apis.md Related APIs
references/interaction-guidelines.md Interaction Guidelines & Best Practices
references/verification-method.md Verification Method
references/acceptance-criteria.md Acceptance Criteria
references/SKILL.zh-CN.md Chinese Version
requirements.txt Python deps for scripts/
安全使用建议
This skill appears to do what it says: manage ADBPG knowledge bases and upload/search documents. Before using it: (1) Configure your Alibaba Cloud credentials outside the chat (aliyun configure or env vars) and verify with aliyun gpdb describe-regions; (2) review and run pip install -r scripts/requirements.txt in a safe virtualenv before running the included script; (3) do not paste long-lived root credentials in chat—the skill needs manager-account and namespace passwords for gpdb operations, which are sensitive; prefer short-lived or least-privilege RAM credentials and follow the provided RAM policy examples; (4) inspect scripts/upload_document_local.py before running (it validates inputs and uses the SDK, but you should still confirm it meets your security policy). If you need the agent to perform operations autonomously, ensure the account used has least-privilege permissions listed in references/ram-policies.md.
功能分析
Type: OpenClaw Skill Name: alibabacloud-analyticdb-postgresql-knowledgebase-ops Version: 0.0.1 The skill bundle is a legitimate tool for managing Alibaba Cloud AnalyticDB for PostgreSQL (ADBPG) knowledge bases, supporting document ingestion and RAG workflows. The included Python script (scripts/upload_document_local.py) uses the official Alibaba Cloud SDK and implements robust input validation, including regex checks and path traversal prevention. Furthermore, the SKILL.md instructions incorporate explicit security constraints for the AI agent, such as prohibiting the echoing of credentials and requiring user confirmation for all sensitive parameters.
能力标签
requires-walletrequires-oauth-token
能力评估
Purpose & Capability
The name/description (ADBPG knowledge base management) matches the provided CLI examples, RAM policies, API lists, and the included Python upload script. Requiring the aliyun CLI, an ADBPG instance, namespace/manager credentials and the listed gpdb permissions is coherent with the stated purpose.
Instruction Scope
SKILL.md stays focused on creating namespaces/collections, uploading documents, and querying/Q&A. It properly instructs use of the default credential chain and warns about not printing long-lived secrets. One point to note: it asks for manager-account-password and namespace-password to be collected via conversation or command-line for operations — these are sensitive but necessary for gpdb operations; users should prefer configuring CLI credentials (aliyun configure or env vars) outside the chat/session as the docs recommend.
Install Mechanism
This is instruction-only with a single helper script. There is no install spec embedded in the skill bundle. The script relies on standard Alibaba Cloud Python SDK packages listed in scripts/requirements.txt; installing them via pip is normal and expected.
Credentials
The skill does not declare or require unrelated environment variables or credentials. It uses the SDK's default credential chain (CredentialClient) and the CLI for authentication, which is proportionate. Documentation shows how to configure access keys and environment variables (typical for Alibaba Cloud) but the skill warns not to paste long-lived secrets into the conversation.
Persistence & Privilege
The skill does not request always:true or other elevated persistence. It does not attempt to modify other skills or system-wide agent configuration. Autonomous invocation is allowed (platform default) and appropriate for this integration.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install alibabacloud-analyticdb-postgresql-knowledgebase-ops
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /alibabacloud-analyticdb-postgresql-knowledgebase-ops 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.0.1
alibabacloud-analyticdb-postgresql-knowledgebase-ops 0.0.1 - Initial release for ADBPG Knowledge Base Management: create knowledge bases, upload documents, enable semantic search & Q&A via LLM. - Step-by-step instructions for environment setup, credential verification, RAM permission checks, and required CLI/Python toolchain. - Clear parameter confirmation, timeout rules, and operational best practices outlined for reliability and compliance. - Full workflow documentation: resource creation, document upload, and user interaction guidelines for secure and smooth operations. - Targeted at enterprise scenarios involving RAG, intelligent search, and embedding with AnalyticDB PostgreSQL.
元数据
Slug alibabacloud-analyticdb-postgresql-knowledgebase-ops
版本 0.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Alibabacloud Analyticdb Postgresql Knowledgebase Ops 是什么?

ADBPG Knowledge Base Management: Create knowledge bases, upload documents, search, Q&A. Triggers: "knowledge base", "document library", "document upload", "k... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 142 次。

如何安装 Alibabacloud Analyticdb Postgresql Knowledgebase Ops?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install alibabacloud-analyticdb-postgresql-knowledgebase-ops」即可一键安装,无需额外配置。

Alibabacloud Analyticdb Postgresql Knowledgebase Ops 是免费的吗?

是的,Alibabacloud Analyticdb Postgresql Knowledgebase Ops 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Alibabacloud Analyticdb Postgresql Knowledgebase Ops 支持哪些平台?

Alibabacloud Analyticdb Postgresql Knowledgebase Ops 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Alibabacloud Analyticdb Postgresql Knowledgebase Ops?

由 alibabacloud-skills-team(@sdk-team)开发并维护,当前版本 v0.0.1。

💬 留言讨论