ml-commons icon indicating copy to clipboard operation
ml-commons copied to clipboard

[FEATURE] Add possible values to ConnectorAction.ActionType enum, or make generic

Open tianjing-li opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? A clear and concise description of what the problem is, e.g. I'm always frustrated when [...]

When registering a ML model, you can specify an actions parameter that is an array of objects, however there is currently no point to do so since the action_type only supports predict currently. For example, what if I wanted to add in the same model, actions for embed and predict?

"actions": [
    {
      "action_type": "predict",
      "method": "POST",
      "url": "https://api.cohere.ai/v1/chat",
      "headers": {
        "Authorization": "Bearer ${credential.cohere_key}",
        "Request-Source": "unspecified:opensearch"
      },
      "request_body": "{ \"message\": ${parameters.message}, \"model\": \"${parameters.model}\", \"connectors\": \"${parameters.connectors}\", \"conversation_id\": \"${parameters.conversation_id}\" }"
    },
    {
      "action_type": "other..",
  ]

What solution would you like? A clear and concise description of what you want to happen.

Solution 1:

  • Increase the ActionType enum values we can use

Solution 2:

  • Remove the ActionType enum, and allow the use the flexibility to define the action_type to url mapping generically

What alternatives have you considered? A clear and concise description of any alternative solutions or features you've considered.

Two solutions above

Do you have any additional context? Add any other context or screenshots about the feature request here.

tianjing-li avatar Feb 01 '24 19:02 tianjing-li

When registering a ML model, you can specify an actions parameter that is an array of objects, however there is currently no point to do so since the action_type only supports predict currently.

Thanks @tianjing-li , you are correct. We built connector action as list for future extension. Check my response https://github.com/opensearch-project/ml-commons/issues/1926#issuecomment-1916351976

ylwu-amzn avatar Feb 02 '24 10:02 ylwu-amzn

@ylwu-amzn Thank you! will make a note of that ticket

tianjing-li avatar Feb 02 '24 15:02 tianjing-li