@ia-ccun/code-agent-cli 0.0.52 → 0.0.53-beta.1
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.
- package/bin/cli.js +6 -2
- package/config/agent/bin/README.md +102 -0
- package/config/agent/extensions/aicode-advisor.ts +13 -0
- package/config/agent/extensions/aicode-btw.ts +66 -14
- package/config/agent/extensions/aicode-cd.ts +834 -0
- package/config/agent/extensions/aicode-grillMe.ts +198 -0
- package/config/agent/extensions/aicode-pets.ts +362 -0
- package/config/agent/extensions/aicode-safety-guard.ts +552 -0
- package/config/agent/extensions/aicode-tips.ts +70 -16
- package/config/agent/extensions/aicode-todo-progress.ts +547 -0
- package/config/agent/extensions/custom.ts +93 -95
- package/config/agent/extensions/error-monitor.ts +1 -18
- package/config/agent/extensions/ponytail.ts +441 -0
- package/config/agent/extensions/tps.ts +87 -0
- package/config/agent/extensions/working-msg.ts +165 -50
- package/config/agent/help.md +0 -7
- package/config/agent/models.json +7 -7
- package/config/agent/settings.json +2 -1
- package/config/agent/skills/chroma/LICENSE +21 -0
- package/config/agent/skills/chroma/chroma-local/SKILL.md +165 -0
- package/config/agent/skills/chroma/chroma-local/cli.md +48 -0
- package/config/agent/skills/chroma/chroma-local/data-model.md +103 -0
- package/config/agent/skills/chroma/chroma-local/error-handling/python.md +166 -0
- package/config/agent/skills/chroma/chroma-local/error-handling/typescript.md +231 -0
- package/config/agent/skills/chroma/chroma-local/local-chroma/python.md +95 -0
- package/config/agent/skills/chroma/chroma-local/local-chroma/typescript.md +101 -0
- package/config/agent/skills/chroma/chroma-local/metadata/python.md +154 -0
- package/config/agent/skills/chroma/chroma-local/metadata/typescript.md +153 -0
- package/config/agent/skills/chroma/chroma-local/querying/python.md +147 -0
- package/config/agent/skills/chroma/chroma-local/querying/typescript.md +157 -0
- package/config/agent/skills/chroma/chroma-local/regex/python.md +69 -0
- package/config/agent/skills/chroma/chroma-local/regex/typescript.md +71 -0
- package/config/agent/skills/chroma/chroma-local/understanding-a-codebase.md +80 -0
- package/config/agent/skills/chroma/chroma-local/updating-deleting/python.md +159 -0
- package/config/agent/skills/chroma/chroma-local/updating-deleting/typescript.md +228 -0
- package/config/agent/skills/milvus-skill/LICENSE +202 -0
- package/config/agent/skills/milvus-skill/README.md +37 -0
- package/config/agent/skills/milvus-skill/SKILL.md +259 -0
- package/config/agent/skills/milvus-skill/references/collection.md +86 -0
- package/config/agent/skills/milvus-skill/references/database.md +24 -0
- package/config/agent/skills/milvus-skill/references/index.md +69 -0
- package/config/agent/skills/milvus-skill/references/partition.md +29 -0
- package/config/agent/skills/milvus-skill/references/patterns.md +150 -0
- package/config/agent/skills/milvus-skill/references/user-role.md +90 -0
- package/config/agent/skills/milvus-skill/references/vector.md +247 -0
- package/config/agent/skills/ponytail/SKILL.md +100 -0
- package/config/agent/skills/ponytail-audit/SKILL.md +40 -0
- package/config/agent/skills/ponytail-debt/SKILL.md +44 -0
- package/config/agent/skills/ponytail-help/SKILL.md +68 -0
- package/config/agent/skills/ponytail-review/SKILL.md +56 -0
- package/config/agent/skills/zread/README.md +115 -0
- package/config/agent/skills/zread/SKILL.md +103 -0
- package/config/agent/skills/zread/references/stdio-protocol.md +312 -0
- package/package.json +7 -6
- package/scripts/postinstall.js +58 -1
- package/scripts/regression/README.md +224 -0
- package/scripts/regression/cases/01-version-and-deps.sh +94 -0
- package/scripts/regression/cases/02-extension-loading.sh +130 -0
- package/scripts/regression/cases/03-rpc-protocol.sh +259 -0
- package/scripts/regression/cases/04-prompt-stream.sh +130 -0
- package/scripts/regression/cases/05-slash-commands-and-skills.sh +119 -0
- package/scripts/regression/cases/06-tool-execution.sh +115 -0
- package/scripts/regression/cases/07-pi-new-features.sh +141 -0
- package/scripts/regression/lib/common.sh +287 -0
- package/scripts/regression/results/.last_pid +1 -0
- package/scripts/regression/results/.last_workdir +1 -0
- package/scripts/regression/results/02-extension-loading.log +29 -0
- package/scripts/regression/results/03-prompt-stream.log +25 -0
- package/scripts/regression/results/03-rpc-protocol.log +38 -0
- package/scripts/regression/results/04-slash-commands-and-skills.log +10 -0
- package/scripts/regression/results/05-tool-execution.log +6 -0
- package/scripts/regression/results/06-pi-new-features.log +33 -0
- package/scripts/regression/run-all.sh +187 -0
- package/config/agent/dangerous-patterns.json +0 -106
- package/config/agent/extensions/bash-check.ts +0 -227
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# milvus-skill
|
|
2
|
+
|
|
3
|
+
An agent skill that teaches LLMs how to use [pymilvus](https://github.com/milvus-io/pymilvus) to operate [Milvus](https://milvus.io/) vector database.
|
|
4
|
+
|
|
5
|
+
## What's Included
|
|
6
|
+
|
|
7
|
+
- **SKILL.md** — Main skill definition with connection, collection management, vector operations, and index management
|
|
8
|
+
- **references/** — Detailed reference docs for each feature area:
|
|
9
|
+
- `collection.md` — Data types, schema fields, collection operations
|
|
10
|
+
- `vector.md` — Insert, search, hybrid search, full-text search, iterators, filters
|
|
11
|
+
- `index.md` — Index types, metric types, create/manage indexes
|
|
12
|
+
- `partition.md` — Partition CRUD
|
|
13
|
+
- `database.md` — Database management
|
|
14
|
+
- `user-role.md` — RBAC: users, roles, privileges
|
|
15
|
+
- `patterns.md` — Common patterns (RAG, semantic search, hybrid search, full-text search)
|
|
16
|
+
|
|
17
|
+
## Install as Claude Code Skill
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
claude skill add --url https://github.com/zilliztech/milvus-skill
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Capabilities
|
|
24
|
+
|
|
25
|
+
- Connect to Milvus Lite, Standalone, Cluster, or Zilliz Cloud
|
|
26
|
+
- Create collections with quick or custom schemas
|
|
27
|
+
- Insert, upsert, search, query, get, delete vectors
|
|
28
|
+
- Hybrid search with RRF/Weighted reranking
|
|
29
|
+
- Full-text search with BM25
|
|
30
|
+
- Paginated iteration over large result sets
|
|
31
|
+
- Index management (AUTOINDEX, HNSW, IVF_FLAT, etc.)
|
|
32
|
+
- Partition, database, and RBAC management
|
|
33
|
+
|
|
34
|
+
## Requirements
|
|
35
|
+
|
|
36
|
+
- Python 3.8+
|
|
37
|
+
- `pymilvus` (`pip install pymilvus`)
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: milvus-skill
|
|
3
|
+
description: Operate Milvus vector database with pymilvus Python SDK. Use when the user wants to connect to Milvus, create collections, insert vectors, perform similarity search, hybrid search, full-text search, manage indexes, partitions, databases, or RBAC via Python code.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
compatibility: Requires Python 3.8+ and pymilvus (pip install pymilvus). Runs on macOS and Linux.
|
|
6
|
+
metadata:
|
|
7
|
+
author: zilliztech
|
|
8
|
+
version: "1.0.0"
|
|
9
|
+
allowed-tools: Bash Read Write
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Milvus Vector Database Skill
|
|
13
|
+
|
|
14
|
+
Operate [Milvus](https://milvus.io/) vector databases directly through Python code using the `pymilvus` SDK. Covers the full lifecycle — connecting, schema design, collection management, vector CRUD, search, hybrid search, full-text search, indexing, partitions, databases, and RBAC.
|
|
15
|
+
|
|
16
|
+
## When to Use
|
|
17
|
+
|
|
18
|
+
Use this skill when the user wants to:
|
|
19
|
+
- Connect to a Milvus instance (local, standalone, cluster, or Milvus Lite)
|
|
20
|
+
- Create collections with custom schemas
|
|
21
|
+
- Insert, upsert, search, query, get, or delete vectors
|
|
22
|
+
- Perform hybrid search with reranking
|
|
23
|
+
- Perform full-text search (BM25)
|
|
24
|
+
- Manage indexes, partitions, databases
|
|
25
|
+
- Set up users, roles, and access control (RBAC)
|
|
26
|
+
- Build RAG pipelines, semantic search, or recommendation systems with Milvus
|
|
27
|
+
- Iterate over large result sets with search/query iterators
|
|
28
|
+
|
|
29
|
+
## Requirements
|
|
30
|
+
|
|
31
|
+
- Python 3.8+
|
|
32
|
+
- `pymilvus` (`pip install pymilvus`)
|
|
33
|
+
- A running Milvus instance, or use Milvus Lite (embedded, file-based) for development
|
|
34
|
+
|
|
35
|
+
## Capabilities Overview
|
|
36
|
+
|
|
37
|
+
| Area | What You Can Do |
|
|
38
|
+
|------|----------------|
|
|
39
|
+
| **Connection** | Connect to Milvus Lite, Standalone, Cluster, or Zilliz Cloud |
|
|
40
|
+
| **Collections** | Create (quick or custom schema), list, describe, drop, rename, truncate, load, release |
|
|
41
|
+
| **Vectors** | Insert, upsert, search, hybrid search, query, get, delete |
|
|
42
|
+
| **Full-Text Search** | BM25-based keyword search with sparse vectors |
|
|
43
|
+
| **Iterators** | Paginated search and query over large datasets |
|
|
44
|
+
| **Indexes** | Create (AUTOINDEX, HNSW, IVF_FLAT, etc.), list, describe, drop |
|
|
45
|
+
| **Partitions** | Create, list, load, release, drop |
|
|
46
|
+
| **Databases** | Create, list, switch, drop |
|
|
47
|
+
| **RBAC** | Users, roles, privileges management |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Connection
|
|
52
|
+
|
|
53
|
+
> **IMPORTANT: Before writing any connection code, you MUST ask the user for their connection details.** Ask:
|
|
54
|
+
> 1. **Deployment type** — Milvus Lite (local file), Standalone/Cluster (self-hosted), or Zilliz Cloud (managed)?
|
|
55
|
+
> 2. **URI** — For self-hosted: host and port (e.g., `http://localhost:19530`). For Zilliz Cloud: the endpoint URL.
|
|
56
|
+
> 3. **Authentication** — Token, API key, or username/password if required.
|
|
57
|
+
> 4. **Database name** — If not using the default database.
|
|
58
|
+
>
|
|
59
|
+
> **Never assume or hardcode connection parameters.** Use Milvus Lite (`uri="./milvus.db"`) only if the user explicitly wants local/embedded mode for development.
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from pymilvus import MilvusClient
|
|
63
|
+
|
|
64
|
+
# Milvus Lite (embedded, file-based — great for dev/test)
|
|
65
|
+
client = MilvusClient(uri="./milvus.db")
|
|
66
|
+
|
|
67
|
+
# Standalone / Cluster Milvus (ask user for actual host:port and credentials)
|
|
68
|
+
client = MilvusClient(uri="<USER_URI>", token="<USER_TOKEN>")
|
|
69
|
+
|
|
70
|
+
# Zilliz Cloud (ask user for endpoint and API key)
|
|
71
|
+
client = MilvusClient(uri="<USER_ZILLIZ_ENDPOINT>", token="<USER_API_KEY>")
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Parameters:**
|
|
75
|
+
|
|
76
|
+
| Parameter | Type | Description |
|
|
77
|
+
|-----------|------|-------------|
|
|
78
|
+
| `uri` | str | `"./file.db"` for Milvus Lite, `"http://host:19530"` for server |
|
|
79
|
+
| `token` | str | API key or `"username:password"` |
|
|
80
|
+
| `user` | str | Username (alternative to token) |
|
|
81
|
+
| `password` | str | Password (alternative to token) |
|
|
82
|
+
| `db_name` | str | Target database (default: `"default"`) |
|
|
83
|
+
| `timeout` | float | Operation timeout in seconds |
|
|
84
|
+
|
|
85
|
+
### Async Client
|
|
86
|
+
|
|
87
|
+
```python
|
|
88
|
+
from pymilvus import AsyncMilvusClient
|
|
89
|
+
|
|
90
|
+
async with AsyncMilvusClient(uri="<USER_URI>") as client:
|
|
91
|
+
results = await client.search(collection_name="my_collection", data=[query_vector], limit=10)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Collection Management
|
|
97
|
+
|
|
98
|
+
### Quick Create (auto schema + auto index + auto load)
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
client.create_collection(
|
|
102
|
+
collection_name="my_collection",
|
|
103
|
+
dimension=768,
|
|
104
|
+
metric_type="COSINE" # Optional: "COSINE" (default), "L2", "IP"
|
|
105
|
+
)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
This automatically creates an `id` field (INT64, primary key, auto_id), a `vector` field (FLOAT_VECTOR), AUTOINDEX, and auto-loads the collection.
|
|
109
|
+
|
|
110
|
+
### Custom Schema Create
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
from pymilvus import DataType
|
|
114
|
+
|
|
115
|
+
schema = client.create_schema(auto_id=False, enable_dynamic_field=True)
|
|
116
|
+
schema.add_field("id", DataType.INT64, is_primary=True)
|
|
117
|
+
schema.add_field("text", DataType.VARCHAR, max_length=512)
|
|
118
|
+
schema.add_field("embedding", DataType.FLOAT_VECTOR, dim=768)
|
|
119
|
+
|
|
120
|
+
index_params = client.prepare_index_params()
|
|
121
|
+
index_params.add_index(field_name="embedding", index_type="AUTOINDEX", metric_type="COSINE")
|
|
122
|
+
|
|
123
|
+
client.create_collection(collection_name="my_collection", schema=schema, index_params=index_params)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**See [references/collection.md](references/collection.md) for data types, add_field parameters, and all collection operations.**
|
|
127
|
+
|
|
128
|
+
### Other Collection Operations
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
client.list_collections()
|
|
132
|
+
client.describe_collection(collection_name="my_collection")
|
|
133
|
+
client.has_collection(collection_name="my_collection")
|
|
134
|
+
client.rename_collection(old_name="old", new_name="new")
|
|
135
|
+
client.drop_collection(collection_name="my_collection")
|
|
136
|
+
client.truncate_collection(collection_name="my_collection")
|
|
137
|
+
client.load_collection(collection_name="my_collection")
|
|
138
|
+
client.release_collection(collection_name="my_collection")
|
|
139
|
+
client.get_load_state(collection_name="my_collection")
|
|
140
|
+
client.get_collection_stats(collection_name="my_collection")
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
- Quick create is best for prototyping; use custom schema for production.
|
|
144
|
+
- A collection must be **loaded** before search or query.
|
|
145
|
+
- Use `enable_dynamic_field=True` to allow inserting fields not defined in the schema.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Vector Operations
|
|
150
|
+
|
|
151
|
+
**See [references/vector.md](references/vector.md) for hybrid search, full-text search, iterators, filter syntax, and detailed examples.**
|
|
152
|
+
|
|
153
|
+
### Insert / Upsert
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
# Vectors must come from an embedding model — never use fake/placeholder vectors
|
|
157
|
+
from pymilvus import model
|
|
158
|
+
|
|
159
|
+
embedding_fn = model.dense.SentenceTransformerEmbeddingFunction(model_name="all-MiniLM-L6-v2")
|
|
160
|
+
|
|
161
|
+
docs = ["AI advances in 2024", "ML basics for beginners"]
|
|
162
|
+
vectors = embedding_fn.encode_documents(docs)
|
|
163
|
+
|
|
164
|
+
data = [
|
|
165
|
+
{"id": 1, "text": docs[0], "embedding": vectors[0]},
|
|
166
|
+
{"id": 2, "text": docs[1], "embedding": vectors[1]},
|
|
167
|
+
]
|
|
168
|
+
client.insert(collection_name="my_collection", data=data)
|
|
169
|
+
client.upsert(collection_name="my_collection", data=data)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Search (vector similarity)
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
# Use the same embedding model to encode the query
|
|
176
|
+
query_vectors = embedding_fn.encode_queries(["What is artificial intelligence?"])
|
|
177
|
+
|
|
178
|
+
results = client.search(
|
|
179
|
+
collection_name="my_collection",
|
|
180
|
+
data=query_vectors,
|
|
181
|
+
anns_field="embedding",
|
|
182
|
+
limit=10,
|
|
183
|
+
output_fields=["text", "id"],
|
|
184
|
+
filter='age > 20 and status == "active"',
|
|
185
|
+
search_params={"metric_type": "COSINE", "params": {"nprobe": 10}}
|
|
186
|
+
)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Query / Get / Delete
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
# Query by filter
|
|
193
|
+
client.query(collection_name="my_collection", filter='id in [1, 2, 3]', output_fields=["text"], limit=100)
|
|
194
|
+
|
|
195
|
+
# Get by primary key
|
|
196
|
+
client.get(collection_name="my_collection", ids=[1, 2, 3], output_fields=["text"])
|
|
197
|
+
|
|
198
|
+
# Delete
|
|
199
|
+
client.delete(collection_name="my_collection", ids=[1, 2, 3])
|
|
200
|
+
client.delete(collection_name="my_collection", filter='status == "obsolete"')
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
- **Never use fake or placeholder vectors** (e.g., `[0.1, 0.2, ...]`). Always generate vectors from an embedding model.
|
|
204
|
+
- Use `pip install "pymilvus[model]"` for built-in embedding functions, or use any embedding model (OpenAI, Cohere, etc.).
|
|
205
|
+
- Vector dimension in search must match the collection schema exactly.
|
|
206
|
+
- The query embedding model must be the **same model** used to generate the stored vectors.
|
|
207
|
+
- For large inserts, batch data into chunks (e.g., 1000 rows per batch).
|
|
208
|
+
- For large result sets, use iterators — see [references/vector.md](references/vector.md).
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Index Management
|
|
213
|
+
|
|
214
|
+
**See [references/index.md](references/index.md) for index types, metric types, and parameters.**
|
|
215
|
+
|
|
216
|
+
```python
|
|
217
|
+
index_params = client.prepare_index_params()
|
|
218
|
+
index_params.add_index(
|
|
219
|
+
field_name="embedding",
|
|
220
|
+
index_type="HNSW",
|
|
221
|
+
metric_type="COSINE",
|
|
222
|
+
params={"M": 16, "efConstruction": 256}
|
|
223
|
+
)
|
|
224
|
+
client.create_index(collection_name="my_collection", index_params=index_params)
|
|
225
|
+
|
|
226
|
+
client.list_indexes(collection_name="my_collection")
|
|
227
|
+
client.describe_index(collection_name="my_collection", index_name="my_index")
|
|
228
|
+
client.drop_index(collection_name="my_collection", index_name="my_index")
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
- `AUTOINDEX` is recommended for most use cases.
|
|
232
|
+
- An index is required before loading a collection.
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Additional Features
|
|
237
|
+
|
|
238
|
+
| Feature | Reference |
|
|
239
|
+
|---------|-----------|
|
|
240
|
+
| Partition Management | [references/partition.md](references/partition.md) |
|
|
241
|
+
| Database Management | [references/database.md](references/database.md) |
|
|
242
|
+
| User & Role Management (RBAC) | [references/user-role.md](references/user-role.md) |
|
|
243
|
+
| Common Patterns (RAG, Semantic Search) | [references/patterns.md](references/patterns.md) |
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## General Guidance
|
|
248
|
+
|
|
249
|
+
- **Always ask the user for connection details** (URI, token/credentials) before writing connection code. Never assume or hardcode connection parameters.
|
|
250
|
+
- **Never generate fake or placeholder vectors.** Always use an embedding model to produce real vectors. Suggest `pip install "pymilvus[model]"` for built-in embedding functions.
|
|
251
|
+
- For quick prototyping, use **Milvus Lite** (`uri="./file.db"`) — no server needed, but only if the user explicitly requests local/embedded mode.
|
|
252
|
+
- A collection must be **loaded into memory** before search/query.
|
|
253
|
+
- The vector dimension in search data must **exactly match** the collection schema.
|
|
254
|
+
- The query embedding model must be the **same model** used to generate the stored vectors.
|
|
255
|
+
- Before any destructive operation (drop collection, drop database, delete vectors), always confirm with the user.
|
|
256
|
+
- Use `enable_dynamic_field=True` when the schema may evolve.
|
|
257
|
+
- Prefer `AUTOINDEX` unless the user has specific performance requirements.
|
|
258
|
+
- Use `truncate_collection` to clear all data without dropping the collection.
|
|
259
|
+
- For large datasets, use iterators (`search_iterator`, `query_iterator`) instead of increasing limit.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Collection Management — Detailed Reference
|
|
2
|
+
|
|
3
|
+
## Supported Data Types
|
|
4
|
+
|
|
5
|
+
### Scalar Types
|
|
6
|
+
|
|
7
|
+
| DataType | Notes |
|
|
8
|
+
|----------|-------|
|
|
9
|
+
| `DataType.BOOL` | Boolean |
|
|
10
|
+
| `DataType.INT8` / `INT16` / `INT32` / `INT64` | Integers |
|
|
11
|
+
| `DataType.FLOAT` / `DOUBLE` | Floating point |
|
|
12
|
+
| `DataType.VARCHAR` | String (requires `max_length`) |
|
|
13
|
+
| `DataType.JSON` | JSON object |
|
|
14
|
+
| `DataType.ARRAY` | Array (requires `element_type`, `max_capacity`) |
|
|
15
|
+
|
|
16
|
+
### Vector Types
|
|
17
|
+
|
|
18
|
+
| DataType | Notes |
|
|
19
|
+
|----------|-------|
|
|
20
|
+
| `DataType.FLOAT_VECTOR` | Float32 vector (requires `dim`) |
|
|
21
|
+
| `DataType.FLOAT16_VECTOR` | Float16 vector (requires `dim`) |
|
|
22
|
+
| `DataType.BFLOAT16_VECTOR` | BFloat16 vector (requires `dim`) |
|
|
23
|
+
| `DataType.BINARY_VECTOR` | Binary vector (requires `dim`) |
|
|
24
|
+
| `DataType.SPARSE_FLOAT_VECTOR` | Sparse vector (no `dim` needed) |
|
|
25
|
+
| `DataType.INT8_VECTOR` | Int8 vector (requires `dim`) |
|
|
26
|
+
|
|
27
|
+
## add_field Parameters
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
schema.add_field(
|
|
31
|
+
field_name="my_field",
|
|
32
|
+
datatype=DataType.VARCHAR,
|
|
33
|
+
is_primary=False,
|
|
34
|
+
auto_id=False,
|
|
35
|
+
max_length=256, # Required for VARCHAR
|
|
36
|
+
dim=768, # Required for vector types (except sparse)
|
|
37
|
+
element_type=DataType.INT64, # Required for ARRAY
|
|
38
|
+
max_capacity=100, # Required for ARRAY
|
|
39
|
+
nullable=False,
|
|
40
|
+
default_value=None,
|
|
41
|
+
is_partition_key=False,
|
|
42
|
+
description=""
|
|
43
|
+
)
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## All Collection Operations
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
# List all collections
|
|
50
|
+
collections = client.list_collections()
|
|
51
|
+
|
|
52
|
+
# Describe a collection
|
|
53
|
+
info = client.describe_collection(collection_name="my_collection")
|
|
54
|
+
|
|
55
|
+
# Check if collection exists
|
|
56
|
+
exists = client.has_collection(collection_name="my_collection")
|
|
57
|
+
|
|
58
|
+
# Rename a collection
|
|
59
|
+
client.rename_collection(old_name="old_name", new_name="new_name")
|
|
60
|
+
|
|
61
|
+
# Drop a collection
|
|
62
|
+
client.drop_collection(collection_name="my_collection")
|
|
63
|
+
|
|
64
|
+
# Truncate a collection (delete all data, keep schema and index)
|
|
65
|
+
client.truncate_collection(collection_name="my_collection")
|
|
66
|
+
|
|
67
|
+
# Load collection into memory (required before search/query)
|
|
68
|
+
client.load_collection(collection_name="my_collection")
|
|
69
|
+
|
|
70
|
+
# Release collection from memory
|
|
71
|
+
client.release_collection(collection_name="my_collection")
|
|
72
|
+
|
|
73
|
+
# Get load state
|
|
74
|
+
state = client.get_load_state(collection_name="my_collection")
|
|
75
|
+
|
|
76
|
+
# Get collection statistics
|
|
77
|
+
stats = client.get_collection_stats(collection_name="my_collection")
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Guidance
|
|
81
|
+
|
|
82
|
+
- Quick create is best for prototyping; use custom schema for production.
|
|
83
|
+
- A collection must be **loaded** before search or query operations.
|
|
84
|
+
- Before dropping a collection, confirm with the user — this deletes all data.
|
|
85
|
+
- Use `enable_dynamic_field=True` to allow inserting fields not defined in the schema.
|
|
86
|
+
- Use `truncate_collection` to clear all data while preserving the collection structure.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Database Management
|
|
2
|
+
|
|
3
|
+
```python
|
|
4
|
+
# Create a database
|
|
5
|
+
client.create_database(db_name="my_database")
|
|
6
|
+
|
|
7
|
+
# List all databases
|
|
8
|
+
databases = client.list_databases()
|
|
9
|
+
# Returns: ["default", "my_database"]
|
|
10
|
+
|
|
11
|
+
# Switch to a database
|
|
12
|
+
client.using_database(db_name="my_database")
|
|
13
|
+
|
|
14
|
+
# Drop a database (must drop all collections first)
|
|
15
|
+
client.drop_database(db_name="my_database")
|
|
16
|
+
|
|
17
|
+
# Or connect to a specific database at init (use the user's actual URI and credentials)
|
|
18
|
+
client = MilvusClient(uri="<USER_URI>", token="<USER_TOKEN>", db_name="my_database")
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Guidance
|
|
22
|
+
|
|
23
|
+
- Every Milvus instance has a `"default"` database.
|
|
24
|
+
- Before dropping a database, all collections in it must be dropped first.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Index Management — Detailed Reference
|
|
2
|
+
|
|
3
|
+
## Create Index
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
index_params = client.prepare_index_params()
|
|
7
|
+
|
|
8
|
+
# Vector index
|
|
9
|
+
index_params.add_index(
|
|
10
|
+
field_name="embedding",
|
|
11
|
+
index_type="HNSW", # See index types table below
|
|
12
|
+
metric_type="COSINE", # "COSINE", "L2", "IP"
|
|
13
|
+
params={"M": 16, "efConstruction": 256}
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
# Optional: scalar index
|
|
17
|
+
index_params.add_index(
|
|
18
|
+
field_name="text",
|
|
19
|
+
index_type="" # Auto-select for scalars
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
client.create_index(
|
|
23
|
+
collection_name="my_collection",
|
|
24
|
+
index_params=index_params
|
|
25
|
+
)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Common Index Types
|
|
29
|
+
|
|
30
|
+
| Index Type | For | Key Params | Notes |
|
|
31
|
+
|------------|-----|------------|-------|
|
|
32
|
+
| `AUTOINDEX` | Dense vectors | Auto-tuned | Recommended for most cases |
|
|
33
|
+
| `FLAT` | Dense vectors | None | Brute force, 100% recall |
|
|
34
|
+
| `IVF_FLAT` | Dense vectors | `nlist` | Good balance |
|
|
35
|
+
| `IVF_SQ8` | Dense vectors | `nlist` | Compressed, less memory |
|
|
36
|
+
| `HNSW` | Dense vectors | `M`, `efConstruction` | High recall, more memory |
|
|
37
|
+
| `DISKANN` | Dense vectors | None | Disk-based, large datasets |
|
|
38
|
+
| `SPARSE_INVERTED_INDEX` | Sparse vectors | `drop_ratio_build` | For sparse vectors |
|
|
39
|
+
| `SPARSE_WAND` | Sparse vectors | `drop_ratio_build` | Faster sparse search |
|
|
40
|
+
|
|
41
|
+
## Metric Types
|
|
42
|
+
|
|
43
|
+
| Metric | Description | Use With |
|
|
44
|
+
|--------|-------------|----------|
|
|
45
|
+
| `"COSINE"` | Cosine similarity (larger = more similar) | Dense vectors |
|
|
46
|
+
| `"L2"` | Euclidean distance (smaller = more similar) | Dense vectors |
|
|
47
|
+
| `"IP"` | Inner product (larger = more similar) | Dense & Sparse vectors |
|
|
48
|
+
| `"BM25"` | BM25 relevance scoring | Full-text search (sparse vectors from built-in tokenizer) |
|
|
49
|
+
|
|
50
|
+
## Other Index Operations
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
# List indexes
|
|
54
|
+
indexes = client.list_indexes(collection_name="my_collection")
|
|
55
|
+
|
|
56
|
+
# Describe an index
|
|
57
|
+
info = client.describe_index(collection_name="my_collection", index_name="my_index")
|
|
58
|
+
|
|
59
|
+
# Drop an index
|
|
60
|
+
client.drop_index(collection_name="my_collection", index_name="my_index")
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Guidance
|
|
64
|
+
|
|
65
|
+
- `AUTOINDEX` is recommended for most use cases.
|
|
66
|
+
- An index is required before loading a collection.
|
|
67
|
+
- After creating an index, load the collection before searching.
|
|
68
|
+
- Sparse vectors only support `"IP"` metric type.
|
|
69
|
+
- For full-text search, use `"BM25"` metric type with `SPARSE_INVERTED_INDEX` or `SPARSE_WAND`.
|