Skip to content

Commit 19b0087

Browse files
docs(skills): prefer host-managed environment variables (#17792)
* docs(skills): prefer host-managed environment variables * docs(skills): add readme prerequisites * docs(skills): clarify smoke test env setup * docs(skills): simplify smoke test wording * docs(skills): merge readme guidance into env-first pr * Apply suggestion from @Bobholamovic * Update skills/paddleocr-text-recognition/scripts/smoke_test.py Co-authored-by: Lin Manhui <mhlin425@whu.edu.cn> * docs(skills): refine review wording in guides * docs(skills): complete readme setup steps * docs(skills): clarify install and usage flow * Update docs and fix bugs --------- Co-authored-by: Lin Manhui <mhlin425@whu.edu.cn> Co-authored-by: Bobholamovic <bob1998425@hotmail.com>
1 parent 949efb3 commit 19b0087

11 files changed

Lines changed: 425 additions & 137 deletions

File tree

skills/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ PADDLEOCR_DOC_PARSING_API_URL=
3232
# ============================================
3333

3434
# Request timeout (milliseconds, default 25000)
35-
# PADDLEOCR_TIMEOUT_MS=25000
35+
# PADDLEOCR_OCR_TIMEOUT=25000
3636

3737
# Log level (DEBUG/INFO/WARNING/ERROR, default INFO)
3838
# PADDLEOCR_LOG_LEVEL=INFO

skills/README.ch.md

Lines changed: 0 additions & 36 deletions
This file was deleted.

skills/README.md

Lines changed: 162 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,177 @@
11
# PaddleOCR Skills
22

3-
This directory contains AI agent skills for PaddleOCR official APIs.
3+
This directory contains official PaddleOCR Agent Skills. They integrate with AI apps such as Claude Code for OCR text extraction from images/PDFs and layout-aware document parsing.
44

55
## Included Skills
66

7-
- `paddleocr-text-recognition`: OCR text extraction for images/PDFs.
8-
- `paddleocr-doc-parsing`: document parsing for layout-aware extraction.
7+
- `paddleocr-text-recognition`: extract text from images/PDFs.
8+
- `paddleocr-doc-parsing`: document parsing that converts images/PDFs to Markdown.
99

10-
## Quick Start
10+
## Prerequisites
1111

12-
1. Install dependencies for the skill you use.
13-
2. Configure API credentials interactively:
14-
```bash
15-
python skills/paddleocr-text-recognition/scripts/configure.py
16-
```
17-
Or manually copy `.env.example` to `.env` and fill in your credentials: `cp skills/.env.example skills/.env`
18-
3. Run smoke tests:
12+
1. Python 3.8 or later must be installed on the device that runs the skill.
13+
2. These skills depend on PaddleOCR official APIs and require API credentials. Visit the [PaddleOCR website](https://www.paddleocr.com), click **API**, select the model you need, then copy the `API_URL` and `Token`. They correspond to the API URL and access token used for authentication. Supported models per skill:
14+
- `paddleocr-text-recognition`: `PP-OCRv5`
15+
- `paddleocr-doc-parsing`: `PP-StructureV3`, `PaddleOCR-VL`, `PaddleOCR-VL-1.5`
16+
17+
## Using in AI Apps
18+
19+
### Install to AI Apps
20+
21+
#### Option 1: Install via `skills` CLI
22+
23+
The `skills` CLI installs skills globally on the device so all AI apps can use them. [Node.js](https://nodejs.org/en/download) is required.
24+
25+
```shell
26+
npx skills add PaddlePaddle/PaddleOCR -g --skill paddleocr-text-recognition -y
27+
npx skills add PaddlePaddle/PaddleOCR -g --skill paddleocr-doc-parsing -y
28+
```
29+
30+
> This repository is relatively large. On slower networks, `npx skills add` may time out. If that happens, clone the repository locally first, then install from the local path:
31+
>
32+
> ```shell
33+
> git clone https://github.com/PaddlePaddle/PaddleOCR.git
34+
> npx skills add ./PaddleOCR/skills/paddleocr-text-recognition
35+
> ```
36+
37+
#### Option 2: Install via `clawhub` (OpenClaw)
38+
39+
```shell
40+
clawhub install paddleocr-text-recognition
41+
clawhub install paddleocr-doc-parsing
42+
```
43+
44+
See the [OpenClaw Skills documentation](https://docs.openclaw.ai/tools/skills) for details.
45+
46+
#### Option 3: Manual installation
1947

20-
```bash
21-
python skills/paddleocr-text-recognition/scripts/smoke_test.py
22-
python skills/paddleocr-doc-parsing/scripts/smoke_test.py
48+
If the above options are not available, you can clone the repository and manually copy the skill directories to the location required by your AI app ([Git](https://git-scm.com/downloads) required):
49+
50+
```shell
51+
git clone https://github.com/PaddlePaddle/PaddleOCR.git
2352
```
2453

25-
## Documentation
54+
After cloning, skill source code is located under `PaddleOCR/skills`. Refer to the documentation for your AI app to complete installation:
55+
56+
- Claude Code: <https://code.claude.com/docs/en/skills>
57+
- claude.ai: <https://support.claude.com/en/articles/12512180-use-skills-in-claude>
58+
- OpenClaw: <https://docs.openclaw.ai/tools/skills>
59+
60+
### Configure Environment Variables
61+
62+
After installation, configure the required environment variables so the skills can work properly. Each skill requires the following:
63+
64+
| Skill | Required | Optional |
65+
| --- | --- | --- |
66+
| `paddleocr-text-recognition` | `PADDLEOCR_OCR_API_URL` (API URL), `PADDLEOCR_ACCESS_TOKEN` (access token) | `PADDLEOCR_OCR_TIMEOUT` (timeout) |
67+
| `paddleocr-doc-parsing` | `PADDLEOCR_DOC_PARSING_API_URL` (API URL), `PADDLEOCR_ACCESS_TOKEN` (access token) | `PADDLEOCR_DOC_PARSING_TIMEOUT` (timeout) |
68+
69+
You can ask the AI in natural language (e.g., "I need to configure paddleocr-text-recognition skill"), or configure manually. Below are manual configuration methods for some AI apps:
70+
71+
- **Claude Code**: add an `env` field to `.claude/settings.local.json` in your project:
2672

27-
- Text recognition: `skills/paddleocr-text-recognition/SKILL.md`
28-
- Doc parsing: `skills/paddleocr-doc-parsing/SKILL.md`
73+
```json
74+
{
75+
"env": {
76+
"PADDLEOCR_ACCESS_TOKEN": "<ACCESS_TOKEN>",
77+
"PADDLEOCR_OCR_API_URL": "<OCR_API_URL>",
78+
"PADDLEOCR_DOC_PARSING_API_URL": "<DOC_PARSING_API_URL>"
79+
}
80+
}
81+
```
2982

30-
## API Access
83+
- **OpenClaw**: add skill configuration to `~/.openclaw/openclaw.json`:
3184

32-
Get API credentials from the PaddleOCR official website: <https://www.paddleocr.com>
85+
```json
86+
{
87+
"skills": {
88+
"entries": {
89+
"paddleocr-text-recognition": {
90+
"enabled": true,
91+
"apiKey": "<ACCESS_TOKEN>",
92+
"env": {
93+
"PADDLEOCR_OCR_API_URL": "<OCR_API_URL>"
94+
}
95+
},
96+
"paddleocr-doc-parsing": {
97+
"enabled": true,
98+
"apiKey": "<ACCESS_TOKEN>",
99+
"env": {
100+
"PADDLEOCR_DOC_PARSING_API_URL": "<DOC_PARSING_API_URL>"
101+
}
102+
}
103+
}
104+
}
105+
}
106+
```
107+
108+
### Usage Examples
109+
110+
After configuration, describe the OCR or document parsing task in natural language and provide a file URL or local path so the AI app can invoke the corresponding skill.
111+
112+
**paddleocr-text-recognition**
113+
114+
URL example:
115+
116+
```text
117+
Extract all text from this file: https://example.com/invoice.jpg
118+
```
33119

34-
## License
120+
Local file example:
35121

36-
[Apache License 2.0](../LICENSE)
122+
```text
123+
Extract all text from local file C:\docs\invoice.pdf
124+
```
125+
126+
**paddleocr-doc-parsing**
127+
128+
URL example:
129+
130+
```text
131+
Parse this PDF and return the main body plus all tables: https://example.com/report.pdf
132+
```
133+
134+
Local file example:
135+
136+
```text
137+
Parse local file C:\docs\report.pdf and return complete structured output.
138+
```
139+
140+
## Local Testing
141+
142+
This section describes how to run smoke tests locally to verify that the skills work correctly.
143+
144+
> The examples below cover both skills. Run only the commands for the skill you need.
145+
146+
Make sure your working directory is the directory containing this file.
147+
148+
1. Install dependencies.
149+
150+
```shell
151+
python -m pip install -r paddleocr-text-recognition/scripts/requirements.txt
152+
python -m pip install -r paddleocr-doc-parsing/scripts/requirements.txt
153+
# Optional: required only when using document file optimization
154+
python -m pip install -r paddleocr-doc-parsing/scripts/requirements-optimize.txt
155+
```
156+
157+
2. Configure environment variables (see [Configure Environment Variables](#configure-environment-variables) for the list of variables). Choose one of the following methods:
158+
159+
**Option A**: run the interactive configuration script.
160+
161+
```shell
162+
python paddleocr-text-recognition/scripts/configure.py
163+
python paddleocr-doc-parsing/scripts/configure.py
164+
```
165+
166+
**Option B**: create a local `.env` file from the `.env.example` template and fill in the required variables.
167+
168+
```shell
169+
cp .env.example .env
170+
```
171+
172+
3. Run the smoke test scripts.
173+
174+
```shell
175+
python paddleocr-text-recognition/scripts/smoke_test.py
176+
python paddleocr-doc-parsing/scripts/smoke_test.py
177+
```

0 commit comments

Comments
 (0)