@@ -87,23 +87,31 @@ public void constructor_NullMethod() {
87
87
88
88
@ Test
89
89
public void connectorWithNullPreProcessFunction () {
90
- var action = new ConnectorAction (TEST_ACTION_TYPE , TEST_METHOD_HTTP , OPENAI_URL , null , TEST_REQUEST_BODY , null , null );
90
+ ConnectorAction action = new ConnectorAction (TEST_ACTION_TYPE , TEST_METHOD_HTTP , OPENAI_URL , null , TEST_REQUEST_BODY , null , null );
91
91
action .validatePrePostProcessFunctions (Map .of ());
92
92
assertNotNull (action );
93
93
}
94
94
95
95
@ Test
96
96
public void connectorWithCustomPainlessScriptPreProcessFunction () {
97
- var preProcessFunction =
97
+ String preProcessFunction =
98
98
"\" \\ n StringBuilder builder = new StringBuilder();\\ n builder.append(\\ \" \\ \\ \\ \" \\ \" );\\ n String first = params.text_docs[0];\\ n builder.append(first);\\ n builder.append(\\ \" \\ \\ \\ \" \\ \" );\\ n def parameters = \\ \" {\\ \" +\\ \" \\ \\ \\ \" text_inputs\\ \\ \\ \" :\\ \" + builder + \\ \" }\\ \" ;\\ n return \\ \" {\\ \" +\\ \" \\ \\ \\ \" parameters\\ \\ \\ \" :\\ \" + parameters + \\ \" }\\ \" ;\" " ;
99
- var action = new ConnectorAction (TEST_ACTION_TYPE , TEST_METHOD_HTTP , OPENAI_URL , null , TEST_REQUEST_BODY , preProcessFunction , null );
99
+ ConnectorAction action = new ConnectorAction (
100
+ TEST_ACTION_TYPE ,
101
+ TEST_METHOD_HTTP ,
102
+ OPENAI_URL ,
103
+ null ,
104
+ TEST_REQUEST_BODY ,
105
+ preProcessFunction ,
106
+ null
107
+ );
100
108
action .validatePrePostProcessFunctions (null );
101
109
assertNotNull (action );
102
110
}
103
111
104
112
@ Test
105
113
public void openAIConnectorWithCorrectInBuiltPrePostProcessFunction () {
106
- var action = new ConnectorAction (
114
+ ConnectorAction action = new ConnectorAction (
107
115
TEST_ACTION_TYPE ,
108
116
TEST_METHOD_HTTP ,
109
117
"https://${parameters.endpoint}/v1/chat/completions" ,
@@ -118,7 +126,7 @@ public void openAIConnectorWithCorrectInBuiltPrePostProcessFunction() {
118
126
119
127
@ Test
120
128
public void openAIConnectorWithWrongInBuiltPrePostProcessFunction () {
121
- var action1 = new ConnectorAction (
129
+ ConnectorAction action1 = new ConnectorAction (
122
130
TEST_ACTION_TYPE ,
123
131
TEST_METHOD_HTTP ,
124
132
OPENAI_URL ,
@@ -132,7 +140,7 @@ public void openAIConnectorWithWrongInBuiltPrePostProcessFunction() {
132
140
"LLM service is openai, so PreProcessFunction should be connector.pre_process.openai.embedding" ,
133
141
exception .getMessage ()
134
142
);
135
- var action2 = new ConnectorAction (
143
+ ConnectorAction action2 = new ConnectorAction (
136
144
TEST_ACTION_TYPE ,
137
145
TEST_METHOD_HTTP ,
138
146
OPENAI_URL ,
@@ -150,7 +158,7 @@ public void openAIConnectorWithWrongInBuiltPrePostProcessFunction() {
150
158
151
159
@ Test
152
160
public void cohereConnectorWithCorrectInBuiltPrePostProcessFunction () {
153
- var action = new ConnectorAction (
161
+ ConnectorAction action = new ConnectorAction (
154
162
TEST_ACTION_TYPE ,
155
163
TEST_METHOD_HTTP ,
156
164
COHERE_URL ,
@@ -187,7 +195,7 @@ public void cohereConnectorWithCorrectInBuiltPrePostProcessFunction() {
187
195
188
196
@ Test
189
197
public void cohereConnectorWithWrongInBuiltPrePostProcessFunction () {
190
- var action1 = new ConnectorAction (
198
+ ConnectorAction action1 = new ConnectorAction (
191
199
TEST_ACTION_TYPE ,
192
200
TEST_METHOD_HTTP ,
193
201
COHERE_URL ,
@@ -202,7 +210,7 @@ public void cohereConnectorWithWrongInBuiltPrePostProcessFunction() {
202
210
+ " or connector.pre_process.cohere.multimodal_embedding or connector.pre_process.cohere.rerank" ,
203
211
exception .getMessage ()
204
212
);
205
- var action2 = new ConnectorAction (
213
+ ConnectorAction action2 = new ConnectorAction (
206
214
TEST_ACTION_TYPE ,
207
215
TEST_METHOD_HTTP ,
208
216
COHERE_URL ,
@@ -221,7 +229,7 @@ public void cohereConnectorWithWrongInBuiltPrePostProcessFunction() {
221
229
222
230
@ Test
223
231
public void bedrockConnectorWithCorrectInBuiltPrePostProcessFunction () {
224
- var action = new ConnectorAction (
232
+ ConnectorAction action = new ConnectorAction (
225
233
TEST_ACTION_TYPE ,
226
234
TEST_METHOD_HTTP ,
227
235
BEDROCK_URL ,
@@ -258,7 +266,7 @@ public void bedrockConnectorWithCorrectInBuiltPrePostProcessFunction() {
258
266
259
267
@ Test
260
268
public void bedrockConnectorWithWrongInBuiltPrePostProcessFunction () {
261
- var action1 = new ConnectorAction (
269
+ ConnectorAction action1 = new ConnectorAction (
262
270
TEST_ACTION_TYPE ,
263
271
TEST_METHOD_HTTP ,
264
272
BEDROCK_URL ,
@@ -273,7 +281,7 @@ public void bedrockConnectorWithWrongInBuiltPrePostProcessFunction() {
273
281
+ " or connector.pre_process.bedrock.multimodal_embedding or connector.pre_process.bedrock.rerank" ,
274
282
exception .getMessage ()
275
283
);
276
- var action2 = new ConnectorAction (
284
+ ConnectorAction action2 = new ConnectorAction (
277
285
TEST_ACTION_TYPE ,
278
286
TEST_METHOD_HTTP ,
279
287
BEDROCK_URL ,
@@ -292,7 +300,7 @@ public void bedrockConnectorWithWrongInBuiltPrePostProcessFunction() {
292
300
293
301
@ Test
294
302
public void sagemakerConnectorWithCorrectInBuiltPrePostProcessFunction () {
295
- var action = new ConnectorAction (
303
+ ConnectorAction action = new ConnectorAction (
296
304
TEST_ACTION_TYPE ,
297
305
TEST_METHOD_HTTP ,
298
306
SAGEMAKER_URL ,
@@ -318,7 +326,7 @@ public void sagemakerConnectorWithCorrectInBuiltPrePostProcessFunction() {
318
326
319
327
@ Test
320
328
public void sagemakerConnectorWithWrongInBuiltPrePostProcessFunction () {
321
- var action1 = new ConnectorAction (
329
+ ConnectorAction action1 = new ConnectorAction (
322
330
TEST_ACTION_TYPE ,
323
331
TEST_METHOD_HTTP ,
324
332
SAGEMAKER_URL ,
@@ -333,7 +341,7 @@ public void sagemakerConnectorWithWrongInBuiltPrePostProcessFunction() {
333
341
+ " or connector.pre_process.default.rerank" ,
334
342
exception .getMessage ()
335
343
);
336
- var action2 = new ConnectorAction (
344
+ ConnectorAction action2 = new ConnectorAction (
337
345
TEST_ACTION_TYPE ,
338
346
TEST_METHOD_HTTP ,
339
347
SAGEMAKER_URL ,
0 commit comments