rag-milvus
БесплатноБез исполняемых скриптовНе проверенBuilds and evaluates persistent document retrieval with Milvus and Milvus Lite. Use when implementing semantic search, metadata-filtered RAG, repeatable…
от davila7★ 34 631 звезда на GitHubОб этом скилле
Milvus Retrieval
Build and verify a persistent document retriever with the MilvusClient API.
Start with a local Milvus Lite database for a small, single-process experiment.
Use an existing server when the project needs concurrent clients or server features.
Choose the scope
Use this skill for document retrieval, metadata-filtered search, repeatable ingestion, and moving a validated retrieval experiment to a Milvus deployment.
| Requirement | Approach |
|---|---|
| Small experiment with local persistence | Milvus Lite and a local .db path |
| Concurrent services or distributed operation | Milvus server with a configured URI |
| Existing relational data and transactional joins | Consider the application's existing SQL database |
| Only an in-process nearest-neighbor benchmark | Consider FAISS without a database layer |
Confirm the embedding model, vector dimension, collection name, metadata fields, and retrieval evaluation before creating a collection. Reuse an existing project environment. Never recreate a populated collection to resolve a schema mismatch.
Workflow 1: Establish a local retrieval baseline
Checklist:
- Identify the documents and the source identifiers to retain.
- Select an embedding model and record its dimension and revision.
- Create an isolated collection for the experiment.
- Upsert stable chunk IDs and run a filtered query.
- Close and reopen the database, then repeat the query.
- Run ingestion twice and confirm that IDs are not duplicated.
Dependencies
Use Python 3.10 or newer. In an existing uv project:
uv add "pymilvus[milvus-lite]>=3.0.2,<4" "milvus-lite>=3.2.2,<4" "openai>=2,<3"
For a new experiment, first run uv init --python 3.11 milvus-experiment
and work inside that directory. Retain pyproject.toml and uv.lock for
reproducibility. Inspect the resolver output before changing an existing lockfile.
The example uses the OpenAI embedding API and reads OPENAI_API_KEY from the
environment. It sends the sample text and query to that provider and incurs its
usage charges. For private documents, use the project's approved embedding
provider or a local model; keep the document and query embedding settings equal.
No paid database service is required for the local example.
Persistent, repeatable example
Save this as retrieve.py and run uv run python retrieve.py.
The collection and IDs below belong to the example; choose a separate namespace
when adapting it to application data.
import os
from openai import OpenAI
from pymilvus import DataType, MilvusClient
uri = os.environ.get("MILVUS_DB_URI", "./milvus_retrieval.db")
connection = {"uri": uri}
if os.environ.get("MILVUS_TOKEN"):
connection["token"] = os.environ["MILVUS_TOKEN"]
collection = "milvus_skill_demo_v1"
model = "text-embedding-3-small"
dimension = 512
documents = [
{"id": "guide:lite", "source": "guide",
"text": "Milvus Lite persists vectors in a local database for small experiments."},
{"id": "guide:server", "source": "guide",
"text": "Milvus server supports applications with multiple concurrent clients."},
{"id": "recipe:bread", "source": "recipe",
"text": "Bread dough needs flour, water, yeast, and time to rise."},
]
with OpenAI() as embedding_client:
def embed(texts):
response = embedding_client.embeddings.create(
input=texts, model=model, dimensions=dimension,
)
return [item.embedding for item in sorted(response.data, key=lambda x: x.index)]
vectors = embed([doc["text"] for doc in documents])
query_vector = embed(["How can I save vectors locally between runs?"])[0]
client = MilvusClient(**connection)
try:
if not client.has_collection(collection_name=collection):
schema = MilvusClient.create_schema(auto_id=False, enable_dynamic_field=False)
schema.add_field("id", DataType.VARCHAR, is_primary=True, max_length=128)
schema.add_field("text", DataType.VARCHAR, max_length=8192)
schema.add_field("source", DataType.VARCHAR, max_length=128)
schema.add_field("vector", DataType.FLOAT_VECTOR, dim=dimension)
indexes = client.prepare_index_params()
indexes.add_index(field_name="vector", index_type="AUTOINDEX", metric_type="COSINE")
client.create_collection(
collection_name=collection, schema=schema, index_params=indexes,
consistency_level="Strong",
)
fields = {field["name"]: field for field in
client.describe_collection(collection_name=collection)["fields"]}
if (set(fields) != {"id", "text", "source", "vector"}
or int(fields["vector"]["params"]["dim"]) != dimension):
raise ValueError("Collection schema differs; use a new collection name.")
client.upsert(
collection_name=collection,
data=[{**doc, "vector": vector} for doc, vector in zip(documents, vectors)],
)
client.flush(collection_name=collect
Установить rag-milvus в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл rag-milvus?
Builds and evaluates persistent document retrieval with Milvus and Milvus Lite. Use when implementing semantic search, metadata-filtered RAG, repeatable ingestion, or moving a local retrieval experiment to a server.
Как установить скилл rag-milvus?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл rag-milvus запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic