5 Commits

Author SHA1 Message Date
Jiangzhou a821c20a64 feat(doctor): surface daemon-side exception tracebacks (#173) (#177)
When a daemon-side `ccc doctor` check failed (e.g. the model check), only a
one-line, 500-char-truncated summary reached the CLI; the full traceback was
logged to daemon.log but never surfaced, making failures hard to debug.

Carry the full traceback across both daemon→CLI error paths:

- Per-check failures: add `traceback` to `EmbeddingCheckResult` and
  `DoctorCheckResult`; `check_embedding` captures `format_exc()` and
  `_check_model` propagates it. The CLI prints it dimmed under the error.
- Streaming exceptions: add `traceback` to `ErrorResponse`, populated by the
  daemon's streaming handler and appended to the client-raised RuntimeError.

Both new fields default to None, keeping the msgpack wire format
backward-compatible.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 09:49:57 -07:00
Jiangzhou 9700655aa6 refactor(embedder-params): drop dimensions knob; pass indexing kwargs into LiteLLM ctor (#151)
- 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).
2026-04-25 09:33:24 -07:00
Jiangzhou ee3515fa57 feat: configurable embedder indexing_params/query_params + curated defaults (#150)
Users can now set `indexing_params` and `query_params` under `embedding:` in
`global_settings.yml` to pass extra kwargs to the embedder separately for
indexing vs. query — supporting asymmetric retrieval models (Cohere v3,
Voyage, Nvidia NIM, Gemini, nomic-ai code/text models, Snowflake arctic,
etc.).

- `ccc init` auto-populates these from a curated table of known models and
  prints the applied defaults; unknown models get a commented-out template
  for the accepted keys (`prompt_name` for sentence-transformers;
  `input_type`, `dimensions` for litellm).
- Daemon validates the effective params at startup; invalid keys fail fast
  with a clear error.
- Backward compat: configs for `nomic-ai/CodeRankEmbed` /
  `nomic-ai/nomic-embed-code` that predate this feature keep the previous
  hardcoded `prompt_name=query` behavior, and a one-time handshake warning
  asks users to make the setting explicit. The warning is suppressible by
  any non-None `query_params` (including `{}`).
- `ccc doctor` now tests indexing and query separately so asymmetric
  misconfigurations surface independently.

Drops the legacy `shared.query_prompt_name` module variable and
`_QUERY_PROMPT_MODELS` set; the new resolution path is centralized in
`embedder_params.resolve_embedder_params` and the curated defaults live in
`embedder_defaults._DEFAULT_PARAMS`.

Also enables `litellm.drop_params = True` so provider-specific kwargs that
a particular model doesn't accept are silently dropped instead of failing.
2026-04-24 16:08:20 -07:00
Jiangzhou 5b6e3f5538 feat: make sentence-transformers optional; interactive ccc init (#132)
- Move `sentence-transformers` behind `[embeddings-local]` and `[default]`
  extras (via `cocoindex[sentence-transformers]`), so `pip install
  cocoindex-code` is LiteLLM-only. Closes #117.
- `ccc init` is now interactive when global settings don't exist: pick
  provider (sentence-transformers / litellm) and model via a
  questionary TUI. New `--litellm-model MODEL` flag skips prompts and
  is the non-TTY escape hatch for LiteLLM. Closes #70.
- Change the default sentence-transformers model from
  `all-MiniLM-L6-v2` to `Snowflake/snowflake-arctic-embed-xs`
  (lighter, better quality for code).
- Generated `global_settings.yml` now includes a `ccc doctor` reminder
  and commented-out env-var examples (OPENAI_API_KEY, GEMINI_API_KEY,
  ANTHROPIC_API_KEY, VOYAGE_API_KEY).
- Model test during init runs in the daemon via the existing
  `DoctorRequest` path; the daemon loads the model once and stays
  running, so the user's next `ccc index` starts warm.
- Docker image now installs `cocoindex-code[default]` and pre-caches
  the new default model. The `COCOINDEX_CODE_EMBEDDING_MODEL` env var
  is no longer documented for Docker; users mount a
  `global_settings.yml` or pass `--litellm-model`.
- Extract `check_embedding` + `EmbeddingCheckResult` into `shared.py`;
  refactor daemon `_check_model` to delegate. Error messages in doctor
  output now include the exception type name (strictly more
  informative).
- Tests switch to a lighter `paraphrase-MiniLM-L3-v2` model via a new
  `make_test_user_settings()` helper in `conftest.py`, leaving CI
  cache costs unchanged.
2026-04-13 22:25:17 -07:00
faysou 34565b47c3 Add a rate limiter for litellm (#125) 2026-04-05 19:03:26 -07:00