-
Notifications
You must be signed in to change notification settings - Fork 177
Adding query planning tool search template validation and integration tests #4177
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
base: main
Are you sure you want to change the base?
Conversation
private static final String DEFAULT_SYSTEM_PROMPT = | ||
"You are an OpenSearch Query DSL generation assistant, translating natural language questions to OpenSeach DSL Queries"; | ||
|
||
private static final Logger logger = LogManager.getLogger(QueryPlanningTool.class); |
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.
can you use the same logger like the rest of the repo?
import lombok.extern.log4j.Log4j2; |
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.
Ill remove the logger, left over from debugging
private void validateTemplateFields(Map<String, String> template) { | ||
// Validate templateId | ||
String templateId = template.get(TEMPLATE_ID_FIELD); | ||
if (templateId == null || templateId.trim().isEmpty()) { |
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.
is it the same validation of search template or similar to opensearch core?
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.
This validation is specifically for the query planning tool configuration, it ensures that each entry of the search_templates
field contains both template_id
and template_description
|
||
// Validate templateDescription | ||
String templateDescription = template.get(TEMPLATE_DESCRIPTION_FIELD); | ||
if (templateDescription == null || templateDescription.trim().isEmpty()) { |
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.
nit: can we use .isBlank()
instead of .trim().isEmpty()
isBalnk() is more efficient
plugin/build.gradle
Outdated
zipArchive("org.opensearch.plugin:opensearch-job-scheduler:${opensearch_build}") | ||
zipArchive("org.opensearch.plugin:opensearch-knn:${opensearch_build}") | ||
zipArchive("org.opensearch.plugin:neural-search:${opensearch_build}") |
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.
Can we remove these?
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.
ah yeah, left over from debugging, Ill remove in the next commit
plugin/build.gradle
Outdated
plugin(provider(new Callable<RegularFile>(){ | ||
@Override | ||
RegularFile call() throws Exception { | ||
return new RegularFile() { | ||
@Override | ||
File getAsFile() { | ||
return configurations.zipArchive.asFileTree.matching{include "**/opensearch-knn-${opensearch_build}.zip"}.getSingleFile() | ||
} | ||
} | ||
} | ||
})) | ||
plugin(provider(new Callable<RegularFile>(){ | ||
@Override | ||
RegularFile call() throws Exception { | ||
return new RegularFile() { | ||
@Override | ||
File getAsFile() { | ||
return configurations.zipArchive.asFileTree.matching{include "**/neural-search-${opensearch_build}.zip"}.getSingleFile() | ||
} | ||
} | ||
} | ||
})) |
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.
Can we remove these too
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.
Why do we need to have these plugins in the integTest setup?
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.
will do
… tests Signed-off-by: Joshua Palis <jpalis@amazon.com>
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.
LGTM!
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4177 +/- ##
============================================
- Coverage 82.02% 82.00% -0.03%
+ Complexity 9195 9193 -2
============================================
Files 789 789
Lines 39541 39557 +16
Branches 4387 4390 +3
============================================
+ Hits 32432 32437 +5
- Misses 5219 5228 +9
- Partials 1890 1892 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: Joshua Palis <jpalis@amazon.com>
you need to meet the codecov for your if else condition |
Description
search_templates
to require bothtemplate_id
andtemplate_description
Additionally includes changes from #4176, will rebase once its merged
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.