diff --git a/servers/unraid/supermemory-poc/README.md b/servers/unraid/supermemory-poc/README.md index a0483f4..d143d5d 100644 --- a/servers/unraid/supermemory-poc/README.md +++ b/servers/unraid/supermemory-poc/README.md @@ -10,10 +10,12 @@ production Hindsight service or change the default Hermes profile. cache live under `/mnt/user/appdata/supermemory-poc/data`. - A dedicated address on Docker `br0`; port `6767` is not published on the unRaid host address. -- Local multilingual `Xenova/bge-m3` embeddings at 1024 dimensions. -- One embedding worker and ingest concurrency 1. This avoids treating known - concurrent-local-embedding instability as a retrieval-quality result. -- Extraction/summarization uses an operator-supplied OpenAI-compatible LLM. +- Remote OpenAI-compatible embeddings through HK LiteLLM using + `google/gemini-embedding-2` at 1024 dimensions. +- Extraction, summarization, and other intelligent steps use + `gemini-3.5-flash-lite` through the same LiteLLM endpoint. +- Ingest concurrency remains 1 so the first POC emphasizes correctness and + observable cost over throughput. - Resource ceiling: 4 CPUs and 8 GiB RAM. Supermemory Local keeps its corpus in memory, so RSS must be watched as the sample grows. @@ -24,8 +26,10 @@ directory and re-ingest when comparing a different embedding plan. 1. Confirm the chosen `SUPERMEMORY_IPV4_ADDRESS` is absent from both Arcane's `br0` attachments and the LAN neighbor/DHCP tables. -2. Add `SUPERMEMORY_IPV4_ADDRESS`, `OPENAI_API_KEY`, and optional model/base URL - overrides to this Project's Arcane environment. Do not put secrets in Git, +2. Add `SUPERMEMORY_IPV4_ADDRESS`, `OPENAI_API_KEY`, + `OPENAI_BASE_URL=https://api.opfo.xyz/v1`, and + `OPENAI_MODEL=gemini-3.5-flash-lite` to this Project's Arcane environment. + `OPENAI_API_KEY` is the HK LiteLLM bearer key. Do not put it in Git, Compose, activity notes, or chat. 3. Confirm `/mnt/user/appdata` has room for the 298 MiB server binary, the multilingual model cache, data, and rollback copy. @@ -45,7 +49,7 @@ image build is required. The server creates its client bearer token at: -`/mnt/user/appdata/supermemory-poc/data/api-key` +`/mnt/user/appdata/supermemory-poc/data-google-gemini-embedding-2-1024/api-key` Read it through an authorized unRaid/Arcane console without printing it into logs. Save it only as `SUPERMEMORY_API_KEY` in the `supermemory-lab` Hermes @@ -77,17 +81,16 @@ Run `poc.py smoke` before importing any sampled production material. It checks the v3 document path plus the v4 search, profile, and conversation endpoints used by Hermes. -### Current local-embedding blocker +### Embedding plan and smoke gate -On the unRaid POC host, `server-v0.0.8` remains healthy but its local embedding -worker returns `unknown certificate verification error` when first loading -`Xenova/bge-m3`. Supplying a Mozilla CA bundle through `SSL_CERT_FILE`, -`SSL_CERT_DIR`, `NODE_EXTRA_CA_CERTS`, and Debian's standard CA path did not -change the error; TLS verification was never disabled. Do not import sampled -Hindsight or document data until either a remote OpenAI-compatible embedding -endpoint or a separately approved local embedding sidecar passes the smoke -test. The server also returns HTTP 409 when deleting documents stuck in the -`embedding` state, so failed smoke rows may require a fresh POC data directory. +The earlier local `Xenova/bge-m3` experiment is preserved under the old `data` +directory because embedding plans cannot be changed in place. This deployment +uses the fresh `data-google-gemini-embedding-2-1024` directory. The one-shot +`supermemory-smoke` service verifies the locked embedding plan, performs a +Chinese hybrid-search round trip, checks provenance metadata, and exercises +the profile and conversation endpoints. It writes a sentinel after success so +ordinary redeploys do not add duplicate smoke documents. Do not import sampled +Hindsight or document material until this service exits successfully. ## Evaluation guardrails diff --git a/servers/unraid/supermemory-poc/compose.yaml b/servers/unraid/supermemory-poc/compose.yaml index 0626e08..6143b22 100644 --- a/servers/unraid/supermemory-poc/compose.yaml +++ b/servers/unraid/supermemory-poc/compose.yaml @@ -53,20 +53,20 @@ services: PORT: "6767" SUPERMEMORY_DATA_DIR: /var/lib/supermemory SUPERMEMORY_DISABLE_TELEMETRY: "1" - SUPERMEMORY_EMBEDDING_PROVIDER: local - SUPERMEMORY_EMBEDDING_MODEL: Xenova/bge-m3 + SUPERMEMORY_EMBEDDING_PROVIDER: openai + SUPERMEMORY_EMBEDDING_MODEL: google/gemini-embedding-2 SUPERMEMORY_EMBEDDING_DIMENSIONS: "1024" - SUPERMEMORY_LOCAL_EMBEDDING_POOL_SIZE: "1" - SUPERMEMORY_LOCAL_EMBEDDING_WASM_THREADS: "1" - SUPERMEMORY_LOCAL_EMBEDDING_BATCH_SIZE: "4" + SUPERMEMORY_EMBEDDING_BASE_URL: ${OPENAI_BASE_URL:?set OPENAI_BASE_URL in Arcane environment} SUPERMEMORY_EMBEDDING_RAM_LIMIT: 2gb SUPERMEMORY_INGEST_CONCURRENCY: "1" SSL_CERT_FILE: /opt/supermemory/bin/ca-certificates.crt SSL_CERT_DIR: /etc/ssl/certs NODE_EXTRA_CA_CERTS: /opt/supermemory/bin/ca-certificates.crt OPENAI_API_KEY: ${OPENAI_API_KEY:?set OPENAI_API_KEY in Arcane environment} - OPENAI_BASE_URL: ${OPENAI_BASE_URL:-} - OPENAI_MODEL: ${OPENAI_MODEL:-gpt-5.1} + OPENAI_BASE_URL: ${OPENAI_BASE_URL:?set OPENAI_BASE_URL in Arcane environment} + OPENAI_MODEL: ${OPENAI_MODEL:-gemini-3.5-flash-lite} + OPENAI_FAST_MODEL: ${OPENAI_MODEL:-gemini-3.5-flash-lite} + OPENAI_TEXT_MODEL: ${OPENAI_MODEL:-gemini-3.5-flash-lite} entrypoint: - /bin/bash - -ec @@ -86,7 +86,7 @@ services: volumes: - /mnt/user/appdata/supermemory-poc/bin:/opt/supermemory/bin:ro - /mnt/user/appdata/supermemory-poc/bin/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt:ro - - /mnt/user/appdata/supermemory-poc/data:/var/lib/supermemory + - /mnt/user/appdata/supermemory-poc/data-google-gemini-embedding-2-1024:/var/lib/supermemory networks: br0: ipv4_address: ${SUPERMEMORY_IPV4_ADDRESS:?set an unused LAN address in Arcane environment} @@ -100,6 +100,34 @@ services: max-size: 10m max-file: "3" + supermemory-smoke: + image: curlimages/curl:8.16.0@sha256:463eaf6072688fe96ac64fa623fe73e1dbe25d8ad6c34404a669ad3ce1f104b6 + container_name: supermemory-poc-smoke + user: "0:0" + restart: "no" + depends_on: + supermemory: + condition: service_healthy + network_mode: service:supermemory + environment: + SUPERMEMORY_URL: http://127.0.0.1:6767 + SUPERMEMORY_CONTAINER_TAG: hermes_supermemory_lab + entrypoint: + - /bin/sh + - /opt/supermemory-poc/smoke.sh + volumes: + - ./smoke.sh:/opt/supermemory-poc/smoke.sh:ro + - /mnt/user/appdata/supermemory-poc/data-google-gemini-embedding-2-1024:/var/lib/supermemory + security_opt: + - no-new-privileges:true + cap_drop: + - ALL + logging: + driver: json-file + options: + max-size: 1m + max-file: "2" + networks: fetch: internal: false diff --git a/servers/unraid/supermemory-poc/smoke.sh b/servers/unraid/supermemory-poc/smoke.sh new file mode 100644 index 0000000..88a4c2d --- /dev/null +++ b/servers/unraid/supermemory-poc/smoke.sh @@ -0,0 +1,62 @@ +#!/bin/sh +set -eu + +data_dir=/var/lib/supermemory +sentinel="$data_dir/.smoke-google-gemini-embedding-2-1024.ok" +base_url="${SUPERMEMORY_URL:-http://127.0.0.1:6767}" +container_tag="${SUPERMEMORY_CONTAINER_TAG:-hermes_supermemory_lab}" + +if [ -f "$sentinel" ]; then + printf '%s\n' '{"smoke":"already-passed"}' + exit 0 +fi + +api_key=$(cat "$data_dir/api-key") +auth_header="Authorization: Bearer $api_key" +marker="supermemory-poc-google-embedding-2-$(date +%s)" + +plan="$data_dir/embedding-plan.json" +for _ in $(seq 1 30); do + [ -f "$plan" ] && break + sleep 1 +done +grep -q 'openai' "$plan" +grep -q 'google/gemini-embedding-2' "$plan" +grep -q '1024' "$plan" + +curl --fail --silent --show-error --max-time 60 \ + -H "$auth_header" \ + -H 'Content-Type: application/json' \ + --data "{\"content\":\"$marker:中文跨文档检索测试;海棠计划的下一步是核对原始报告。\",\"containerTag\":\"$container_tag\",\"customId\":\"$marker\",\"metadata\":{\"source\":\"poc-smoke\",\"status\":\"temporary\"}}" \ + "$base_url/v3/documents" >/tmp/add.json + +found=false +for _ in $(seq 1 90); do + curl --fail --silent --show-error --max-time 60 \ + -H "$auth_header" \ + -H 'Content-Type: application/json' \ + --data "{\"q\":\"海棠计划下一步是什么?\",\"containerTag\":\"$container_tag\",\"searchMode\":\"hybrid\",\"limit\":5}" \ + "$base_url/v4/search" >/tmp/search.json + if grep -q '核对原始报告' /tmp/search.json && grep -q 'poc-smoke' /tmp/search.json; then + found=true + break + fi + sleep 2 +done +[ "$found" = true ] + +curl --fail --silent --show-error --max-time 60 \ + -H "$auth_header" \ + -H 'Content-Type: application/json' \ + --data "{\"containerTag\":\"$container_tag\",\"q\":\"海棠计划\"}" \ + "$base_url/v4/profile" >/tmp/profile.json +grep -q '"profile"' /tmp/profile.json + +curl --fail --silent --show-error --max-time 60 \ + -H "$auth_header" \ + -H 'Content-Type: application/json' \ + --data "{\"conversationId\":\"$marker\",\"containerTags\":[\"$container_tag\"],\"messages\":[{\"role\":\"user\",\"content\":\"这只是隔离测试。\"},{\"role\":\"assistant\",\"content\":\"不会作为正式事实。\"}],\"metadata\":{\"source\":\"poc-smoke\",\"status\":\"temporary\"}}" \ + "$base_url/v4/conversations" >/tmp/conversation.json + +touch "$sentinel" +printf '%s\n' '{"embedding_plan":"openai/google/gemini-embedding-2/1024","llm":"gemini-3.5-flash-lite","chinese_hybrid_search":"ok","metadata_traceability":"ok","profile":"ok","conversation_ingest":"accepted"}'