honcho/tests
Vansh-Sharma27 e83ab842c1
fix(embedding): configurable tokenizer for non-OpenAI embedding models
The embedding client resolved every model's tokenizer through tiktoken,
silently falling back to cl100k_base for models tiktoken doesn't know
(e.g. baai/bge-m3). cl100k_base undercounts vs the model's real
tokenizer on technical/mixed text (runtime-measured +44% for bge-m3),
so prepare_chunks emits "within-limit" chunks the provider then rejects
with HTTP 400. The reconciler retries the unchanged payload 20 times
over ~3h, marks MessageEmbedding.sync_state='failed', and the message
is permanently excluded from vector search (search.py filters
embedding IS NOT NULL).

Add EMBEDDING_MODEL_CONFIG__TOKENIZER: unset keeps tiktoken
auto-detection (backwards compatible); tiktoken:<encoding>, hf:<repo>,
or file:<path> select an explicit tokenizer. HF/file tokenizers use the
optional honcho[tokenizers] extra. The HuggingFace adapter encodes
without special tokens and reserves the special-token overhead
([CLS]/[SEP]) from the chunk budget so provider-side counts stay
exactly within limit. Unknown models now log a warning pointing at the
new setting. Invalid specs raise ValidationException (repo-standard).
The singleton rebuild signature includes tokenizer so runtime config
changes take effect.

Runtime-verified end-to-end without a live provider: 24,360 chars of
technical text with bge-m3 went from 1 chunk (8,355 real tokens > 8,192
-> provider 400 -> failed) to 2 chunks (8,192 / 1,803, both within
limit).

Out of scope (noted for follow-up): recovery/reindex of existing failed
rows, scripts/generate_message_embeddings.py chunk-identity bug,
ConclusionCreate o200k_base validator alignment, typed
dimension-vs-token-limit exceptions, live-embedding CI matrix.

Fixes #827
2026-08-20 01:49:49 +05:30
..
alembic feat: make session_name nullable for documents and update related SDKs (#347) 2026-01-26 13:33:11 -05:00
bench rename to REPRESENTATION_BATCH_TARGET_INPUT_TOKENS 2026-07-09 10:42:52 -04:00
crud Scopes Phase 2b: `scope` option on chat, representation, context, and search (#897) 2026-08-12 18:34:55 -04:00
deriver feat: scope backfill-by-copy and removal reconciliation jobs (#904) 2026-08-14 15:08:43 -04:00
dialectic Scopes Phase 2b: `scope` option on chat, representation, context, and search (#897) 2026-08-12 18:34:55 -04:00
dreamer Scopes Phase 2a: scope-kind peers, guardrails, and scopes CRUD routes (#884) 2026-08-12 16:21:40 -04:00
integration feat: defer embedding messages (#704) 2026-06-11 10:31:04 -04:00
live_llm fix(llm): forward provider_params.timeout to the OpenAI-compatible embedding client (#1024) 2026-08-18 10:51:53 -04:00
llm fix(embedding): configurable tokenizer for non-OpenAI embedding models 2026-08-20 01:49:49 +05:30
reconciler fix: Various Codex Audits (#386) 2026-02-13 12:00:15 -05:00
routes fix(filter): make the filter DSL reject bad input instead of 500ing, and fix negation over unset fields (#947) 2026-08-13 10:39:19 -04:00
scripts feat: add new cloudevents for api routes (#637) 2026-05-20 18:25:30 -04:00
sdk Scopes SDK Changes (#1030) 2026-08-19 10:48:29 -04:00
sdk_typescript add read db (#773) 2026-06-10 13:28:36 -04:00
startup add read db (#773) 2026-06-10 13:28:36 -04:00
telemetry Vineeth/sentry filter consolidation (#934) 2026-07-24 15:42:41 -04:00
unified Scopes Phase 2b: `scope` option on chat, representation, context, and search (#897) 2026-08-12 18:34:55 -04:00
utils fix: honor DERIVER_DEDUPLICATE in create_observations (#1018) 2026-08-19 13:57:49 -04:00
vector_store fix: apply session scoping to all working-representation query paths (#881) 2026-07-24 11:41:34 -04:00
webhooks Tighten Transaction Scopes (#525) 2026-04-08 11:14:50 -04:00
__init__.py Refactor clients.py to add modern features and more flexible configuration (#459) 2026-04-20 02:46:37 -04:00
conftest.py feat: scope backfill-by-copy and removal reconciliation jobs (#904) 2026-08-14 15:08:43 -04:00
test_advanced_filters.py fix: apply session scoping to all working-representation query paths (#881) 2026-07-24 11:41:34 -04:00
test_cache_redaction.py Scopes Phase 2a: scope-kind peers, guardrails, and scopes CRUD routes (#884) 2026-08-12 16:21:40 -04:00
test_config.py fix(llm): support per-request provider timeouts (#832) 2026-08-04 12:43:00 -04:00
test_datetime_parsing.py Make embeddings configurable (#678) 2026-05-14 15:03:35 -04:00
test_db_resilience.py fix(deriver): increase deriver polling backoff (#1015) 2026-08-14 16:38:20 -04:00
test_dependencies.py add read db (#773) 2026-06-10 13:28:36 -04:00
test_generate_jwt_script.py feat: add generate_jwt.py script for creating scoped JWTs (#757) 2026-06-09 13:49:55 -04:00
test_models_vector_dim.py feat: add new cloudevents for api routes (#637) 2026-05-20 18:25:30 -04:00
test_schema_validations.py Align API contract with DB contract for IDs (#684) 2026-05-14 16:37:39 -04:00
test_search.py Tighten Transaction Scopes (#525) 2026-04-08 11:14:50 -04:00
test_security.py Fix scoped JWTs (#679) 2026-06-22 17:30:00 -04:00
test_session_allowlist.py fix(filter): make the filter DSL reject bad input instead of 500ing, and fix negation over unset fields (#947) 2026-08-13 10:39:19 -04:00