Skip to content

Commit 84ae034

Browse files
Auto-generated API code (#2939)
1 parent 67d0671 commit 84ae034

17 files changed

+451
-55
lines changed

elasticsearch/_async/client/cluster.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ async def delete_voting_config_exclusions(
185185
Remove master-eligible nodes from the voting configuration exclusion list.</p>
186186
187187
188-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-post-voting-config-exclusions>`_
188+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-cluster-post-voting-config-exclusions>`_
189189
190190
:param master_timeout: Period to wait for a connection to the master node.
191191
:param wait_for_removal: Specifies whether to wait for all excluded nodes to
@@ -680,7 +680,7 @@ async def post_voting_config_exclusions(
680680
They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes.</p>
681681
682682
683-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-post-voting-config-exclusions>`_
683+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-cluster-post-voting-config-exclusions>`_
684684
685685
:param master_timeout: Period to wait for a connection to the master node.
686686
:param node_ids: A comma-separated list of the persistent ids of the nodes to

elasticsearch/_async/client/inference.py

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,113 @@ async def get(
234234
path_parts=__path_parts,
235235
)
236236

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.17/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+
237344
@_rewrite_parameters(
238345
body_name="inference_config",
239346
)

elasticsearch/_async/client/license.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ async def post(
237237
If the operator privileges feature is enabled, only operator users can use this API.</p>
238238
239239
240-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-license-post>`_
240+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-license-post>`_
241241
242242
:param acknowledge: Specifies whether you acknowledge the license changes.
243243
:param license:

elasticsearch/_async/client/ml.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,7 @@ async def get_data_frame_analytics_stats(
16761676
"""
16771677
.. raw:: html
16781678
1679-
<p>Get data frame analytics jobs usage info.</p>
1679+
<p>Get data frame analytics job stats.</p>
16801680
16811681
16821682
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/get-dfanalytics-stats.html>`_
@@ -1744,7 +1744,7 @@ async def get_datafeed_stats(
17441744
"""
17451745
.. raw:: html
17461746
1747-
<p>Get datafeeds usage info.
1747+
<p>Get datafeed stats.
17481748
You can get statistics for multiple datafeeds in a single API request by
17491749
using a comma-separated list of datafeeds or a wildcard expression. You can
17501750
get statistics for all datafeeds by using <code>_all</code>, by specifying <code>*</code> as the
@@ -2033,7 +2033,7 @@ async def get_job_stats(
20332033
"""
20342034
.. raw:: html
20352035
2036-
<p>Get anomaly detection jobs usage info.</p>
2036+
<p>Get anomaly detection job stats.</p>
20372037
20382038
20392039
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.17/ml-get-job-stats.html>`_
@@ -5004,7 +5004,7 @@ async def update_data_frame_analytics(
50045004
<p>Update a data frame analytics job.</p>
50055005
50065006
5007-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-update-data-frame-analytics>`_
5007+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-ml-update-data-frame-analytics>`_
50085008
50095009
:param id: Identifier for the data frame analytics job. This identifier can contain
50105010
lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores.
@@ -5577,7 +5577,7 @@ async def update_trained_model_deployment(
55775577
<p>Update a trained model deployment.</p>
55785578
55795579
5580-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-ml-update-trained-model-deployment>`_
5580+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-ml-update-trained-model-deployment>`_
55815581
55825582
:param model_id: The unique identifier of the trained model. Currently, only
55835583
PyTorch models are supported.

elasticsearch/_async/client/transform.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ async def update_transform(
795795
time of update and runs with those privileges.</p>
796796
797797
798-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-transform-update-transform>`_
798+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-transform-update-transform>`_
799799
800800
:param transform_id: Identifier for the transform.
801801
:param defer_validation: When true, deferrable validations are not run. This
@@ -890,7 +890,7 @@ async def upgrade_transforms(
890890
You may want to perform a recent cluster backup prior to the upgrade.</p>
891891
892892
893-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-transform-upgrade-transforms>`_
893+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-transform-upgrade-transforms>`_
894894
895895
:param dry_run: When true, the request checks for updates but does not run them.
896896
:param timeout: Period to wait for a response. If no response is received before

elasticsearch/_async/client/watcher.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async def ack_watch(
4848
This happens when the condition of the watch is not met (the condition evaluates to false).</p>
4949
5050
51-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-watcher-ack-watch>`_
51+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-ack-watch>`_
5252
5353
:param watch_id: The watch identifier.
5454
:param action_id: A comma-separated list of the action identifiers to acknowledge.
@@ -104,7 +104,7 @@ async def activate_watch(
104104
A watch can be either active or inactive.</p>
105105
106106
107-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-watcher-activate-watch>`_
107+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-activate-watch>`_
108108
109109
:param watch_id: The watch identifier.
110110
"""
@@ -148,7 +148,7 @@ async def deactivate_watch(
148148
A watch can be either active or inactive.</p>
149149
150150
151-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-watcher-deactivate-watch>`_
151+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-deactivate-watch>`_
152152
153153
:param watch_id: The watch identifier.
154154
"""
@@ -196,7 +196,7 @@ async def delete_watch(
196196
When Elasticsearch security features are enabled, make sure no write privileges are granted to anyone for the <code>.watches</code> index.</p>
197197
198198
199-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-watcher-delete-watch>`_
199+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-delete-watch>`_
200200
201201
:param id: The watch identifier.
202202
"""
@@ -277,7 +277,7 @@ async def execute_watch(
277277
<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>
278278
279279
280-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-watcher-execute-watch>`_
280+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-execute-watch>`_
281281
282282
:param id: The watch identifier.
283283
:param action_modes: Determines how to handle the watch actions as part of the
@@ -365,7 +365,7 @@ async def get_settings(
365365
Only a subset of settings are shown, for example <code>index.auto_expand_replicas</code> and <code>index.number_of_replicas</code>.</p>
366366
367367
368-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-watcher-get-settings>`_
368+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-get-settings>`_
369369
370370
:param master_timeout: The period to wait for a connection to the master node.
371371
If no response is received before the timeout expires, the request fails
@@ -410,7 +410,7 @@ async def get_watch(
410410
<p>Get a watch.</p>
411411
412412
413-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-watcher-get-watch>`_
413+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-get-watch>`_
414414
415415
:param id: The watch identifier.
416416
"""
@@ -485,7 +485,7 @@ async def put_watch(
485485
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>
486486
487487
488-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-watcher-put-watch>`_
488+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-put-watch>`_
489489
490490
:param id: The identifier for the watch.
491491
:param actions: The list of actions that will be run if the condition matches.
@@ -598,7 +598,7 @@ async def query_watches(
598598
<p>Note that only the <code>_id</code> and <code>metadata.*</code> fields are queryable or sortable.</p>
599599
600600
601-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-watcher-query-watches>`_
601+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-query-watches>`_
602602
603603
:param from_: The offset from the first result to fetch. It must be non-negative.
604604
:param query: A query that filters the watches to be returned.
@@ -673,7 +673,7 @@ async def start(
673673
Start the Watcher service if it is not already running.</p>
674674
675675
676-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-watcher-start>`_
676+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-start>`_
677677
678678
:param master_timeout: Period to wait for a connection to the master node.
679679
"""
@@ -739,7 +739,7 @@ async def stats(
739739
You retrieve more metrics by using the metric parameter.</p>
740740
741741
742-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-watcher-stats>`_
742+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-stats>`_
743743
744744
:param metric: Defines which additional metrics are included in the response.
745745
:param emit_stacktraces: Defines whether stack traces are generated for each
@@ -790,7 +790,7 @@ async def stop(
790790
Stop the Watcher service if it is running.</p>
791791
792792
793-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-watcher-stop>`_
793+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-stop>`_
794794
795795
:param master_timeout: The period to wait for the master node. If the master
796796
node is not available before the timeout expires, the request fails and returns
@@ -851,7 +851,7 @@ async def update_settings(
851851
Watcher shards must always be in the <code>data_content</code> tier.</p>
852852
853853
854-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-watcher-update-settings>`_
854+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-update-settings>`_
855855
856856
:param index_auto_expand_replicas:
857857
:param index_number_of_replicas:

elasticsearch/_async/client/xpack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ async def usage(
103103
The API also provides some usage statistics.</p>
104104
105105
106-
`<https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-xpack>`_
106+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/group/endpoint-xpack>`_
107107
108108
:param master_timeout: The period to wait for a connection to the master node.
109109
If no response is received before the timeout expires, the request fails

elasticsearch/_sync/client/cluster.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def delete_voting_config_exclusions(
185185
Remove master-eligible nodes from the voting configuration exclusion list.</p>
186186
187187
188-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-post-voting-config-exclusions>`_
188+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-cluster-post-voting-config-exclusions>`_
189189
190190
:param master_timeout: Period to wait for a connection to the master node.
191191
:param wait_for_removal: Specifies whether to wait for all excluded nodes to
@@ -680,7 +680,7 @@ def post_voting_config_exclusions(
680680
They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes.</p>
681681
682682
683-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-post-voting-config-exclusions>`_
683+
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-cluster-post-voting-config-exclusions>`_
684684
685685
:param master_timeout: Period to wait for a connection to the master node.
686686
:param node_ids: A comma-separated list of the persistent ids of the nodes to

0 commit comments

Comments
 (0)