@@ -496,4 +496,90 @@ public void Test_Text2VecDigitalOcean_Omits_Unset_BaseURL()
496496 Assert . Contains ( "\" model\" :\" qwen3-embedding-0.6b\" " , json ) ;
497497 Assert . DoesNotContain ( "\" baseURL\" " , json ) ;
498498 }
499+
500+ /// <summary>
501+ /// Tests that Text2VecAWS serializes <c>dimensions</c> as a JSON number (not a string) when it
502+ /// is set via the Bedrock factory.
503+ /// </summary>
504+ [ Fact ]
505+ [ System . Diagnostics . CodeAnalysis . SuppressMessage (
506+ "Performance" ,
507+ "CA1869:Cache and reuse 'JsonSerializerOptions' instances" ,
508+ Justification = "<Pending>"
509+ ) ]
510+ public void Test_Text2VecAWS_Serializes_Dimensions_When_Set ( )
511+ {
512+ // Arrange
513+ var vc = Configure . Vector (
514+ "default" ,
515+ v =>
516+ v . Text2VecAWSBedrock (
517+ region : "us-east-1" ,
518+ model : "amazon.titan-embed-text-v2:0" ,
519+ dimensions : 1024
520+ )
521+ ) ;
522+
523+ // Act
524+ var dto = vc . Vectorizer ? . ToDto ( ) ?? default ;
525+ var json = JsonSerializer . Serialize (
526+ dto ,
527+ new JsonSerializerOptions
528+ {
529+ PropertyNamingPolicy = JsonNamingPolicy . CamelCase ,
530+ DefaultIgnoreCondition = System
531+ . Text
532+ . Json
533+ . Serialization
534+ . JsonIgnoreCondition
535+ . WhenWritingNull ,
536+ WriteIndented = false ,
537+ }
538+ ) ;
539+
540+ // Assert
541+ Assert . Contains ( "\" text2vec-aws\" " , json ) ;
542+ Assert . Contains ( "\" dimensions\" :1024" , json ) ;
543+ Assert . DoesNotContain ( "\" dimensions\" :\" 1024\" " , json ) ;
544+ }
545+
546+ /// <summary>
547+ /// Tests that Text2VecAWS omits <c>dimensions</c> when it is unset so the server can apply its
548+ /// default.
549+ /// </summary>
550+ [ Fact ]
551+ [ System . Diagnostics . CodeAnalysis . SuppressMessage (
552+ "Performance" ,
553+ "CA1869:Cache and reuse 'JsonSerializerOptions' instances" ,
554+ Justification = "<Pending>"
555+ ) ]
556+ public void Test_Text2VecAWS_Omits_Unset_Dimensions ( )
557+ {
558+ // Arrange
559+ var vc = Configure . Vector (
560+ "default" ,
561+ v => v . Text2VecAWSSagemaker ( region : "us-east-1" , endpoint : "my-endpoint" )
562+ ) ;
563+
564+ // Act
565+ var dto = vc . Vectorizer ? . ToDto ( ) ?? default ;
566+ var json = JsonSerializer . Serialize (
567+ dto ,
568+ new JsonSerializerOptions
569+ {
570+ PropertyNamingPolicy = JsonNamingPolicy . CamelCase ,
571+ DefaultIgnoreCondition = System
572+ . Text
573+ . Json
574+ . Serialization
575+ . JsonIgnoreCondition
576+ . WhenWritingNull ,
577+ WriteIndented = false ,
578+ }
579+ ) ;
580+
581+ // Assert
582+ Assert . Contains ( "\" text2vec-aws\" " , json ) ;
583+ Assert . DoesNotContain ( "\" dimensions\" " , json ) ;
584+ }
499585}
0 commit comments