honcho/tests
JUNZE 00d6d36728
fix: make embedding batch size configurable (#983)
* fix: resolve tiktoken encoding without constructing the embedding client

EmbeddingClient.encoding forced full client construction, which raises
'OpenAI API key is required' even though tiktoken needs no credentials.
The document dedup tie-break (src/crud/document.py) only needs .encoding
for token counting, so any test hitting that path fails in environments
without embedding keys — notably CI for pull requests from forks, where
repo secrets are unavailable (e.g. #908's test-python job failing on
tests/crud/test_document.py::test_duplicate_rejection_reinforces_existing).

Resolve the encoding from the configured model directly, falling back to
cl100k_base, and only reuse the underlying client's encoding when it has
already been constructed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix: make embedding batch size configurable

Add optional max_batch_size to the embedding model config
(EMBEDDING_MODEL_CONFIG__MAX_BATCH_SIZE) to cap texts per request for
OpenAI-compatible providers with smaller limits than OpenAI's, such as
DashScope text-embedding-v4 (10) and Alibaba Bailian
qwen3.7-text-embedding (20). When unset, native provider defaults are
preserved (OpenAI 2048, Gemini 100).

Fixes #687.

* test(embedding): cover Gemini batching and config fallbacks per review

- Gemini transport now tested for configured batch splitting and the 100
  default fallback
- OpenAI unset default (2048, single request) explicitly covered
- env-parsing test now asserts the value survives resolve_embedding_model_config
- docs: 100 is the client's conservative Gemini default, not a native limit

* test(embedding): assert provider batch-size defaults

---------

Co-authored-by: adavyas <adavyasharma@gmail.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-05 15:43:32 -04:00
..
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 Fix: vector query top k zero (#970) 2026-08-03 12:31:03 -04:00
deriver Counts documents deduped during representation, exact and semantically similar 2026-07-16 14:30:55 -02:00
dialectic feat(dialectic): optional structured outputs with limited schema for Dialectic calls (#896) 2026-07-20 18:46:49 -04:00
dreamer Session-purity invariant + card_refresh dream type (DEV-2000) (#883) 2026-07-23 14:22:07 -04:00
integration feat: defer embedding messages (#704) 2026-06-11 10:31:04 -04:00
live_llm fix(llm): support per-request provider timeouts (#832) 2026-08-04 12:43:00 -04:00
llm fix: make embedding batch size configurable (#983) 2026-08-05 15:43:32 -04:00
reconciler fix: Various Codex Audits (#386) 2026-02-13 12:00:15 -05:00
routes Session-purity invariant + card_refresh dream type (DEV-2000) (#883) 2026-07-23 14:22:07 -04:00
scripts feat: add new cloudevents for api routes (#637) 2026-05-20 18:25:30 -04:00
sdk feat(dialectic): optional structured outputs with limited schema for Dialectic calls (#896) 2026-07-20 18:46:49 -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 feat(dialectic): optional structured outputs with limited schema for Dialectic calls (#896) 2026-07-20 18:46:49 -04:00
utils fix: increase throughput of unit tests by changing behavior db teardown (#949) 2026-07-29 11:19:41 -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 fix: increase throughput of unit tests by changing behavior db teardown (#949) 2026-07-29 11:19:41 -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 fix: increase throughput of unit tests by changing behavior db teardown (#949) 2026-07-29 11:19:41 -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 add read db (#773) 2026-06-10 13:28:36 -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 feat: session allowlist on dialectic and representation via filters (#882) 2026-07-28 10:55:02 -04:00