-
Notifications
You must be signed in to change notification settings - Fork 25.2k
[8.x] Support configurable chunking in semantic_text fields (#121041) #126545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* test * Revert "test" This reverts commit 9f4e2ad. * Refactor InferenceService to allow passing in chunking settings * Add chunking config to inference field metadata and store in semantic_text field * Fix test compilation errors * Hacking around trying to get ingest to work * Debugging * [CI] Auto commit changes from spotless * POC works and update TODO to fix this * [CI] Auto commit changes from spotless * Refactor chunking settings from model settings to field inference request * A bit of cleanup * Revert a bunch of changes to try to narrow down what broke CI * test * Revert "test" This reverts commit 9f4e2ad. * Fix InferenceFieldMetadataTest * [CI] Auto commit changes from spotless * Add chunking settings back in * Update builder to use new map * Fix compilation errors after merge * Debugging tests * debugging * Cleanup * Add yaml test * Update tests * Add chunking to test inference service * Trying to get tests to work * Shard bulk inference test never specifies chunking settings * Fix test * Always process batches in order * Fix chunking in test inference service and yaml tests * [CI] Auto commit changes from spotless * Refactor - remove convenience method with default chunking settings * Fix ShardBulkInferenceActionFilterTests * Fix ElasticsearchInternalServiceTests * Fix SemanticTextFieldMapperTests * [CI] Auto commit changes from spotless * Fix test data to fit within bounds * Add additional yaml test cases * Playing with xcontent parsing * A little cleanup * Update docs/changelog/121041.yaml * Fix failures introduced by merge * [CI] Auto commit changes from spotless * Address PR feedback * [CI] Auto commit changes from spotless * Fix predicate in updated test * Better handling of null/empty ChunkingSettings * Update parsing settings * Fix errors post merge * PR feedback * [CI] Auto commit changes from spotless * PR feedback and fix Xcontent parsing for SemanticTextField * Remove chunking settings check to use what's passed in from sender service * Fix some tests * Cleanup * Test failure whack-a-mole * Cleanup * Refactor to handle memory optimized bulk shard inference actions - this is ugly but at least it compiles * [CI] Auto commit changes from spotless * Minor cleanup * A bit more cleanup * Spotless * Revert change * Update chunking setting update logic * Go back to serializing maps * Revert change to model settings - source still errors on missing model_id * Fix updating chunking settings * Look up model if null * Fix test * Work around elastic#125723 in semantic text field serialization * Add BWC tests * Add chunking_settings to docs * Refactor/rename * Address minor PR feedback * Add test case for null update * PR feedback - adjust refactor of chunked inputs * Refactored AbstractTestInferenceService to return offsets instead of just Strings * [CI] Auto commit changes from spotless * Fix tests where chunk output was of size 3 * Update mappings per PR feedback * PR Feedback * Fix problems related to merge * PR optimization * Fix test * Delete extra file --------- Co-authored-by: elasticsearchmachine <[email protected]> (cherry picked from commit e7d4a28) # Conflicts: # docs/reference/elasticsearch/mapping-reference/semantic-text.md # server/src/main/java/org/elasticsearch/TransportVersions.java # x-pack/plugin/inference/qa/test-service-plugin/src/main/java/org/elasticsearch/xpack/inference/mock/TestSparseInferenceServiceExtension.java # x-pack/plugin/inference/src/main/java/module-info.java # x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/InferenceFeatures.java # x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/chunking/EmbeddingRequestChunkerTests.java # x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/amazonbedrock/AmazonBedrockServiceTests.java # x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/azureaistudio/AzureAiStudioServiceTests.java # x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/azureopenai/AzureOpenAiServiceTests.java # x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/cohere/CohereServiceTests.java # x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/elastic/ElasticInferenceServiceTests.java # x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/huggingface/HuggingFaceElserServiceTests.java # x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/huggingface/HuggingFaceServiceTests.java # x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/mistral/MistralServiceTests.java # x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/openai/OpenAiServiceTests.java
@@ -63,7 +63,7 @@ public TestSparseModel(String inferenceEntityId, TestServiceSettings serviceSett | |||
public static class TestInferenceService extends AbstractTestInferenceService { | |||
public static final String NAME = "test_service"; | |||
|
|||
private static final EnumSet<TaskType> supportedTaskTypes = EnumSet.of(TaskType.SPARSE_EMBEDDING); | |||
private static final EnumSet<TaskType> supportedTaskTypes = EnumSet.of(TaskType.SPARSE_EMBEDDING, TaskType.TEXT_EMBEDDING); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is right, this change isn't in main
. Blocking merge until we can confirm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not in main
but it is in 8.x
. And it was required to get an existing test to pass that counts the number of text embedding models.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the link to the relevant file in the 8.x branch, to which this backport is merging into:
Line 66 in 909cc55
private static final EnumSet<TaskType> supportedTaskTypes = EnumSet.of(TaskType.SPARSE_EMBEDDING, TaskType.TEXT_EMBEDDING); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying, let's fix this in a separate PR
@@ -63,7 +63,7 @@ public TestSparseModel(String inferenceEntityId, TestServiceSettings serviceSett | |||
public static class TestInferenceService extends AbstractTestInferenceService { | |||
public static final String NAME = "test_service"; | |||
|
|||
private static final EnumSet<TaskType> supportedTaskTypes = EnumSet.of(TaskType.SPARSE_EMBEDDING); | |||
private static final EnumSet<TaskType> supportedTaskTypes = EnumSet.of(TaskType.SPARSE_EMBEDDING, TaskType.TEXT_EMBEDDING); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying, let's fix this in a separate PR
Backport
This will backport the following commits from
main
to8.x
:Questions ?
Please refer to the Backport tool documentation