Source code for opensearchpy.plugins.ml

# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
#
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.

# ------------------------------------------------------------------------------------------
# THIS CODE IS AUTOMATICALLY GENERATED AND MANUAL EDITS WILL BE LOST
#
# To contribute, kindly make modifications in the opensearch-py client generator
# or in the OpenSearch API specification, and run `nox -rs generate`. See DEVELOPER_GUIDE.md
# and https://github.com/opensearch-project/opensearch-api-specification for details.
# -----------------------------------------------------------------------------------------+


from typing import Any

from ..client.utils import SKIP_IN_PATH, NamespacedClient, _make_path, query_params


[docs] class MlClient(NamespacedClient):
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def delete_model( self, *, model_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Deletes a model. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'model_id'.") return self.transport.perform_request( "DELETE", _make_path("_plugins", "_ml", "models", model_id), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def delete_model_group( self, *, model_group_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Deletes a model group. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if model_group_id in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'model_group_id'." ) return self.transport.perform_request( "DELETE", _make_path("_plugins", "_ml", "model_groups", model_group_id), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_model_group( self, *, model_group_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves a model group. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if model_group_id in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'model_group_id'." ) return self.transport.perform_request( "GET", _make_path("_plugins", "_ml", "model_groups", model_group_id), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_task( self, *, task_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves a task. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'task_id'.") return self.transport.perform_request( "GET", _make_path("_plugins", "_ml", "tasks", task_id), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def register_model( self, *, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Registers a model. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "POST", "/_plugins/_ml/models/_register", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def register_model_group( self, *, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Registers a model group. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "POST", "/_plugins/_ml/model_groups/_register", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def search_models( self, *, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Searches for models. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "POST", "/_plugins/_ml/models/_search", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def deploy_model( self, *, model_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Deploys a model. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'model_id'.") return self.transport.perform_request( "POST", _make_path("_plugins", "_ml", "models", model_id, "_deploy"), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def undeploy_model( self, *, body: Any = None, model_id: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Undeploys a model. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "POST", _make_path("_plugins", "_ml", "models", model_id, "_undeploy"), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def create_connector( self, *, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Creates a standalone connector. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "POST", "/_plugins/_ml/connectors/_create", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def delete_agent( self, *, agent_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Delete an agent. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if agent_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'agent_id'.") return self.transport.perform_request( "DELETE", _make_path("_plugins", "_ml", "agents", agent_id), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def delete_connector( self, *, connector_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Deletes a standalone connector. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if connector_id in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'connector_id'." ) return self.transport.perform_request( "DELETE", _make_path("_plugins", "_ml", "connectors", connector_id), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def delete_task( self, *, task_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Deletes a task. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if task_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'task_id'.") return self.transport.perform_request( "DELETE", _make_path("_plugins", "_ml", "tasks", task_id), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def register_agents( self, *, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Register an agent. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "POST", "/_plugins/_ml/agents/_register", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def chunk_model( self, *, model_id: Any, chunk_number: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Uploads model chunk. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ from warnings import warn warn("Deprecated: Use `upload_chunk` instead.") for param in (model_id, chunk_number): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "POST", _make_path("_plugins", "_ml", "models", model_id, "chunk", chunk_number), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def create_controller( self, *, model_id: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Creates a controller. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'model_id'.") return self.transport.perform_request( "POST", _make_path("_plugins", "_ml", "controllers", model_id), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def create_memory( self, *, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Create a memory. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "POST", "/_plugins/_ml/memory", params=params, headers=headers, body=body )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def create_message( self, *, memory_id: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Create a message. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if memory_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'memory_id'.") return self.transport.perform_request( "POST", _make_path("_plugins", "_ml", "memory", memory_id, "messages"), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def create_model_meta( self, *, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Registers model metadata. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ from warnings import warn warn("Deprecated: Use `_register_meta` instead.") return self.transport.perform_request( "POST", "/_plugins/_ml/models/meta", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def delete_controller( self, *, model_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Deletes a controller. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'model_id'.") return self.transport.perform_request( "DELETE", _make_path("_plugins", "_ml", "controllers", model_id), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def delete_memory( self, *, memory_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Delete a memory. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if memory_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'memory_id'.") return self.transport.perform_request( "DELETE", _make_path("_plugins", "_ml", "memory", memory_id), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def execute_agent( self, *, agent_id: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Execute an agent. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if agent_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'agent_id'.") return self.transport.perform_request( "POST", _make_path("_plugins", "_ml", "agents", agent_id, "_execute"), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def execute_algorithm( self, *, algorithm_name: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Execute an algorithm. :arg algorithm_name: The function name. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if algorithm_name in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'algorithm_name'." ) return self.transport.perform_request( "POST", _make_path("_plugins", "_ml", "_execute", algorithm_name), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_agent( self, *, agent_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Get an agent. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if agent_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'agent_id'.") return self.transport.perform_request( "GET", _make_path("_plugins", "_ml", "agents", agent_id), params=params, headers=headers, )
[docs] @query_params( "error_trace", "filter_path", "human", "max_results", "next_token", "pretty", "source", ) def get_all_memories( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Get all memories. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg max_results: The maximum number of results to return. If there are fewer memories than the number set in `max_results`, the response returns only the number of memories that exist. Default is `10`. :arg next_token: The index of the first memory in the sorted list of memories to return. Memories are ordered by `create_time`. For example, if memories `A`, `B`, and `C` exist, `next_token=1` returns memories `B` and `C`. Default is `0` (return all memories). :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "GET", "/_plugins/_ml/memory", params=params, headers=headers )
[docs] @query_params( "error_trace", "filter_path", "human", "max_results", "next_token", "pretty", "source", ) def get_all_messages( self, *, memory_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Get all messages in a memory. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if memory_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'memory_id'.") return self.transport.perform_request( "GET", _make_path("_plugins", "_ml", "memory", memory_id, "messages"), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_all_tools( self, *, params: Any = None, headers: Any = None, ) -> Any: """ Get tools. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "GET", "/_plugins/_ml/tools", params=params, headers=headers )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_connector( self, *, connector_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves a standalone connector. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if connector_id in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'connector_id'." ) return self.transport.perform_request( "GET", _make_path("_plugins", "_ml", "connectors", connector_id), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_controller( self, *, model_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves a controller. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'model_id'.") return self.transport.perform_request( "GET", _make_path("_plugins", "_ml", "controllers", model_id), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_memory( self, *, memory_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Get a memory. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if memory_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'memory_id'.") return self.transport.perform_request( "GET", _make_path("_plugins", "_ml", "memory", memory_id), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_message( self, *, message_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Get a message. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if message_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'message_id'.") return self.transport.perform_request( "GET", _make_path("_plugins", "_ml", "memory", "message", message_id), params=params, headers=headers, )
[docs] @query_params( "error_trace", "filter_path", "human", "max_results", "next_token", "pretty", "source", ) def get_message_traces( self, *, message_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Get a message traces. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if message_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'message_id'.") return self.transport.perform_request( "GET", _make_path("_plugins", "_ml", "memory", "message", message_id, "traces"), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_model( self, *, model_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Retrieves a model. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'model_id'.") return self.transport.perform_request( "GET", _make_path("_plugins", "_ml", "models", model_id), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_profile( self, *, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Get a profile. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "GET", "/_plugins/_ml/profile", params=params, headers=headers, body=body )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_profile_models( self, *, body: Any = None, model_id: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Get a profile models. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "GET", _make_path("_plugins", "_ml", "profile", "models", model_id), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_profile_tasks( self, *, body: Any = None, task_id: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Get a profile tasks. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "GET", _make_path("_plugins", "_ml", "profile", "tasks", task_id), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_stats( self, *, node_id: Any = None, stat: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Get stats. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "GET", _make_path("_plugins", "_ml", node_id, "stats", stat), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_tool( self, *, tool_name: Any, params: Any = None, headers: Any = None, ) -> Any: """ Get tools. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if tool_name in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'tool_name'.") return self.transport.perform_request( "GET", _make_path("_plugins", "_ml", "tools", tool_name), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def load_model( self, *, model_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Deploys a model. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ from warnings import warn warn("Deprecated: Use `deploy_model` instead.") if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'model_id'.") return self.transport.perform_request( "POST", _make_path("_plugins", "_ml", "models", model_id, "_load"), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def predict( self, *, algorithm_name: Any, model_id: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Predicts new data with trained model. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ for param in (algorithm_name, model_id): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "POST", _make_path("_plugins", "_ml", "_predict", algorithm_name, model_id), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def predict_model( self, *, model_id: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Predicts a model. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'model_id'.") return self.transport.perform_request( "POST", _make_path("_plugins", "_ml", "models", model_id, "_predict"), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def register_model_meta( self, *, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Registers model metadata. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "POST", "/_plugins/_ml/models/_register_meta", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def search_agents( self, *, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Search agents. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "POST", "/_plugins/_ml/agents/_search", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def search_connectors( self, *, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Searches for standalone connectors. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "POST", "/_plugins/_ml/connectors/_search", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def search_memory( self, *, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Search memory. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "POST", "/_plugins/_ml/memory/_search", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def search_message( self, *, memory_id: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Search messages. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if memory_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'memory_id'.") return self.transport.perform_request( "POST", _make_path("_plugins", "_ml", "memory", memory_id, "_search"), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def search_model_group( self, *, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Searches for model groups. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "POST", "/_plugins/_ml/model_groups/_search", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def search_tasks( self, *, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Searches for tasks. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "POST", "/_plugins/_ml/tasks/_search", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def train( self, *, algorithm_name: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Trains a model synchronously. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if algorithm_name in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'algorithm_name'." ) return self.transport.perform_request( "POST", _make_path("_plugins", "_ml", "_train", algorithm_name), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def train_predict( self, *, algorithm_name: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Trains a model and predicts against the same training dataset. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if algorithm_name in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'algorithm_name'." ) return self.transport.perform_request( "POST", _make_path("_plugins", "_ml", "_train_predict", algorithm_name), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def unload_model( self, *, body: Any = None, model_id: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Unloads a model. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ from warnings import warn warn("Deprecated: Use `undeploy_model` instead.") return self.transport.perform_request( "POST", _make_path("_plugins", "_ml", "models", model_id, "_unload"), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def update_connector( self, *, connector_id: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Updates a standalone connector. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if connector_id in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'connector_id'." ) return self.transport.perform_request( "PUT", _make_path("_plugins", "_ml", "connectors", connector_id), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def update_controller( self, *, model_id: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Updates a controller. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'model_id'.") return self.transport.perform_request( "PUT", _make_path("_plugins", "_ml", "controllers", model_id), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def update_memory( self, *, memory_id: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Update a memory. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if memory_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'memory_id'.") return self.transport.perform_request( "PUT", _make_path("_plugins", "_ml", "memory", memory_id), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def update_message( self, *, message_id: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Update a message. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if message_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'message_id'.") return self.transport.perform_request( "PUT", _make_path("_plugins", "_ml", "memory", "message", message_id), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def update_model( self, *, model_id: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Updates a model. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'model_id'.") return self.transport.perform_request( "PUT", _make_path("_plugins", "_ml", "models", model_id), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def update_model_group( self, *, model_group_id: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Updates a model group. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if model_group_id in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'model_group_id'." ) return self.transport.perform_request( "PUT", _make_path("_plugins", "_ml", "model_groups", model_group_id), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def upload_chunk( self, *, model_id: Any, chunk_number: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Uploads model chunk. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ for param in (model_id, chunk_number): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "POST", _make_path( "_plugins", "_ml", "models", model_id, "upload_chunk", chunk_number ), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def upload_model( self, *, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Registers a model. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ from warnings import warn warn("Deprecated: Use `register_model` instead.") return self.transport.perform_request( "POST", "/_plugins/_ml/models/_upload", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def add_agentic_memory( self, *, memory_container_id: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Add agentic memory to a memory container. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if memory_container_id in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'memory_container_id'." ) return self.transport.perform_request( "POST", _make_path( "_plugins", "_ml", "memory_containers", memory_container_id, "memories" ), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def create_memory_container( self, *, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Create a memory container. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "POST", "/_plugins/_ml/memory_containers/_create", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def create_memory_container_session( self, *, memory_container_id: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Create session in a memory container. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if memory_container_id in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'memory_container_id'." ) return self.transport.perform_request( "POST", _make_path( "_plugins", "_ml", "memory_containers", memory_container_id, "memories", "sessions", ), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def delete_agentic_memory( self, *, memory_container_id: Any, doc_type: Any, id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Delete a specific memory by its type and ID. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ for param in (memory_container_id, doc_type, id): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "DELETE", _make_path( "_plugins", "_ml", "memory_containers", memory_container_id, "memories", doc_type, id, ), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def delete_agentic_memory_query( self, *, memory_container_id: Any, doc_type: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Delete multiple memories using a query to match specific criteria. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ for param in (memory_container_id, doc_type): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "POST", _make_path( "_plugins", "_ml", "memory_containers", memory_container_id, "memories", doc_type, "_delete_by_query", ), params=params, headers=headers, body=body, )
[docs] @query_params( "delete_all_memories", "delete_memories", "error_trace", "filter_path", "human", "pretty", "source", ) def delete_memory_container( self, *, memory_container_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Delete a memory container. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if memory_container_id in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'memory_container_id'." ) return self.transport.perform_request( "DELETE", _make_path("_plugins", "_ml", "memory_containers", memory_container_id), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def execute_agent_stream( self, *, agent_id: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Execute an agent in streaming mode. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if agent_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'agent_id'.") return self.transport.perform_request( "POST", _make_path("_plugins", "_ml", "agents", agent_id, "_execute", "stream"), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def execute_tool( self, *, tool_name: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Execute a tool. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if tool_name in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'tool_name'.") return self.transport.perform_request( "POST", _make_path("_plugins", "_ml", "tools", "_execute", tool_name), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_agentic_memory( self, *, memory_container_id: Any, doc_type: Any, id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Get a specific memory by its type and ID. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ for param in (memory_container_id, doc_type, id): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "GET", _make_path( "_plugins", "_ml", "memory_containers", memory_container_id, "memories", doc_type, id, ), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def get_memory_container( self, *, memory_container_id: Any, params: Any = None, headers: Any = None, ) -> Any: """ Get a memory container. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if memory_container_id in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'memory_container_id'." ) return self.transport.perform_request( "GET", _make_path("_plugins", "_ml", "memory_containers", memory_container_id), params=params, headers=headers, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def predict_model_stream( self, *, model_id: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Predicts a model in streaming mode. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if model_id in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument 'model_id'.") return self.transport.perform_request( "POST", _make_path("_plugins", "_ml", "models", model_id, "_predict", "stream"), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def search_agentic_memory( self, *, memory_container_id: Any, doc_type: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Search for memories of a specific type within a memory container. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ for param in (memory_container_id, doc_type): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "GET", _make_path( "_plugins", "_ml", "memory_containers", memory_container_id, "memories", doc_type, "_search", ), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def search_memory_container( self, *, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Search memory containers. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ return self.transport.perform_request( "POST", "/_plugins/_ml/memory_containers/_search", params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def update_agentic_memory( self, *, memory_container_id: Any, doc_type: Any, id: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Update a specific memory by its type and ID. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ for param in (memory_container_id, doc_type, id): if param in SKIP_IN_PATH: raise ValueError("Empty value passed for a required argument.") return self.transport.perform_request( "PUT", _make_path( "_plugins", "_ml", "memory_containers", memory_container_id, "memories", doc_type, id, ), params=params, headers=headers, body=body, )
[docs] @query_params("error_trace", "filter_path", "human", "pretty", "source") def update_memory_container( self, *, memory_container_id: Any, body: Any = None, params: Any = None, headers: Any = None, ) -> Any: """ Update a memory container. :arg error_trace: Whether to include the stack trace of returned errors. Default is false. :arg filter_path: A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`. :arg human: Whether to return human-readable values for statistics. Default is false. :arg pretty: Whether to pretty-format the returned JSON response. Default is false. :arg source: The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. """ if memory_container_id in SKIP_IN_PATH: raise ValueError( "Empty value passed for a required argument 'memory_container_id'." ) return self.transport.perform_request( "PUT", _make_path("_plugins", "_ml", "memory_containers", memory_container_id), params=params, headers=headers, body=body, )