@@ -214,12 +214,14 @@ func TestBatchClassificationConfiguration(t *testing.T) {
214214 {
215215 name : "Custom max batch size" ,
216216 config : & config.RouterConfig {
217- API : config.APIConfig {
218- BatchClassification : struct {
219- Metrics config.BatchClassificationMetricsConfig `yaml:"metrics,omitempty"`
220- }{
221- Metrics : config.BatchClassificationMetricsConfig {
222- Enabled : true ,
217+ APIServer : config.APIServer {
218+ API : config.APIConfig {
219+ BatchClassification : struct {
220+ Metrics config.BatchClassificationMetricsConfig `yaml:"metrics,omitempty"`
221+ }{
222+ Metrics : config.BatchClassificationMetricsConfig {
223+ Enabled : true ,
224+ },
223225 },
224226 },
225227 },
@@ -248,12 +250,14 @@ func TestBatchClassificationConfiguration(t *testing.T) {
248250 {
249251 name : "Valid request within custom limits" ,
250252 config : & config.RouterConfig {
251- API : config.APIConfig {
252- BatchClassification : struct {
253- Metrics config.BatchClassificationMetricsConfig `yaml:"metrics,omitempty"`
254- }{
255- Metrics : config.BatchClassificationMetricsConfig {
256- Enabled : true ,
253+ APIServer : config.APIServer {
254+ API : config.APIConfig {
255+ BatchClassification : struct {
256+ Metrics config.BatchClassificationMetricsConfig `yaml:"metrics,omitempty"`
257+ }{
258+ Metrics : config.BatchClassificationMetricsConfig {
259+ Enabled : true ,
260+ },
257261 },
258262 },
259263 },
@@ -305,23 +309,27 @@ func TestBatchClassificationConfiguration(t *testing.T) {
305309func TestOpenAIModelsEndpoint (t * testing.T ) {
306310 // Test with default config (IncludeConfigModelsInList = false)
307311 cfg := & config.RouterConfig {
308- VLLMEndpoints : []config.VLLMEndpoint {
309- {
310- Name : "primary" ,
311- Address : "127.0.0.1" ,
312- Port : 8000 ,
313- Weight : 1 ,
314- },
315- },
316- ModelConfig : map [string ]config.ModelParams {
317- "gpt-4o-mini" : {
318- PreferredEndpoints : []string {"primary" },
312+ BackendModels : config.BackendModels {
313+ VLLMEndpoints : []config.VLLMEndpoint {
314+ {
315+ Name : "primary" ,
316+ Address : "127.0.0.1" ,
317+ Port : 8000 ,
318+ Weight : 1 ,
319+ },
319320 },
320- "llama-3.1-8b-instruct" : {
321- PreferredEndpoints : []string {"primary" },
321+ ModelConfig : map [string ]config.ModelParams {
322+ "gpt-4o-mini" : {
323+ PreferredEndpoints : []string {"primary" },
324+ },
325+ "llama-3.1-8b-instruct" : {
326+ PreferredEndpoints : []string {"primary" },
327+ },
322328 },
323329 },
324- IncludeConfigModelsInList : false ,
330+ RouterOptions : config.RouterOptions {
331+ IncludeConfigModelsInList : false ,
332+ },
325333 }
326334
327335 apiServer := & ClassificationAPIServer {
@@ -371,23 +379,27 @@ func TestOpenAIModelsEndpoint(t *testing.T) {
371379func TestOpenAIModelsEndpointWithConfigModels (t * testing.T ) {
372380 // Test with IncludeConfigModelsInList = true
373381 cfg := & config.RouterConfig {
374- VLLMEndpoints : []config.VLLMEndpoint {
375- {
376- Name : "primary" ,
377- Address : "127.0.0.1" ,
378- Port : 8000 ,
379- Weight : 1 ,
380- },
381- },
382- ModelConfig : map [string ]config.ModelParams {
383- "gpt-4o-mini" : {
384- PreferredEndpoints : []string {"primary" },
382+ BackendModels : config.BackendModels {
383+ VLLMEndpoints : []config.VLLMEndpoint {
384+ {
385+ Name : "primary" ,
386+ Address : "127.0.0.1" ,
387+ Port : 8000 ,
388+ Weight : 1 ,
389+ },
385390 },
386- "llama-3.1-8b-instruct" : {
387- PreferredEndpoints : []string {"primary" },
391+ ModelConfig : map [string ]config.ModelParams {
392+ "gpt-4o-mini" : {
393+ PreferredEndpoints : []string {"primary" },
394+ },
395+ "llama-3.1-8b-instruct" : {
396+ PreferredEndpoints : []string {"primary" },
397+ },
388398 },
389399 },
390- IncludeConfigModelsInList : true ,
400+ RouterOptions : config.RouterOptions {
401+ IncludeConfigModelsInList : true ,
402+ },
391403 }
392404
393405 apiServer := & ClassificationAPIServer {
@@ -441,18 +453,32 @@ func TestOpenAIModelsEndpointWithConfigModels(t *testing.T) {
441453func TestSystemPromptEndpointSecurity (t * testing.T ) {
442454 // Create test configuration with categories that have system prompts
443455 cfg := & config.RouterConfig {
444- Categories : []config.Category {
445- {
446- Name : "math" ,
447- SystemPrompt : "You are a math expert." ,
448- SystemPromptEnabled : & []bool {true }[0 ], // Pointer to true
449- SystemPromptMode : "replace" ,
450- },
451- {
452- Name : "coding" ,
453- SystemPrompt : "You are a coding assistant." ,
454- SystemPromptEnabled : & []bool {false }[0 ], // Pointer to false
455- SystemPromptMode : "insert" ,
456+ IntelligentRouting : config.IntelligentRouting {
457+ Categories : []config.Category {
458+ {
459+ CategoryMetadata : config.CategoryMetadata {
460+ Name : "math" ,
461+ },
462+ DomainAwarePolicies : config.DomainAwarePolicies {
463+ SystemPromptPolicy : config.SystemPromptPolicy {
464+ SystemPrompt : "You are a math expert." ,
465+ SystemPromptEnabled : & []bool {true }[0 ], // Pointer to true
466+ SystemPromptMode : "replace" ,
467+ },
468+ },
469+ },
470+ {
471+ CategoryMetadata : config.CategoryMetadata {
472+ Name : "coding" ,
473+ },
474+ DomainAwarePolicies : config.DomainAwarePolicies {
475+ SystemPromptPolicy : config.SystemPromptPolicy {
476+ SystemPrompt : "You are a coding assistant." ,
477+ SystemPromptEnabled : & []bool {false }[0 ], // Pointer to false
478+ SystemPromptMode : "insert" ,
479+ },
480+ },
481+ },
456482 },
457483 },
458484 }
@@ -633,16 +659,30 @@ func TestSystemPromptEndpointSecurity(t *testing.T) {
633659func TestSystemPromptEndpointFunctionality (t * testing.T ) {
634660 // Create test configuration
635661 cfg := & config.RouterConfig {
636- Categories : []config.Category {
637- {
638- Name : "math" ,
639- SystemPrompt : "You are a math expert." ,
640- SystemPromptEnabled : & []bool {true }[0 ],
641- SystemPromptMode : "replace" ,
642- },
643- {
644- Name : "no-prompt" ,
645- SystemPrompt : "" , // No system prompt
662+ IntelligentRouting : config.IntelligentRouting {
663+ Categories : []config.Category {
664+ {
665+ CategoryMetadata : config.CategoryMetadata {
666+ Name : "math" ,
667+ },
668+ DomainAwarePolicies : config.DomainAwarePolicies {
669+ SystemPromptPolicy : config.SystemPromptPolicy {
670+ SystemPrompt : "You are a math expert." ,
671+ SystemPromptEnabled : & []bool {true }[0 ],
672+ SystemPromptMode : "replace" ,
673+ },
674+ },
675+ },
676+ {
677+ CategoryMetadata : config.CategoryMetadata {
678+ Name : "no-prompt" ,
679+ },
680+ DomainAwarePolicies : config.DomainAwarePolicies {
681+ SystemPromptPolicy : config.SystemPromptPolicy {
682+ SystemPrompt : "" , // No system prompt
683+ },
684+ },
685+ },
646686 },
647687 },
648688 }
0 commit comments