Skip to content

feat: Pinecone knowledge backend (revives #238 as contract-compliant built-in) - #438

Closed
esafwan wants to merge 4 commits into
feat/faiss-knowledge-backendfrom
feat/pinecone-knowledge-backend
Closed

feat: Pinecone knowledge backend (revives #238 as contract-compliant built-in)#438
esafwan wants to merge 4 commits into
feat/faiss-knowledge-backendfrom
feat/pinecone-knowledge-backend

Conversation

@esafwan

@esafwan esafwan commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

feat: Pinecone knowledge backend

Adds Pinecone (serverless cloud vector DB) as a built-in knowledge backend via llama-index-vector-stores-pinecone 0.8.0 (pinecone 7.x client; compatible with llama-index-core 0.14.23 + Python 3.14). Revives the closed #238 on the current contract architecture.

Design

  • PineconeBackend(LlamaIndexBackend, KnowledgeBackend), mirroring pgvector_backend.py: HUF-side embeddings, site_name + knowledge_source metadata, MetadataFilters on search and deletes.
  • Two-layer isolation: one shared serverless index; each Knowledge Source pinned to a namespace (scrub(site)_scrub(source), overridable) — plus mandatory site/source metadata filters on every query/delete (same pattern as pgvector's table+filters).
  • Config via advanced_config (no first-class DocType fields): pinecone_api_key (plaintext warning; PINECONE_API_KEY env fallback), pinecone_index_name (validated), pinecone_namespace, pinecone_cloud (aws/gcp/azure), pinecone_region. Index auto-created with the source's dimension + cosine metric via ServerlessSpec; dimension of existing indexes validated.
  • delete_chunks: count via filtered fetch then delete_nodes(filters=...); clear: namespace-scoped delete_all; get_stats: describe_index_stats.

Testing (bench 16_kbreg, Frappe 16.27, Python 3.14)

Test Status
Registry discovery as built-in
Advanced-config schema round-trip (5 keys)
32 mocked unit tests (init, dep guard, config validation, namespace isolation, real delete path, stats, registry)
ruff check / ruff format
Live E2E (index → search → delete) key-gated — no Pinecone API key in the dev secrets store. The E2E cycle is scripted and skips cleanly without PINECONE_API_KEY; run it with a key set to complete the live-test bar before merge.

Dependencies

esafwan added 4 commits July 26, 2026 04:23
Built-in pinecone backend on LlamaIndexBackend via
llama-index-vector-stores-pinecone (0.8.0, pinecone <8,>=7):

- pinecone_backend.py: config validation (API key from advanced_config
  or PINECONE_API_KEY env, index-name rules, dimension, cloud/region),
  serverless index auto-creation with cosine metric, per-site/per-source
  namespace isolation plus site_name/knowledge_source metadata filters,
  delete_chunks via count-then-delete_nodes, clear via namespace purge,
  get_stats via describe_index_stats, advanced-config schema with
  plaintext-warning on the API key.
- Registered as built-in: backend registry, Knowledge Source options and
  vector depends_on lists, VECTOR_KNOWLEDGE_TYPES, knowledge_source.js,
  indexer vector tuple, hooks.py comment, BACKEND_CONTRACT.md.
- pyproject: llama-index-vector-stores-pinecone dependency.
- 32 mocked unit tests (backend + registry), zvec-test style.
…dge-backend

# Conflicts:
#	huf/ai/knowledge/backends/BACKEND_CONTRACT.md
#	huf/ai/knowledge/backends/__init__.py
#	huf/ai/knowledge/indexer.py
#	huf/hooks.py
#	huf/huf/doctype/knowledge_source/knowledge_source.js
#	huf/huf/doctype/knowledge_source/knowledge_source.json
#	huf/huf/doctype/knowledge_source/knowledge_source.py
#	pyproject.toml
@esafwan

esafwan commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by consolidated vector backend PR #467, now included in integration PR #468.

@esafwan esafwan closed this Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant