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

Add missing param scores on ml.put_trained_model_vocabulary #2354

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions elasticsearch/_async/client/ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
"""
Expand All @@ -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] = {}
Expand All @@ -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"}
Expand Down
8 changes: 8 additions & 0 deletions elasticsearch/_sync/client/ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
"""
Expand All @@ -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] = {}
Expand All @@ -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"}
Expand Down
Loading