1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | /** |
6: | * Copyright OpenSearch Contributors |
7: | * SPDX-License-Identifier: Apache-2.0 |
8: | * |
9: | * The OpenSearch Contributors require contributions made to |
10: | * this file be licensed under the Apache-2.0 license or a |
11: | * compatible open source license. |
12: | */ |
13: | |
14: | namespace OpenSearch\Endpoints\Ml; |
15: | |
16: | use OpenSearch\Common\Exceptions\RuntimeException; |
17: | use OpenSearch\Endpoints\AbstractEndpoint; |
18: | |
19: | class Predict extends AbstractEndpoint |
20: | { |
21: | /** |
22: | * @return string[] |
23: | */ |
24: | public function getParamWhitelist(): array |
25: | { |
26: | return []; |
27: | } |
28: | |
29: | /** |
30: | * @return string |
31: | */ |
32: | public function getURI(): string |
33: | { |
34: | if ($this->id) { |
35: | return "/_plugins/_ml/models/$this->id/_predict"; |
36: | } |
37: | |
38: | throw new RuntimeException( |
39: | 'id is required for predict' |
40: | ); |
41: | |
42: | } |
43: | |
44: | /** |
45: | * @return string |
46: | */ |
47: | public function getMethod(): string |
48: | { |
49: | return 'POST'; |
50: | } |
51: | } |
52: |