Skip to content

Commit d5d0c19

Browse files
Add ML Commons smoke tests (#5369)
Signed-off-by: rithin-pullela-aws <rithinp@amazon.com>
1 parent 5a0cb91 commit d5d0c19

File tree

4 files changed

+274
-0
lines changed

4 files changed

+274
-0
lines changed

manifests/3.0.0-alpha1/opensearch-3.0.0-alpha1-test.yml

+2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ components:
9090
test-configs:
9191
- with-security
9292
- without-security
93+
smoke-test:
94+
test-spec: ml-commons.yml
9395
- name: opensearch-learning-to-rank-base
9496
integ-test:
9597
test-configs:

manifests/3.0.0-beta1/opensearch-3.0.0-beta1-test.yml

+2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ components:
9090
test-configs:
9191
- with-security
9292
- without-security
93+
smoke-test:
94+
test-spec: ml-commons.yml
9395
- name: opensearch-learning-to-rank-base
9496
integ-test:
9597
test-configs:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
---
2+
info:
3+
title: OpenSearch ml-commons plugin smoke tests
4+
version: 2.x
5+
name: ml-commons
6+
paths:
7+
/_plugins/_ml/models/_register:
8+
POST:
9+
parameters: [
10+
{
11+
'name': 'openAI-GPT-3.5 model with a connector',
12+
'function_name': 'remote',
13+
'description': 'test model',
14+
'connector': {
15+
'name': 'OpenAI Connector',
16+
'description': 'The connector to public OpenAI model service for GPT 3.5',
17+
'version': 1,
18+
'protocol': 'http',
19+
'parameters': {
20+
'endpoint': 'api.openai.com',
21+
'max_tokens': 7,
22+
'temperature': 0,
23+
'model': 'text-davinci-003'
24+
},
25+
'credential': {
26+
'openAI_key': '...'
27+
},
28+
'actions': [
29+
{
30+
'action_type': 'predict',
31+
'method': 'POST',
32+
'url': 'https://${parameters.endpoint}/v1/completions',
33+
'headers': {
34+
'Authorization': 'Bearer ${credential.openAI_key}'
35+
},
36+
'request_body': '{ "model": "${parameters.model}", "prompt": "${parameters.prompt}", "max_tokens": ${parameters.max_tokens}, "temperature": ${parameters.temperature} }'
37+
}
38+
]
39+
}
40+
}
41+
]
42+
/_plugins/_ml/stats:
43+
GET:
44+
parameters: []
45+
/_plugins/_ml/stats/ml_request_count:
46+
GET:
47+
parameters: []
48+
/iris_data_train_predict_it:
49+
PUT:
50+
parameters: []
51+
/_bulk?refresh=true:
52+
POST:
53+
parameters: [
54+
{
55+
'index':
56+
{
57+
'_index': 'iris_data_train_predict_it',
58+
'_id': '1'
59+
}
60+
},
61+
{
62+
'sepal_length_in_cm': 5.1,
63+
'sepal_width_in_cm': 3.5,
64+
'petal_length_in_cm': 1.4,
65+
'petal_width_in_cm': 0.2,
66+
'class': 'Iris-setosa'
67+
},
68+
{
69+
'index':
70+
{
71+
'_index': 'iris_data_train_predict_it',
72+
'_id': '2'
73+
}
74+
},
75+
{
76+
'sepal_length_in_cm': 4.9,
77+
'sepal_width_in_cm': 3.0,
78+
'petal_length_in_cm': 1.4,
79+
'petal_width_in_cm': 0.2,
80+
'class': 'Iris-setosa'
81+
},
82+
{
83+
'index':
84+
{
85+
'_index': 'iris_data_train_predict_it',
86+
'_id': '3'
87+
}
88+
},
89+
{
90+
'sepal_length_in_cm': 4.7,
91+
'sepal_width_in_cm': 3.2,
92+
'petal_length_in_cm': 1.3,
93+
'petal_width_in_cm': 0.2,
94+
'class': 'Iris-setosa'
95+
},
96+
{
97+
'index':
98+
{
99+
'_index': 'iris_data_train_predict_it',
100+
'_id': '4'
101+
}
102+
},
103+
{
104+
'sepal_length_in_cm': 4.6,
105+
'sepal_width_in_cm': 3.1,
106+
'petal_length_in_cm': 1.5,
107+
'petal_width_in_cm': 0.2,
108+
'class': 'Iris-setosa'
109+
}
110+
]
111+
/_cluster/settings:
112+
PUT:
113+
parameters: [
114+
{
115+
'persistent': {
116+
'plugins.ml_commons.only_run_on_ml_node': false
117+
}
118+
}
119+
]
120+
/_plugins/_ml/_train/kmeans:
121+
POST:
122+
parameters: [
123+
{
124+
'parameters': {
125+
'centroids': 3,
126+
'iterations': 10,
127+
'distance_type': 'COSINE'
128+
},
129+
'input_query': {
130+
'_source': ['petal_length_in_cm', 'petal_width_in_cm'],
131+
'size': 10000
132+
},
133+
'input_index': ['iris_data_train_predict_it']
134+
}
135+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
---
2+
info:
3+
title: OpenSearch ml-commons plugin smoke tests
4+
version: default
5+
name: ml-commons
6+
paths:
7+
/_plugins/_ml/models/_register:
8+
POST:
9+
parameters: [
10+
{
11+
'name': 'openAI-GPT-3.5 model with a connector',
12+
'function_name': 'remote',
13+
'description': 'test model',
14+
'connector': {
15+
'name': 'OpenAI Connector',
16+
'description': 'The connector to public OpenAI model service for GPT 3.5',
17+
'version': 1,
18+
'protocol': 'http',
19+
'parameters': {
20+
'endpoint': 'api.openai.com',
21+
'max_tokens': 7,
22+
'temperature': 0,
23+
'model': 'text-davinci-003'
24+
},
25+
'credential': {
26+
'openAI_key': '...'
27+
},
28+
'actions': [
29+
{
30+
'action_type': 'predict',
31+
'method': 'POST',
32+
'url': 'https://${parameters.endpoint}/v1/completions',
33+
'headers': {
34+
'Authorization': 'Bearer ${credential.openAI_key}'
35+
},
36+
'request_body': '{ "model": "${parameters.model}", "prompt": "${parameters.prompt}", "max_tokens": ${parameters.max_tokens}, "temperature": ${parameters.temperature} }'
37+
}
38+
]
39+
}
40+
}
41+
]
42+
/_plugins/_ml/stats:
43+
GET:
44+
parameters: []
45+
/_plugins/_ml/stats/ml_request_count:
46+
GET:
47+
parameters: []
48+
/iris_data_train_predict_it:
49+
PUT:
50+
parameters: []
51+
/_bulk?refresh=true:
52+
POST:
53+
parameters: [
54+
{
55+
'index':
56+
{
57+
'_index': 'iris_data_train_predict_it',
58+
'_id': '1'
59+
}
60+
},
61+
{
62+
'sepal_length_in_cm': 5.1,
63+
'sepal_width_in_cm': 3.5,
64+
'petal_length_in_cm': 1.4,
65+
'petal_width_in_cm': 0.2,
66+
'class': 'Iris-setosa'
67+
},
68+
{
69+
'index':
70+
{
71+
'_index': 'iris_data_train_predict_it',
72+
'_id': '2'
73+
}
74+
},
75+
{
76+
'sepal_length_in_cm': 4.9,
77+
'sepal_width_in_cm': 3.0,
78+
'petal_length_in_cm': 1.4,
79+
'petal_width_in_cm': 0.2,
80+
'class': 'Iris-setosa'
81+
},
82+
{
83+
'index':
84+
{
85+
'_index': 'iris_data_train_predict_it',
86+
'_id': '3'
87+
}
88+
},
89+
{
90+
'sepal_length_in_cm': 4.7,
91+
'sepal_width_in_cm': 3.2,
92+
'petal_length_in_cm': 1.3,
93+
'petal_width_in_cm': 0.2,
94+
'class': 'Iris-setosa'
95+
},
96+
{
97+
'index':
98+
{
99+
'_index': 'iris_data_train_predict_it',
100+
'_id': '4'
101+
}
102+
},
103+
{
104+
'sepal_length_in_cm': 4.6,
105+
'sepal_width_in_cm': 3.1,
106+
'petal_length_in_cm': 1.5,
107+
'petal_width_in_cm': 0.2,
108+
'class': 'Iris-setosa'
109+
}
110+
]
111+
/_cluster/settings:
112+
PUT:
113+
parameters: [
114+
{
115+
'persistent': {
116+
'plugins.ml_commons.only_run_on_ml_node': false
117+
}
118+
}
119+
]
120+
/_plugins/_ml/_train/kmeans:
121+
POST:
122+
parameters: [
123+
{
124+
'parameters': {
125+
'centroids': 3,
126+
'iterations': 10,
127+
'distance_type': 'COSINE'
128+
},
129+
'input_query': {
130+
'_source': ['petal_length_in_cm', 'petal_width_in_cm'],
131+
'size': 10000
132+
},
133+
'input_index': ['iris_data_train_predict_it']
134+
}
135+
]

0 commit comments

Comments
 (0)