@@ -533,4 +533,90 @@ public void Test_Text2VecGoogle_Omits_Unset_Location()
533533 Assert . Contains ( "\" text2vec-google\" " , json ) ;
534534 Assert . DoesNotContain ( "\" location\" " , json ) ;
535535 }
536+
537+ /// <summary>
538+ /// Tests that Text2VecAWS serializes <c>dimensions</c> as a JSON number (not a string) when it
539+ /// is set via the Bedrock factory.
540+ /// </summary>
541+ [ Fact ]
542+ [ System . Diagnostics . CodeAnalysis . SuppressMessage (
543+ "Performance" ,
544+ "CA1869:Cache and reuse 'JsonSerializerOptions' instances" ,
545+ Justification = "<Pending>"
546+ ) ]
547+ public void Test_Text2VecAWS_Serializes_Dimensions_When_Set ( )
548+ {
549+ // Arrange
550+ var vc = Configure . Vector (
551+ "default" ,
552+ v =>
553+ v . Text2VecAWSBedrock (
554+ region : "us-east-1" ,
555+ model : "amazon.titan-embed-text-v2:0" ,
556+ dimensions : 1024
557+ )
558+ ) ;
559+
560+ // Act
561+ var dto = vc . Vectorizer ? . ToDto ( ) ?? default ;
562+ var json = JsonSerializer . Serialize (
563+ dto ,
564+ new JsonSerializerOptions
565+ {
566+ PropertyNamingPolicy = JsonNamingPolicy . CamelCase ,
567+ DefaultIgnoreCondition = System
568+ . Text
569+ . Json
570+ . Serialization
571+ . JsonIgnoreCondition
572+ . WhenWritingNull ,
573+ WriteIndented = false ,
574+ }
575+ ) ;
576+
577+ // Assert
578+ Assert . Contains ( "\" text2vec-aws\" " , json ) ;
579+ Assert . Contains ( "\" dimensions\" :1024" , json ) ;
580+ Assert . DoesNotContain ( "\" dimensions\" :\" 1024\" " , json ) ;
581+ }
582+
583+ /// <summary>
584+ /// Tests that Text2VecAWS omits <c>dimensions</c> when it is unset so the server can apply its
585+ /// default.
586+ /// </summary>
587+ [ Fact ]
588+ [ System . Diagnostics . CodeAnalysis . SuppressMessage (
589+ "Performance" ,
590+ "CA1869:Cache and reuse 'JsonSerializerOptions' instances" ,
591+ Justification = "<Pending>"
592+ ) ]
593+ public void Test_Text2VecAWS_Omits_Unset_Dimensions ( )
594+ {
595+ // Arrange
596+ var vc = Configure . Vector (
597+ "default" ,
598+ v => v . Text2VecAWSSagemaker ( region : "us-east-1" , endpoint : "my-endpoint" )
599+ ) ;
600+
601+ // Act
602+ var dto = vc . Vectorizer ? . ToDto ( ) ?? default ;
603+ var json = JsonSerializer . Serialize (
604+ dto ,
605+ new JsonSerializerOptions
606+ {
607+ PropertyNamingPolicy = JsonNamingPolicy . CamelCase ,
608+ DefaultIgnoreCondition = System
609+ . Text
610+ . Json
611+ . Serialization
612+ . JsonIgnoreCondition
613+ . WhenWritingNull ,
614+ WriteIndented = false ,
615+ }
616+ ) ;
617+
618+ // Assert
619+ Assert . Contains ( "\" text2vec-aws\" " , json ) ;
620+ Assert . DoesNotContain ( "\" dimensions\" " , json ) ;
621+ }
536622}
0 commit comments