Add semantic mapping transformer to transform mapping for semantic felds.#1
Closed
Add semantic mapping transformer to transform mapping for semantic felds.#1
Conversation
Signed-off-by: Bo Zhang <bzhangam@amazon.com>
e0530c8 to
8e36a35
Compare
q-andy
reviewed
Mar 20, 2025
| @Override | ||
| public void onResponse(MLModel mlModel) { | ||
| try { | ||
| modifyMappings(mappings, mlModel, modelIdToFieldPathMap.get(modelId), semanticFieldPathToConfigMap, modelId); |
There was a problem hiding this comment.
Any multithreading concerns here with modifying a map like this if the map isn't a ConcurrentHashMap/SkipListMap? I An alternative thread-safe way could be to use PlainActionListeners to await the model info with blocking and then modify the mappings synchronously
Owner
Author
There was a problem hiding this comment.
Should be no risk since we don't iterate the map here. But to make it safe I can add synchronized to ensure we modify the mapping synchronously. Since we don't expect too many model ids in one mapping and modifying the map is a fast local calculation we should be good.
…lds. Signed-off-by: Bo Zhang <bzhangam@amazon.com>
736ed44 to
bdd0eb5
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add semantic mapping transformer to transform mapping for semantic fields.
It will auto add semantic info fields to the mapping based on the model id defined in the semantic fields.
Note
This PR is based on this one. And it's not target the main branch of the neural plugin main. It's just for review purpose.
Related Issues
#[803] - Proposal to support semantic field in neural search.
#[1211] - HLD of the semantic field.
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.