refactor(embedding): drop init(), build default registry eagerly

Replace the import-time init() that mutated the DefaultRegistry global with a constructor that returns a ready registry, removing mutate-after-init global state. Exported API unchanged.
This commit is contained in:
2026-06-19 14:26:35 +01:00
parent 406b539c84
commit b38ecee4da
2 changed files with 19 additions and 12 deletions
-11
View File
@@ -562,17 +562,6 @@ func (m *bgeModel) Close() error {
return nil
}
// Register the BGE model with the default registry at init time
func init() {
RegisterModel(ModelMetadata{
Name: BGEModelName,
Version: BGEModelVersion,
Dimensions: EmbeddingDim,
Description: "High-quality semantic search model",
Default: true,
}, newBGEModel)
}
// Service provides thread-safe text embedding generation with model abstraction.
type Service struct {
model EmbeddingModel