Synthèse automatique
Guide d'utilisation de la base de données vectorielle Milvus via le SDK Python pymilvus, couvrant la connexion, les collections, la recherche vectorielle et hybride, les index et le RBAC.
Points forts
- Couvre l'ensemble du cycle de vie : connexion, schémas, CRUD de vecteurs, recherche et indexation
- Inclut des fonctionnalités avancées comme la recherche hybride avec reranking, la recherche plein texte BM25 et les itérateurs paginés
- Distingue clairement Milvus Lite, Standalone/Cluster et Zilliz Cloud, et impose de demander les paramètres de connexion à l'utilisateur
- Fournit des exemples de code Python concrets, y compris un client asynchrone
Limites
- Le SKILL.md fourni s'interrompt au milieu de la section sur la gestion des collections, donc la couverture réelle est partielle
- Suppose un environnement Python 3.8+ avec pymilvus installé et une instance Milvus accessible
- Pas de conseils sur le dimensionnement, les performances ou le choix des index au-delà de leur création
À utiliser lorsqu'on veut écrire du code Python pour interroger ou administrer une base Milvus, par exemple pour une pipeline RAG ou une recherche sémantique.
À éviter si le projet utilise une autre base vectorielle (Qdrant, Pinecone, pgvector) ou un autre langage que Python.
Analyse de sécurité
SûrThe skill is a straightforward documentation-style wrapper around the pymilvus Python SDK. There are no curl|sh pipelines, no obfuscated payloads, no attempts to read or exfiltrate secrets, no disabling of safety behavior. It handles credentials only by templating placeholders like <USER_TOKEN> and explicitly tells the agent to ask the user for connection details rather than inventing them. Drop/truncate/RBAC operations are described but are normal database administration surfaces exercised at the user's direction, not autonomous destruction. Bash usage is limited to running Python, which is a powerful but fully legitimate capability for the stated purpose.
- •Declares Bash/Read/Write tools but only uses them to run Python snippets and read reference docs
- •Skill handles database credentials (URI, token, API key) but explicitly instructs the agent to ask the user rather than hardcode or assume them
- •Includes RBAC and drop/truncate operations — destructive in intent on the user's own data only, and gated behind explicit user requests
Exemples
Connect to my Milvus instance at http://localhost:19530 with pymilvus and create a collection named documents with a 768-dim vector field and a text field, using AUTOINDEX.Using pymilvus, write a hybrid search over my 'products' collection that combines dense vector search and BM25 full-text search, then reranks the results.Show me how to iterate over all vectors in my Milvus collection in batches using a query iterator instead of loading everything at once.name: milvus 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. license: Apache-2.0 compatibility: Requires Python 3.8+ and pymilvus (pip install pymilvus). Runs on macOS and Linux. metadata: author: zilliztech version: "1.0.0" allowed-tools: Bash Read Write
Milvus Vector Database Skill
Operate Milvus 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.
When to Use
Use this skill when the user wants to:
- Connect to a Milvus instance (local, standalone, cluster, or Milvus Lite)
- Create collections with custom schemas
- Insert, upsert, search, query, get, or delete vectors
- Perform hybrid search with reranking
- Perform full-text search (BM25)
- Manage indexes, partitions, databases
- Set up users, roles, and access control (RBAC)
- Build RAG pipelines, semantic search, or recommendation systems with Milvus
- Iterate over large result sets with search/query iterators
Requirements
- Python 3.8+
pymilvus(pip install pymilvus)- A running Milvus instance, or use Milvus Lite (embedded, file-based) for development
Capabilities Overview
| Area | What You Can Do | |------|----------------| | Connection | Connect to Milvus Lite, Standalone, Cluster, or Zilliz Cloud | | Collections | Create (quick or custom schema), list, describe, drop, rename, truncate, load, release | | Vectors | Insert, upsert, search, hybrid search, query, get, delete | | Full-Text Search | BM25-based keyword search with sparse vectors | | Iterators | Paginated search and query over large datasets | | Indexes | Create (AUTOINDEX, HNSW, IVF_FLAT, etc.), list, describe, drop | | Partitions | Create, list, load, release, drop | | Databases | Create, list, switch, drop | | RBAC | Users, roles, privileges management |
Connection
IMPORTANT: Before writing any connection code, you MUST ask the user for their connection details. Ask:
- Deployment type — Milvus Lite (local file), Standalone/Cluster (self-hosted), or Zilliz Cloud (managed)?
- URI — For self-hosted: host and port (e.g.,
http://localhost:19530). For Zilliz Cloud: the endpoint URL.- Authentication — Token, API key, or username/password if required.
- Database name — If not using the default database.
Never assume or hardcode connection parameters. Use Milvus Lite (
uri="./milvus.db") only if the user explicitly wants local/embedded mode for development.
from pymilvus import MilvusClient
# Milvus Lite (embedded, file-based — great for dev/test)
client = MilvusClient(uri="./milvus.db")
# Standalone / Cluster Milvus (ask user for actual host:port and credentials)
client = MilvusClient(uri="<USER_URI>", token="<USER_TOKEN>")
# Zilliz Cloud (ask user for endpoint and API key)
client = MilvusClient(uri="<USER_ZILLIZ_ENDPOINT>", token="<USER_API_KEY>")
Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| uri | str | "./file.db" for Milvus Lite, "http://host:19530" for server |
| token | str | API key or "username:password" |
| user | str | Username (alternative to token) |
| password | str | Password (alternative to token) |
| db_name | str | Target database (default: "default") |
| timeout | float | Operation timeout in seconds |
Async Client
from pymilvus import AsyncMilvusClient
async with AsyncMilvusClient(uri="<USER_URI>") as client:
results = await client.search(collection_name="my_collection", data=[query_vector], limit=10)
Collection Management
Quick Create (auto schema + auto index + auto load)
client.create_collection(
collection_name="my_collection",
dimension=768,
metric_type="COSINE" # Optional: "COSINE" (default), "L2", "IP"
)
This automatically creates an id field (INT64, primary key, auto_id), a vector field (FLOAT_VECTOR), AUTOINDEX, and auto-loads the collection.
Custom Schema Create
from pymilvus import DataType
schema = client.create_schema(auto_id=False, enable_dynamic_field=True)
schema.add_field("id", DataType.INT64, is_primary=True)
schema.add_field("text", DataType.VARCHAR, max_length=512)
schema.add_field("embedding", DataType.FLOAT_VECTOR, dim=768)
index_params = client.prepare_index_params()
index_params.add_index(field_name="embedding", index_type="AUTOINDEX", metric_type="COSINE")
client.create_collection(collection_name="my_collection", schema=schema, index_params=index_params)
See references/collection.md for data types, add_field parameters, and all collection operations.
Other Collection Operations
client.list_collections()
client.describe_collection(collection_name="my_collection")
client.has_collection(collection_name="my_collection")
client.rename_collection(old_name="old", new_name="new")
client.drop_collection(collection_name="my_collection")
client.truncate_collection(collection_name="my_collection")
client.load_collection(collection_name="my_collection")
client.release_collection(collection_name="my_collection")
client.get_load_state(collection_name="my_collection")
client.get_collection_stats(collection_name="my_collection")
- Quick create is best for prototyping; use custom schema for production.
- A collection must be loaded before search or query.
- Use
enable_dynamic_field=Trueto allow inserting fields not defined in the schema.
Vector Operations
See references/vector.md for hybrid search, full-text search, iterators, filter syntax, and detailed examples.
Insert / Upsert
# Vectors must come from an embedding model — never use fake/placeholder vectors
from pymilvus import model
embedding_fn = model.dense.SentenceTransformerEmbeddingFunction(model_name="all-MiniLM-L6-v2")
docs = ["AI advances in 2024", "ML basics for beginners"]
vectors = embedding_fn.encode_documents(docs)
data = [
{"id": 1, "text": docs[0], "embedding": vectors[0]},
{"id": 2, "text": docs[1], "embedding": vectors[1]},
]
client.insert(collection_name="my_collection", data=data)
client.upsert(collection_name="my_collection", data=data)
Search (vector similarity)
# Use the same embedding model to encode the query
query_vectors = embedding_fn.encode_queries(["What is artificial intelligence?"])
results = client.search(
collection_name="my_collection",
data=query_vectors,
anns_field="embedding",
limit=10,
output_fields=["text", "id"],
filter='age > 20 and status == "active"',
search_params={"metric_type": "COSINE", "params": {"nprobe": 10}}
)
Query / Get / Delete
# Query by filter
client.query(collection_name="my_collection", filter='id in [1, 2, 3]', output_fields=["text"], limit=100)
# Get by primary key
client.get(collection_name="my_collection", ids=[1, 2, 3], output_fields=["text"])
# Delete
client.delete(collection_name="my_collection", ids=[1, 2, 3])
client.delete(collection_name="my_collection", filter='status == "obsolete"')
- Never use fake or placeholder vectors (e.g.,
[0.1, 0.2, ...]). Always generate vectors from an embedding model. - Use
pip install "pymilvus[model]"for built-in embedding functions, or use any embedding model (OpenAI, Cohere, etc.). - Vector dimension in search must match the collection schema exactly.
- The query embedding model must be the same model used to generate the stored vectors.
- For large inserts, batch data into chunks (e.g., 1000 rows per batch).
- For large result sets, use iterators — see references/vector.md.
Index Management
See references/index.md for index types, metric types, and parameters.
index_params = client.prepare_index_params()
index_params.add_index(
field_name="embedding",
index_type="HNSW",
metric_type="COSINE",
params={"M": 16, "efConstruction": 256}
)
client.create_index(collection_name="my_collection", index_params=index_params)
client.list_indexes(collection_name="my_collection")
client.describe_index(collection_name="my_collection", index_name="my_index")
client.drop_index(collection_name="my_collection", index_name="my_index")
AUTOINDEXis recommended for most use cases.- An index is required before loading a collection.
Additional Features
| Feature | Reference | |---------|-----------| | Partition Management | references/partition.md | | Database Management | references/database.md | | User & Role Management (RBAC) | references/user-role.md | | Common Patterns (RAG, Semantic Search) | references/patterns.md |
General Guidance
- Always ask the user for connection details (URI, token/credentials) before writing connection code. Never assume or hardcode connection parameters.
- 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. - For quick prototyping, use Milvus Lite (
uri="./file.db") — no server needed, but only if the user explicitly requests local/embedded mode. - A collection must be loaded into memory before search/query.
- The vector dimension in search data must exactly match the collection schema.
- The query embedding model must be the same model used to generate the stored vectors.
- Before any destructive operation (drop collection, drop database, delete vectors), always confirm with the user.
- Use
enable_dynamic_field=Truewhen the schema may evolve. - Prefer
AUTOINDEXunless the user has specific performance requirements. - Use
truncate_collectionto clear all data without dropping the collection. - For large datasets, use iterators (
search_iterator,query_iterator) instead of increasing limit.
Du fichier au premier essai
Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.
Consulter la source et ses fichiers annexesCe téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.
1. Télécharger le fichier
Télécharger SKILL.mdDepuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/milvus-vector-database-ms2s7br1/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.
Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.
mkdir -p '.skill-downloads/milvus-vector-database-ms2s7br1' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/milvus-vector-database-ms2s7br1/download' --output '.skill-downloads/milvus-vector-database-ms2s7br1/SKILL.md.part' && mv '.skill-downloads/milvus-vector-database-ms2s7br1/SKILL.md.part' '.skill-downloads/milvus-vector-database-ms2s7br1/SKILL.md'2. Vérifier les prérequis
Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.
Environnement déclaré par l’auteur : Requires Python 3.8+ and pymilvus (pip install pymilvus). Runs on macOS and Linux.
Outils déclarés par l’auteur (à vérifier dans votre agent) : Bash Read Write
Extrait original : Requirements
- Python 3.8+
pymilvus(pip install pymilvus)- A running Milvus instance, or use Milvus Lite (embedded, file-based) for development
Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.
3. Charger la skill
Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.
Claude Code
test -f '.skill-downloads/milvus-vector-database-ms2s7br1/SKILL.md' && test -s '.skill-downloads/milvus-vector-database-ms2s7br1/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/milvus' && cp -R '.skill-downloads/milvus-vector-database-ms2s7br1' '.claude/skills/milvus'Cursor
test -f '.skill-downloads/milvus-vector-database-ms2s7br1/SKILL.md' && test -s '.skill-downloads/milvus-vector-database-ms2s7br1/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/milvus' && cp -R '.skill-downloads/milvus-vector-database-ms2s7br1' '.cursor/skills/milvus'Codex
test -f '.skill-downloads/milvus-vector-database-ms2s7br1/SKILL.md' && test -s '.skill-downloads/milvus-vector-database-ms2s7br1/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/milvus' && cp -R '.skill-downloads/milvus-vector-database-ms2s7br1' '.agents/skills/milvus'OpenSkills
OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.
Installation officielle d’OpenSkillsopenskills install './.skill-downloads/milvus-vector-database-ms2s7br1'openskills read 'milvus-vector-database-ms2s7br1'La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.
Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.
openskills syncMode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.
4. Faire un premier essai
Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :
Lis .skill-downloads/milvus-vector-database-ms2s7br1/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.
Créer des cartes interactives avec kepler.gl
Data & IA
Création de cartes interactives et export HTML autonome avec le package Python keplergl, à partir de données géospatiales (DataFrame, GeoJSON, CSV).
Optimisation de paramètres par agent
Data & IA
Guide d'optimisation de systèmes configurables avec objectif mesurable, via des essais bornés et une recommandation fondée sur des preuves.
Relance des visiteurs ICP
Data & IA
Identifiez les utilisateurs inscrits correspondant au profil client idéal mais qui n'ont pas activé, et rédigez des messages de relance personnalisés pour les réengager.