Logo Neo4j Vector Index Skill

Neo4j Vector Index Skill

Tổ chức
neo4j
neo4j-vector-index-skill

Create and manage Neo4j vector indexes, run vector similarity search (ANN/kNN), store embeddings on nodes or relationships, use SEARCH clause (Neo4j 2026.01+, preferred) or db.index.vector.queryNodes() procedure (deprecated 2026.04, still works on 2025.x), configure HNSW and quantization options, pick similarity function and embedding provider dimensions, and batch-update embeddings. Use when tasks involve CREATE VECTOR INDEX, vector.dimensions, cosine/euclidean search, embedding ingestion pipelines, semantic or structural nearest-neighbor lookup, or hybrid search (vector + fulltext, multiple vector sources, or graph-derived scores). Does NOT handle GraphRAG retrieval_query graph traversal — use neo4j-graphrag-skill. Does NOT handle fulltext-only/keyword-only search — use neo4j-cypher-skill. Does NOT compute GDS graph embeddings (FastRP, Node2Vec) — use neo4j-gds-skill.

Tổng quan

Nhà phát hànhneo4j
Kho mãagent-skills
Tên kỹ năngneo4j-vector-index-skill
Sao
127
Bản fork
44
Tệp đi kèm
2
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 2 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được neo4j công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Neo4j Vector Index Skill trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/neo4j/agent-skills/tree/main/neo4j-vector-index-skill
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/neo4j/agent-skills.git /tmp/agent-skills
mkdir -p .claude/skills
cp -r /tmp/agent-skills/neo4j-vector-index-skill .claude/skills/neo4j-vector-index-skill
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Neo4j Vector Index Skill trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Neo4j Vector Index Skill ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Neo4j Vector Index Skill với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

When to Use

  • Creating a vector index (CREATE VECTOR INDEX) on nodes or relationships
  • Running vector similarity / nearest-neighbor search
  • Storing embeddings on graph nodes during ingestion
  • Indexing/querying embeddings already written by GDS algorithms
  • Choosing similarity function, dimensions, HNSW params, or quantization
  • Using SEARCH clause (2026.01+) or db.index.vector.queryNodes() (2025.x)
  • Batch-updating embeddings after model change
  • Combining vector results with immediate graph neighborhood (full retrieval_query pipelines → neo4j-graphrag-skill)
  • Hybrid search that combines vector results with fulltext or other ranked sources

When NOT to Use

  • GraphRAG pipelines (VectorCypherRetriever, HybridCypherRetriever, retrieval_query) → neo4j-graphrag-skill
  • Fulltext-only / keyword-only search (FULLTEXT INDEX, db.index.fulltext.queryNodes) → neo4j-cypher-skill
  • Computing GDS graph embeddings (FastRP, Node2Vec, GraphSAGE) → neo4j-gds-skill
  • Index admin (list all indexes, drop range/text/lookup indexes) → neo4j-cypher-skill

Pre-flight — Determine Version

cypher
CALL dbms.components() YIELD versions RETURN versions[0] AS neo4j_version
VersionUse
2026.01 or higherSEARCH clause (in-index filtering, preferred)
2025.xdb.index.vector.queryNodes() procedure (deprecated 2026.04 — use SEARCH when on 2026.x)
5.27 on AuraAura reports 5.27 regardless of engine until after 2026.12 LTS (then calendar version) — Aura runs latest 2026.x → use SEARCH

Step 1 — Create Vector Index

Node index (single label):

cypher
CYPHER 25
CREATE VECTOR INDEX chunk_embedding IF NOT EXISTS
FOR (c:Chunk) ON (c.embedding)
OPTIONS {
  indexConfig: {
    `vector.dimensions`: 1536,
    `vector.similarity_function`: 'cosine',
    `vector.quantization.type`: 'SCALAR',
    `vector.hnsw.m`: 16,
    `vector.hnsw.ef_construction`: 100
  }
}

Node index with filterable properties [2026.01+] — WITH declares which properties can be used in SEARCH ... WHERE:

cypher
CYPHER 25
CREATE VECTOR INDEX chunk_embedding_filtered IF NOT EXISTS
FOR (c:Chunk) ON (c.embedding)
WITH [c.source, c.lang, c.published_year]  // stored as metadata; filterable in SEARCH WHERE
OPTIONS { indexConfig: { `vector.dimensions`: 1536, `vector.similarity_function`: 'cosine' } }

IF NOT EXISTS never adds WITH properties to an existing index: if an index with the same name exists, or one on :Chunk(embedding) with the same WITH list, this is a silent no-op (00NA0). An index on the same property with a different WITH list counts as a different index, so you can end up with two indexes. Adding filter properties = drop + re-create.

Multi-label index with filterable properties [2026.01+]:

cypher
CYPHER 25
CREATE VECTOR INDEX doc_embedding IF NOT EXISTS
FOR (n:Document|Article) ON n.embedding
WITH [n.author, n.published_year, n.lang]
OPTIONS { indexConfig: { `vector.dimensions`: 1536, `vector.similarity_function`: 'cosine' } }

Relationship index:

cypher
CYPHER 25
CREATE VECTOR INDEX rel_embedding IF NOT EXISTS
FOR ()-[r:HAS_CHUNK]-() ON (r.embedding)
OPTIONS { indexConfig: { `vector.dimensions`: 768, `vector.similarity_function`: 'cosine' } }

WITH property types — only scalar types allowed: INTEGER, FLOAT, STRING, BOOLEAN, DATE, ZONED DATETIME, LOCAL DATETIME, ZONED TIME, LOCAL TIME, DURATION. Not allowed: LIST, POINT, or the vector property itself.

Index config reference:

ParameterTypeDefaultNotes
vector.dimensionsINTEGER 1–4096noneRequired; must match embedding model exactly
vector.similarity_functionSTRING'cosine''cosine' or 'euclidean'
vector.quantization.typeSTRING'binary' ('scalar' before 2026.08)'none', 'scalar', 'binary' [2026.06+, GA 2026.07]; reduces storage; binary smallest (1 bit per dimension), most aggressive; needs vector-2.0+ (5.18+); set explicitly for version-independent behavior
vector.quantization.enabledBOOLEANtrueDeprecated 2026.06 — use vector.quantization.type; false without vector.quantization.type: 'none' fails index creation before 2026.07
vector.default_search_expansion_factorFLOAT 1.0–10000.01.0 none / 1.5 scalar / 3.0 binary (was 2.0 before 2026.07)[2026.06+, GA 2026.07]; value >1.0 on quantized vectors enables automatic rescoring with full-precision vectors (High-Fidelity Quantized search, HFQ); not settable at query time; existing indexes keep their stored value until rebuilt
vector.hnsw.mINTEGER 1–51216HNSW graph connections; higher = better recall, more memory
vector.hnsw.ef_constructionINTEGER 1–3200100Build-time candidates; higher = better recall, slower build

Unquantized vectors: set vector.quantization.type: 'none' alone — on 2026.06, vector.quantization.enabled: false without it errors (fixed 2026.07).

Similarity function choice:

Use caseFunction
Normalized embeddings (OpenAI, Cohere, Voyage, Google)'cosine'
Unnormalized / raw distance matters'euclidean'

Index providers — latest selected automatically; not specifiable in Cypher 25. Check with SHOW VECTOR INDEXES YIELD name, indexProvider:

ProviderQuantization support
vector-2026.08High-Fidelity Quantized search for binary; 'binary' default
vector-2026.07High-Fidelity Quantized search for scalar and binary
vector-2026.06scalar and binary; required for binary + rescoring
vector-3.0 (2025.09+) / vector-2.0 (5.18+)scalar

Changing quantization type, expansion factor, or provider requires drop + re-create + re-population. Indexes built before 2026.08 and rarely updated: re-create for 2026.09 rescored-binary/scalar speedup (~5× latency and throughput).

Memory — vector index files live in OS filesystem cache, not page cache. Leave RAM for: HNSW graph ≈ 8 B × vectors × vector.hnsw.m plus vector values (full precision ≈ 4 B × dims × vectors; scalar ÷4; binary ÷32). Size page cache for vector properties only if queries return or re-rank them. Details → Vector index memory configuration.


Step 2 — Wait for Index ONLINE

Index builds asynchronously — do NOT query until ONLINE:

cypher
SHOW VECTOR INDEXES YIELD name, state, populationPercent
WHERE name = 'chunk_embedding'
RETURN name, state, populationPercent

Poll every 5s until state = 'ONLINE' and populationPercent = 100.0. If state = 'FAILED' → stop, check logs.

Shell poll (cypher-shell):

bash
until cypher-shell -u neo4j -p "$NEO4J_PASSWORD" \
  "SHOW VECTOR INDEXES YIELD name, state WHERE name='chunk_embedding' RETURN state" \
  | grep -q ONLINE; do
  sleep 5
done

Step 3 — Ingest Embeddings

Batch UNWIND pattern (use for > 100 nodes — never one-node-per-transaction):

python
from neo4j import GraphDatabase

driver = GraphDatabase.driver(uri, auth=(user, password))

def embed_batch(texts: list[str]) -> list[list[float]]:
    response = openai_client.embeddings.create(
        model="text-embedding-3-small", input=texts
    )
    return [r.embedding for r in response.data]

def store_embeddings(records: list[dict], batch_size: int = 500):
    expected_dim = 1536  # must match vector.dimensions
    texts = [r["text"] for r in records]
    embeddings = embed_batch(texts)
    for emb in embeddings:
        assert len(emb) == expected_dim, f"Dim mismatch: {len(emb)} != {expected_dim}"
    rows = [{"id": r["id"], "embedding": emb}
            for r, emb in zip(records, embeddings)]
    for i in range(0, len(rows), batch_size):
        driver.execute_query(
            "UNWIND $rows AS row MATCH (c:Chunk {id: row.id}) SET c.embedding = row.embedding",
            rows=rows[i:i+batch_size]
        )

❌ Never create index after embeddings are already stored — always create index first. ✅ Create index → poll ONLINE → ingest embeddings.


Step 4 — Run Vector Search

SEARCH clause (2026.01+, preferred)

cypher
CYPHER 25
MATCH (c:Chunk)
  SEARCH c IN (
    VECTOR INDEX chunk_embedding
    FOR $queryEmbedding
    LIMIT 10
  ) SCORE AS score
RETURN c.text, score
ORDER BY score DESC

With in-index filter [2026.01+] — properties must be declared in WITH at index creation:

cypher
// Index must have been created with: WITH [c.source, c.lang, c.published_year]
CYPHER 25
MATCH (c:Chunk)
  SEARCH c IN (
    VECTOR INDEX chunk_embedding_filtered
    FOR $queryEmbedding
    WHERE c.source = $source AND c.lang = 'en' AND c.published_year >= 2024
    LIMIT 10
  ) SCORE AS score
RETURN c.text, c.source, score
ORDER BY score DESC

Filtering strategy — choose one:

StrategyWhen to useTradeoff
In-index WHERE [2026.01+]Filters on pre-declared WITH properties; known at index design timeFast, consistent latency; properties must be declared upfront
Post-filter (WHERE on enclosing MATCH, or after procedure)Arbitrary Cypher predicates, graph traversal, OR/NOTIndex returns top k first, then filters → fewer than k rows; over-fetch (larger LIMIT), then trim
Exact search over small subsetSmall known candidate setMATCH subset, compute vector.similarity.cosine(...), ORDER BY; no index

MATCH ... WHERE placed before or around SEARCH is a post-filter, not a pre-filter — it does not restrict the index candidates.

In-index WHERE hard limits [2026.01+]:

  • Property must be listed in WITH [...] at index creation — undeclared property raises 22ND3 ("not an additional property for vector search with filters"); no fallback. Fix: add to WITH (drop + re-create) or post-filter after SEARCH
  • AND predicates only — no OR, NOT, string ops. IN list membership allowed [2026.06+]
  • Scalar types only: INTEGER, FLOAT, STRING, BOOLEAN, temporal types — not VECTOR/LIST/POINT

Post-filter pattern (2025.x or arbitrary predicates)

cypher
CYPHER 25
CALL db.index.vector.queryNodes('chunk_embedding', 50, $queryEmbedding)
YIELD node AS c, score
WHERE c.source = $source    // post-filter: fetch more, then filter
RETURN c.text, score
ORDER BY score DESC LIMIT 10

Relationship index procedure:

cypher
CYPHER 25
CALL db.index.vector.queryRelationships('rel_embedding', 5, $queryEmbedding)
YIELD relationship AS r, score
RETURN r.text, score

SEARCH clause hard limits (all versions):

  • Index name cannot be a parameter ($indexName not allowed — use literal string)
  • Binding variable must come from the enclosing MATCH pattern
  • Query vector cannot reference the binding variable

Step 5 — Combine with Graph Traversal (simple cases)

Vector search as entry point, then graph hop:

cypher
CYPHER 25
MATCH (c:Chunk)
  SEARCH c IN (
    VECTOR INDEX chunk_embedding
    FOR $queryEmbedding
    LIMIT 10
  ) SCORE AS score
MATCH (c)<-[:HAS_CHUNK]-(a:Article)
OPTIONAL MATCH (a)-[:MENTIONS]->(org:Organization)
RETURN c.text, a.title, score, collect(DISTINCT org.name) AS organizations
ORDER BY score DESC

For full retrieval_query pipelines, HybridCypherRetriever, or neo4j-graphrag library → delegate to neo4j-graphrag-skill.


Step 6 — Hybrid Search

Use hybrid search when one signal misses useful candidates: semantic vectors miss exact terms, lexical fulltext misses paraphrases, structural graph signals find topology not present in text. The common pattern is vector + fulltext, but the same approach works for several vector indexes, GDS-written embeddings, graph traversal scores, or any two+ ranked/scored sources. Load references/hybrid-search.md and apply its query shape.

Rules:

  • Run each source independently; rank each by score DESC, stable_id ASC.
  • Combine by rank, not raw scores; fulltext and vector scores are not comparable.
  • Every UNION ALL branch returns same columns: matched node + contribution.
  • Use sourceK > finalK; combine before final limiting.
  • Sum contributions per node; order final rows by wrrf DESC, stable_id ASC.
  • Add more sources with extra UNION ALL branches and new sourceWeights keys.

Embedding Provider Quick-Reference

Provider / ModelDimensionsSimilarityNotes
OpenAI text-embedding-3-small1536cosineDefault; reducible to 256–1536 via dimensions= param
OpenAI text-embedding-3-large3072cosineReducible to 256–3072
OpenAI text-embedding-ada-0021536cosineLegacy; prefer 3-small
Cohere embed-v3 (English)1024cosineUse input_type='search_document' at ingest, 'search_query' at query
Voyage voyage-3-large1024cosineHigh quality; needs voyage-ai package
Google text-embedding-004768cosineVia Vertex AI
Ollama nomic-embed-text768cosineLocal dev/testing
Ollama mxbai-embed-large1024cosineLocal; production-quality

vector.dimensions must exactly match model output — no auto-truncation.


Vector Functions

Read references/vector-functions.md when you need this.

Index Management

cypher
// Show all vector indexes with config
// No indexConfig column — config is in options.indexConfig (and createStatement)
SHOW VECTOR INDEXES YIELD name, state, populationPercent,
  labelsOrTypes, properties, options
RETURN name, state, populationPercent, labelsOrTypes, properties, options.indexConfig AS indexConfig;

// Drop (node data unchanged — only index structure removed)
DROP INDEX chunk_embedding IF EXISTS;

// No ALTER VECTOR INDEX — to change dimensions or similarity function:
// 1. DROP INDEX old_index IF EXISTS
// 2. CREATE VECTOR INDEX new_index ... with new OPTIONS
// 3. Re-generate all embeddings with new model
// 4. Poll until ONLINE

Common Errors

ErrorCauseFix
Some nodes never returned, no errorStored vector wrong length (≠ vector.dimensions), non-numeric, or all zeros under cosine → silently not indexedAssert dims before write; find offenders with size(c.embedding) <> $dims
51N65 vector index dimensionality mismatchQuery vector length ≠ vector.dimensionsUse same model and dimensions setting as ingest
Search returns incomplete resultsIndex still POPULATINGPoll until state = 'ONLINE'
Unknown procedure db.index.vector.queryNodesNeo4j < 5.11No vector index support below 5.11; upgrade
SEARCH clause not availableNeo4j < 2026.01Use queryNodes() procedure
OR/NOT not allowed in SEARCH WHERESEARCH in-index filter restrictionMove complex predicates to outer WHERE after SEARCH
Zero results from correct queryWrong similarity function or all-zeros embeddingVerify with vector.similarity.cosine(); check embed call succeeded
Score always 1.0All-zeros or identical vectorsEmbedding generation failed; add dimension assertion before ingest
vector.quantization.enabled / .type option rejectedprovider vector-1.0 (Neo4j < 5.18)Omit quantization option or upgrade to 5.18+
BINARY quantization rejectedprovider older than vector-2026.06Upgrade to 2026.06+; SHOW VECTOR INDEXES YIELD name, indexProvider to check (vector-2026.07 adds High-Fidelity Quantized search)

Checklist

  • vector.dimensions matches embedding model output exactly
  • Vector index created before ingesting embeddings
  • Similarity function chosen explicitly (cosine for normalized, euclidean for distance-based)
  • Index polled to state = 'ONLINE' before first query
  • Dimension validated on every embedding before ingest
  • SEARCH clause on Neo4j >= 2026.01 (preferred); procedure fallback only on 2025.x (deprecated 2026.04)
  • SEARCH WHERE uses AND-only predicates with scalar types
  • Batch UNWIND pattern used for > 100 nodes
  • If model changes: drop index → recreate with new dimensions → re-generate all embeddings

In-Cypher Embedding Generation — ai.text.embed() [2025.12]

cypher
// Syntax (requires CYPHER 25)
CYPHER 25
// ai.text.embed(resource :: STRING, provider :: STRING, configuration :: MAP) :: VECTOR

Provider strings are lowercase ('openai', 'vertexai', 'bedrock-titan', 'azure-openai'). Full provider config → neo4j-genai-plugin-skill.

Storing the result: ai.text.embed() returns VECTOR. Storing VECTOR properties needs block format (Enterprise; Aura default). Community / aligned format → SET c.embedding = toFloatList(ai.text.embed(...)) (stores LIST<FLOAT>); raw VECTOR fails with 51N77.

Full query pattern — embed at query time, search immediately (procedure fallback for 2025.x):

cypher
CYPHER 25
WITH ai.text.embed(
    "What are good open source projects",
    "openai",
    { token: $openaiKey, model: 'text-embedding-3-small' }) AS userEmbedding
CALL db.index.vector.queryNodes('chunk_embedding', 6, userEmbedding)  // deprecated 2026.04
YIELD node AS c, score
RETURN c.text, score
ORDER BY score DESC

With SEARCH clause (2026.01+):

cypher
CYPHER 25
WITH ai.text.embed("my query", "openai", { token: $openaiKey, model: 'text-embedding-3-small' }) AS userEmbedding
MATCH (c:Chunk)
  SEARCH c IN (VECTOR INDEX chunk_embedding FOR userEmbedding LIMIT 6) SCORE AS score
RETURN c.text, score
ORDER BY score DESC

Never pass API key as string literal — use $openaiKey parameter (inject via driver params) or apoc.static.get().

Rule: Use same model at ingest time and query time — embeddings from different models are not comparable.

Deprecated (still works but do not use in new code):

  • genai.vector.encode() [deprecated] → use ai.text.embed() [2025.12]
  • genai.vector.encodeBatch() [deprecated] → use CALL ai.text.embedBatch() [2025.12]
  • genai.vector.listEncodingProviders() [deprecated] → use CALL ai.text.embed.providers() [2025.12]

For full ai.text.* reference (completion, structured output, chat, tokenization) → neo4j-genai-plugin-skill.


Cypher-Based Embedding Ingestion — db.create.setNodeVectorProperty

Set vector property via Cypher (e.g. during LOAD CSV or MERGE pipeline):

cypher
LOAD CSV WITH HEADERS FROM 'https://example.com/data.csv' AS row
MERGE (q:Question {text: row.question})
WITH q, row
CALL db.create.setNodeVectorProperty(q, 'embedding', apoc.convert.fromJsonList(row.question_embedding))

apoc.convert.fromJsonList() converts "[0.1,0.2,...]" STRING to LIST<FLOAT>. Python-generated embeddings → UNWIND batch pattern (Step 3).


Similarity Function — Extended Guidance

Choose based on training loss function:

  • Check embedding model docs — models trained with cosine loss → use 'cosine'
  • Models trained with L2/Euclidean loss → use 'euclidean'
  • When docs are silent: default to 'cosine' (all major hosted APIs use it)

Common pitfall — wrong similarity function:

❌ Created index with 'euclidean' but model outputs L2-normalized vectors
   → scores are mathematically correct but rankings differ from expected cosine order
   → no error thrown; wrong results silently returned
✅ Verify: run vector.similarity.cosine(a.embedding, b.embedding) manually on known
   similar pairs — score should be > 0.9 for near-duplicate text

Sanity check query after index creation:

cypher
MATCH (c:Chunk) WITH c LIMIT 2
WITH collect(c) AS nodes
RETURN vector.similarity.cosine(nodes[0].embedding, nodes[1].embedding) AS cosine_check,
       vector.similarity.euclidean(nodes[0].embedding, nodes[1].embedding) AS euclidean_check

If both return null → embeddings not set. If cosine returns 1.0 → identical vectors (embed call failed).


Gotchas — Extended

GotchaDetailFix
Index not ONLINE at ingest timeInserting nodes before index exists is valid — index auto-populates. But querying during POPULATING returns partial resultsAlways poll state = 'ONLINE' before first query
Wrong dimensions — silent failureStored vector dim ≠ vector.dimensions → no error at write or query; node silently not indexed, results just missing. Wrong-length query vector raises 51N65Assert len(emb) == expected_dim before every SET c.embedding — the only guard
Different models at ingest vs queryNo error; cosine scores ~0.3–0.5 for clearly similar textUse same model string/version for both; store model name as node metadata
Missing model at queryai.text.embed raises an error (with cause) on wrong/missing key, provider or unreachable endpoint; returns null only for null inputTest encode call standalone; check CYPHER 25 RETURN ai.text.embed(...) before embedding into pipeline
Large single-transaction ingestOne transaction for 10k nodes → OOM or timeoutUse UNWIND $rows ... CALL IN TRANSACTIONS OF 500 ROWS or Python batch loop
Chunk overlap not setAdjacent chunks with no overlap → context at boundaries lost → poor recall for cross-paragraph queriesSet chunk_overlap ≥ 10% of chunk_size

References

Load on demand:

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Neo4j Vector Index Skill làm được gì?

Create and manage Neo4j vector indexes, run vector similarity search (ANN/kNN), store embeddings on nodes or relationships, use SEARCH clause (Neo4j 2026.01+, preferred) or db.index.vector.queryNodes() procedure (deprecated 2026.04, still works on 2025.x), configure HNSW and quantization options, pick similarity function and embedding provider dimensions, and batch-update embeddings. Use when tasks involve CREATE VECTOR INDEX, vector.dimensions, cosine/euclidean search, embedding ingestion pipelines, semantic or structural nearest-neighbor lookup, or hybrid search (vector + fulltext, multip...

Vì sao nên dùng Neo4j Vector Index Skill trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Neo4j Vector Index Skill là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Neo4j Vector Index Skill trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/neo4j/agent-skills/tree/main/neo4j-vector-index-skill. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Neo4j Vector Index Skill?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Neo4j Vector Index Skill với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Neo4j Vector Index Skill với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Neo4j Vector Index Skill có miễn phí không?

Có. Kỹ năng này được neo4j phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇