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

[BUG] Standalone Connector update (Within a model update) message is misleading

Open brianf-aws opened this issue 10 months ago • 1 comments

What is the bug? Context: While updating a connector attached to a model via a model id, the message that appears is false even when the field does not exist for example.

## Create a connector 
{
	"connector_id": "Nx2TlZQBrGHu3J9owF7o"
}

### Register to model
{
	"name": "AWS TItan MM embedding model",
	"function_name": "remote",
	"description": "AWS TItan MM embedding model",
	"connector_id" : "Nx2TlZQBrGHu3J9owF7o"
}

PUT /_plugins/_ml/models/Fsp2BZMBO39bHfNca1lv
{
  "connectors": {
    "credential": {
      "auth": "..."
    }
  }
}
## result
{
	"_index": ".plugins-ml-model",
	"_id": "Fsp2BZMBO39bHfNca1lv",
	"_version": 3,
	"result": "updated",
	"_shards": {
		"total": 1,
		"successful": 1,
		"failed": 0
	},
	"_seq_no": 5,
	"_primary_term": 1
}
## Even this
PUT /_plugins/_ml/models/Fsp2BZMBO39bHfNca1lv
{
  "connectorssss_blah": { <--- could be any string
    "credential": {
      "auth": "..."
    }
  }
}

## result
{
	"_index": ".plugins-ml-model",
	"_id": "Fsp2BZMBO39bHfNca1lv",
	"_version": 3,
	"result": "updated",
	"_shards": {
		"total": 1,
		"successful": 1,
		"failed": 0
	},
	"_seq_no": 5,
	"_primary_term": 1
}

## But when the update is on the connector (singular valid field)
##            then it will cause a NPE when connector is updated as this a valid field
PUT /_plugins/_ml/models/Fsp2BZMBO39bHfNca1lv
{
  "connector": { <--- This actually is a valid field
    "credential": {
      "auth": "..."
    }
  }
}

{
	"error": {
		"root_cause": [
			{
				"type": "null_pointer_exception",
				"reason": "Cannot invoke \"org.opensearch.ml.common.connector.Connector.update(org.opensearch.ml.common.transport.connector.MLCreateConnectorInput, java.util.function.Function)\" because \"connector\" is null"
			}
		],
		"type": "null_pointer_exception",
		"reason": "Cannot invoke \"org.opensearch.ml.common.connector.Connector.update(org.opensearch.ml.common.transport.connector.MLCreateConnectorInput, java.util.function.Function)\" because \"connector\" is null"
	},
	"status": 500
}

What is the expected behavior? A valid exception should be thrown for not actually updating something that is there. Since this was a standalone connector it wasnt really associated to the model directly.

What is your host/environment?

  • OS: [e.g. iOS]
  • Version [e.g. 22]
  • Plugins

Do you have any screenshots?

Image

Do you have any additional context? Add any other context about the problem.

brianf-aws avatar Jan 23 '25 23:01 brianf-aws

Can you assign this to me?

brianf-aws avatar Jan 28 '25 18:01 brianf-aws