elasticsearch 8.18.0__py3-none-any.whl → 8.18.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- elasticsearch/_async/client/cluster.py +2 -2
- elasticsearch/_async/client/inference.py +107 -0
- elasticsearch/_async/client/license.py +1 -1
- elasticsearch/_async/client/ml.py +5 -5
- elasticsearch/_async/client/transform.py +2 -2
- elasticsearch/_async/client/watcher.py +13 -13
- elasticsearch/_async/client/xpack.py +1 -1
- elasticsearch/_sync/client/cluster.py +2 -2
- elasticsearch/_sync/client/inference.py +107 -0
- elasticsearch/_sync/client/license.py +1 -1
- elasticsearch/_sync/client/ml.py +5 -5
- elasticsearch/_sync/client/transform.py +2 -2
- elasticsearch/_sync/client/watcher.py +13 -13
- elasticsearch/_sync/client/xpack.py +1 -1
- elasticsearch/_version.py +1 -1
- elasticsearch/dsl/field.py +139 -1
- elasticsearch/dsl/query.py +6 -0
- elasticsearch/dsl/types.py +44 -6
- {elasticsearch-8.18.0.dist-info → elasticsearch-8.18.1.dist-info}/METADATA +3 -1
- {elasticsearch-8.18.0.dist-info → elasticsearch-8.18.1.dist-info}/RECORD +25 -23
- elasticsearch-8.18.1.dist-info/licenses/LICENSE.txt +175 -0
- elasticsearch-8.18.1.dist-info/licenses/NOTICE.txt +559 -0
- {elasticsearch-8.18.0.dist-info → elasticsearch-8.18.1.dist-info}/WHEEL +0 -0
- {elasticsearch-8.18.0.dist-info → elasticsearch-8.18.1.dist-info}/licenses/LICENSE +0 -0
- {elasticsearch-8.18.0.dist-info → elasticsearch-8.18.1.dist-info}/licenses/NOTICE +0 -0
|
@@ -185,7 +185,7 @@ class ClusterClient(NamespacedClient):
|
|
|
185
185
|
Remove master-eligible nodes from the voting configuration exclusion list.</p>
|
|
186
186
|
|
|
187
187
|
|
|
188
|
-
`<https://www.elastic.co/
|
|
188
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-cluster-post-voting-config-exclusions>`_
|
|
189
189
|
|
|
190
190
|
:param master_timeout: Period to wait for a connection to the master node.
|
|
191
191
|
:param wait_for_removal: Specifies whether to wait for all excluded nodes to
|
|
@@ -680,7 +680,7 @@ class ClusterClient(NamespacedClient):
|
|
|
680
680
|
They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes.</p>
|
|
681
681
|
|
|
682
682
|
|
|
683
|
-
`<https://www.elastic.co/
|
|
683
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-cluster-post-voting-config-exclusions>`_
|
|
684
684
|
|
|
685
685
|
:param master_timeout: Period to wait for a connection to the master node.
|
|
686
686
|
:param node_ids: A comma-separated list of the persistent ids of the nodes to
|
|
@@ -234,6 +234,113 @@ class InferenceClient(NamespacedClient):
|
|
|
234
234
|
path_parts=__path_parts,
|
|
235
235
|
)
|
|
236
236
|
|
|
237
|
+
@_rewrite_parameters(
|
|
238
|
+
body_fields=("input", "query", "task_settings"),
|
|
239
|
+
)
|
|
240
|
+
async def inference(
|
|
241
|
+
self,
|
|
242
|
+
*,
|
|
243
|
+
inference_id: str,
|
|
244
|
+
input: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
245
|
+
task_type: t.Optional[
|
|
246
|
+
t.Union[
|
|
247
|
+
str,
|
|
248
|
+
t.Literal[
|
|
249
|
+
"chat_completion",
|
|
250
|
+
"completion",
|
|
251
|
+
"rerank",
|
|
252
|
+
"sparse_embedding",
|
|
253
|
+
"text_embedding",
|
|
254
|
+
],
|
|
255
|
+
]
|
|
256
|
+
] = None,
|
|
257
|
+
error_trace: t.Optional[bool] = None,
|
|
258
|
+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
259
|
+
human: t.Optional[bool] = None,
|
|
260
|
+
pretty: t.Optional[bool] = None,
|
|
261
|
+
query: t.Optional[str] = None,
|
|
262
|
+
task_settings: t.Optional[t.Any] = None,
|
|
263
|
+
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
264
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
265
|
+
) -> ObjectApiResponse[t.Any]:
|
|
266
|
+
"""
|
|
267
|
+
.. raw:: html
|
|
268
|
+
|
|
269
|
+
<p>Perform inference on the service.</p>
|
|
270
|
+
<p>This API enables you to use machine learning models to perform specific tasks on data that you provide as an input.
|
|
271
|
+
It returns a response with the results of the tasks.
|
|
272
|
+
The inference endpoint you use can perform one specific task that has been defined when the endpoint was created with the create inference API.</p>
|
|
273
|
+
<p>For details about using this API with a service, such as Amazon Bedrock, Anthropic, or HuggingFace, refer to the service-specific documentation.</p>
|
|
274
|
+
<blockquote>
|
|
275
|
+
<p>info
|
|
276
|
+
The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.</p>
|
|
277
|
+
</blockquote>
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/post-inference-api.html>`_
|
|
281
|
+
|
|
282
|
+
:param inference_id: The unique identifier for the inference endpoint.
|
|
283
|
+
:param input: The text on which you want to perform the inference task. It can
|
|
284
|
+
be a single string or an array. > info > Inference endpoints for the `completion`
|
|
285
|
+
task type currently only support a single string as input.
|
|
286
|
+
:param task_type: The type of inference task that the model performs.
|
|
287
|
+
:param query: The query input, which is required only for the `rerank` task.
|
|
288
|
+
It is not required for other tasks.
|
|
289
|
+
:param task_settings: Task settings for the individual inference request. These
|
|
290
|
+
settings are specific to the task type you specified and override the task
|
|
291
|
+
settings specified when initializing the service.
|
|
292
|
+
:param timeout: The amount of time to wait for the inference request to complete.
|
|
293
|
+
"""
|
|
294
|
+
if inference_id in SKIP_IN_PATH:
|
|
295
|
+
raise ValueError("Empty value passed for parameter 'inference_id'")
|
|
296
|
+
if input is None and body is None:
|
|
297
|
+
raise ValueError("Empty value passed for parameter 'input'")
|
|
298
|
+
__path_parts: t.Dict[str, str]
|
|
299
|
+
if task_type not in SKIP_IN_PATH and inference_id not in SKIP_IN_PATH:
|
|
300
|
+
__path_parts = {
|
|
301
|
+
"task_type": _quote(task_type),
|
|
302
|
+
"inference_id": _quote(inference_id),
|
|
303
|
+
}
|
|
304
|
+
__path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["inference_id"]}'
|
|
305
|
+
elif inference_id not in SKIP_IN_PATH:
|
|
306
|
+
__path_parts = {"inference_id": _quote(inference_id)}
|
|
307
|
+
__path = f'/_inference/{__path_parts["inference_id"]}'
|
|
308
|
+
else:
|
|
309
|
+
raise ValueError("Couldn't find a path for the given parameters")
|
|
310
|
+
__query: t.Dict[str, t.Any] = {}
|
|
311
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
312
|
+
if error_trace is not None:
|
|
313
|
+
__query["error_trace"] = error_trace
|
|
314
|
+
if filter_path is not None:
|
|
315
|
+
__query["filter_path"] = filter_path
|
|
316
|
+
if human is not None:
|
|
317
|
+
__query["human"] = human
|
|
318
|
+
if pretty is not None:
|
|
319
|
+
__query["pretty"] = pretty
|
|
320
|
+
if timeout is not None:
|
|
321
|
+
__query["timeout"] = timeout
|
|
322
|
+
if not __body:
|
|
323
|
+
if input is not None:
|
|
324
|
+
__body["input"] = input
|
|
325
|
+
if query is not None:
|
|
326
|
+
__body["query"] = query
|
|
327
|
+
if task_settings is not None:
|
|
328
|
+
__body["task_settings"] = task_settings
|
|
329
|
+
if not __body:
|
|
330
|
+
__body = None # type: ignore[assignment]
|
|
331
|
+
__headers = {"accept": "application/json"}
|
|
332
|
+
if __body is not None:
|
|
333
|
+
__headers["content-type"] = "application/json"
|
|
334
|
+
return await self.perform_request( # type: ignore[return-value]
|
|
335
|
+
"POST",
|
|
336
|
+
__path,
|
|
337
|
+
params=__query,
|
|
338
|
+
headers=__headers,
|
|
339
|
+
body=__body,
|
|
340
|
+
endpoint_id="inference.inference",
|
|
341
|
+
path_parts=__path_parts,
|
|
342
|
+
)
|
|
343
|
+
|
|
237
344
|
@_rewrite_parameters(
|
|
238
345
|
body_name="inference_config",
|
|
239
346
|
)
|
|
@@ -237,7 +237,7 @@ class LicenseClient(NamespacedClient):
|
|
|
237
237
|
If the operator privileges feature is enabled, only operator users can use this API.</p>
|
|
238
238
|
|
|
239
239
|
|
|
240
|
-
`<https://www.elastic.co/
|
|
240
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-license-post>`_
|
|
241
241
|
|
|
242
242
|
:param acknowledge: Specifies whether you acknowledge the license changes.
|
|
243
243
|
:param license:
|
|
@@ -1676,7 +1676,7 @@ class MlClient(NamespacedClient):
|
|
|
1676
1676
|
"""
|
|
1677
1677
|
.. raw:: html
|
|
1678
1678
|
|
|
1679
|
-
<p>Get data frame analytics
|
|
1679
|
+
<p>Get data frame analytics job stats.</p>
|
|
1680
1680
|
|
|
1681
1681
|
|
|
1682
1682
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-dfanalytics-stats.html>`_
|
|
@@ -1744,7 +1744,7 @@ class MlClient(NamespacedClient):
|
|
|
1744
1744
|
"""
|
|
1745
1745
|
.. raw:: html
|
|
1746
1746
|
|
|
1747
|
-
<p>Get
|
|
1747
|
+
<p>Get datafeed stats.
|
|
1748
1748
|
You can get statistics for multiple datafeeds in a single API request by
|
|
1749
1749
|
using a comma-separated list of datafeeds or a wildcard expression. You can
|
|
1750
1750
|
get statistics for all datafeeds by using <code>_all</code>, by specifying <code>*</code> as the
|
|
@@ -2033,7 +2033,7 @@ class MlClient(NamespacedClient):
|
|
|
2033
2033
|
"""
|
|
2034
2034
|
.. raw:: html
|
|
2035
2035
|
|
|
2036
|
-
<p>Get anomaly detection
|
|
2036
|
+
<p>Get anomaly detection job stats.</p>
|
|
2037
2037
|
|
|
2038
2038
|
|
|
2039
2039
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-get-job-stats.html>`_
|
|
@@ -5004,7 +5004,7 @@ class MlClient(NamespacedClient):
|
|
|
5004
5004
|
<p>Update a data frame analytics job.</p>
|
|
5005
5005
|
|
|
5006
5006
|
|
|
5007
|
-
`<https://www.elastic.co/
|
|
5007
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-ml-update-data-frame-analytics>`_
|
|
5008
5008
|
|
|
5009
5009
|
:param id: Identifier for the data frame analytics job. This identifier can contain
|
|
5010
5010
|
lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores.
|
|
@@ -5577,7 +5577,7 @@ class MlClient(NamespacedClient):
|
|
|
5577
5577
|
<p>Update a trained model deployment.</p>
|
|
5578
5578
|
|
|
5579
5579
|
|
|
5580
|
-
`<https://www.elastic.co/
|
|
5580
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-ml-update-trained-model-deployment>`_
|
|
5581
5581
|
|
|
5582
5582
|
:param model_id: The unique identifier of the trained model. Currently, only
|
|
5583
5583
|
PyTorch models are supported.
|
|
@@ -795,7 +795,7 @@ class TransformClient(NamespacedClient):
|
|
|
795
795
|
time of update and runs with those privileges.</p>
|
|
796
796
|
|
|
797
797
|
|
|
798
|
-
`<https://www.elastic.co/
|
|
798
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-transform-update-transform>`_
|
|
799
799
|
|
|
800
800
|
:param transform_id: Identifier for the transform.
|
|
801
801
|
:param defer_validation: When true, deferrable validations are not run. This
|
|
@@ -890,7 +890,7 @@ class TransformClient(NamespacedClient):
|
|
|
890
890
|
You may want to perform a recent cluster backup prior to the upgrade.</p>
|
|
891
891
|
|
|
892
892
|
|
|
893
|
-
`<https://www.elastic.co/
|
|
893
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-transform-upgrade-transforms>`_
|
|
894
894
|
|
|
895
895
|
:param dry_run: When true, the request checks for updates but does not run them.
|
|
896
896
|
:param timeout: Period to wait for a response. If no response is received before
|
|
@@ -48,7 +48,7 @@ class WatcherClient(NamespacedClient):
|
|
|
48
48
|
This happens when the condition of the watch is not met (the condition evaluates to false).</p>
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
`<https://www.elastic.co/
|
|
51
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-ack-watch>`_
|
|
52
52
|
|
|
53
53
|
:param watch_id: The watch identifier.
|
|
54
54
|
:param action_id: A comma-separated list of the action identifiers to acknowledge.
|
|
@@ -104,7 +104,7 @@ class WatcherClient(NamespacedClient):
|
|
|
104
104
|
A watch can be either active or inactive.</p>
|
|
105
105
|
|
|
106
106
|
|
|
107
|
-
`<https://www.elastic.co/
|
|
107
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-activate-watch>`_
|
|
108
108
|
|
|
109
109
|
:param watch_id: The watch identifier.
|
|
110
110
|
"""
|
|
@@ -148,7 +148,7 @@ class WatcherClient(NamespacedClient):
|
|
|
148
148
|
A watch can be either active or inactive.</p>
|
|
149
149
|
|
|
150
150
|
|
|
151
|
-
`<https://www.elastic.co/
|
|
151
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-deactivate-watch>`_
|
|
152
152
|
|
|
153
153
|
:param watch_id: The watch identifier.
|
|
154
154
|
"""
|
|
@@ -196,7 +196,7 @@ class WatcherClient(NamespacedClient):
|
|
|
196
196
|
When Elasticsearch security features are enabled, make sure no write privileges are granted to anyone for the <code>.watches</code> index.</p>
|
|
197
197
|
|
|
198
198
|
|
|
199
|
-
`<https://www.elastic.co/
|
|
199
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-delete-watch>`_
|
|
200
200
|
|
|
201
201
|
:param id: The watch identifier.
|
|
202
202
|
"""
|
|
@@ -277,7 +277,7 @@ class WatcherClient(NamespacedClient):
|
|
|
277
277
|
<p>When using the run watch API, the authorization data of the user that called the API will be used as a base, instead of the information who stored the watch.</p>
|
|
278
278
|
|
|
279
279
|
|
|
280
|
-
`<https://www.elastic.co/
|
|
280
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-execute-watch>`_
|
|
281
281
|
|
|
282
282
|
:param id: The watch identifier.
|
|
283
283
|
:param action_modes: Determines how to handle the watch actions as part of the
|
|
@@ -365,7 +365,7 @@ class WatcherClient(NamespacedClient):
|
|
|
365
365
|
Only a subset of settings are shown, for example <code>index.auto_expand_replicas</code> and <code>index.number_of_replicas</code>.</p>
|
|
366
366
|
|
|
367
367
|
|
|
368
|
-
`<https://www.elastic.co/
|
|
368
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-get-settings>`_
|
|
369
369
|
|
|
370
370
|
:param master_timeout: The period to wait for a connection to the master node.
|
|
371
371
|
If no response is received before the timeout expires, the request fails
|
|
@@ -410,7 +410,7 @@ class WatcherClient(NamespacedClient):
|
|
|
410
410
|
<p>Get a watch.</p>
|
|
411
411
|
|
|
412
412
|
|
|
413
|
-
`<https://www.elastic.co/
|
|
413
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-get-watch>`_
|
|
414
414
|
|
|
415
415
|
:param id: The watch identifier.
|
|
416
416
|
"""
|
|
@@ -485,7 +485,7 @@ class WatcherClient(NamespacedClient):
|
|
|
485
485
|
If the user is able to read index <code>a</code>, but not index <code>b</code>, the same will apply when the watch runs.</p>
|
|
486
486
|
|
|
487
487
|
|
|
488
|
-
`<https://www.elastic.co/
|
|
488
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-put-watch>`_
|
|
489
489
|
|
|
490
490
|
:param id: The identifier for the watch.
|
|
491
491
|
:param actions: The list of actions that will be run if the condition matches.
|
|
@@ -598,7 +598,7 @@ class WatcherClient(NamespacedClient):
|
|
|
598
598
|
<p>Note that only the <code>_id</code> and <code>metadata.*</code> fields are queryable or sortable.</p>
|
|
599
599
|
|
|
600
600
|
|
|
601
|
-
`<https://www.elastic.co/
|
|
601
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-query-watches>`_
|
|
602
602
|
|
|
603
603
|
:param from_: The offset from the first result to fetch. It must be non-negative.
|
|
604
604
|
:param query: A query that filters the watches to be returned.
|
|
@@ -673,7 +673,7 @@ class WatcherClient(NamespacedClient):
|
|
|
673
673
|
Start the Watcher service if it is not already running.</p>
|
|
674
674
|
|
|
675
675
|
|
|
676
|
-
`<https://www.elastic.co/
|
|
676
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-start>`_
|
|
677
677
|
|
|
678
678
|
:param master_timeout: Period to wait for a connection to the master node.
|
|
679
679
|
"""
|
|
@@ -739,7 +739,7 @@ class WatcherClient(NamespacedClient):
|
|
|
739
739
|
You retrieve more metrics by using the metric parameter.</p>
|
|
740
740
|
|
|
741
741
|
|
|
742
|
-
`<https://www.elastic.co/
|
|
742
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-stats>`_
|
|
743
743
|
|
|
744
744
|
:param metric: Defines which additional metrics are included in the response.
|
|
745
745
|
:param emit_stacktraces: Defines whether stack traces are generated for each
|
|
@@ -790,7 +790,7 @@ class WatcherClient(NamespacedClient):
|
|
|
790
790
|
Stop the Watcher service if it is running.</p>
|
|
791
791
|
|
|
792
792
|
|
|
793
|
-
`<https://www.elastic.co/
|
|
793
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-stop>`_
|
|
794
794
|
|
|
795
795
|
:param master_timeout: The period to wait for the master node. If the master
|
|
796
796
|
node is not available before the timeout expires, the request fails and returns
|
|
@@ -851,7 +851,7 @@ class WatcherClient(NamespacedClient):
|
|
|
851
851
|
Watcher shards must always be in the <code>data_content</code> tier.</p>
|
|
852
852
|
|
|
853
853
|
|
|
854
|
-
`<https://www.elastic.co/
|
|
854
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-update-settings>`_
|
|
855
855
|
|
|
856
856
|
:param index_auto_expand_replicas:
|
|
857
857
|
:param index_number_of_replicas:
|
|
@@ -103,7 +103,7 @@ class XPackClient(NamespacedClient):
|
|
|
103
103
|
The API also provides some usage statistics.</p>
|
|
104
104
|
|
|
105
105
|
|
|
106
|
-
`<https://www.elastic.co/
|
|
106
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/group/endpoint-xpack>`_
|
|
107
107
|
|
|
108
108
|
:param master_timeout: The period to wait for a connection to the master node.
|
|
109
109
|
If no response is received before the timeout expires, the request fails
|
|
@@ -185,7 +185,7 @@ class ClusterClient(NamespacedClient):
|
|
|
185
185
|
Remove master-eligible nodes from the voting configuration exclusion list.</p>
|
|
186
186
|
|
|
187
187
|
|
|
188
|
-
`<https://www.elastic.co/
|
|
188
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-cluster-post-voting-config-exclusions>`_
|
|
189
189
|
|
|
190
190
|
:param master_timeout: Period to wait for a connection to the master node.
|
|
191
191
|
:param wait_for_removal: Specifies whether to wait for all excluded nodes to
|
|
@@ -680,7 +680,7 @@ class ClusterClient(NamespacedClient):
|
|
|
680
680
|
They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes.</p>
|
|
681
681
|
|
|
682
682
|
|
|
683
|
-
`<https://www.elastic.co/
|
|
683
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-cluster-post-voting-config-exclusions>`_
|
|
684
684
|
|
|
685
685
|
:param master_timeout: Period to wait for a connection to the master node.
|
|
686
686
|
:param node_ids: A comma-separated list of the persistent ids of the nodes to
|
|
@@ -234,6 +234,113 @@ class InferenceClient(NamespacedClient):
|
|
|
234
234
|
path_parts=__path_parts,
|
|
235
235
|
)
|
|
236
236
|
|
|
237
|
+
@_rewrite_parameters(
|
|
238
|
+
body_fields=("input", "query", "task_settings"),
|
|
239
|
+
)
|
|
240
|
+
def inference(
|
|
241
|
+
self,
|
|
242
|
+
*,
|
|
243
|
+
inference_id: str,
|
|
244
|
+
input: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
245
|
+
task_type: t.Optional[
|
|
246
|
+
t.Union[
|
|
247
|
+
str,
|
|
248
|
+
t.Literal[
|
|
249
|
+
"chat_completion",
|
|
250
|
+
"completion",
|
|
251
|
+
"rerank",
|
|
252
|
+
"sparse_embedding",
|
|
253
|
+
"text_embedding",
|
|
254
|
+
],
|
|
255
|
+
]
|
|
256
|
+
] = None,
|
|
257
|
+
error_trace: t.Optional[bool] = None,
|
|
258
|
+
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
259
|
+
human: t.Optional[bool] = None,
|
|
260
|
+
pretty: t.Optional[bool] = None,
|
|
261
|
+
query: t.Optional[str] = None,
|
|
262
|
+
task_settings: t.Optional[t.Any] = None,
|
|
263
|
+
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
|
|
264
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
265
|
+
) -> ObjectApiResponse[t.Any]:
|
|
266
|
+
"""
|
|
267
|
+
.. raw:: html
|
|
268
|
+
|
|
269
|
+
<p>Perform inference on the service.</p>
|
|
270
|
+
<p>This API enables you to use machine learning models to perform specific tasks on data that you provide as an input.
|
|
271
|
+
It returns a response with the results of the tasks.
|
|
272
|
+
The inference endpoint you use can perform one specific task that has been defined when the endpoint was created with the create inference API.</p>
|
|
273
|
+
<p>For details about using this API with a service, such as Amazon Bedrock, Anthropic, or HuggingFace, refer to the service-specific documentation.</p>
|
|
274
|
+
<blockquote>
|
|
275
|
+
<p>info
|
|
276
|
+
The inference APIs enable you to use certain services, such as built-in machine learning models (ELSER, E5), models uploaded through Eland, Cohere, OpenAI, Azure, Google AI Studio, Google Vertex AI, Anthropic, Watsonx.ai, or Hugging Face. For built-in models and models uploaded through Eland, the inference APIs offer an alternative way to use and manage trained models. However, if you do not plan to use the inference APIs to use these models or if you want to use non-NLP models, use the machine learning trained model APIs.</p>
|
|
277
|
+
</blockquote>
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/post-inference-api.html>`_
|
|
281
|
+
|
|
282
|
+
:param inference_id: The unique identifier for the inference endpoint.
|
|
283
|
+
:param input: The text on which you want to perform the inference task. It can
|
|
284
|
+
be a single string or an array. > info > Inference endpoints for the `completion`
|
|
285
|
+
task type currently only support a single string as input.
|
|
286
|
+
:param task_type: The type of inference task that the model performs.
|
|
287
|
+
:param query: The query input, which is required only for the `rerank` task.
|
|
288
|
+
It is not required for other tasks.
|
|
289
|
+
:param task_settings: Task settings for the individual inference request. These
|
|
290
|
+
settings are specific to the task type you specified and override the task
|
|
291
|
+
settings specified when initializing the service.
|
|
292
|
+
:param timeout: The amount of time to wait for the inference request to complete.
|
|
293
|
+
"""
|
|
294
|
+
if inference_id in SKIP_IN_PATH:
|
|
295
|
+
raise ValueError("Empty value passed for parameter 'inference_id'")
|
|
296
|
+
if input is None and body is None:
|
|
297
|
+
raise ValueError("Empty value passed for parameter 'input'")
|
|
298
|
+
__path_parts: t.Dict[str, str]
|
|
299
|
+
if task_type not in SKIP_IN_PATH and inference_id not in SKIP_IN_PATH:
|
|
300
|
+
__path_parts = {
|
|
301
|
+
"task_type": _quote(task_type),
|
|
302
|
+
"inference_id": _quote(inference_id),
|
|
303
|
+
}
|
|
304
|
+
__path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["inference_id"]}'
|
|
305
|
+
elif inference_id not in SKIP_IN_PATH:
|
|
306
|
+
__path_parts = {"inference_id": _quote(inference_id)}
|
|
307
|
+
__path = f'/_inference/{__path_parts["inference_id"]}'
|
|
308
|
+
else:
|
|
309
|
+
raise ValueError("Couldn't find a path for the given parameters")
|
|
310
|
+
__query: t.Dict[str, t.Any] = {}
|
|
311
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
312
|
+
if error_trace is not None:
|
|
313
|
+
__query["error_trace"] = error_trace
|
|
314
|
+
if filter_path is not None:
|
|
315
|
+
__query["filter_path"] = filter_path
|
|
316
|
+
if human is not None:
|
|
317
|
+
__query["human"] = human
|
|
318
|
+
if pretty is not None:
|
|
319
|
+
__query["pretty"] = pretty
|
|
320
|
+
if timeout is not None:
|
|
321
|
+
__query["timeout"] = timeout
|
|
322
|
+
if not __body:
|
|
323
|
+
if input is not None:
|
|
324
|
+
__body["input"] = input
|
|
325
|
+
if query is not None:
|
|
326
|
+
__body["query"] = query
|
|
327
|
+
if task_settings is not None:
|
|
328
|
+
__body["task_settings"] = task_settings
|
|
329
|
+
if not __body:
|
|
330
|
+
__body = None # type: ignore[assignment]
|
|
331
|
+
__headers = {"accept": "application/json"}
|
|
332
|
+
if __body is not None:
|
|
333
|
+
__headers["content-type"] = "application/json"
|
|
334
|
+
return self.perform_request( # type: ignore[return-value]
|
|
335
|
+
"POST",
|
|
336
|
+
__path,
|
|
337
|
+
params=__query,
|
|
338
|
+
headers=__headers,
|
|
339
|
+
body=__body,
|
|
340
|
+
endpoint_id="inference.inference",
|
|
341
|
+
path_parts=__path_parts,
|
|
342
|
+
)
|
|
343
|
+
|
|
237
344
|
@_rewrite_parameters(
|
|
238
345
|
body_name="inference_config",
|
|
239
346
|
)
|
|
@@ -237,7 +237,7 @@ class LicenseClient(NamespacedClient):
|
|
|
237
237
|
If the operator privileges feature is enabled, only operator users can use this API.</p>
|
|
238
238
|
|
|
239
239
|
|
|
240
|
-
`<https://www.elastic.co/
|
|
240
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-license-post>`_
|
|
241
241
|
|
|
242
242
|
:param acknowledge: Specifies whether you acknowledge the license changes.
|
|
243
243
|
:param license:
|
elasticsearch/_sync/client/ml.py
CHANGED
|
@@ -1676,7 +1676,7 @@ class MlClient(NamespacedClient):
|
|
|
1676
1676
|
"""
|
|
1677
1677
|
.. raw:: html
|
|
1678
1678
|
|
|
1679
|
-
<p>Get data frame analytics
|
|
1679
|
+
<p>Get data frame analytics job stats.</p>
|
|
1680
1680
|
|
|
1681
1681
|
|
|
1682
1682
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-dfanalytics-stats.html>`_
|
|
@@ -1744,7 +1744,7 @@ class MlClient(NamespacedClient):
|
|
|
1744
1744
|
"""
|
|
1745
1745
|
.. raw:: html
|
|
1746
1746
|
|
|
1747
|
-
<p>Get
|
|
1747
|
+
<p>Get datafeed stats.
|
|
1748
1748
|
You can get statistics for multiple datafeeds in a single API request by
|
|
1749
1749
|
using a comma-separated list of datafeeds or a wildcard expression. You can
|
|
1750
1750
|
get statistics for all datafeeds by using <code>_all</code>, by specifying <code>*</code> as the
|
|
@@ -2033,7 +2033,7 @@ class MlClient(NamespacedClient):
|
|
|
2033
2033
|
"""
|
|
2034
2034
|
.. raw:: html
|
|
2035
2035
|
|
|
2036
|
-
<p>Get anomaly detection
|
|
2036
|
+
<p>Get anomaly detection job stats.</p>
|
|
2037
2037
|
|
|
2038
2038
|
|
|
2039
2039
|
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-get-job-stats.html>`_
|
|
@@ -5004,7 +5004,7 @@ class MlClient(NamespacedClient):
|
|
|
5004
5004
|
<p>Update a data frame analytics job.</p>
|
|
5005
5005
|
|
|
5006
5006
|
|
|
5007
|
-
`<https://www.elastic.co/
|
|
5007
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-ml-update-data-frame-analytics>`_
|
|
5008
5008
|
|
|
5009
5009
|
:param id: Identifier for the data frame analytics job. This identifier can contain
|
|
5010
5010
|
lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores.
|
|
@@ -5577,7 +5577,7 @@ class MlClient(NamespacedClient):
|
|
|
5577
5577
|
<p>Update a trained model deployment.</p>
|
|
5578
5578
|
|
|
5579
5579
|
|
|
5580
|
-
`<https://www.elastic.co/
|
|
5580
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-ml-update-trained-model-deployment>`_
|
|
5581
5581
|
|
|
5582
5582
|
:param model_id: The unique identifier of the trained model. Currently, only
|
|
5583
5583
|
PyTorch models are supported.
|
|
@@ -795,7 +795,7 @@ class TransformClient(NamespacedClient):
|
|
|
795
795
|
time of update and runs with those privileges.</p>
|
|
796
796
|
|
|
797
797
|
|
|
798
|
-
`<https://www.elastic.co/
|
|
798
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-transform-update-transform>`_
|
|
799
799
|
|
|
800
800
|
:param transform_id: Identifier for the transform.
|
|
801
801
|
:param defer_validation: When true, deferrable validations are not run. This
|
|
@@ -890,7 +890,7 @@ class TransformClient(NamespacedClient):
|
|
|
890
890
|
You may want to perform a recent cluster backup prior to the upgrade.</p>
|
|
891
891
|
|
|
892
892
|
|
|
893
|
-
`<https://www.elastic.co/
|
|
893
|
+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-transform-upgrade-transforms>`_
|
|
894
894
|
|
|
895
895
|
:param dry_run: When true, the request checks for updates but does not run them.
|
|
896
896
|
:param timeout: Period to wait for a response. If no response is received before
|