File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
main/java/dev/langchain4j/model/bedrock
test/java/dev/langchain4j/model/bedrock Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -23,8 +23,7 @@ class AwsDocumentConverter {
2323
2424 static final ObjectMapper OBJECT_MAPPER = new ObjectMapper ()
2525 .disable (INDENT_OUTPUT )
26- .disable (DeserializationFeature .FAIL_ON_UNKNOWN_PROPERTIES )
27- .setSerializationInclusion (JsonInclude .Include .NON_NULL );
26+ .disable (DeserializationFeature .FAIL_ON_UNKNOWN_PROPERTIES );
2827
2928 private AwsDocumentConverter () {}
3029
@@ -55,6 +54,8 @@ private static Object documentToObject(Document doc) {
5554 Map <String , Object > innerObject = new HashMap <>();
5655 doc .asMap ().forEach ((k , v ) -> innerObject .put (k , documentToObject (v )));
5756 return innerObject ;
57+ } else if (doc .isNull ()) {
58+ return null ;
5859 } else {
5960 return doc .asString ();
6061 }
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ void convert_primitive_types_to_json() {
2222 docMap .put ("integer" , Document .fromNumber (42 ));
2323 docMap .put ("double" , Document .fromNumber (42.5 ));
2424 docMap .put ("boolean" , Document .fromBoolean (true ));
25+ docMap .put ("null" , Document .fromNull ());
2526 Document document = Document .fromMap (docMap );
2627
2728 // When
@@ -32,7 +33,8 @@ void convert_primitive_types_to_json() {
3233 .containsIgnoringWhitespaces ("\" string\" : \" test\" " )
3334 .containsIgnoringWhitespaces ("\" integer\" : 42" )
3435 .containsIgnoringWhitespaces ("\" double\" : 42.5" )
35- .containsIgnoringWhitespaces ("\" boolean\" : true" );
36+ .containsIgnoringWhitespaces ("\" boolean\" : true" )
37+ .containsIgnoringWhitespaces ("\" null\" : null" );
3638 }
3739
3840 @ Test
You can’t perform that action at this time.
0 commit comments