skillnet-ai 0.0.1__tar.gz → 0.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ZJUNLP
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,361 @@
1
+ Metadata-Version: 2.4
2
+ Name: skillnet-ai
3
+ Version: 0.0.2
4
+ Summary: Official Python SDK for SkillNet: Create, Evaluate, and Connect AI Skills.
5
+ Author-email: SkillNet Team <liangyuannnnn@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, http://skillnet.openkg.cn
8
+ Project-URL: Source, https://github.com/zjunlp/SkillNet
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.8
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: requests>=2.25.0
16
+ Requires-Dist: openai<2.0,>=1.0
17
+ Requires-Dist: pydantic>=2.0.0
18
+ Requires-Dist: tqdm>=4.0.0
19
+ Requires-Dist: typer>=0.9.0
20
+ Requires-Dist: rich>=13.0.0
21
+ Requires-Dist: PyPDF2>=3.0.0
22
+ Requires-Dist: pycryptodome>=3.20.0
23
+ Requires-Dist: python-docx>=0.8.11
24
+ Requires-Dist: python-pptx>=0.6.21
25
+ Dynamic: license-file
26
+
27
+ # skillnet-ai
28
+
29
+ [![PyPI version](https://badge.fury.io/py/skillnet-ai.svg)](https://badge.fury.io/py/skillnet-ai)
30
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
31
+ [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
32
+
33
+ **skillnet-ai** is the official Python Toolkit for interacting with the SkillNet platform. It allows AI Agents to **Create**, **Evaluate** and **Organize** AI skills at scale. It functions seamlessly as both a powerful Python Library and a feature-rich Command Line Interface (CLI).
34
+
35
+ ---
36
+
37
+ ## 🚀 Features
38
+
39
+ - **🔍 Search**: Find skills using keywords match or semantic search.
40
+ - **📦 One-Line Installation**: Download skill packages directly from GitHub repositories.
41
+ - **✨ Skill Creation**: Automatically convert various sources into structured, reusable `skill` packages using LLMs:
42
+ - Execution trajectories / conversation logs
43
+ - GitHub repositories
44
+ - Office documents (PDF, PPT, Word)
45
+ - Direct text prompts
46
+ - **📊 Evaluation**: Evaluate and score skills for quality assurance (Safety, Completeness, Excutability, Modifiability, Cost-Aware).
47
+ - **🕸️ Relationship Analysis**: Automatically map the connections between skills in your local library, identifying structural relationships between skills (similar_to, belong_to, compose_with, depend_on).
48
+
49
+ ---
50
+
51
+ ## 📥 Installation
52
+
53
+ ```bash
54
+ pip install skillnet-ai
55
+ ```
56
+
57
+ ---
58
+
59
+ ## 🛠 Usage (Python SDK)
60
+
61
+ The `SkillNetClient` provides a unified interface for searching, downloading, creating, and evaluating skills.
62
+
63
+ ### 1. Initialize the Client
64
+
65
+ Initialize the client with your credentials. You can also set `API_KEY` and `GITHUB_TOKEN` in your environment variables.
66
+
67
+ ```python
68
+ from skillnet_ai import SkillNetClient
69
+
70
+ # Initialize with optional credentials
71
+ client = SkillNetClient(
72
+ api_key="sk-...", # Required for AI Search, Creation, and Evaluation
73
+ base_url="...", # Optional custom LLM base URL
74
+ github_token="ghp-..." # Optional, for private repos or higher rate limits
75
+ )
76
+ ```
77
+
78
+ ### 2. Search for Skills
79
+ Perform keywords match or semantic searches to find skills.
80
+
81
+ ```python
82
+ # 1. Standard Keywords Match
83
+ results = client.search(q="pdf tool")
84
+
85
+ # 2. Semantic Search
86
+ results = client.search(q="Help me analyze financial PDF reports", mode="vector")
87
+
88
+ if results:
89
+ top_skill = results[0]
90
+ print(f"Found: {top_skill.skill_name} (Stars: {top_skill.stars})")
91
+ print(f"URL: {top_skill.skill_url}")
92
+ ```
93
+ #### Parameter Reference
94
+ | Parameter | Type | Default | Description |
95
+ |------------|--------|-------------|-------------|
96
+ | q | str | Required | Search query (keywords or natural language). |
97
+ | mode | str | "keyword" | Search mode: "keyword" or "vector". |
98
+ | category | str | None | Filter skills by category. |
99
+ | limit | int | 20 | Maximum number of results per request. |
100
+ | page | int | 1 | [Keyword Mode Only] Page number for pagination. |
101
+ | min_stars | int | 0 | [Keyword Mode Only] Filter by minimum star count. |
102
+ | sort_by | str | "stars" | [Keyword Mode Only] Sort by "stars" or "recent". |
103
+ | threshold | float | 0.8 | [Vector Mode Only] Minimum similarity threshold (0.0 - 1.0). |
104
+
105
+
106
+ ### 3. Install Skills
107
+ Download and install a skill directly from a URL (e.g., from above search results) into your local workspace.
108
+
109
+ ```python
110
+ skill_url = "https://github.com/anthropics/skills/tree/main/skills/skill-creator"
111
+
112
+ try:
113
+ # Downloads to ./my_agent_skills
114
+ local_path = client.download(url=skill_url, target_dir="./my_agent_skills")
115
+ print(f"Skill successfully installed at: {local_path}")
116
+ except Exception as e:
117
+ print(f"Download failed: {e}")
118
+ ```
119
+
120
+ ### 4. Create Skills
121
+ #### 4.1 Create from Local Trajectory
122
+ Turn conversation logs or execution traces into a polished Skill Package (SKILL.md, scripts, etc.).
123
+
124
+ ```python
125
+ # 1. Prepare your trajectory (e.g., a conversation log string)
126
+ trajectory_log = """
127
+ User: I need to rename all .jpg files in this folder to .png.
128
+ Agent: I will write a python script to iterate through the folder...
129
+ Agent: Script executed. Renamed 5 files.
130
+ """
131
+
132
+ # 2. Generate Skills
133
+ # Returns a list of paths to the generated skill folders
134
+ created_paths = client.create(
135
+ trajectory_content=trajectory_log,
136
+ output_dir="./created_skills",
137
+ model="gpt-4o"
138
+ )
139
+
140
+ print(f"Created {len(created_paths)} new skills.")
141
+ for path in created_paths:
142
+ print(f"- {path}")
143
+ ```
144
+
145
+ #### 4.2 Create from GitHub Repository
146
+ Convert an existing GitHub repository into a skill package.
147
+
148
+ ```python
149
+ # Create skill from a GitHub repository
150
+ created_paths = client.create(
151
+ github_url="https://github.com/zjunlp/DeepKE",
152
+ output_dir="./created_skills",
153
+ model="gpt-4o"
154
+ )
155
+ ```
156
+
157
+ #### 4.3 Create from Office Documents
158
+ Convert PDF, PowerPoint, or Word documents into skill packages.
159
+
160
+ ```python
161
+ # Create skill from a PDF document
162
+ created_paths = client.create(
163
+ office_file="./docs/user_guide.pdf",
164
+ output_dir="./created_skills"
165
+ )
166
+ ```
167
+
168
+ #### 4.4 Create from Prompt
169
+ Generate a skill directly from a text description.
170
+
171
+ ```python
172
+ # Create skill from a prompt description
173
+ created_paths = client.create(
174
+ prompt="Create a skill for web scraping that extracts article titles and content",
175
+ output_dir="./created_skills"
176
+ )
177
+ ```
178
+
179
+ ### 5. Skill Evaluation
180
+ Assess the Safety, Completeness, Executability, Modifiability and Cost-Aware of a skill. Supports both remote GitHub URLs and local directories.
181
+
182
+ ```python
183
+ # Evaluate from local directory
184
+ # target_skill = "./my_skills/web_search"
185
+
186
+ # Evaluate from GitHub URL (uses github_token if provided during initialization)
187
+ target_skill = "https://github.com/microsoft/autogen/tree/main/samples/tools/web_search"
188
+
189
+ result = client.evaluate(target=target_skill)
190
+ print(f"Evaluation Result: {result}")
191
+ ```
192
+
193
+ ### 6. Skill Relationship Analysis
194
+ Analyze a local directory containing multiple skills to infer a relationship graph. It identifies relationships like dependencies (depend_on), collaboration (compose_with), hierarchy (belong_to), and alternatives (similar_to).
195
+
196
+ ```python
197
+ # Directory containing multiple skill folders
198
+ skills_directory = "./my_agent_skills"
199
+
200
+ # Analyze relationships between skills
201
+ # This will also save a 'relationships.json' in the directory by default
202
+ relationships = client.analyze(skills_dir=skills_directory)
203
+
204
+ # Display the relationships
205
+ for rel in relationships:
206
+ print(f"{rel['source']} --[{rel['type']}]--> {rel['target']}")
207
+ # Output: PDF_Parser --[compose_with]--> Text_Summarizer
208
+ ```
209
+
210
+ ---
211
+
212
+ ## 💻 CLI Usage
213
+
214
+ skillnet-ai provides a robust Command Line Interface (CLI) powered by `Typer` and `Rich`. It allows you to create, evaluate, and organize skills directly from the terminal with visual feedback.
215
+
216
+ **Tip:** You can view the full list of options for any command using `--help` (e.g., `skillnet search --help`).
217
+
218
+ ### 1. Search Skills (`search`)
219
+
220
+ Search the registry using keywords match or semantic search.
221
+
222
+ ```bash
223
+ # Basic keywords match
224
+ skillnet search "pdf extraction"
225
+
226
+ # Semantic/Vector search (finds skills by meaning)
227
+ skillnet search "tools for reading financial documents" --mode vector --threshold 0.85
228
+
229
+ # Filter by category and sort results
230
+ skillnet search "visualization" --category "Data" --sort-by stars --limit 10
231
+ ```
232
+
233
+ #### Key Options:
234
+
235
+ | Option | Type | Default | Description |
236
+ |--------------|-------|----------|-------------|
237
+ | q (Argument) | str | Required | Your search query (keywords or natural language description). |
238
+ | --mode | str | keyword | Search mode: keyword (fuzzy match) or vector (AI semantic). |
239
+ | --category | str | None | Filter results by category (e.g., `Development`, `Business`). |
240
+ | --limit | int | 20 | Maximum number of results to return. |
241
+ | **[Keyword Mode Only]** | | | |
242
+ | --page | int | 1 | Page number for pagination. |
243
+ | --min-stars | int | 0 | Minimum star rating required. |
244
+ | --sort-by | str | stars | Sort criteria: stars or recent. |
245
+ | **[Vector Mode Only]** | | | |
246
+ | --threshold | float | 0.8 | Similarity threshold (0.0–1.0). Higher is stricter. |
247
+
248
+
249
+ ### 2. Install Skills (`download`)
250
+
251
+ Download and install a skill directly from a GitHub repository subdirectory.
252
+
253
+ ```bash
254
+ # Download to the current directory
255
+ skillnet download https://github.com/owner/repo/tree/main/skills/math_solver
256
+
257
+ # Download to a specific target directory
258
+ skillnet download https://github.com/owner/repo/tree/main/skills/math_solver -d ./my_agent/skills
259
+
260
+ # Download from a private repository
261
+ skillnet download <private_url> --token <your_github_token>
262
+ ```
263
+
264
+ ### 3. Create Skills (`create`)
265
+
266
+ Generate structured Skill Packages from various sources using LLMs.
267
+
268
+ Requirement: Ensure API_KEY is set in your environment variables.
269
+
270
+ ```bash
271
+ # From a trajectory file
272
+ skillnet create ./logs/trajectory.txt -d ./generated_skills
273
+
274
+ # From a GitHub repository
275
+ skillnet create --github https://github.com/owner/repo
276
+
277
+ # From an office document (PDF, PPT, Word)
278
+ skillnet create --office ./docs/guide.pdf
279
+
280
+ # From a direct prompt
281
+ skillnet create --prompt "Create a skill for extracting tables from images"
282
+
283
+ # Specify a custom model
284
+ skillnet create --office report.pdf --model gpt-4o
285
+ ```
286
+
287
+ ### 4. Evaluate Skills (`evaluate`)
288
+ Generate a comprehensive quality report (Safety, Completeness, Executability, Modifiability, Cost Awareness) for a skill.
289
+
290
+ Requirement: Ensure API_KEY is set in your environment variables.
291
+
292
+ ```bash
293
+ # Evaluate a remote skill via GitHub URL
294
+ skillnet evaluate https://github.com/owner/repo/tree/main/skills/web_search
295
+
296
+ # Evaluate a local skill directory
297
+ skillnet evaluate ./my_skills/web_search
298
+
299
+ # Custom evaluation config
300
+ skillnet evaluate ./my_skills/tool --category "DevOps" --model gpt-4o
301
+ ```
302
+
303
+ ### 5. Analyze Relationships (`analyze`)
304
+ Scan a directory of skills to analyze their connections using AI.
305
+
306
+ Requirement: Ensure API_KEY is set in your environment variables.
307
+
308
+ ```bash
309
+ # Analyze a directory containing multiple skill folders
310
+ skillnet analyze ./my_agent_skills
311
+
312
+ # Analyze without saving the result file (just print to console)
313
+ skillnet analyze ./my_agent_skills --no-save
314
+
315
+ # Specify a model for the analysis
316
+ skillnet analyze ./my_agent_skills --model gpt-4o
317
+ ```
318
+
319
+ ## ⚙️ Configuration
320
+
321
+ ### Environment Variables
322
+
323
+ If you are using the **Creation**, **Evaluation**, or **Analyze** feature, you must configure your LLM provider.
324
+
325
+ | Variable | Description | Default |
326
+ | :--- | :--- | :--- |
327
+ | `API_KEY` | Required for creating or evaluating skills. | `None` |
328
+ | `BASE_URL` | Optional. Useful if using a proxy or compatible API. | `https://api.openai.com/v1` |
329
+
330
+ ---
331
+
332
+ ## 📂 Skill Structure
333
+
334
+ When you create or install a skill, it follows the **Standard Skill Structure**:
335
+
336
+ ```text
337
+ skill-name/
338
+ ├── SKILL.md # (required) Main orchestration file (YAML metadata + Instructions)
339
+ ├── scripts/ # (optional) Executable Python/Bash scripts
340
+ ├── references/ # (optional) Static documentation or API specs
341
+ └── assets/ # (optional) Templates, icons, etc.
342
+ ```
343
+
344
+ ---
345
+
346
+ ## 🗺 Roadmap
347
+
348
+ - [x] Keywords Match & Semantic Search
349
+ - [x] Skill Installer
350
+ - [x] Skill Creator (Local File & GitHub Repository)
351
+ - [x] Skill Evaluation & Scoring
352
+
353
+ ---
354
+
355
+ ## 🤝 Contributing
356
+
357
+ Contributions are welcome! Please submit a Pull Request or open an Issue on GitHub.
358
+
359
+ ## 📄 License
360
+
361
+ This project is licensed under the [MIT License](LICENSE).