Skip to content

Commit 6509870

Browse files
Added yaml tests for multu chunks
1 parent bb99b3b commit 6509870

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

x-pack/plugin/inference/src/yamlRestTest/resources/rest-api-spec/test/inference/30_semantic_text_inference.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,3 +1159,36 @@ setup:
11591159

11601160
- exists: hits.hits.0._source._inference_fields
11611161
- not_exists: hits.hits.1._source._inference_fields
1162+
1163+
---
1164+
"Multi chunks skips empty input embedding generation":
1165+
- requires:
1166+
cluster_features: "semantic_text.handle_empty_input"
1167+
reason: skips generating embeddings when semantic_text field is contains empty or whitespace only input
1168+
1169+
- do:
1170+
index:
1171+
index: test-index
1172+
id: doc_1
1173+
body:
1174+
sparse_field: ["some test data", " ", "now with chunks"]
1175+
refresh: true
1176+
1177+
- do:
1178+
search:
1179+
index: test-index
1180+
body:
1181+
fields: [ _inference_fields ]
1182+
query:
1183+
match_all: { }
1184+
1185+
- match: { hits.total.value: 1 }
1186+
1187+
- length: { hits.hits.0._source._inference_fields.sparse_field.inference.chunks: 1 }
1188+
- length: { hits.hits.0._source._inference_fields.sparse_field.inference.chunks.sparse_field: 2 }
1189+
- exists: hits.hits.0._source._inference_fields.sparse_field.inference.chunks.sparse_field.0.embeddings
1190+
- match: { hits.hits.0._source._inference_fields.sparse_field.inference.chunks.sparse_field.0.start_offset: 0 }
1191+
- match: { hits.hits.0._source._inference_fields.sparse_field.inference.chunks.sparse_field.0.end_offset: 14 }
1192+
- exists: hits.hits.0._source._inference_fields.sparse_field.inference.chunks.sparse_field.1.embeddings
1193+
- match: { hits.hits.0._source._inference_fields.sparse_field.inference.chunks.sparse_field.1.start_offset: 20 }
1194+
- match: { hits.hits.0._source._inference_fields.sparse_field.inference.chunks.sparse_field.1.end_offset: 35 }

0 commit comments

Comments
 (0)