Skip to content
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

[FEATURE] Add an API to return validation parameters #364

Closed
dbwiddis opened this issue Jan 5, 2024 · 3 comments · Fixed by #394
Closed

[FEATURE] Add an API to return validation parameters #364

dbwiddis opened this issue Jan 5, 2024 · 3 comments · Fixed by #394
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request v2.12.0

Comments

@dbwiddis
Copy link
Member

dbwiddis commented Jan 5, 2024

Is your feature request related to a problem?

Users do not have an easy way to validate workflow steps, particularly in understanding what parameters are part of the output (e.g., model_id) and which inputs are required vs. optional (other than by laboriously visiting original API docs). We should allow users to easily identify these requirements via API.

In addition, the planned front-end will need access to this same information in order to enable real-time validation in the drag-and-drop interface.

What solution would you like?

Create a new REST API to return content equivalent to the workflow-steps.json file.

Allow an optional parameter for the workflow step type which returns only the content of that portion of the file.

What alternatives have you considered?

  1. Force users to navigate documentation.
  2. Point users to the JSON file on GitHub.
  3. Document every single step on opensearch.org.

Do you have any additional context?

We already parse the contents of this file into a WorkflowValidator class, which internally contains a Map<String, WorkflowStepValidator>.

  1. The API can simply return the contents of these objects, which simply requires toXContent() methods.
  2. We could also avoid the potential issues with parsing this file (e.g., users experiencing runtime validation checks rather than compile time checks) by simply hardcoding the WorkflowStepValidator map. We can then remove the parse methods and all the complexity with exceptions that they bring.
@dbwiddis dbwiddis added documentation Improvements or additions to documentation enhancement New feature or request untriaged v2.12.0 labels Jan 5, 2024
@dbwiddis dbwiddis removed the untriaged label Jan 5, 2024
@owaiskazi19
Copy link
Member

owaiskazi19 commented Jan 9, 2024

Request: GET /_plugins/_flow_framework/workflow/_steps

Response:

{
  "undeploy_model": {
    "inputs": [
      "model_id"
    ],
    "outputs": [
      "success"
    ],
    "required_plugins": [
      "opensearch-ml"
    ]
  },
  "register_model_group": {
    "inputs": [
      "name"
    ],
    "outputs": [
      "model_group_id",
      "model_group_status"
    ],
    "required_plugins": [
      "opensearch-ml"
    ]
  },
  "register_remote_model": {
    "inputs": [
      "name",
      "connector_id"
    ],
    "outputs": [
      "model_id",
      "register_model_status"
    ],
    "required_plugins": [
      "opensearch-ml"
    ]
  },
  "register_local_sparse_encoding_model": {
    "inputs": [
      "name",
      "version",
      "model_format",
      "function_name",
      "model_content_hash_value",
      "url"
    ],
    "outputs": [
      "model_id",
      "register_model_status"
    ],
    "required_plugins": [
      "opensearch-ml"
    ],
    "timeout": "1m"
  },
  "create_index": {
    "inputs": [
      "index_name",
      "default_mapping_option"
    ],
    "outputs": [
      "index_name"
    ],
    "required_plugins": []
  },
  "delete_agent": {
    "inputs": [
      "agent_id"
    ],
    "outputs": [
      "agent_id"
    ],
    "required_plugins": [
      "opensearch-ml"
    ]
  },
  "create_ingest_pipeline": {
    "inputs": [
      "id",
      "description",
      "type",
      "model_id",
      "input_field_name",
      "output_field_name"
    ],
    "outputs": [
      "pipeline_id"
    ],
    "required_plugins": []
  },
  "register_local_pretrained_model": {
    "inputs": [
      "name",
      "version",
      "model_format"
    ],
    "outputs": [
      "model_id",
      "register_model_status"
    ],
    "required_plugins": [
      "opensearch-ml"
    ],
    "timeout": "1m"
  },
  "create_tool": {
    "inputs": [
      "type"
    ],
    "outputs": [
      "tools"
    ],
    "required_plugins": [
      "opensearch-ml"
    ]
  },
  "noop": {
    "inputs": [],
    "outputs": [],
    "required_plugins": []
  },
  "create_connector": {
    "inputs": [
      "name",
      "description",
      "version",
      "protocol",
      "parameters",
      "credential",
      "actions"
    ],
    "outputs": [
      "connector_id"
    ],
    "required_plugins": [
      "opensearch-ml"
    ]
  },
  "delete_model_group": {
    "inputs": [],
    "outputs": [],
    "required_plugins": []
  },
  "register_agent": {
    "inputs": [
      "name",
      "type"
    ],
    "outputs": [
      "agent_id"
    ],
    "required_plugins": [
      "opensearch-ml"
    ]
  },
  "deploy_model": {
    "inputs": [
      "model_id"
    ],
    "outputs": [
      "deploy_model_status"
    ],
    "required_plugins": [
      "opensearch-ml"
    ],
    "timeout": "15s"
  },
  "delete_connector": {
    "inputs": [
      "connector_id"
    ],
    "outputs": [
      "connector_id"
    ],
    "required_plugins": [
      "opensearch-ml"
    ]
  },
  "register_local_custom_model": {
    "inputs": [
      "name",
      "version",
      "model_format",
      "function_name",
      "model_content_hash_value",
      "url",
      "model_type",
      "embedding_dimension",
      "framework_type"
    ],
    "outputs": [
      "model_id",
      "register_model_status"
    ],
    "required_plugins": [
      "opensearch-ml"
    ],
    "timeout": "1m"
  },
  "delete_model": {
    "inputs": [
      "model_id"
    ],
    "outputs": [
      "model_id"
    ],
    "required_plugins": [
      "opensearch-ml"
    ]
  }
}

@dbwiddis
Copy link
Member Author

Should we remove the create index and create ingest pipeline from the JSON?

@owaiskazi19
Copy link
Member

Should we remove the create index and create ingest pipeline from the JSON?

We should. Let me push the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request v2.12.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants