Skip to content

Auto-generated code for main #2909

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 14, 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/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3050,7 +3050,7 @@ async def knn_search(
</ul>


`<https://www.elastic.co/guide/en/elasticsearch/reference/master/knn-search-api.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-knn-search>`_

:param index: A comma-separated list of index names to search; use `_all` or
to perform the operation on all indices.
Expand Down Expand Up @@ -4388,7 +4388,7 @@ async def scripts_painless_execute(
<p>Each context requires a script, but additional parameters depend on the context you're using for that script.</p>


`<https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html>`_
`<https://www.elastic.co/docs/reference/scripting-languages/painless/painless-api-examples>`_

:param context: The context that the script should run in. NOTE: Result ordering
in the field contexts is not guaranteed.
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch/_async/client/esql.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ async def query(
Get search results for an ES|QL (Elasticsearch query language) query.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-rest.html>`_
`<https://www.elastic.co/docs/explore-analyze/query-filter/languages/esql-rest>`_

:param query: The ES|QL query API accepts an ES|QL query string in the query
parameter, runs it, and returns the results.
Expand Down
12 changes: 6 additions & 6 deletions elasticsearch/_async/client/fleet.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ async def msearch(
example, a request targeting foo*,bar* returns an error if an index starts
with foo but no index starts with bar.
:param allow_partial_search_results: If true, returns partial results if there
are shard request timeouts or [shard failures](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-replication.html#shard-failures).
If false, returns an error with no partial results. Defaults to the configured
cluster setting `search.default_allow_partial_results` which is true by default.
are shard request timeouts or shard failures. If false, returns an error
with no partial results. Defaults to the configured cluster setting `search.default_allow_partial_results`,
which is true by default.
:param ccs_minimize_roundtrips: If true, network roundtrips between the coordinating
node and remote clusters are minimized for cross-cluster search requests.
:param expand_wildcards: Type of index that wildcard expressions can match. If
Expand Down Expand Up @@ -401,9 +401,9 @@ async def search(
:param aggs:
:param allow_no_indices:
:param allow_partial_search_results: If true, returns partial results if there
are shard request timeouts or [shard failures](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-replication.html#shard-failures).
If false, returns an error with no partial results. Defaults to the configured
cluster setting `search.default_allow_partial_results` which is true by default.
are shard request timeouts or shard failures. If false, returns an error
with no partial results. Defaults to the configured cluster setting `search.default_allow_partial_results`,
which is true by default.
:param analyze_wildcard:
:param analyzer:
:param batched_reduce_size:
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/docs/api/doc/elasticsearch/operation/operation-inference-inference>`_

: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
6 changes: 3 additions & 3 deletions elasticsearch/_async/client/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ async def geo_ip_stats(
Get download statistics for GeoIP2 databases that are used with the GeoIP processor.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/master/geoip-processor.html>`_
`<https://www.elastic.co/docs/reference/enrich-processor/geoip-processor>`_
"""
__path_parts: t.Dict[str, str] = {}
__path = "/_ingest/geoip/stats"
Expand Down Expand Up @@ -412,7 +412,7 @@ async def processor_grok(
A grok pattern is like a regular expression that supports aliased expressions that can be reused.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/master/grok-processor.html>`_
`<https://www.elastic.co/docs/reference/enrich-processor/grok-processor>`_
"""
__path_parts: t.Dict[str, str] = {}
__path = "/_ingest/processor/grok"
Expand Down Expand Up @@ -620,7 +620,7 @@ async def put_pipeline(
Changes made using this API take effect immediately.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/master/ingest.html>`_
`<https://www.elastic.co/docs/manage-data/ingest/transform-enrich/ingest-pipelines>`_

:param id: ID of the ingest pipeline to create or update.
:param deprecated: Marks this ingest pipeline as deprecated. When a deprecated
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch/_async/client/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ async def get_repositories_metering_info(
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-nodes-get-repositories-metering-info>`_

:param node_id: Comma-separated list of node IDs or names used to limit returned
information. All the nodes selective options are explained [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster.html#cluster-nodes).
information.
"""
if node_id in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'node_id'")
Expand Down
5 changes: 0 additions & 5 deletions elasticsearch/_async/client/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ async def clone(
human: t.Optional[bool] = None,
master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
pretty: t.Optional[bool] = 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]:
"""
Expand All @@ -126,8 +125,6 @@ async def clone(
: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
an error. To indicate that the request should never timeout, set it to `-1`.
:param timeout: The period of time to wait for a response. If no response is
received before the timeout expires, the request fails and returns an error.
"""
if repository in SKIP_IN_PATH:
raise ValueError("Empty value passed for parameter 'repository'")
Expand Down Expand Up @@ -155,8 +152,6 @@ async def clone(
__query["master_timeout"] = master_timeout
if pretty is not None:
__query["pretty"] = pretty
if timeout is not None:
__query["timeout"] = timeout
if not __body:
if indices is not None:
__body["indices"] = indices
Expand Down
4 changes: 2 additions & 2 deletions elasticsearch/_sync/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3048,7 +3048,7 @@ def knn_search(
</ul>


`<https://www.elastic.co/guide/en/elasticsearch/reference/master/knn-search-api.html>`_
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-knn-search>`_

:param index: A comma-separated list of index names to search; use `_all` or
to perform the operation on all indices.
Expand Down Expand Up @@ -4386,7 +4386,7 @@ def scripts_painless_execute(
<p>Each context requires a script, but additional parameters depend on the context you're using for that script.</p>


`<https://www.elastic.co/guide/en/elasticsearch/painless/master/painless-execute-api.html>`_
`<https://www.elastic.co/docs/reference/scripting-languages/painless/painless-api-examples>`_

:param context: The context that the script should run in. NOTE: Result ordering
in the field contexts is not guaranteed.
Expand Down
2 changes: 1 addition & 1 deletion elasticsearch/_sync/client/esql.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ def query(
Get search results for an ES|QL (Elasticsearch query language) query.</p>


`<https://www.elastic.co/guide/en/elasticsearch/reference/master/esql-rest.html>`_
`<https://www.elastic.co/docs/explore-analyze/query-filter/languages/esql-rest>`_

:param query: The ES|QL query API accepts an ES|QL query string in the query
parameter, runs it, and returns the results.
Expand Down
12 changes: 6 additions & 6 deletions elasticsearch/_sync/client/fleet.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ def msearch(
example, a request targeting foo*,bar* returns an error if an index starts
with foo but no index starts with bar.
:param allow_partial_search_results: If true, returns partial results if there
are shard request timeouts or [shard failures](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-replication.html#shard-failures).
If false, returns an error with no partial results. Defaults to the configured
cluster setting `search.default_allow_partial_results` which is true by default.
are shard request timeouts or shard failures. If false, returns an error
with no partial results. Defaults to the configured cluster setting `search.default_allow_partial_results`,
which is true by default.
:param ccs_minimize_roundtrips: If true, network roundtrips between the coordinating
node and remote clusters are minimized for cross-cluster search requests.
:param expand_wildcards: Type of index that wildcard expressions can match. If
Expand Down Expand Up @@ -401,9 +401,9 @@ def search(
:param aggs:
:param allow_no_indices:
:param allow_partial_search_results: If true, returns partial results if there
are shard request timeouts or [shard failures](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-replication.html#shard-failures).
If false, returns an error with no partial results. Defaults to the configured
cluster setting `search.default_allow_partial_results` which is true by default.
are shard request timeouts or shard failures. If false, returns an error
with no partial results. Defaults to the configured cluster setting `search.default_allow_partial_results`,
which is true by default.
:param analyze_wildcard:
:param analyzer:
:param batched_reduce_size:
Expand Down
Loading