diff --git a/litellm-config.yaml b/litellm-config.yaml index 56bdc19..5b74b77 100644 --- a/litellm-config.yaml +++ b/litellm-config.yaml @@ -61,6 +61,14 @@ search_tools: # caller-supplied id — see scripts/update.sh, scripts/ingest-memory.sh, and # vendor/litellm-pgvector/'s local patches (models.py, main.py, # prisma/schema.prisma). +# +# This block only seeds the store into litellm's in-memory registry at +# boot — it does NOT make it appear on the Admin UI's Vector Stores page +# (/ui/vector-stores). That page reads litellm's own DB +# (LiteLLM_ManagedVectorStoresTable), a separate registration scripts/ +# update.sh also does via POST /vector_store/new. Keep both in sync by +# hand if you change api_base/api_key here — see update.sh's comment on +# why there's no automatic sync from this block to the DB row. vector_store_registry: - vector_store_name: memory-and-notes litellm_params: diff --git a/scripts/update.sh b/scripts/update.sh index 274dfe6..b291c96 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -116,5 +116,35 @@ echo "==> syncing litellm-pgvector's database schema" docker compose up -d --wait pgvector-db litellm-pgvector docker compose exec -T litellm-pgvector prisma db push --accept-data-loss +# Registers memory-and-notes in litellm's own DB (LiteLLM_ManagedVectorStoresTable), +# not just litellm-config.yaml's vector_store_registry block. Both matter for +# different reasons: config.yaml seeds it into memory at boot (works even +# before this script has ever run against a fresh DB); the DB row is what +# /vector_store/list — and so the Admin UI's Vector Stores page — actually +# shows, since that endpoint only auto-syncs a config-only entry into the DB +# view once a DB row with the same id exists (see issue #24 follow-up). +# +# Must pass the real key, not the os.environ/... form used in +# litellm-config.yaml — this hits the live management API, not the +# config.yaml loader, so there's no env-substitution pass over the request +# body. Ignores failure if the row already exists (no update-in-place: see +# below). +# +# No update-if-changed path — the DB row is otherwise never touched once +# created (/vector_store/update in this litellm version can't set +# litellm_params at all — VectorStoreUpdateRequest has no such field, so an +# update silently no-ops on it). If LITELLM_PGVECTOR_API_KEY ever rotates, +# fix this row by hand: /vector_store/delete then re-run this script. +echo "==> registering memory-and-notes vector store with litellm (for the Admin UI)" +curl -sf -X POST "http://localhost:${LITELLM_PORT:-4000}/vector_store/new" \ + -H "Authorization: Bearer ${LITELLM_MASTER_KEY}" \ + -H "Content-Type: application/json" \ + -d "$(jq -n --arg key "${LITELLM_PGVECTOR_API_KEY}" '{ + vector_store_id: "memory-and-notes", + custom_llm_provider: "pg_vector", + vector_store_name: "memory-and-notes", + litellm_params: {api_base: "http://litellm-pgvector:8000", api_key: $key} + }')" > /dev/null 2>&1 || echo "memory-and-notes: already registered (or registration failed — check by hand if this is a fresh deploy)." + echo "==> status" docker compose ps