Skip to content

Add configurable embedding models with ModelRegistry and provider inference#4

Merged
codenamev merged 8 commits intomainfrom
claude/configurable-embedding-models-ys3Kc
Apr 10, 2026
Merged

Add configurable embedding models with ModelRegistry and provider inference#4
codenamev merged 8 commits intomainfrom
claude/configurable-embedding-models-ys3Kc

Conversation

@codenamev
Copy link
Copy Markdown
Owner

Enable users to configure embedding models across all providers (tfidf,
fastembed, api) via CLAUDE_MEMORY_EMBEDDING_MODEL env var. The resolver
now auto-infers the provider from the model name using the registry, so
setting just the model name is sufficient.

Key changes:

  • ModelRegistry: known models with dimensions, descriptions, size metadata
  • FastembedAdapter: dynamic dimensions from registry (was hardcoded 384)
  • Resolver: model-based provider inference, unified model forwarding
  • ApiAdapter: registry-backed dimensions (avoids probe API call)
  • EmbeddingsCommand: CLI for listing models and validating setup

https://claude.ai/code/session_01DrjisFD2mvy2nvognHczbd

claude and others added 8 commits April 1, 2026 17:15
…erence

Enable users to configure embedding models across all providers (tfidf,
fastembed, api) via CLAUDE_MEMORY_EMBEDDING_MODEL env var. The resolver
now auto-infers the provider from the model name using the registry, so
setting just the model name is sufficient.

Key changes:
- ModelRegistry: known models with dimensions, descriptions, size metadata
- FastembedAdapter: dynamic dimensions from registry (was hardcoded 384)
- Resolver: model-based provider inference, unified model forwarding
- ApiAdapter: registry-backed dimensions (avoids probe API call)
- EmbeddingsCommand: CLI for listing models and validating setup

https://claude.ai/code/session_01DrjisFD2mvy2nvognHczbd
Replace stubs with real provider instances and real SQLiteStore databases.
Fastembed tests use skip pattern (matching benchmarks/) when models can't
be downloaded. EmbeddingsCommand tests use real tmpdir databases to verify
dimension mismatch detection and database state display.

https://claude.ai/code/session_01DrjisFD2mvy2nvognHczbd
check_dimension_compatibility and show_database_state opened SQLiteStore
connections but only closed them in the happy path. On exception, the
connection would leak. Wrap both in begin/ensure blocks.
…tion

Move default model knowledge into ModelRegistry (single source of truth)
instead of hardcoding adapter constants in EmbeddingsCommand. Extract
with_each_store helper to eliminate duplicated store open/close/ensure
loops in show_database_state and check_dimension_compatibility.
Move DB-reading and dimension-checking logic into a focused Inspector
class that returns structured Data.define value objects. The command
becomes a thin router (173 LOC, down from 239) that formats output.

Inspector owns: with_each_store, database_states, dimension_checks.
Store connection safety (ensure close) lives in one place now.
Fastembed::SUPPORTED_MODELS is a Hash, so use direct key lookup instead
of iterating with find and accessing positional array elements.
…ance

Extract resolve_or_skip helper in resolver_spec to eliminate 4 duplicated
begin/rescue/skip blocks. Add rubocop disable comment to fastembed
allow_any_instance_of (unavoidable: require is called inside initialize
before an instance reference exists).
@codenamev codenamev merged commit 0c95d87 into main Apr 10, 2026
1 check failed
@codenamev codenamev deleted the claude/configurable-embedding-models-ys3Kc branch April 10, 2026 20:42
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.

2 participants