test Supermemory with native Gemini
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
set -eu
|
||||
|
||||
data_dir=/var/lib/supermemory
|
||||
sentinel="$data_dir/.smoke-google-gemini-embedding-2-1024.ok"
|
||||
sentinel="$data_dir/.smoke-gemini-embedding-2-768.ok"
|
||||
base_url="${SUPERMEMORY_URL:-http://127.0.0.1:6767}"
|
||||
container_tag="${SUPERMEMORY_CONTAINER_TAG:-hermes_supermemory_lab}"
|
||||
|
||||
@@ -13,7 +13,7 @@ fi
|
||||
|
||||
api_key=$(cat "$data_dir/api-key")
|
||||
auth_header="Authorization: Bearer $api_key"
|
||||
marker="supermemory-poc-google-embedding-2-$(date +%s)"
|
||||
marker="supermemory-poc-gemini-native-$(date +%s)"
|
||||
|
||||
fail() {
|
||||
code="$1"
|
||||
@@ -27,78 +27,68 @@ for _ in $(seq 1 30); do
|
||||
[ -f "$plan" ] && break
|
||||
sleep 1
|
||||
done
|
||||
grep -q 'openai' "$plan" || fail 11 embedding-plan-provider
|
||||
grep -q 'google/gemini-embedding-2' "$plan" || fail 12 embedding-plan-model
|
||||
grep -q '1024' "$plan" || fail 13 embedding-plan-dimensions
|
||||
grep -q 'gemini' "$plan" || fail 11 embedding-plan-provider
|
||||
grep -q 'gemini-embedding-2' "$plan" || fail 12 embedding-plan-model
|
||||
grep -q '768' "$plan" || fail 13 embedding-plan-dimensions
|
||||
|
||||
if ! curl --fail --silent --show-error --max-time 60 \
|
||||
-H "$auth_header" \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data "{\"containerTags\":[\"$container_tag\"],\"limit\":20}" \
|
||||
"$base_url/v3/documents/list" >/tmp/documents.json; then
|
||||
fail 21 documents-list
|
||||
--data "{\"content\":\"$marker:中文跨文档检索测试;海棠计划的下一步是核对原始报告。\",\"containerTag\":\"$container_tag\",\"customId\":\"$marker\",\"metadata\":{\"source\":\"poc-smoke\",\"status\":\"temporary\"}}" \
|
||||
"$base_url/v3/documents" >/tmp/add.json; then
|
||||
fail 22 document-add
|
||||
fi
|
||||
|
||||
if grep -q 'supermemory-poc-google-embedding-2' /tmp/documents.json; then
|
||||
if grep -Eq '"status"[[:space:]]*:[[:space:]]*"failed"' /tmp/documents.json; then
|
||||
fail 31 document-processing-failed
|
||||
fi
|
||||
if ! grep -Eq '"status"[[:space:]]*:[[:space:]]*"done"' /tmp/documents.json; then
|
||||
if grep -Eq '"status"[[:space:]]*:[[:space:]]*"embedding"' /tmp/documents.json; then
|
||||
fail 32 document-stuck-embedding
|
||||
fi
|
||||
if grep -Eq '"status"[[:space:]]*:[[:space:]]*"chunking"' /tmp/documents.json; then
|
||||
fail 33 document-stuck-chunking
|
||||
fi
|
||||
if grep -Eq '"status"[[:space:]]*:[[:space:]]*"indexing"' /tmp/documents.json; then
|
||||
fail 34 document-stuck-indexing
|
||||
fi
|
||||
fail 35 document-not-done
|
||||
fi
|
||||
else
|
||||
document_id=$(sed -n 's/.*"id"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' /tmp/add.json | head -n 1)
|
||||
[ -n "$document_id" ] || fail 23 document-id-missing
|
||||
|
||||
document_status=
|
||||
for _ in $(seq 1 120); do
|
||||
if ! 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; then
|
||||
fail 22 document-add
|
||||
"$base_url/v3/documents/$document_id" >/tmp/document.json; then
|
||||
fail 24 document-get
|
||||
fi
|
||||
fi
|
||||
if grep -Eq '"status"[[:space:]]*:[[:space:]]*"failed"' /tmp/document.json; then
|
||||
fail 31 document-processing-failed
|
||||
fi
|
||||
if grep -Eq '"status"[[:space:]]*:[[:space:]]*"done"' /tmp/document.json; then
|
||||
document_status=done
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
[ "$document_status" = done ] || fail 35 document-not-done
|
||||
|
||||
existing_marker=$(grep -o 'supermemory-poc-google-embedding-2-[0-9]*' /tmp/documents.json | head -n 1)
|
||||
[ -n "$existing_marker" ] || fail 36 document-marker-missing
|
||||
if ! curl --fail --silent --show-error --max-time 15 \
|
||||
-H "$auth_header" \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data "{\"q\":\"$marker\",\"containerTag\":\"$container_tag\"}" \
|
||||
"$base_url/v3/search" >/tmp/search-v3.json; then
|
||||
fail 41 search-v3-request
|
||||
fi
|
||||
grep -q "$marker" /tmp/search-v3.json || fail 44 search-v3-no-hit
|
||||
|
||||
curl --fail --silent --show-error --max-time 15 \
|
||||
-H "$auth_header" \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data "{\"q\":\"$existing_marker\",\"containerTag\":\"$container_tag\",\"searchMode\":\"hybrid\",\"limit\":5}" \
|
||||
"$base_url/v4/search" >/tmp/search-exact.json || fail 41 search-exact-request
|
||||
if ! grep -q "$existing_marker" /tmp/search-exact.json; then
|
||||
curl --fail --silent --show-error --max-time 15 \
|
||||
-H "$auth_header" \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data "{\"q\":\"$existing_marker\",\"containerTag\":\"$container_tag\"}" \
|
||||
"$base_url/v3/search" >/tmp/search-exact-v3.json || fail 43 search-exact-v3-request
|
||||
if grep -q "$existing_marker" /tmp/search-exact-v3.json; then
|
||||
grep -q 'poc-smoke' /tmp/search-exact-v3.json || fail 49 search-v3-metadata-missing
|
||||
fail 48 search-v3-only
|
||||
fi
|
||||
fail 44 search-exact-no-hit
|
||||
fi
|
||||
grep -q 'poc-smoke' /tmp/search-exact.json || fail 45 search-exact-metadata-missing
|
||||
--data "{\"q\":\"$marker\",\"containerTag\":\"$container_tag\",\"searchMode\":\"documents\",\"limit\":5}" \
|
||||
"$base_url/v4/search" >/tmp/search-documents.json || fail 42 search-documents-request
|
||||
grep -q "$marker" /tmp/search-documents.json || fail 45 search-documents-no-hit
|
||||
grep -q 'poc-smoke' /tmp/search-documents.json || fail 46 search-documents-metadata-missing
|
||||
|
||||
curl --fail --silent --show-error --max-time 15 \
|
||||
-H "$auth_header" \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data "{\"q\":\"海棠计划下一步是什么?\",\"containerTag\":\"$container_tag\",\"searchMode\":\"hybrid\",\"limit\":5}" \
|
||||
"$base_url/v4/search" >/tmp/search-semantic.json || fail 42 search-semantic-request
|
||||
grep -q '核对原始报告' /tmp/search-semantic.json || fail 46 search-semantic-no-hit
|
||||
grep -q 'poc-smoke' /tmp/search-semantic.json || fail 47 search-semantic-metadata-missing
|
||||
"$base_url/v4/search" >/tmp/search-hybrid.json || fail 47 search-hybrid-request
|
||||
grep -q '核对原始报告' /tmp/search-hybrid.json || fail 48 search-hybrid-no-hit
|
||||
grep -q 'poc-smoke' /tmp/search-hybrid.json || fail 49 search-hybrid-metadata-missing
|
||||
|
||||
curl --fail --silent --show-error --max-time 60 \
|
||||
-H "$auth_header" \
|
||||
-H 'Content-Type: application/json' \
|
||||
--data "{\"containerTag\":\"$container_tag\",\"q\":\"海棠计划\"}" \
|
||||
--data "{\"containerTag\":\"$container_tag\",\"q\":\"$marker\"}" \
|
||||
"$base_url/v4/profile" >/tmp/profile.json || fail 51 profile-request
|
||||
grep -q '"profile"' /tmp/profile.json || fail 52 profile-shape
|
||||
|
||||
@@ -109,4 +99,4 @@ curl --fail --silent --show-error --max-time 60 \
|
||||
"$base_url/v4/conversations" >/tmp/conversation.json || fail 61 conversation-ingest
|
||||
|
||||
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"}'
|
||||
printf '%s\n' '{"embedding_plan":"gemini/gemini-embedding-2/768","llm":"gemini-native-default","v3_search":"ok","v4_documents_search":"ok","chinese_hybrid_search":"ok","metadata_traceability":"ok","profile":"ok","conversation_ingest":"accepted"}'
|
||||
|
||||
Reference in New Issue
Block a user