Closed amitgalitz closed 7 months ago
See https://github.com/opensearch-project/flow-framework/issues/261 for a previous thought I had along these lines, and the wrong way to do it ...
I think this is a great idea to improve ease of use, I'm just curious what's the rationale for separating default configs and substitution ready templates? Would it not be simpler to have substitution ready templates (with some default values) in the template index and have the user provision them while supplying the substitution params? This way we wouldnt need to store the default configs in a separate system index.
I think this is a great idea to improve ease of use, I'm just curious what's the rationale for separating default configs and substitution ready templates? Would it not be simpler to have substitution ready templates (with some default values) in the template index and have the user provision them while supplying the substitution params? This way we wouldnt need to store the default configs in a separate system index.
The reason for separating the defaults and substitution ready templates as I feel like they served different purposes. Similar to our new feature of providing parameters in the provision api path in this PR: https://github.com/opensearch-project/flow-framework/pull/525
the defaults are the equivalent of the api path values and the subtitution ready template is the template provided in the create.
I wanted to make everything possibly for substitution but also not require the user to always give all those values each time. We want to potentially have defaults for all the connectors here https://github.com/opensearch-project/ml-commons/tree/main/docs/remote_inference_blueprints. How did you envisioning the configurable template looking like if its merged with the defaults?
In order to be able to easily substitute any subset of field in the template that we want we will have to maintain two different set of documents. Giving these temporary names for easier discussion:
- Substitution Ready Template A set of templates that have all there fields ready to be substituted
- Predefined defaults A set of files with predefined defaults for each of the templates (potentially some default files can be used for multiple templates
I don't think we need two sets of documents: that introduces a lot of complexity, and separates the substitution name (in a template) from its default somewhere else. This:
We're basically substituting params at runtime (we are literally calling the map params
).
We already have a section of the template (for any workflow) of user_params
. Why not either:
default_params
for the substitutions in that workflow. It's right there, next to the workflow, for easy cross reference.user_params
field as the defaults, with clear documentation that they can be overridden on the REST path/body.
"name": "${create_connector_1}",
FYI, I've already implemented these substitutions with double curly braces, e.g., "name": "${{create_connector_1}}",
.
So the work to implement this is really:
Is your feature request related to a problem?
Flow-Framework currently supports the creation and provisioning of templates in order to executes a sequence of API calls in OpenSearch. Pasted in the bottom of this issue is an example of a more complicated template where we create a connector, set up a model, a few tools and agents.
As seen this template can be quite long to send to an API and users might not want or need to constantly be altering all the variables in it.
It is popular in CDK repos or other configuration automation platforms to have a simpler mechanisms to easily change just the variables that we want. Another potential improvement that could be added together with this is having predefined templates that are easily used and also ‘fine-grained’ edited by customers.
What solution would you like?
Users should be able to make an API request to create a template by choosing a predefined template and editing only the variables they care about.
How we will achieve this?
In order to be able to easily substitute any subset of field in the template that we want we will have to maintain two different set of documents. Giving these temporary names for easier discussion:
Example:
Substitution ready default template:
Default config example
Request from customers:
Changes to create workflow API:
In order to enable this change we will need to add an optional parameter to the create workflow API to distinguish which predefined defaults to use.
Option 1:
Option 2:
Storage:
Storage of both the predefined substitution ready templates and the pre-defined templates can be done on a system index. We can also provide users the ability to create there own pre-defined default files that they can easily change. If we store these documents in a system index we can control how users can add additional documents.
Potential new system indices are
.plugins-flow-framework-defaults
for the default values and.plugins-flow-framework-configurable-templates
for the configurable templates.Another options is to have the configurable templates as part of the template index that would be available to all users, but I don't know if that would create issues in terms of provisioning it. We wont necessarily be provisioning the configurable template themselves but they will be used for copying over to other provisioning and saved templates.
Appendix
Default templates to add: