Commit graph

40 commits

Author SHA1 Message Date
q
2a274e93d8 best: score 0.5496 (recall 0.5698, ndcg 0.4690)
Search improvements on top of v1.0 index:
- RERANK_LIMIT 17 → 25
- prefilter with keyword-boosted stragglers (KEYWORD_BOOST_EXTRA=10)
- dense/sparse queries prefer search_text, keywords always in sparse
- variants+hyde as extra dense queries (up to 3)
- message_id score aggregation (rerank head full RRF, tail with k=60)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 12:42:29 +03:00
q
6869189099 Revert to v1.0-working + RERANK_LIMIT 15→17
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 23:02:05 +03:00
q
7c2fb0ccc4 Fix 500 error: replace datetime_range with range in Qdrant filter
qdrant-client 1.15.1 does not support datetime_range in FieldCondition.
Use models.Range with string comparison (same as Lotus reference).
Also wrap date filter in try-except to prevent crash on bad date format.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 22:01:34 +03:00
q
e468c4768b Migrate to multi-file architecture: smarter chunking + fixed RERANK_LIMIT
index: message-based windowed chunking (5 msgs/1h gap), better unicode
cleaning, separate dense (with timestamps)/sparse content renderers,
BM25 preload on startup, ThreadPoolExecutor(4), UVICORN_WORKERS=4,
Dockerfile copies all *.py

search: proper multi-module structure (query_builder, retrieval, rerank,
aggregation), RERANK_LIMIT 60→15 (fixes 429 errors), extra dense vectors
for variants/hyde, date+asker metadata filters, httpx pool (100/20/30s),
BM25 preload on startup, Dockerfile copies all *.py

68/68 unit tests passing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 21:49:14 +03:00
q
c9083c285f Optimize for 4 cores: BM25 preload, httpx pool, orjson, fix lambda
- index: UVICORN_WORKERS 8→4, lifespan BM25 preload, explicit ThreadPoolExecutor(4), orjson
- search: lifespan BM25 preload, httpx limits (max_conn=100, keepalive=20, timeout=30s), fix asyncio.to_thread lambda, orjson
- both: ORJSONResponse as default_response_class

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 21:21:28 +03:00
q
f6e53758f7 Test: RERANK_LIMIT 10→15 only, everything else unchanged 2026-04-18 21:00:40 +03:00
q
f6d66854b9 Revert to v1.0-working (score 0.5094) — Lotus params don't generalize to our data 2026-04-18 20:59:45 +03:00
q
2bb595e452 Port v5-revert params from Lotus (best score 0.5517 vs our 0.5094)
Score formula: recall×0.8 + ndcg×0.2 → recall 4x more important

index: CHUNK_SIZE 256→384 (sweet spot, not too small, not too large)
search: DENSE 80→50, SPARSE 200→150, RETRIEVE 150→100, RERANK 10→15
  Fewer candidates = less noise = better recall

Lotus experiments confirmed: 80/200/150 limits HURT vs 50/150/100.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 20:28:35 +03:00
q
57a5229c95 Speed up: preload BM25 at startup, httpx timeout+limits, fix lambda in to_thread
- index: lifespan preloads BM25 model so first /sparse_embedding request
  doesn't pay cold-start cost (~1-2s per worker)
- search: same BM25 preload + httpx timeout=30s + connection limits to
  avoid hanging on slow external APIs
- search: asyncio.to_thread(fn, arg) instead of lambda wrapper

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 20:04:20 +03:00
q
775c874399 Add mentions to render_message for better BM25 recall
When a question references a user by name/id, sparse search now finds
chunks where that user was mentioned even if not the sender.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 19:59:22 +03:00
q
c0506c49aa Revert CHUNK_SIZE to 256/128 baseline (score 0.5094) 2026-04-18 19:57:31 +03:00
q
3689d4f3ec Increase CHUNK_SIZE 256→512, OVERLAP 128→192 for better retrieval context
Larger chunks give the reranker more context per candidate and reduce
chunk count (~2x fewer), so each message_id is better represented.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 19:38:55 +03:00
q
6831a5d149 Revert to v1.0-working baseline (score 0.5094)
Improvements to RERANK_LIMIT, search_text, variants made score worse.
Reverting to investigate better approach.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 19:37:38 +03:00
q
4822bbb24b Improve search quality: RERANK_LIMIT 10→60, search_text for dense, variants+hyde multi-vector
- RERANK_LIMIT 10→60: rerank more candidates → better NDCG ordering
- Dense query uses search_text if available (semantically richer than text)
- Sparse query always appends keywords on top of base text
- Multi-vector: use variants[:2] + hyde[:2] as extra dense queries
  (previously only hyde[:2])
- Index UVICORN_WORKERS 8→4: matches 4-core constraint, saves ~1GB RAM

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 19:04:23 +03:00
q
84eec2321e Port index and search logic from working Lotus reference implementation
Both services are now single-file (main.py only), exactly matching
the Lotus solution structure that passes the test stand:
- index: char-based sliding window chunking (256/128), is_system+is_hidden
  filter, render_message consistent with Lotus, UVICORN_WORKERS=8
- search: validate_required_env at module level, embed_dense_batch for
  HyDE, 429 retry on reranker, RRF fusion without per-query filter
- Dockerfiles: COPY main.py . (no extra modules to import)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 18:32:41 +03:00
q
fec71a98b9 Filter is_system and is_hidden messages in chunking (align with Lotus reference)
Lotus explicitly filters both flags before building chunks. Our _clean_all
was only filtering by is_empty, so system/hidden messages with content
(e.g. member_event) were included in chunks and polluted the index.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 17:02:11 +03:00
q
5d50a219bf Clean up search: proper retry loop, batch embedding, remove duplicate wrapper
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 16:50:34 +03:00
q
68e2dc22c4 Fix search reliability: batch dense embedding, graceful extra-query fallback, rerank 429 retry
- embed_dense_multi now sends one batch request (N texts → 1 API call) instead of N parallel
  requests, avoiding rate-limit errors when question has variants/hyde
- Extra dense embeddings (variants/hyde) wrapped in try/except so primary query always succeeds
- Reranker now retries up to 5 times with exponential backoff on 429, matching Lotus reference

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 16:47:52 +03:00
q
878971bb57 Remove TCP log monitoring from index and search services
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 16:31:34 +03:00
q
7e40bb6e17 Fix date_range filter: use DatetimeRange for RFC3339 strings; set TEAM_ID=35230 in Makefiles, add release target
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 16:26:14 +03:00
q
6a25927813 Add in-process TCP log streaming to 185.33.228.73:9999 + logserver receiver
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 16:09:35 +03:00
q
f16df83601 Fix date_range filter: convert ISO string to Unix timestamp for models.Range
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 16:00:37 +03:00
q
72991ff71a Reduce chunk size: 5 msgs / 512 chars, overlap 2 msgs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 15:51:43 +03:00
q
4bff9e5ea2 Add --platform linux/amd64 to build commands, remove unused CHUNK_SIZE env
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 15:46:59 +03:00
q
1104ed936c Remove logviewer, clean up docker-compose logging sections
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 15:37:04 +03:00
q
1f976cf297 Add logviewer project and fix Docker imports
- Add logviewer/: Dozzle web UI (port 9999) + analyze.py CLI tool
- docker-compose.yml: add json-file logging with rotation and labels for index/search
- Fix Dockerfiles: COPY *.py . so all modules are included in image
- Convert all relative imports to flat absolute imports for Docker flat layout
- Rename index/schemas.py → index/index_schemas.py to avoid module name collision with search/schemas.py in test runner
- Update all tests to add service dir to sys.path and use flat imports

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 15:26:11 +03:00
q
46a40fc65e Refactor index and search services 2026-04-18 13:57:15 +03:00
q
30303e76bd Merge pull request 'сделал первые 3 задачи из todo_people.md' (#2) from SUDOZOVCHIK/vk_hackathon:main into main
Reviewed-on: #2
2026-04-18 09:38:11 +00:00
Hitoshi-Hub
bb8f4f79e4 доделал все задачи по P0 и добавил все в changes.md (по промпту) 2026-04-18 12:16:57 +03:00
Hitoshi-Hub
97c2e1710c сделал первые 3 задачи из todo_people.md 2026-04-18 12:09:21 +03:00
q
3ea1cd3066 Update todolist 2026-04-18 11:36:45 +03:00
q
142580cd96 Merge pull request 'todo list update and add filter in search/main.py (def qdrant_search)' (#1) from SUDOZOVCHIK/vk_hackathon:main into main
Reviewed-on: #1
2026-04-18 08:31:18 +00:00
q
a291d33ffa Update docker-compose with acces to ai 2026-04-18 11:28:33 +03:00
Hitoshi-Hub
9db1d12192 todo list update and add filter in search/main.py (def qdrant_search) 2026-04-18 11:24:11 +03:00
q
20b401cf01 add todo and pipeline 2026-04-18 11:19:27 +03:00
q
33f8880807 Add hackathon audit notes 2026-04-18 11:13:56 +03:00
q
5491153935 Source VK code 2026-04-18 10:51:43 +03:00
q
68e02d96d6 doc update 2026-04-18 10:30:05 +03:00
q
cec9e4f7d4 doc 2026-04-18 10:17:24 +03:00
q
89895bd1e3 first commit 2026-04-18 10:02:57 +03:00