Skip to content

[ML] Adds a new field supported_task_types in the configuration response#120150

Merged
jonathan-buttner merged 15 commits intoelastic:mainfrom
jonathan-buttner:ml-services-api-task-type
Jan 17, 2025
Merged

[ML] Adds a new field supported_task_types in the configuration response#120150
jonathan-buttner merged 15 commits intoelastic:mainfrom
jonathan-buttner:ml-services-api-task-type

Conversation

@jonathan-buttner
Copy link
Contributor

@jonathan-buttner jonathan-buttner commented Jan 14, 2025

This PR adds a new field for the service configuration response to indicate which task types are supported by a field.

New field: supported_task_types

This field will be included in the response for each field returned.

Dependent on this PR being merged first: #119982

Example
{
  "service": "openai",
  "name": "OpenAI",
  "task_types": [
    "text_embedding",
    "completion"
  ],
  "configurations": {
    "api_key": {
      "description": "The OpenAI API authentication key. For more details about generating OpenAI API keys, refer to the https://platform.openai.com/account/api-keys.",
      "label": "API Key",
      "required": true,
      "sensitive": true,
      "updatable": true,
      "type": "str",
      "supported_task_types": [
        "text_embedding",
        "completion"
      ]
    },
    "dimensions": {
      "description": "Dimensions",
      "label": "Dimensions",
      "required": false,
      "sensitive": false,
      "updatable": false,
      "type": "str",
      "supported_task_types": [
        "text_embedding" <--- only available for text embedding
      ]
    },
    "organization_id": {
      "description": "The unique identifier of your organization.",
      "label": "Organization ID",
      "required": false,
      "sensitive": false,
      "updatable": false,
      "type": "str",
      "supported_task_types": [
        "text_embedding",
        "completion"
      ]
    },
    "rate_limit.requests_per_minute": {
      "description": "Default number of requests allowed per minute. For text_embedding is 3000. For completion is 500.",
      "label": "Rate Limit",
      "required": false,
      "sensitive": false,
      "updatable": false,
      "type": "int",
      "supported_task_types": [
        "text_embedding",
        "completion"
      ]
    },
    "model_id": {
      "description": "The name of the model to use for the inference task.",
      "label": "Model ID",
      "required": true,
      "sensitive": false,
      "updatable": false,
      "type": "str",
      "supported_task_types": [
        "text_embedding",
        "completion"
      ]
    },
    "url": {
      "default_value": "https://api.openai.com/v1/chat/completions",
      "description": "The OpenAI API endpoint URL. For more information on the URL, refer to the https://platform.openai.com/docs/api-reference.",
      "label": "URL",
      "required": true,
      "sensitive": false,
      "updatable": false,
      "type": "str",
      "supported_task_types": [
        "text_embedding",
        "completion"
      ]
    }
  }
}

@jonathan-buttner jonathan-buttner added >feature :ml Machine learning Team:ML Meta label for the ML team auto-backport Automatically create backport pull requests when merged Feature:GenAI Features around GenAI v9.0.0 v8.18.0 labels Jan 14, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @jonathan-buttner, I've created a changelog YAML for you.

@jonathan-buttner jonathan-buttner changed the title [ML] Adds a new field available_for_task_types in the configuration response [ML] Adds a new field supported_task_types in the configuration response Jan 15, 2025
@jonathan-buttner jonathan-buttner marked this pull request as ready for review January 15, 2025 22:11
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/ml-core (Team:ML)

Copy link
Contributor

@ymao1 ymao1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Works as described. Left one optional nit.

I'm guessing there will be a followup to add the task type specific fields?

configurationMap.put(
RESOURCE_NAME,
new SettingsConfiguration.Builder().setDescription("The name of your Azure OpenAI resource.")
new SettingsConfiguration.Builder(EnumSet.of(TaskType.TEXT_EMBEDDING, TaskType.COMPLETION)).setDescription(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: would it make sense to use the supportedTaskTypes defined above for the configurations that support all supported task types and just explicitly define it for the configurations that don't support all of them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'll make that change 👍

@jonathan-buttner
Copy link
Contributor Author

Thanks @ymao1 !

I'm guessing there will be a followup to add the task type specific fields?

Yep that's correct. I still need to do that. I was going to do it in a separate PR.

Copy link

@YulNaumenko YulNaumenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Works as expected.

@jonathan-buttner jonathan-buttner merged commit 06e1621 into elastic:main Jan 17, 2025
16 checks passed
@jonathan-buttner jonathan-buttner deleted the ml-services-api-task-type branch January 17, 2025 16:41
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.x

jonathan-buttner added a commit to jonathan-buttner/elasticsearch that referenced this pull request Jan 17, 2025
…nse (elastic#120150)

* Adding new field to settings class

* adding new available_for_task_types field

* Update docs/changelog/120150.yaml

* Delete docs/changelog/120150.yaml

* Fixing tests and task types

* Renaming field to supported_task_types

* Pulling in chat_completion addition

* Addressing feedback
elasticsearchmachine pushed a commit that referenced this pull request Jan 17, 2025
…nse (#120150) (#120410)

* Adding new field to settings class

* adding new available_for_task_types field

* Update docs/changelog/120150.yaml

* Delete docs/changelog/120150.yaml

* Fixing tests and task types

* Renaming field to supported_task_types

* Pulling in chat_completion addition

* Addressing feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged Feature:GenAI Features around GenAI :ml Machine learning >refactoring Team:ML Meta label for the ML team v8.18.0 v9.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants