diff --git a/docs/examples/00fea15cbca83be9d5f1a024ff2ec708.asciidoc b/docs/examples/00fea15cbca83be9d5f1a024ff2ec708.asciidoc index 4e63a4e90..852ec4273 100644 --- a/docs/examples/00fea15cbca83be9d5f1a024ff2ec708.asciidoc +++ b/docs/examples/00fea15cbca83be9d5f1a024ff2ec708.asciidoc @@ -1,4 +1,4 @@ -// inference/put-inference.asciidoc:381 +// inference/put-inference.asciidoc:452 [source, python] ---- diff --git a/docs/examples/10c3fe2265bb34964bd1005f9da66773.asciidoc b/docs/examples/10c3fe2265bb34964bd1005f9da66773.asciidoc index 08c365b91..4a4f388c8 100644 --- a/docs/examples/10c3fe2265bb34964bd1005f9da66773.asciidoc +++ b/docs/examples/10c3fe2265bb34964bd1005f9da66773.asciidoc @@ -1,4 +1,4 @@ -// inference/put-inference.asciidoc:488 +// inference/put-inference.asciidoc:559 [source, python] ---- diff --git a/docs/examples/1dadb7efe27b6c0c231eb6535e413bd9.asciidoc b/docs/examples/1dadb7efe27b6c0c231eb6535e413bd9.asciidoc new file mode 100644 index 000000000..b114a67e1 --- /dev/null +++ b/docs/examples/1dadb7efe27b6c0c231eb6535e413bd9.asciidoc @@ -0,0 +1,19 @@ +// inference/put-inference.asciidoc:671 + +[source, python] +---- +resp = client.inference.put_model( + task_type="text_embedding", + inference_id="azure_ai_studio_embeddings", + body={ + "service": "azureaistudio", + "service_settings": { + "api_key": "", + "target": "", + "provider": "", + "endpoint_type": "", + }, + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/3541d4a85e27b2c3896a7a7ee98b4b37.asciidoc b/docs/examples/3541d4a85e27b2c3896a7a7ee98b4b37.asciidoc index 2c5244e74..515516945 100644 --- a/docs/examples/3541d4a85e27b2c3896a7a7ee98b4b37.asciidoc +++ b/docs/examples/3541d4a85e27b2c3896a7a7ee98b4b37.asciidoc @@ -1,4 +1,4 @@ -// health/health.asciidoc:478 +// health/health.asciidoc:481 [source, python] ---- diff --git a/docs/examples/36b86b97feedcf5632824eefc251d6ed.asciidoc b/docs/examples/36b86b97feedcf5632824eefc251d6ed.asciidoc deleted file mode 100644 index 10baf038a..000000000 --- a/docs/examples/36b86b97feedcf5632824eefc251d6ed.asciidoc +++ /dev/null @@ -1,10 +0,0 @@ -// getting-started.asciidoc:245 - -[source, python] ----- -resp = client.search( - index="books", - body={"query": {"match": {"name": "brave"}}}, -) -print(resp) ----- \ No newline at end of file diff --git a/docs/examples/4ca15672fc5ab1d80a127d086b6d2837.asciidoc b/docs/examples/4ca15672fc5ab1d80a127d086b6d2837.asciidoc index 4f9dcb5a9..f2197e790 100644 --- a/docs/examples/4ca15672fc5ab1d80a127d086b6d2837.asciidoc +++ b/docs/examples/4ca15672fc5ab1d80a127d086b6d2837.asciidoc @@ -1,4 +1,4 @@ -// cluster/allocation-explain.asciidoc:342 +// cluster/allocation-explain.asciidoc:344 [source, python] ---- diff --git a/docs/examples/5553cf7a02c22f616cd994747f2dd5a5.asciidoc b/docs/examples/5553cf7a02c22f616cd994747f2dd5a5.asciidoc index 274b79804..d03933cb3 100644 --- a/docs/examples/5553cf7a02c22f616cd994747f2dd5a5.asciidoc +++ b/docs/examples/5553cf7a02c22f616cd994747f2dd5a5.asciidoc @@ -1,4 +1,4 @@ -// mapping/types/nested.asciidoc:58 +// mapping/types/nested.asciidoc:60 [source, python] ---- diff --git a/docs/examples/59d736a4d064ed2013c7ead8e32e0998.asciidoc b/docs/examples/59d736a4d064ed2013c7ead8e32e0998.asciidoc index 25a961d96..695942d2e 100644 --- a/docs/examples/59d736a4d064ed2013c7ead8e32e0998.asciidoc +++ b/docs/examples/59d736a4d064ed2013c7ead8e32e0998.asciidoc @@ -1,4 +1,4 @@ -// inference/put-inference.asciidoc:529 +// inference/put-inference.asciidoc:600 [source, python] ---- diff --git a/docs/examples/6cd083045bf06e80b83889a939a18451.asciidoc b/docs/examples/6cd083045bf06e80b83889a939a18451.asciidoc index a685eae37..ef268ceea 100644 --- a/docs/examples/6cd083045bf06e80b83889a939a18451.asciidoc +++ b/docs/examples/6cd083045bf06e80b83889a939a18451.asciidoc @@ -1,4 +1,4 @@ -// mapping/types/nested.asciidoc:85 +// mapping/types/nested.asciidoc:87 [source, python] ---- diff --git a/docs/examples/6ddd4e657efbf45def430a6419825796.asciidoc b/docs/examples/6ddd4e657efbf45def430a6419825796.asciidoc new file mode 100644 index 000000000..dcbb1f44d --- /dev/null +++ b/docs/examples/6ddd4e657efbf45def430a6419825796.asciidoc @@ -0,0 +1,19 @@ +// inference/put-inference.asciidoc:689 + +[source, python] +---- +resp = client.inference.put_model( + task_type="completion", + inference_id="azure_ai_studio_completion", + body={ + "service": "azureaistudio", + "service_settings": { + "api_key": "", + "target": "", + "provider": "", + "endpoint_type": "", + }, + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/examples/70cc66bf4054ebf0ad4955cb99d9ab80.asciidoc b/docs/examples/70cc66bf4054ebf0ad4955cb99d9ab80.asciidoc index 59c20f5d1..e3e260e2b 100644 --- a/docs/examples/70cc66bf4054ebf0ad4955cb99d9ab80.asciidoc +++ b/docs/examples/70cc66bf4054ebf0ad4955cb99d9ab80.asciidoc @@ -1,4 +1,4 @@ -// ml/trained-models/apis/update-trained-model-deployment.asciidoc:55 +// ml/trained-models/apis/update-trained-model-deployment.asciidoc:53 [source, python] ---- diff --git a/docs/examples/77b90f6787195767b6da60d8532714b4.asciidoc b/docs/examples/77b90f6787195767b6da60d8532714b4.asciidoc index 4393f9458..38ad4091a 100644 --- a/docs/examples/77b90f6787195767b6da60d8532714b4.asciidoc +++ b/docs/examples/77b90f6787195767b6da60d8532714b4.asciidoc @@ -1,4 +1,4 @@ -// inference/put-inference.asciidoc:552 +// inference/put-inference.asciidoc:623 [source, python] ---- diff --git a/docs/examples/7fef68840761c6982c14ad7af96caf37.asciidoc b/docs/examples/7fef68840761c6982c14ad7af96caf37.asciidoc index d0ebccfa8..e060c6234 100644 --- a/docs/examples/7fef68840761c6982c14ad7af96caf37.asciidoc +++ b/docs/examples/7fef68840761c6982c14ad7af96caf37.asciidoc @@ -1,4 +1,4 @@ -// mapping/types/nested.asciidoc:22 +// mapping/types/nested.asciidoc:24 [source, python] ---- diff --git a/docs/examples/8575c966b004fb124c7afd6bb5827b50.asciidoc b/docs/examples/8575c966b004fb124c7afd6bb5827b50.asciidoc deleted file mode 100644 index cd3172de0..000000000 --- a/docs/examples/8575c966b004fb124c7afd6bb5827b50.asciidoc +++ /dev/null @@ -1,15 +0,0 @@ -// getting-started.asciidoc:65 - -[source, python] ----- -resp = client.index( - index="books", - body={ - "name": "Snow Crash", - "author": "Neal Stephenson", - "release_date": "1992-06-01", - "page_count": 470, - }, -) -print(resp) ----- \ No newline at end of file diff --git a/docs/examples/8619bd17bbfe33490b1f277007f654db.asciidoc b/docs/examples/8619bd17bbfe33490b1f277007f654db.asciidoc index 32ff8da77..3a2a78872 100644 --- a/docs/examples/8619bd17bbfe33490b1f277007f654db.asciidoc +++ b/docs/examples/8619bd17bbfe33490b1f277007f654db.asciidoc @@ -1,4 +1,4 @@ -// inference/put-inference.asciidoc:353 +// inference/put-inference.asciidoc:424 [source, python] ---- diff --git a/docs/examples/87733deeea4b441b595d19a0f97346f0.asciidoc b/docs/examples/87733deeea4b441b595d19a0f97346f0.asciidoc index 63e252c69..e323188a2 100644 --- a/docs/examples/87733deeea4b441b595d19a0f97346f0.asciidoc +++ b/docs/examples/87733deeea4b441b595d19a0f97346f0.asciidoc @@ -1,4 +1,4 @@ -// health/health.asciidoc:471 +// health/health.asciidoc:474 [source, python] ---- diff --git a/docs/examples/9a203aae3e1412d919546276fb52a5ca.asciidoc b/docs/examples/9a203aae3e1412d919546276fb52a5ca.asciidoc index 8f030467d..6358786d3 100644 --- a/docs/examples/9a203aae3e1412d919546276fb52a5ca.asciidoc +++ b/docs/examples/9a203aae3e1412d919546276fb52a5ca.asciidoc @@ -1,4 +1,4 @@ -// inference/put-inference.asciidoc:335 +// inference/put-inference.asciidoc:406 [source, python] ---- diff --git a/docs/examples/9d79645ab3a9da3f63c54a1516214a5a.asciidoc b/docs/examples/9d79645ab3a9da3f63c54a1516214a5a.asciidoc index 68c134d0a..c144209d1 100644 --- a/docs/examples/9d79645ab3a9da3f63c54a1516214a5a.asciidoc +++ b/docs/examples/9d79645ab3a9da3f63c54a1516214a5a.asciidoc @@ -1,4 +1,4 @@ -// health/health.asciidoc:463 +// health/health.asciidoc:466 [source, python] ---- diff --git a/docs/examples/9f16fca9813304e398ee052aa857dbcd.asciidoc b/docs/examples/9f16fca9813304e398ee052aa857dbcd.asciidoc index 1d854a9c9..1da3cf8d8 100644 --- a/docs/examples/9f16fca9813304e398ee052aa857dbcd.asciidoc +++ b/docs/examples/9f16fca9813304e398ee052aa857dbcd.asciidoc @@ -1,4 +1,4 @@ -// inference/put-inference.asciidoc:513 +// inference/put-inference.asciidoc:584 [source, python] ---- diff --git a/docs/examples/bcc75fc01b45e482638c65b8fbdf09fa.asciidoc b/docs/examples/bcc75fc01b45e482638c65b8fbdf09fa.asciidoc deleted file mode 100644 index bfbc6a0e8..000000000 --- a/docs/examples/bcc75fc01b45e482638c65b8fbdf09fa.asciidoc +++ /dev/null @@ -1,9 +0,0 @@ -// getting-started.asciidoc:228 - -[source, python] ----- -resp = client.search( - index="books", -) -print(resp) ----- \ No newline at end of file diff --git a/docs/examples/cedb56a71cc743d80263ce352bb21720.asciidoc b/docs/examples/cedb56a71cc743d80263ce352bb21720.asciidoc index 2be37beca..c1628c21e 100644 --- a/docs/examples/cedb56a71cc743d80263ce352bb21720.asciidoc +++ b/docs/examples/cedb56a71cc743d80263ce352bb21720.asciidoc @@ -1,4 +1,4 @@ -// inference/put-inference.asciidoc:406 +// inference/put-inference.asciidoc:477 [source, python] ---- diff --git a/docs/examples/d04f0c8c44e8b4fb55f2e7d9d05977e7.asciidoc b/docs/examples/d04f0c8c44e8b4fb55f2e7d9d05977e7.asciidoc deleted file mode 100644 index 6fe42c6b9..000000000 --- a/docs/examples/d04f0c8c44e8b4fb55f2e7d9d05977e7.asciidoc +++ /dev/null @@ -1,45 +0,0 @@ -// getting-started.asciidoc:104 - -[source, python] ----- -resp = client.bulk( - body=[ - {"index": {"_index": "books"}}, - { - "name": "Revelation Space", - "author": "Alastair Reynolds", - "release_date": "2000-03-15", - "page_count": 585, - }, - {"index": {"_index": "books"}}, - { - "name": "1984", - "author": "George Orwell", - "release_date": "1985-06-01", - "page_count": 328, - }, - {"index": {"_index": "books"}}, - { - "name": "Fahrenheit 451", - "author": "Ray Bradbury", - "release_date": "1953-10-15", - "page_count": 227, - }, - {"index": {"_index": "books"}}, - { - "name": "Brave New World", - "author": "Aldous Huxley", - "release_date": "1932-06-01", - "page_count": 268, - }, - {"index": {"_index": "books"}}, - { - "name": "The Handmaids Tale", - "author": "Margaret Atwood", - "release_date": "1985-06-01", - "page_count": 311, - }, - ], -) -print(resp) ----- \ No newline at end of file diff --git a/docs/examples/eee6110831c08b9c1b3f56b24656e95b.asciidoc b/docs/examples/eee6110831c08b9c1b3f56b24656e95b.asciidoc index 286378a6b..90444ee2a 100644 --- a/docs/examples/eee6110831c08b9c1b3f56b24656e95b.asciidoc +++ b/docs/examples/eee6110831c08b9c1b3f56b24656e95b.asciidoc @@ -1,4 +1,4 @@ -// inference/put-inference.asciidoc:445 +// inference/put-inference.asciidoc:516 [source, python] ---- diff --git a/docs/examples/f57ce7de0946e9416ddb9150e95f4b74.asciidoc b/docs/examples/f57ce7de0946e9416ddb9150e95f4b74.asciidoc new file mode 100644 index 000000000..79e082f07 --- /dev/null +++ b/docs/examples/f57ce7de0946e9416ddb9150e95f4b74.asciidoc @@ -0,0 +1,19 @@ +// inference/put-inference.asciidoc:641 + +[source, python] +---- +resp = client.inference.put_model( + task_type="completion", + inference_id="azure_openai_completion", + body={ + "service": "azureopenai", + "service_settings": { + "api_key": "", + "resource_name": "", + "deployment_id": "", + "api_version": "2024-02-01", + }, + }, +) +print(resp) +---- \ No newline at end of file diff --git a/docs/guide/release-notes.asciidoc b/docs/guide/release-notes.asciidoc index a198f096d..61b7f9233 100644 --- a/docs/guide/release-notes.asciidoc +++ b/docs/guide/release-notes.asciidoc @@ -1,6 +1,7 @@ [[release-notes]] == Release notes +* <> * <> * <> * <> @@ -37,21 +38,28 @@ * <> * <> +[discrete] +[[rn-8-13-2]] +=== 8.13.2 (2024-05-24) + +- Added the `ml.update_trained_model_deployment` API +- Marked Requests 2.32.2 as incompatible with the Elasticsearch client + [discrete] [[rn-8-13-1]] === 8.13.1 (2024-05-03) -- Added ``force_synthetic_source`` to the Get API -- Added ``wait_for_completion`` to the Create trained model API -- Added ``typed_keys`` to the Query API key information API +- Added `force_synthetic_source` to the Get API +- Added `wait_for_completion` to the Create trained model API +- Added `typed_keys` to the Query API key information API [discrete] [[rn-8-13-0]] === 8.13.0 (2024-03-22) - Added native OpenTelemetry support -- Added optional ``orjson`` (a fast, correct JSON library) serialization support -- Added the `text_strcuture.test_grok_pattern` API +- Added optional `orjson` (a fast, correct JSON library) serialization support +- Added the `text_structure.test_grok_pattern` API - Added the `indices.resolve_cluster` API - Renamed the `model_id` parameter to `inference_id` in the `inference` APIs - Changed all `synonyms` APIs from **experimental** to **stable**. diff --git a/elasticsearch/_async/client/ml.py b/elasticsearch/_async/client/ml.py index c357c6b56..34753bf6c 100644 --- a/elasticsearch/_async/client/ml.py +++ b/elasticsearch/_async/client/ml.py @@ -5043,6 +5043,62 @@ async def update_model_snapshot( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("number_of_allocations",), + ) + async def update_trained_model_deployment( + self, + *, + model_id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + number_of_allocations: t.Optional[int] = None, + pretty: t.Optional[bool] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Updates certain properties of trained model deployment. + + ``_ + + :param model_id: The unique identifier of the trained model. Currently, only + PyTorch models are supported. + :param number_of_allocations: The number of model allocations on each node where + the model is deployed. All allocations on a node share the same copy of the + model in memory but use a separate set of threads to evaluate the model. + Increasing this value generally increases the throughput. If this setting + is greater than the number of hardware threads it will automatically be changed + to a value less than the number of hardware threads. + """ + if model_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'model_id'") + __path_parts: t.Dict[str, str] = {"model_id": _quote(model_id)} + __path = f'/_ml/trained_models/{__path_parts["model_id"]}/deployment/_update' + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if number_of_allocations is not None: + __body["number_of_allocations"] = number_of_allocations + __headers = {"accept": "application/json", "content-type": "application/json"} + return await self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.update_trained_model_deployment", + path_parts=__path_parts, + ) + @_rewrite_parameters() async def upgrade_job_snapshot( self, diff --git a/elasticsearch/_sync/client/ml.py b/elasticsearch/_sync/client/ml.py index b8d46181f..eae740e37 100644 --- a/elasticsearch/_sync/client/ml.py +++ b/elasticsearch/_sync/client/ml.py @@ -5043,6 +5043,62 @@ def update_model_snapshot( path_parts=__path_parts, ) + @_rewrite_parameters( + body_fields=("number_of_allocations",), + ) + def update_trained_model_deployment( + self, + *, + model_id: str, + error_trace: t.Optional[bool] = None, + filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, + human: t.Optional[bool] = None, + number_of_allocations: t.Optional[int] = None, + pretty: t.Optional[bool] = None, + body: t.Optional[t.Dict[str, t.Any]] = None, + ) -> ObjectApiResponse[t.Any]: + """ + Updates certain properties of trained model deployment. + + ``_ + + :param model_id: The unique identifier of the trained model. Currently, only + PyTorch models are supported. + :param number_of_allocations: The number of model allocations on each node where + the model is deployed. All allocations on a node share the same copy of the + model in memory but use a separate set of threads to evaluate the model. + Increasing this value generally increases the throughput. If this setting + is greater than the number of hardware threads it will automatically be changed + to a value less than the number of hardware threads. + """ + if model_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for parameter 'model_id'") + __path_parts: t.Dict[str, str] = {"model_id": _quote(model_id)} + __path = f'/_ml/trained_models/{__path_parts["model_id"]}/deployment/_update' + __query: t.Dict[str, t.Any] = {} + __body: t.Dict[str, t.Any] = body if body is not None else {} + if error_trace is not None: + __query["error_trace"] = error_trace + if filter_path is not None: + __query["filter_path"] = filter_path + if human is not None: + __query["human"] = human + if pretty is not None: + __query["pretty"] = pretty + if not __body: + if number_of_allocations is not None: + __body["number_of_allocations"] = number_of_allocations + __headers = {"accept": "application/json", "content-type": "application/json"} + return self.perform_request( # type: ignore[return-value] + "POST", + __path, + params=__query, + headers=__headers, + body=__body, + endpoint_id="ml.update_trained_model_deployment", + path_parts=__path_parts, + ) + @_rewrite_parameters() def upgrade_job_snapshot( self, diff --git a/elasticsearch/_version.py b/elasticsearch/_version.py index 20c5eb394..5b214734c 100644 --- a/elasticsearch/_version.py +++ b/elasticsearch/_version.py @@ -15,4 +15,4 @@ # specific language governing permissions and limitations # under the License. -__versionstr__ = "8.13.1" +__versionstr__ = "8.13.2"