Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/semantic-router/pkg/extproc/extproc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ func CreateTestConfig() *config.RouterConfig {
return &config.RouterConfig{
InlineModels: config.InlineModels{
BertModel: config.BertModel{
ModelID: "sentence-transformers/all-MiniLM-L12-v2",
ModelID: "sentence-transformers/all-MiniLM-L6-v2",
Threshold: 0.8,
UseCPU: true,
},
Expand Down Expand Up @@ -575,12 +575,23 @@ func CreateTestRouter(cfg *config.RouterConfig) (*OpenAIRouter, error) {
}

// Create tools database
toolsSimilarityThreshold := float32(0.2) // Default threshold
if cfg.Tools.SimilarityThreshold != nil {
toolsSimilarityThreshold = *cfg.Tools.SimilarityThreshold
}
toolsOptions := tools.ToolsDatabaseOptions{
SimilarityThreshold: cfg.Threshold,
SimilarityThreshold: toolsSimilarityThreshold,
Enabled: cfg.Tools.Enabled,
}
toolsDatabase := tools.NewToolsDatabase(toolsOptions)

// Load tools from file if configured
if cfg.Tools.Enabled && cfg.Tools.ToolsDBPath != "" {
if loadErr := toolsDatabase.LoadToolsFromFile(cfg.Tools.ToolsDBPath); loadErr != nil {
return nil, fmt.Errorf("failed to load tools database: %w", loadErr)
}
}

// Create classifier
classifier, err := classification.NewClassifier(cfg, categoryMapping, piiMapping, nil)
if err != nil {
Expand Down Expand Up @@ -1072,7 +1083,7 @@ var _ = Describe("ExtProc Package", func() {
It("should create test configuration successfully", func() {
cfg := CreateTestConfig()
Expect(cfg).NotTo(BeNil())
Expect(cfg.InlineModels.BertModel.ModelID).To(Equal("sentence-transformers/all-MiniLM-L12-v2"))
Expect(cfg.InlineModels.BertModel.ModelID).To(Equal("sentence-transformers/all-MiniLM-L6-v2"))
Expect(cfg.BackendModels.DefaultModel).To(Equal("model-b"))
Expect(len(cfg.IntelligentRouting.Categories)).To(Equal(1))
Expect(cfg.IntelligentRouting.Categories[0].CategoryMetadata.Name).To(Equal("coding"))
Expand Down
Loading
Loading