feat(knowledgebase): replace litellm-pgvector connector with memory-retrieval
Per docs/research/langchain-pgvector-vs-litellm-pgvector.md (issue #25): the vendored litellm-pgvector connector (793 lines, Prisma migrations, a fragile git-context build) is replaced by a ~90-line FastAPI service (services/memory-retrieval/) wrapping langchain_postgres.PGVector directly against pgvector-db. Same gateway boundary — it still calls litellm for embeddings, nothing talks to Postgres or the model directly except this service. - New services/memory-retrieval/ (main.py, Dockerfile, requirements.txt): POST /ingest, POST /query, GET /health. - docker-compose.yml: litellm-pgvector service replaced by memory-retrieval; pgvector-db and embedding-server untouched. - litellm-config.yaml: vector_store_registry block removed (no langchain_postgres provider exists to register against; callers query memory-retrieval directly instead of an in-band file_search tool call — that mechanism was never confirmed working per issue #24 anyway). - scripts/ingest-memory.sh rewritten for the new /ingest endpoint (same per-line chunking, no dedup). - .env vars renamed: LITELLM_PGVECTOR_API_KEY/LITELLM_PGVECTOR_EMBEDDING_KEY -> MEMORY_RETRIEVAL_API_KEY/MEMORY_RETRIEVAL_EMBEDDING_KEY. - vendor/litellm-pgvector/ removed entirely. - docs/memory-knowledgebase.md updated for the new setup/query flow. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+17
-25
@@ -214,38 +214,30 @@ services:
|
||||
retries: 10
|
||||
|
||||
# LiteLLM's native knowledgebase/vector-store feature has no Qdrant backend
|
||||
# (the qdrant service above only serves Open WebUI's own RAG/Memory) — this
|
||||
# companion service (github.com/BerriAI/litellm-pgvector) is the only
|
||||
# self-hosted path. No published image exists yet, so this builds from a
|
||||
# vendored copy in vendor/litellm-pgvector/ (see that dir's README) rather
|
||||
# than a remote git build context — the server's Docker/BuildKit couldn't
|
||||
# do an authenticated-looking clone of a public github.com repo (fails
|
||||
# with "could not read Username ... terminal prompts disabled"), and
|
||||
# vendoring sidesteps needing that debugged. See
|
||||
# docs/research/litellm-knowledgebase.md.
|
||||
# ponytail: unverified against real hardware — Prisma migration behavior on
|
||||
# first boot and the exact vector_store_registry field names for the
|
||||
# pg_vector provider need a live smoke test. See issue #24.
|
||||
litellm-pgvector:
|
||||
# (the qdrant service above only serves Open WebUI's own RAG/Memory), so
|
||||
# this small in-repo service wraps langchain_postgres.PGVector directly
|
||||
# against pgvector-db instead — simpler than a vendored third-party
|
||||
# connector (see docs/research/langchain-pgvector-vs-litellm-pgvector.md,
|
||||
# which replaced the earlier litellm-pgvector approach). It still calls
|
||||
# back into litellm for embeddings, same gateway boundary as everything
|
||||
# else in this stack.
|
||||
memory-retrieval:
|
||||
build:
|
||||
context: ./vendor/litellm-pgvector
|
||||
container_name: litellm-pgvector
|
||||
context: ./services/memory-retrieval
|
||||
container_name: memory-retrieval
|
||||
depends_on:
|
||||
pgvector-db:
|
||||
condition: service_healthy
|
||||
litellm:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
- DATABASE_URL=postgresql://litellm_pgvector:${PGVECTOR_DB_PASSWORD}@pgvector-db:5432/litellm_pgvector
|
||||
- SERVER_API_KEY=${LITELLM_PGVECTOR_API_KEY}
|
||||
# Calls back into litellm for embeddings, same pattern as any other
|
||||
# workload — see docs/proxy-key-onboarding.md for issuing this key.
|
||||
- EMBEDDING__MODEL=local-embedding
|
||||
- EMBEDDING__BASE_URL=http://litellm:4000
|
||||
- EMBEDDING__API_KEY=${LITELLM_PGVECTOR_EMBEDDING_KEY}
|
||||
- EMBEDDING__DIMENSIONS=768
|
||||
expose:
|
||||
- "8000"
|
||||
- DATABASE_URL=postgresql+psycopg://litellm_pgvector:${PGVECTOR_DB_PASSWORD}@pgvector-db:5432/litellm_pgvector
|
||||
- LITELLM_BASE_URL=http://litellm:4000/v1
|
||||
# A virtual key for this workload — see docs/proxy-key-onboarding.md.
|
||||
- LITELLM_API_KEY=${MEMORY_RETRIEVAL_EMBEDDING_KEY}
|
||||
- EMBEDDING_MODEL=local-embedding
|
||||
- SERVER_API_KEY=${MEMORY_RETRIEVAL_API_KEY}
|
||||
- COLLECTION_NAME=memory-and-notes
|
||||
restart: unless-stopped
|
||||
networks: [ai-stack]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user