honcho/src
Niyaz Almufti a92fb1e078
Fix Gemini batch embedding for gemini-embedding-2* models (#745)
* Fix Gemini batch embedding for gemini-embedding-2* models

The google-genai SDK treats embed_content(contents=[list_of_strings]) as a
single multi-part document for gemini-embedding-2* models, silently returning
exactly 1 embedding regardless of input count. This caused a zip(...,
strict=True) ValueError in _process_batch.

Wrap each text in genai_types.Content(parts=[genai_types.Part(text=...)])
so the SDK treats each string as a separate content item. This matches the
workaround used by pydantic-ai (#4873) and graphiti (#1474).

Upstream SDK issue: googleapis/python-genai#2523
Fixes plastic-labs/honcho#744

* test(embedding): live embedding coverage for every Gemini and OpenAI model

Adds tests/live_llm/test_live_embeddings.py plus an env-driven embedding
matrix alongside the existing LLM one. Covers single embed, batched embed,
batch-vs-single alignment, chunk-to-id mapping, and the batch-split path.

Only a live call catches the gemini-embedding-2* collapse: the SDK folds a
list of bare strings into one document and returns a single embedding.
Reverting the Content wrapping fails all four batch tests for
gemini-embedding-2-preview and gemini-embedding-2 with the reported
`zip() argument 2 is shorter than argument 1`, while gemini-embedding-001
and text-embedding-3-small stay green.

Also makes the concatenation in the conclusions semantic-search validation
message explicit, so the repo-wide basedpyright pre-push hook passes.

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

* test(embedding): drop the preview twin from the default embedding matrix

gemini-embedding-2 is the GA release of gemini-embedding-2-preview and
behaves identically, so running both by default doubles the Gemini cost for
no extra coverage. The preview stays reachable through
LIVE_EMBEDDING_GEMINI_MODELS.

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

---------

Co-authored-by: Aakash Kattelu <aakash@plasticlabs.ai>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-11 17:50:40 -04:00
..
cache fix: redact Redis password from cache connection logs (#869) 2026-07-24 12:54:31 -04:00
crud Fix: vector query top k zero (#970) 2026-08-03 12:31:03 -04:00
deriver fix(deriver): update extraction examples (#985) 2026-08-06 10:23:18 -04:00
dialectic feat: session allowlist on dialectic and representation via filters (#882) 2026-07-28 10:55:02 -04:00
dreamer Session-purity invariant + card_refresh dream type (DEV-2000) (#883) 2026-07-23 14:22:07 -04:00
llm fix(llm): set HTTP timeout on Gemini clients (#903) 2026-08-04 16:29:32 -04:00
reconciler add prometheus metric for in_flight 2026-07-09 12:01:09 -04:00
routers Fix Gemini batch embedding for gemini-embedding-2* models (#745) 2026-08-11 17:50:40 -04:00
schemas feat: session allowlist on dialectic and representation via filters (#882) 2026-07-28 10:55:02 -04:00
startup Make embeddings configurable (#678) 2026-05-14 15:03:35 -04:00
telemetry Vineeth/sentry filter consolidation (#934) 2026-07-24 15:42:41 -04:00
utils feat: session allowlist on dialectic and representation via filters (#882) 2026-07-28 10:55:02 -04:00
vector_store fix: increase throughput of unit tests by changing behavior db teardown (#949) 2026-07-29 11:19:41 -04:00
webhooks Tighten Transaction Scopes (#525) 2026-04-08 11:14:50 -04:00
__init__.py v0.0.8 Documentation Updates (#55) 2024-05-15 00:07:25 -04:00
_version.py feat: add new cloudevents for api routes (#637) 2026-05-20 18:25:30 -04:00
config.py fix: make embedding batch size configurable (#983) 2026-08-05 15:43:32 -04:00
db.py add read db (#773) 2026-06-10 13:28:36 -04:00
dependencies.py add read db (#773) 2026-06-10 13:28:36 -04:00
embedding_client.py Fix Gemini batch embedding for gemini-embedding-2* models (#745) 2026-08-11 17:50:40 -04:00
exceptions.py Turbopuffer and LanceDB Integration (#287) 2026-01-16 17:04:01 -05:00
main.py Vineeth/sentry filter consolidation (#934) 2026-07-24 15:42:41 -04:00
models.py Make embeddings configurable (#678) 2026-05-14 15:03:35 -04:00
security.py Fix scoped JWTs (#679) 2026-06-22 17:30:00 -04:00