gomcp/internal/infrastructure/onnx/factory.go
DmitrL-dev 694e32be26 refactor: rename identity to syntrex, add root orchestration and CI/CD
- Rename Go module: sentinel-community/gomcp -> syntrex/gomcp (50+ files)
- Rename npm package: sentinel-dashboard -> syntrex-dashboard
- Update Cargo.toml repository URL to syntrex/syntrex
- Update all doc references from DmitrL-dev/AISecurity to syntrex
- Add root Makefile (build-all, test-all, lint-all, clean-all)
- Add MIT LICENSE
- Add .editorconfig (Go/Rust/TS/C cross-language)
- Add .github/workflows/ci.yml (Go + Rust + Dashboard)
- Add dashboard next.config.ts and .env.example
- Clean ARCHITECTURE.md: remove brain/immune/strike/micro-swarm, fix 61->67 engines
2026-03-11 15:30:49 +10:00

26 lines
767 B
Go

//go:build onnx
package onnx
import (
"log"
"github.com/syntrex/gomcp/internal/domain/vectorstore"
)
// NewEmbedderWithFallback attempts to create an ONNX embedder.
// If ONNX Runtime or model is not available, falls back to FTS5Embedder.
// Always returns a working Embedder — never nil.
func NewEmbedderWithFallback(rlmDir string) vectorstore.Embedder {
// Try ONNX first.
onnxEmb, err := NewEmbedder(Config{RlmDir: rlmDir})
if err == nil {
log.Printf("Oracle: ONNX embedder active (%s, dim=%d) [ORACLE: FULL]",
onnxEmb.Name(), onnxEmb.Dimension())
return onnxEmb
}
// ONNX unavailable — degrade gracefully.
log.Printf("Oracle: ONNX unavailable (%v) — falling back to FTS5 [ORACLE: DEGRADED]", err)
return vectorstore.NewFTS5Embedder()
}