diff --git a/elasticsearch/_async/client/ml.py b/elasticsearch/_async/client/ml.py index 9c1339aa1..bba4a2f6f 100644 --- a/elasticsearch/_async/client/ml.py +++ b/elasticsearch/_async/client/ml.py @@ -3302,6 +3302,7 @@ async def put_trained_model_vocabulary( filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, merges: t.Optional[t.Sequence[str]] = None, + scores: t.Optional[t.Sequence[str]] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ @@ -3312,11 +3313,16 @@ async def put_trained_model_vocabulary( :param model_id: The unique identifier of the trained model. :param vocabulary: The model vocabulary, which must not be empty. :param merges: The optional model merges if required by the tokenizer. + :param scores: The optional vocabulary value scores if required by the tokenizer. """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'model_id'") if vocabulary is None: raise ValueError("Empty value passed for parameter 'vocabulary'") + if scores is not None and len(scores) != len(vocabulary): + raise ValueError( + "The value length for the 'scores' and 'vocabulary' parameters is not the same" + ) __path = f"/_ml/trained_models/{_quote(model_id)}/vocabulary" __body: t.Dict[str, t.Any] = {} __query: t.Dict[str, t.Any] = {} @@ -3330,6 +3336,8 @@ async def put_trained_model_vocabulary( __query["human"] = human if merges is not None: __body["merges"] = merges + if scores is not None: + __body["scores"] = scores if pretty is not None: __query["pretty"] = pretty __headers = {"accept": "application/json", "content-type": "application/json"} diff --git a/elasticsearch/_sync/client/ml.py b/elasticsearch/_sync/client/ml.py index ce85e587c..c57405984 100644 --- a/elasticsearch/_sync/client/ml.py +++ b/elasticsearch/_sync/client/ml.py @@ -3302,6 +3302,7 @@ def put_trained_model_vocabulary( filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, merges: t.Optional[t.Sequence[str]] = None, + scores: t.Optional[t.Sequence[str]] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]: """ @@ -3312,11 +3313,16 @@ def put_trained_model_vocabulary( :param model_id: The unique identifier of the trained model. :param vocabulary: The model vocabulary, which must not be empty. :param merges: The optional model merges if required by the tokenizer. + :param scores: The optional vocabulary value scores if required by the tokenizer. """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for parameter 'model_id'") if vocabulary is None: raise ValueError("Empty value passed for parameter 'vocabulary'") + if scores is not None and len(scores) != len(vocabulary): + raise ValueError( + "The value length for the 'scores' and 'vocabulary' parameters is not the same" + ) __path = f"/_ml/trained_models/{_quote(model_id)}/vocabulary" __body: t.Dict[str, t.Any] = {} __query: t.Dict[str, t.Any] = {} @@ -3330,6 +3336,8 @@ def put_trained_model_vocabulary( __query["human"] = human if merges is not None: __body["merges"] = merges + if scores is not None: + __body["scores"] = scores if pretty is not None: __query["pretty"] = pretty __headers = {"accept": "application/json", "content-type": "application/json"}