
Neo4j Genai Plugin Skill
Call embeddings, completions, structured JSON, and chat from Cypher using Neo4j’s GenAI Plugin for in-database GraphRAG and agent retrieval.
Install
npx skills add https://github.com/neo4j-contrib/neo4j-skills --skill neo4j-genai-plugin-skillWhat is this skill?
- Documents ai.text.embed, embedBatch, completion, aggregateCompletion, structuredCompletion, chat, tokenCount, and chunkB
- Pure-Cypher GraphRAG pattern: embed → vector search → graph traversal → completion in one query
- Provider setup for OpenAI, Azure OpenAI, VertexAI, and Amazon Bedrock with lowercase provider strings
- Requires CYPHER 25 per-query prefix or ALTER DATABASE default; Neo4j 2025.12+ or Aura with GenAI Plugin
- Includes migration path from deprecated genai.vector.* to ai.text.*
Adoption & trust: 1 installs on skills.sh; 80 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
Recommended Skills
Journey fit
Graph-backed GenAI wiring is core backend integration work when you embed product knowledge in Neo4j during the build phase. Backend is canonical because the skill centers on Cypher functions, provider config, and query-time LLM calls—not frontend polish or launch SEO.
Common Questions / FAQ
Is Neo4j Genai Plugin Skill safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Neo4j Genai Plugin Skill
# neo4j-genai-plugin-skill Skill for calling LLM providers directly from Cypher using the Neo4j GenAI Plugin `ai.text.*` functions [2025.12]. **Covers:** - `ai.text.embed()` / `ai.text.embedBatch()` — generate vector embeddings in Cypher; replaces deprecated `genai.vector.encode()` - `ai.text.completion()` / `ai.text.aggregateCompletion()` — LLM text generation over query results - `ai.text.structuredCompletion()` / `ai.text.aggregateStructuredCompletion()` — JSON Schema-validated structured output - `ai.text.chat()` — stateful chat with `chatId` (OpenAI / Azure only) - `ai.text.tokenCount()` / `ai.text.chunkByTokenLimit()` — tokenization and chunking helpers - Provider discovery: `ai.text.embed.providers()`, `ai.text.completion.providers()` - Provider configuration — OpenAI, Azure OpenAI, VertexAI, Amazon Bedrock - Pure-Cypher GraphRAG: embed → vector search → graph traversal → completion in one query - CYPHER 25 requirement: per-query prefix and `ALTER DATABASE` default - Migration from deprecated `genai.vector.*` → `ai.text.*` **Version / compatibility:** - `ai.text.*` requires Neo4j 2025.12+ (self-managed) or Aura with GenAI Plugin enabled - All functions require `CYPHER 25` prefix or `ALTER DATABASE neo4j SET DEFAULT LANGUAGE CYPHER 25` - Provider strings are lowercase: `'openai'`, `'azure-openai'`, `'vertexai'`, `'bedrock-titan'` **Not covered:** - Vector index creation and management → `neo4j-vector-index-skill` - GraphRAG pipelines via Python (`neo4j-graphrag` package) → `neo4j-graphrag-skill` - KG construction from documents → `neo4j-document-import-skill` **Install:** ```bash npx skills add https://github.com/neo4j-contrib/neo4j-skills --skill neo4j-genai-plugin-skill ``` Or paste this link into your coding assistant: https://github.com/neo4j-contrib/neo4j-skills/tree/main/neo4j-genai-plugin-skill # GenAI Plugin — Full Provider Configuration Reference All `ai.text.*` functions and `ai.text.embedBatch` accept `configuration :: MAP` as last argument. Provider strings are **lowercase and exact** — case-sensitive. --- ## OpenAI (`'openai'`) | Key | Type | Required | Default | Notes | |---|---|---|---|---| | `token` | STRING | Yes | — | OpenAI API key | | `model` | STRING | Yes | — | e.g. `'text-embedding-3-small'`, `'gpt-4o-mini'` | | `maxBatchSize` | INTEGER | No | 8192 | Max tokens per batch request | | `vendorOptions` | MAP | No | `{}` | Extra OpenAI params, e.g. `{ dimensions: 1024 }` for reduced embedding dims | | `chatHistory` | LIST<ANY> | No | — | Completion/chat only. `[{ role: 'user', content: '...' }, ...]` | ### Embed example ```cypher CYPHER 25 RETURN ai.text.embed('Hello', 'openai', { token: $openaiKey, model: 'text-embedding-3-small', vendorOptions: { dimensions: 1024 } }) AS v ``` ### Completion example ```cypher CYPHER 25 RETURN ai.text.completion('Summarize: ' + $text, 'openai', { token: $openaiKey, model: 'gpt-4o-mini', vendorOptions: { instructions: 'Be concise.' } }) AS summary ``` --- ## Azure OpenAI (`'azure-openai'`) | Key | Type | Required | Default | Notes | |---|---|---|---|---| | `token` | STRING | Yes | — | Azure OAuth2 bearer token | | `resource` | STRING | Yes | — | Azure resource name (subdomain of openai.azure.com) | | `model` | STRING | Yes | — | Deployment name in Azure portal | | `maxBatchSize` | INTEGER | No | 8192 | Embed batch only | | `vendorOptions` | MAP | No | `{}` | Extra Azure params | | `chatHistory` | LIST<ANY> | No | — | Completion/chat only | ### Example ```cypher CYPHER 25 RETURN ai.text.embed('Hello', 'azure-openai', { token: $azureToken, resource: 'my-azure-resource', model: 'text-embedding-3-small' }) AS v ``` ### Override Azure base URL [2026.04] Server-side env var `GENAI_AZURE_OPENAI_BASE_URL` overrides the default `https://<resource>.openai.azure.com` for all `azure-openai` `ai.text.*` calls. Set on the Neo4j server (not the driver/client). Use for private endpoints, custom hostnames, or proxy gateways. ```bash # neo4j.conf or sy