-
Notifications
You must be signed in to change notification settings - Fork 25k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature/semantic-text] Add query and model compatibility tests (#107256
- Loading branch information
1 parent
81c864c
commit 4d24bf0
Showing
4 changed files
with
299 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
190 changes: 190 additions & 0 deletions
190
...resources/rest-api-spec/test/inference/30_semantic_text_inference_incompatible_models.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
setup: | ||
- skip: | ||
version: " - 8.12.99" | ||
reason: semantic_text introduced in 8.13.0 # TODO change when 8.13.0 is released | ||
|
||
- do: | ||
inference.put_model: | ||
task_type: sparse_embedding | ||
inference_id: sparse-inference-id | ||
body: > | ||
{ | ||
"service": "test_service", | ||
"service_settings": { | ||
"model": "my_model", | ||
"api_key": "abc64" | ||
}, | ||
"task_settings": { | ||
} | ||
} | ||
- do: | ||
inference.put_model: | ||
task_type: text_embedding | ||
inference_id: dense-inference-id | ||
body: > | ||
{ | ||
"service": "text_embedding_test_service", | ||
"service_settings": { | ||
"model": "my_model", | ||
"dimensions": 10, | ||
"similarity": "cosine", | ||
"api_key": "abc64" | ||
}, | ||
"task_settings": { | ||
} | ||
} | ||
- do: | ||
indices.create: | ||
index: test-index | ||
body: | ||
mappings: | ||
properties: | ||
sparse_field: | ||
type: semantic_text | ||
inference_id: sparse-inference-id | ||
dense_field: | ||
type: semantic_text | ||
inference_id: dense-inference-id | ||
|
||
# Index a doc to set mappings internally | ||
- do: | ||
index: | ||
index: test-index | ||
id: doc_1 | ||
body: | ||
dense_field: "inference test" | ||
sparse_field: "another inference test" | ||
|
||
--- | ||
"Fails for non-compatible dimensions": | ||
|
||
- do: | ||
inference.delete_model: | ||
task_type: text_embedding | ||
inference_id: dense-inference-id | ||
|
||
- do: | ||
inference.put_model: | ||
task_type: text_embedding | ||
inference_id: dense-inference-id | ||
body: > | ||
{ | ||
"service": "text_embedding_test_service", | ||
"service_settings": { | ||
"model": "my_model", | ||
"dimensions": 20, | ||
"similarity": "cosine", | ||
"api_key": "abc64" | ||
}, | ||
"task_settings": { | ||
} | ||
} | ||
- do: | ||
catch: /Incompatible model settings for field \[dense_field\].+/ | ||
index: | ||
index: test-index | ||
id: doc_2 | ||
body: | ||
dense_field: "some other test" | ||
|
||
--- | ||
"Fails for non-compatible similarity": | ||
|
||
- do: | ||
inference.delete_model: | ||
task_type: text_embedding | ||
inference_id: dense-inference-id | ||
|
||
- do: | ||
inference.put_model: | ||
task_type: text_embedding | ||
inference_id: dense-inference-id | ||
body: > | ||
{ | ||
"service": "text_embedding_test_service", | ||
"service_settings": { | ||
"model": "my_model", | ||
"dimensions": 10, | ||
"similarity": "dot_product", | ||
"api_key": "abc64" | ||
}, | ||
"task_settings": { | ||
} | ||
} | ||
- do: | ||
catch: /Incompatible model settings for field \[dense_field\].+/ | ||
index: | ||
index: test-index | ||
id: doc_2 | ||
body: | ||
dense_field: "some other test" | ||
|
||
--- | ||
"Fails for non-compatible task type for dense vectors": | ||
|
||
- do: | ||
inference.delete_model: | ||
task_type: text_embedding | ||
inference_id: dense-inference-id | ||
|
||
|
||
- do: | ||
inference.put_model: | ||
task_type: sparse_embedding | ||
inference_id: dense-inference-id | ||
body: > | ||
{ | ||
"service": "test_service", | ||
"service_settings": { | ||
"model": "my_model", | ||
"api_key": "abc64" | ||
}, | ||
"task_settings": { | ||
} | ||
} | ||
- do: | ||
catch: /Incompatible model settings for field \[dense_field\].+/ | ||
index: | ||
index: test-index | ||
id: doc_2 | ||
body: | ||
dense_field: "some other test" | ||
|
||
--- | ||
"Fails for non-compatible task type for sparse vectors": | ||
|
||
- do: | ||
inference.delete_model: | ||
task_type: sparse_embedding | ||
inference_id: sparse-inference-id | ||
|
||
- do: | ||
inference.put_model: | ||
task_type: text_embedding | ||
inference_id: sparse-inference-id | ||
body: > | ||
{ | ||
"service": "text_embedding_test_service", | ||
"service_settings": { | ||
"model": "my_model", | ||
"dimensions": 10, | ||
"similarity": "cosine", | ||
"api_key": "abc64" | ||
}, | ||
"task_settings": { | ||
} | ||
} | ||
- do: | ||
catch: /Incompatible model settings for field \[sparse_field\].+/ | ||
index: | ||
index: test-index | ||
id: doc_2 | ||
body: | ||
sparse_field: "some other test" | ||
|
||
|