feat: add PGVector knowledge source#280
Open
esafwan wants to merge 18 commits into
Open
Conversation
- embedding.py: configurable litellm_embedding_timeout (default 600s) passed as request_timeout; Ollama 400 single retry; batch_size=1 for ollama/ models - knowledge_source.py: test_connection whitelist API (tests pgvector + embedding) - knowledge_source.py: _warn_if_embedding_changed() warning when provider/model changes on a source with existing chunks - knowledge_source.js: Test Connection button handler with results dialog - knowledge_source.json: Test Connection button field (pgvector only) - knowledge_input.json: file field description updated to mention litellm_embedding_timeout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: add PGVector knowledge source
Adds PostgreSQL/pgvector as a vector backend for HUF Knowledge Sources, alongside the existing Chroma and SQLite-vec backends.
What's in this PR
New DocTypes
Knowledge Source— pgvector_* connection fields, embedding model/provider/dimension configKnowledge Input— file, text, URL input types with background indexing queueIntegration Credential,Integration Recipient,Integration Service,Integration SettingsBackend
pgvector_backend.py— LlamaIndex PGVectorStore adapter: add_chunks, search, delete_chunks, get_stats, healthembedding.py— LiteLLM provider-agnostic embeddings (OpenAI, Gemini, Ollama, etc.)indexer.py— background job: extract → chunk → embed → insert into pgvectorFixes included (post-test)
litellm_embedding_timeoutsite_config key (default 600s) — discovered during 3.26MB document indexing that hit LiteLLM’s effective 300s wall/api/embed400 errors;batch_size=1forollama/modelsvalidate()msgprint when model/provider changes on a source with existing chunkslitellm_embedding_timeout(replaced misleading “split files >1.5MB” guidance)Testing Extent
All tests run on Frappe 16.18.2, pgvector 0.8.2, bench 5.28.0, devcontainer
fdocker.nomic-embed-text, air-gapped, ~2–10 min for large filesnivoviaagent_knowledge; backend retrieval validatedtest_tool,test_chroma_backend(skip), direct smoke add/search/stats/delete/healthyarn typecheck,yarn build,bench build --app hufpassNot yet validated / caveats
nivowas not explicitly completed in this session.Related PRs
Checklist
llama-index-vector-stores-postgresin requirementstemp_test_docs/removeddevelopment/edge16/HUF_pgvector_PR280_manual_test.md