Inference

class elasticsearch.client.InferenceClient(client)
Parameters:

client (BaseClient) –

delete_model(*, inference_id, task_type=None, error_trace=None, filter_path=None, human=None, pretty=None)

Delete model in the Inference API

https://www.elastic.co/guide/en/elasticsearch/reference/8.13/delete-inference-api.html

Parameters:
  • inference_id (str) – The inference Id

  • task_type (Literal['sparse_embedding', 'text_embedding'] | str | None) – The task type

  • error_trace (bool | None) –

  • filter_path (str | Sequence[str] | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

get_model(*, inference_id, task_type=None, error_trace=None, filter_path=None, human=None, pretty=None)

Get a model in the Inference API

https://www.elastic.co/guide/en/elasticsearch/reference/8.13/get-inference-api.html

Parameters:
  • inference_id (str) – The inference Id

  • task_type (Literal['sparse_embedding', 'text_embedding'] | str | None) – The task type

  • error_trace (bool | None) –

  • filter_path (str | Sequence[str] | None) –

  • human (bool | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]

inference(*, inference_id, input=None, task_type=None, error_trace=None, filter_path=None, human=None, pretty=None, task_settings=None, body=None)

Perform inference on a model

https://www.elastic.co/guide/en/elasticsearch/reference/8.13/post-inference-api.html

Parameters:
  • inference_id (str) – The inference Id

  • input (str | Sequence[str] | None) – Text input to the model. Either a string or an array of strings.

  • task_type (Literal['sparse_embedding', 'text_embedding'] | str | None) – The task type

  • task_settings (Any | None) – Optional task settings

  • error_trace (bool | None) –

  • filter_path (str | Sequence[str] | None) –

  • human (bool | None) –

  • pretty (bool | None) –

  • body (Dict[str, Any] | None) –

Return type:

ObjectApiResponse[Any]

put_model(*, inference_id, task_type=None, error_trace=None, filter_path=None, human=None, model_config=None, body=None, pretty=None)

Configure a model for use in the Inference API

https://www.elastic.co/guide/en/elasticsearch/reference/8.13/put-inference-api.html

Parameters:
  • inference_id (str) – The inference Id

  • task_type (Literal['sparse_embedding', 'text_embedding'] | str | None) – The task type

  • model_config (Mapping[str, Any] | None) –

  • error_trace (bool | None) –

  • filter_path (str | Sequence[str] | None) –

  • human (bool | None) –

  • body (Mapping[str, Any] | None) –

  • pretty (bool | None) –

Return type:

ObjectApiResponse[Any]