Skip to content
Back to skills

Alicloud Ai Search Dashvector

ASecurity

Build vector retrieval with DashVector using the Python SDK. Use when creating collections, upserting docs, and running similarity search with filters in Claude Code/Codex.

  • 21 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 7, 2026
ai-agentspythongobashsqlapi

Works with

  • claude code
  • cli
  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 4 files and shows the line behind each finding

Scanned September 7, 2026

npx -y skills add modbender/skill-library-mcp --skill alicloud-ai-search-dashvector --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Alicloud Ai Search Dashvector?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Alicloud Ai Search Dashvector
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/modbender-alicloud-ai-search-dashvector/badge)](https://www.skillsdirectory.com/skills/modbender-alicloud-ai-search-dashvector)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: alicloud-ai-search-dashvector
description: Build vector retrieval with DashVector using the Python SDK. Use when creating collections, upserting docs, and running similarity search with filters in Claude Code/Codex.
---

Category: provider

# DashVector Vector Search

Use DashVector to manage collections and perform vector similarity search with optional filters and sparse vectors.

## Prerequisites

- Install SDK (recommended in a venv to avoid PEP 668 limits):

```bash
python3 -m venv .venv
. .venv/bin/activate
python -m pip install dashvector
```
- Provide credentials and endpoint via environment variables:
  - `DASHVECTOR_API_KEY`
  - `DASHVECTOR_ENDPOINT` (cluster endpoint)

## Normalized operations

### Create collection
- `name` (str)
- `dimension` (int)
- `metric` (str: `cosine` | `dotproduct` | `euclidean`)
- `fields_schema` (optional dict of field types)

### Upsert docs
- `docs` list of `{id, vector, fields}` or tuples
- Supports `sparse_vector` and multi-vector collections

### Query docs
- `vector` or `id` (one required; if both empty, only filter is applied)
- `topk` (int)
- `filter` (SQL-like where clause)
- `output_fields` (list of field names)
- `include_vector` (bool)

## Quickstart (Python SDK)

```python
import os
import dashvector
from dashvector import Doc

client = dashvector.Client(
    api_key=os.getenv("DASHVECTOR_API_KEY"),
    endpoint=os.getenv("DASHVECTOR_ENDPOINT"),
)

# 1) Create a collection
ret = client.create(
    name="docs",
    dimension=768,
    metric="cosine",
    fields_schema={"title": str, "source": str, "chunk": int},
)
assert ret

# 2) Upsert docs
collection = client.get(name="docs")
ret = collection.upsert(
    [
        Doc(id="1", vector=[0.01] * 768, fields={"title": "Intro", "source": "kb", "chunk": 0}),
        Doc(id="2", vector=[0.02] * 768, fields={"title": "FAQ", "source": "kb", "chunk": 1}),
    ]
)
assert ret

# 3) Query
ret = collection.query(
    vector=[0.01] * 768,
    topk=5,
    filter="source = 'kb' AND chunk >= 0",
    output_fields=["title", "source", "chunk"],
    include_vector=False,
)
for doc in ret:
    print(doc.id, doc.fields)
```

## Script quickstart

```bash
python skills/ai/search/alicloud-ai-search-dashvector/scripts/quickstart.py
```

Environment variables:

- `DASHVECTOR_API_KEY`
- `DASHVECTOR_ENDPOINT`
- `DASHVECTOR_COLLECTION` (optional)
- `DASHVECTOR_DIMENSION` (optional)

Optional args: `--collection`, `--dimension`, `--topk`, `--filter`.

## Notes for Claude Code/Codex

- Prefer `upsert` for idempotent ingestion.
- Keep `dimension` aligned to your embedding model output size.
- Use filters to enforce tenant or dataset scoping.
- If using sparse vectors, pass `sparse_vector={token_id: weight, ...}` when upserting/querying.

## Error handling

- 401/403: invalid `DASHVECTOR_API_KEY`
- 400: invalid collection schema or dimension mismatch
- 429/5xx: retry with exponential backoff

## References

- DashVector Python SDK: `Client.create`, `Collection.upsert`, `Collection.query`

- Source list: `references/sources.md`

Files in this skill

  • SKILL.md3.1 KB
  • agents/openai.yaml240 B
  • references/sources.md110 B
  • scripts/quickstart.py2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.