Skip to content

Auto-generated code for 8.18 #2937

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

Merged
merged 1 commit into from
Apr 29, 2025
Merged
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
4 changes: 2 additions & 2 deletions elasticsearch/_async/client/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ async def delete_voting_config_exclusions(
Remove master-eligible nodes from the voting configuration exclusion list.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/voting-config-exclusions.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-cluster-post-voting-config-exclusions>`_

:param master_timeout: Period to wait for a connection to the master node.
:param wait_for_removal: Specifies whether to wait for all excluded nodes to
Expand Down Expand Up @@ -680,7 +680,7 @@ async def post_voting_config_exclusions(
They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/voting-config-exclusions.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-cluster-post-voting-config-exclusions>`_

:param master_timeout: Period to wait for a connection to the master node.
:param node_ids: A comma-separated list of the persistent ids of the nodes to
Expand Down
107 changes: 107 additions & 0 deletions elasticsearch/_async/client/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,113 @@ async def get(
path_parts=__path_parts,
)

@_rewrite_parameters(
body_fields=("input", "query", "task_settings"),
)
async def inference(
self,
*,
inference_id: str,
input: t.Optional[t.Union[str, t.Sequence[str]]] = None,
task_type: t.Optional[
t.Union[
str,
t.Literal[
"chat_completion",
"completion",
"rerank",
"sparse_embedding",
"text_embedding",
],
]
] = None,
error_trace: t.Optional[bool] = None,
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
human: t.Optional[bool] = None,
pretty: t.Optional[bool] = None,
query: t.Optional[str] = None,
task_settings: t.Optional[t.Any] = None,
timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
body: t.Optional[t.Dict[str, t.Any]] = None,
) -> ObjectApiResponse[t.Any]:
"""
.. raw:: html

<p>Perform inference on the service.</p>
<p>This API enables you to use machine learning models to perform specific tasks on data that you provide as an input.
It returns a response with the results of the tasks.
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>
<p>For details about using this API with a service, such as Amazon Bedrock, Anthropic, or HuggingFace, refer to the service-specific documentation.</p>
<blockquote>
<p>info
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>
</blockquote>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/post-inference-api.html>`_

:param inference_id: The unique identifier for the inference endpoint.
:param input: The text on which you want to perform the inference task. It can
be a single string or an array. > info > Inference endpoints for the `completion`
task type currently only support a single string as input.
:param task_type: The type of inference task that the model performs.
:param query: The query input, which is required only for the `rerank` task.
It is not required for other tasks.
:param task_settings: Task settings for the individual inference request. These
settings are specific to the task type you specified and override the task
settings specified when initializing the service.
:param timeout: The amount of time to wait for the inference request to complete.
"""
if inference_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'inference_id'")
if input is None and body is None:
raise ValueError("Empty value passed for parameter 'input'")
__path_parts: t.Dict[str, str]
if task_type not in SKIP_IN_PATH and inference_id not in SKIP_IN_PATH:
__path_parts = {
"task_type": _quote(task_type),
"inference_id": _quote(inference_id),
}
__path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["inference_id"]}'
elif inference_id not in SKIP_IN_PATH:
__path_parts = {"inference_id": _quote(inference_id)}
__path = f'/_inference/{__path_parts["inference_id"]}'
else:
raise ValueError("Couldn't find a path for the given parameters")
__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 timeout is not None:
__query["timeout"] = timeout
if not __body:
if input is not None:
__body["input"] = input
if query is not None:
__body["query"] = query
if task_settings is not None:
__body["task_settings"] = task_settings
if not __body:
__body = None # type: ignore[assignment]
__headers = {"accept": "application/json"}
if __body is not None:
__headers["content-type"] = "application/json"
return await self.perform_request( # type: ignore[return-value]
"POST",
__path,
params=__query,
headers=__headers,
body=__body,
endpoint_id="inference.inference",
path_parts=__path_parts,
)

@_rewrite_parameters(
body_name="inference_config",
)
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch/_async/client/license.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ async def post(
If the operator privileges feature is enabled, only operator users can use this API.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-license.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-license-post>`_

:param acknowledge: Specifies whether you acknowledge the license changes.
:param license:
Expand Down
10 changes: 5 additions & 5 deletions elasticsearch/_async/client/ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1676,7 +1676,7 @@ async def get_data_frame_analytics_stats(
"""
.. raw:: html

<p>Get data frame analytics jobs usage info.</p>
<p>Get data frame analytics job stats.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/get-dfanalytics-stats.html>`_
Expand Down Expand Up @@ -1744,7 +1744,7 @@ async def get_datafeed_stats(
"""
.. raw:: html

<p>Get datafeeds usage info.
<p>Get datafeed stats.
You can get statistics for multiple datafeeds in a single API request by
using a comma-separated list of datafeeds or a wildcard expression. You can
get statistics for all datafeeds by using <code>_all</code>, by specifying <code>*</code> as the
Expand Down Expand Up @@ -2033,7 +2033,7 @@ async def get_job_stats(
"""
.. raw:: html

<p>Get anomaly detection jobs usage info.</p>
<p>Get anomaly detection job stats.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/ml-get-job-stats.html>`_
Expand Down Expand Up @@ -5004,7 +5004,7 @@ async def update_data_frame_analytics(
<p>Update a data frame analytics job.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-dfanalytics.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-ml-update-data-frame-analytics>`_

:param id: Identifier for the data frame analytics job. This identifier can contain
lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores.
Expand Down Expand Up @@ -5577,7 +5577,7 @@ async def update_trained_model_deployment(
<p>Update a trained model deployment.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-trained-model-deployment.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-ml-update-trained-model-deployment>`_

:param model_id: The unique identifier of the trained model. Currently, only
PyTorch models are supported.
Expand Down
4 changes: 2 additions & 2 deletions elasticsearch/_async/client/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ async def update_transform(
time of update and runs with those privileges.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/update-transform.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-transform-update-transform>`_

:param transform_id: Identifier for the transform.
:param defer_validation: When true, deferrable validations are not run. This
Expand Down Expand Up @@ -890,7 +890,7 @@ async def upgrade_transforms(
You may want to perform a recent cluster backup prior to the upgrade.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/upgrade-transforms.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-transform-upgrade-transforms>`_

:param dry_run: When true, the request checks for updates but does not run them.
:param timeout: Period to wait for a response. If no response is received before
Expand Down
26 changes: 13 additions & 13 deletions elasticsearch/_async/client/watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def ack_watch(
This happens when the condition of the watch is not met (the condition evaluates to false).</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/watcher-api-ack-watch.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-ack-watch>`_

:param watch_id: The watch identifier.
:param action_id: A comma-separated list of the action identifiers to acknowledge.
Expand Down Expand Up @@ -104,7 +104,7 @@ async def activate_watch(
A watch can be either active or inactive.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/watcher-api-activate-watch.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-activate-watch>`_

:param watch_id: The watch identifier.
"""
Expand Down Expand Up @@ -148,7 +148,7 @@ async def deactivate_watch(
A watch can be either active or inactive.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/watcher-api-deactivate-watch.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-deactivate-watch>`_

:param watch_id: The watch identifier.
"""
Expand Down Expand Up @@ -196,7 +196,7 @@ async def delete_watch(
When Elasticsearch security features are enabled, make sure no write privileges are granted to anyone for the <code>.watches</code> index.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/watcher-api-delete-watch.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-delete-watch>`_

:param id: The watch identifier.
"""
Expand Down Expand Up @@ -277,7 +277,7 @@ async def execute_watch(
<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>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/watcher-api-execute-watch.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-execute-watch>`_

:param id: The watch identifier.
:param action_modes: Determines how to handle the watch actions as part of the
Expand Down Expand Up @@ -365,7 +365,7 @@ async def get_settings(
Only a subset of settings are shown, for example <code>index.auto_expand_replicas</code> and <code>index.number_of_replicas</code>.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/watcher-api-get-settings.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-get-settings>`_

:param master_timeout: The period to wait for a connection to the master node.
If no response is received before the timeout expires, the request fails
Expand Down Expand Up @@ -410,7 +410,7 @@ async def get_watch(
<p>Get a watch.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/watcher-api-get-watch.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-get-watch>`_

:param id: The watch identifier.
"""
Expand Down Expand Up @@ -485,7 +485,7 @@ async def put_watch(
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>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/watcher-api-put-watch.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-put-watch>`_

:param id: The identifier for the watch.
:param actions: The list of actions that will be run if the condition matches.
Expand Down Expand Up @@ -598,7 +598,7 @@ async def query_watches(
<p>Note that only the <code>_id</code> and <code>metadata.*</code> fields are queryable or sortable.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/watcher-api-query-watches.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-query-watches>`_

:param from_: The offset from the first result to fetch. It must be non-negative.
:param query: A query that filters the watches to be returned.
Expand Down Expand Up @@ -673,7 +673,7 @@ async def start(
Start the Watcher service if it is not already running.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/watcher-api-start.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-start>`_

:param master_timeout: Period to wait for a connection to the master node.
"""
Expand Down Expand Up @@ -739,7 +739,7 @@ async def stats(
You retrieve more metrics by using the metric parameter.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/watcher-api-stats.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-stats>`_

:param metric: Defines which additional metrics are included in the response.
:param emit_stacktraces: Defines whether stack traces are generated for each
Expand Down Expand Up @@ -790,7 +790,7 @@ async def stop(
Stop the Watcher service if it is running.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/watcher-api-stop.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-stop>`_

:param master_timeout: The period to wait for the master node. If the master
node is not available before the timeout expires, the request fails and returns
Expand Down Expand Up @@ -851,7 +851,7 @@ async def update_settings(
Watcher shards must always be in the <code>data_content</code> tier.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/watcher-api-update-settings.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-watcher-update-settings>`_

:param index_auto_expand_replicas:
:param index_number_of_replicas:
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch/_async/client/xpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ async def usage(
The API also provides some usage statistics.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/usage-api.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/group/endpoint-xpack>`_

:param master_timeout: The period to wait for a connection to the master node.
If no response is received before the timeout expires, the request fails
Expand Down
4 changes: 2 additions & 2 deletions elasticsearch/_sync/client/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def delete_voting_config_exclusions(
Remove master-eligible nodes from the voting configuration exclusion list.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/voting-config-exclusions.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-cluster-post-voting-config-exclusions>`_

:param master_timeout: Period to wait for a connection to the master node.
:param wait_for_removal: Specifies whether to wait for all excluded nodes to
Expand Down Expand Up @@ -680,7 +680,7 @@ def post_voting_config_exclusions(
They are not required when removing master-ineligible nodes or when removing fewer than half of the master-eligible nodes.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/8.18/voting-config-exclusions.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/v8/operation/operation-cluster-post-voting-config-exclusions>`_

:param master_timeout: Period to wait for a connection to the master node.
:param node_ids: A comma-separated list of the persistent ids of the nodes to
Expand Down
Loading