Skip to content

Commit 4d918d9

Browse files
Auto-generated API code
1 parent 3b22767 commit 4d918d9

File tree

2 files changed

+0
-276
lines changed

2 files changed

+0
-276
lines changed

Diff for: elasticsearch/_async/client/inference.py

-138
Original file line numberDiff line numberDiff line change
@@ -351,67 +351,6 @@ async def inference(
351351
path_parts=__path_parts,
352352
)
353353

354-
@_rewrite_parameters(
355-
body_name="chat_completion_request",
356-
)
357-
async def post_eis_chat_completion(
358-
self,
359-
*,
360-
eis_inference_id: str,
361-
chat_completion_request: t.Optional[t.Mapping[str, t.Any]] = None,
362-
body: t.Optional[t.Mapping[str, t.Any]] = None,
363-
error_trace: t.Optional[bool] = None,
364-
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
365-
human: t.Optional[bool] = None,
366-
pretty: t.Optional[bool] = None,
367-
) -> ObjectApiResponse[t.Any]:
368-
"""
369-
.. raw:: html
370-
371-
<p>Perform a chat completion task through the Elastic Inference Service (EIS).</p>
372-
<p>Perform a chat completion inference task with the <code>elastic</code> service.</p>
373-
374-
375-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-post-eis-chat-completion>`_
376-
377-
:param eis_inference_id: The unique identifier of the inference endpoint.
378-
:param chat_completion_request:
379-
"""
380-
if eis_inference_id in SKIP_IN_PATH:
381-
raise ValueError("Empty value passed for parameter 'eis_inference_id'")
382-
if chat_completion_request is None and body is None:
383-
raise ValueError(
384-
"Empty value passed for parameters 'chat_completion_request' and 'body', one of them should be set."
385-
)
386-
elif chat_completion_request is not None and body is not None:
387-
raise ValueError("Cannot set both 'chat_completion_request' and 'body'")
388-
__path_parts: t.Dict[str, str] = {"eis_inference_id": _quote(eis_inference_id)}
389-
__path = (
390-
f'/_inference/chat_completion/{__path_parts["eis_inference_id"]}/_stream'
391-
)
392-
__query: t.Dict[str, t.Any] = {}
393-
if error_trace is not None:
394-
__query["error_trace"] = error_trace
395-
if filter_path is not None:
396-
__query["filter_path"] = filter_path
397-
if human is not None:
398-
__query["human"] = human
399-
if pretty is not None:
400-
__query["pretty"] = pretty
401-
__body = (
402-
chat_completion_request if chat_completion_request is not None else body
403-
)
404-
__headers = {"accept": "application/json", "content-type": "application/json"}
405-
return await self.perform_request( # type: ignore[return-value]
406-
"POST",
407-
__path,
408-
params=__query,
409-
headers=__headers,
410-
body=__body,
411-
endpoint_id="inference.post_eis_chat_completion",
412-
path_parts=__path_parts,
413-
)
414-
415354
@_rewrite_parameters(
416355
body_name="inference_config",
417356
)
@@ -1088,83 +1027,6 @@ async def put_cohere(
10881027
path_parts=__path_parts,
10891028
)
10901029

1091-
@_rewrite_parameters(
1092-
body_fields=("service", "service_settings"),
1093-
)
1094-
async def put_eis(
1095-
self,
1096-
*,
1097-
task_type: t.Union[str, t.Literal["chat_completion"]],
1098-
eis_inference_id: str,
1099-
service: t.Optional[t.Union[str, t.Literal["elastic"]]] = None,
1100-
service_settings: t.Optional[t.Mapping[str, t.Any]] = None,
1101-
error_trace: t.Optional[bool] = None,
1102-
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1103-
human: t.Optional[bool] = None,
1104-
pretty: t.Optional[bool] = None,
1105-
body: t.Optional[t.Dict[str, t.Any]] = None,
1106-
) -> ObjectApiResponse[t.Any]:
1107-
"""
1108-
.. raw:: html
1109-
1110-
<p>Create an Elastic Inference Service (EIS) inference endpoint.</p>
1111-
<p>Create an inference endpoint to perform an inference task through the Elastic Inference Service (EIS).</p>
1112-
1113-
1114-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-eis>`_
1115-
1116-
:param task_type: The type of the inference task that the model will perform.
1117-
NOTE: The `chat_completion` task type only supports streaming and only through
1118-
the _stream API.
1119-
:param eis_inference_id: The unique identifier of the inference endpoint.
1120-
:param service: The type of service supported for the specified task type. In
1121-
this case, `elastic`.
1122-
:param service_settings: Settings used to install the inference model. These
1123-
settings are specific to the `elastic` service.
1124-
"""
1125-
if task_type in SKIP_IN_PATH:
1126-
raise ValueError("Empty value passed for parameter 'task_type'")
1127-
if eis_inference_id in SKIP_IN_PATH:
1128-
raise ValueError("Empty value passed for parameter 'eis_inference_id'")
1129-
if service is None and body is None:
1130-
raise ValueError("Empty value passed for parameter 'service'")
1131-
if service_settings is None and body is None:
1132-
raise ValueError("Empty value passed for parameter 'service_settings'")
1133-
__path_parts: t.Dict[str, str] = {
1134-
"task_type": _quote(task_type),
1135-
"eis_inference_id": _quote(eis_inference_id),
1136-
}
1137-
__path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["eis_inference_id"]}'
1138-
__query: t.Dict[str, t.Any] = {}
1139-
__body: t.Dict[str, t.Any] = body if body is not None else {}
1140-
if error_trace is not None:
1141-
__query["error_trace"] = error_trace
1142-
if filter_path is not None:
1143-
__query["filter_path"] = filter_path
1144-
if human is not None:
1145-
__query["human"] = human
1146-
if pretty is not None:
1147-
__query["pretty"] = pretty
1148-
if not __body:
1149-
if service is not None:
1150-
__body["service"] = service
1151-
if service_settings is not None:
1152-
__body["service_settings"] = service_settings
1153-
if not __body:
1154-
__body = None # type: ignore[assignment]
1155-
__headers = {"accept": "application/json"}
1156-
if __body is not None:
1157-
__headers["content-type"] = "application/json"
1158-
return await self.perform_request( # type: ignore[return-value]
1159-
"PUT",
1160-
__path,
1161-
params=__query,
1162-
headers=__headers,
1163-
body=__body,
1164-
endpoint_id="inference.put_eis",
1165-
path_parts=__path_parts,
1166-
)
1167-
11681030
@_rewrite_parameters(
11691031
body_fields=(
11701032
"service",

Diff for: elasticsearch/_sync/client/inference.py

-138
Original file line numberDiff line numberDiff line change
@@ -351,67 +351,6 @@ def inference(
351351
path_parts=__path_parts,
352352
)
353353

354-
@_rewrite_parameters(
355-
body_name="chat_completion_request",
356-
)
357-
def post_eis_chat_completion(
358-
self,
359-
*,
360-
eis_inference_id: str,
361-
chat_completion_request: t.Optional[t.Mapping[str, t.Any]] = None,
362-
body: t.Optional[t.Mapping[str, t.Any]] = None,
363-
error_trace: t.Optional[bool] = None,
364-
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
365-
human: t.Optional[bool] = None,
366-
pretty: t.Optional[bool] = None,
367-
) -> ObjectApiResponse[t.Any]:
368-
"""
369-
.. raw:: html
370-
371-
<p>Perform a chat completion task through the Elastic Inference Service (EIS).</p>
372-
<p>Perform a chat completion inference task with the <code>elastic</code> service.</p>
373-
374-
375-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-post-eis-chat-completion>`_
376-
377-
:param eis_inference_id: The unique identifier of the inference endpoint.
378-
:param chat_completion_request:
379-
"""
380-
if eis_inference_id in SKIP_IN_PATH:
381-
raise ValueError("Empty value passed for parameter 'eis_inference_id'")
382-
if chat_completion_request is None and body is None:
383-
raise ValueError(
384-
"Empty value passed for parameters 'chat_completion_request' and 'body', one of them should be set."
385-
)
386-
elif chat_completion_request is not None and body is not None:
387-
raise ValueError("Cannot set both 'chat_completion_request' and 'body'")
388-
__path_parts: t.Dict[str, str] = {"eis_inference_id": _quote(eis_inference_id)}
389-
__path = (
390-
f'/_inference/chat_completion/{__path_parts["eis_inference_id"]}/_stream'
391-
)
392-
__query: t.Dict[str, t.Any] = {}
393-
if error_trace is not None:
394-
__query["error_trace"] = error_trace
395-
if filter_path is not None:
396-
__query["filter_path"] = filter_path
397-
if human is not None:
398-
__query["human"] = human
399-
if pretty is not None:
400-
__query["pretty"] = pretty
401-
__body = (
402-
chat_completion_request if chat_completion_request is not None else body
403-
)
404-
__headers = {"accept": "application/json", "content-type": "application/json"}
405-
return self.perform_request( # type: ignore[return-value]
406-
"POST",
407-
__path,
408-
params=__query,
409-
headers=__headers,
410-
body=__body,
411-
endpoint_id="inference.post_eis_chat_completion",
412-
path_parts=__path_parts,
413-
)
414-
415354
@_rewrite_parameters(
416355
body_name="inference_config",
417356
)
@@ -1088,83 +1027,6 @@ def put_cohere(
10881027
path_parts=__path_parts,
10891028
)
10901029

1091-
@_rewrite_parameters(
1092-
body_fields=("service", "service_settings"),
1093-
)
1094-
def put_eis(
1095-
self,
1096-
*,
1097-
task_type: t.Union[str, t.Literal["chat_completion"]],
1098-
eis_inference_id: str,
1099-
service: t.Optional[t.Union[str, t.Literal["elastic"]]] = None,
1100-
service_settings: t.Optional[t.Mapping[str, t.Any]] = None,
1101-
error_trace: t.Optional[bool] = None,
1102-
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1103-
human: t.Optional[bool] = None,
1104-
pretty: t.Optional[bool] = None,
1105-
body: t.Optional[t.Dict[str, t.Any]] = None,
1106-
) -> ObjectApiResponse[t.Any]:
1107-
"""
1108-
.. raw:: html
1109-
1110-
<p>Create an Elastic Inference Service (EIS) inference endpoint.</p>
1111-
<p>Create an inference endpoint to perform an inference task through the Elastic Inference Service (EIS).</p>
1112-
1113-
1114-
`<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-eis>`_
1115-
1116-
:param task_type: The type of the inference task that the model will perform.
1117-
NOTE: The `chat_completion` task type only supports streaming and only through
1118-
the _stream API.
1119-
:param eis_inference_id: The unique identifier of the inference endpoint.
1120-
:param service: The type of service supported for the specified task type. In
1121-
this case, `elastic`.
1122-
:param service_settings: Settings used to install the inference model. These
1123-
settings are specific to the `elastic` service.
1124-
"""
1125-
if task_type in SKIP_IN_PATH:
1126-
raise ValueError("Empty value passed for parameter 'task_type'")
1127-
if eis_inference_id in SKIP_IN_PATH:
1128-
raise ValueError("Empty value passed for parameter 'eis_inference_id'")
1129-
if service is None and body is None:
1130-
raise ValueError("Empty value passed for parameter 'service'")
1131-
if service_settings is None and body is None:
1132-
raise ValueError("Empty value passed for parameter 'service_settings'")
1133-
__path_parts: t.Dict[str, str] = {
1134-
"task_type": _quote(task_type),
1135-
"eis_inference_id": _quote(eis_inference_id),
1136-
}
1137-
__path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["eis_inference_id"]}'
1138-
__query: t.Dict[str, t.Any] = {}
1139-
__body: t.Dict[str, t.Any] = body if body is not None else {}
1140-
if error_trace is not None:
1141-
__query["error_trace"] = error_trace
1142-
if filter_path is not None:
1143-
__query["filter_path"] = filter_path
1144-
if human is not None:
1145-
__query["human"] = human
1146-
if pretty is not None:
1147-
__query["pretty"] = pretty
1148-
if not __body:
1149-
if service is not None:
1150-
__body["service"] = service
1151-
if service_settings is not None:
1152-
__body["service_settings"] = service_settings
1153-
if not __body:
1154-
__body = None # type: ignore[assignment]
1155-
__headers = {"accept": "application/json"}
1156-
if __body is not None:
1157-
__headers["content-type"] = "application/json"
1158-
return self.perform_request( # type: ignore[return-value]
1159-
"PUT",
1160-
__path,
1161-
params=__query,
1162-
headers=__headers,
1163-
body=__body,
1164-
endpoint_id="inference.put_eis",
1165-
path_parts=__path_parts,
1166-
)
1167-
11681030
@_rewrite_parameters(
11691031
body_fields=(
11701032
"service",

0 commit comments

Comments
 (0)