Skip to content

refactor(embedder-params): drop dimensions knob; pass indexing kwargs into LiteLLM ctor#151

Merged
georgeh0 merged 1 commit intomainfrom
g/embedder-tighten-litellm
Apr 25, 2026
Merged

refactor(embedder-params): drop dimensions knob; pass indexing kwargs into LiteLLM ctor#151
georgeh0 merged 1 commit intomainfrom
g/embedder-tighten-litellm

Conversation

@georgeh0
Copy link
Copy Markdown
Member

Summary

  • Drop the unused shared.embedder module-level global. It was set by create_embedder() but never read from production code — the embedder flows through the EMBEDDER ContextKey via context.provide / use_context.
  • Simplify tests/test_daemon.py's daemon_sock fixture: the pre-load + dm.create_embedder monkeypatch was only a win as a cross-module cache via the now-dead global. The session-scoped fixture loads once either way, and run_daemon() is now exercised on its real embedder path.
  • Remove the stale monkeypatch.setattr(_shared, "embedder", stub) in tests/test_chunker_registry.py. CodeChunk.embedding is annotated with the EMBEDDER ContextKey (not the global), and the stub is already wired through Project.create(..., stub, ...).

Test plan

  • uv run mypy . — passes.
  • uv run pytest tests/test_daemon.py tests/test_chunker_registry.py — passes locally.
  • CI covers the rest.

…gs into LiteLLM ctor

- Remove `dimensions` from the litellm whitelist in `_ACCEPTED_KWARGS`.
  Output dimension must be identical for indexing and query for vectors to
  be comparable, so it's a model-wide setting, not a per-side knob —
  exposing it under `indexing_params` / `query_params` invited
  misconfiguration. Updated comment template, README, design doc, and
  testing plan accordingly.
- Plumb `indexing_params` into `create_embedder` and pass them as
  constructor kwargs to `PacedLiteLLMEmbedder`. The values land in
  `self._kwargs` and become defaults forwarded into every
  `litellm.aembedding` call — including paths that don't go through the
  `INDEXING_EMBED_PARAMS` context var (e.g. the dim probe in `_get_dim`).
  Per-call overrides (`query_params` spread at query time) still win
  because `_embed` overlays kwargs on top of `self._kwargs`. Sentence-
  transformers ignores `indexing_params` (its constructor doesn't accept
  arbitrary kwargs; `prompt_name` is per-call only).
@georgeh0 georgeh0 merged commit 9700655 into main Apr 25, 2026
4 checks passed
@georgeh0 georgeh0 deleted the g/embedder-tighten-litellm branch April 25, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant