@@ -934,82 +934,86 @@ public static Response registerRemoteModelWithTTLAndSkipHeapMemCheck(String name
934
934
}
935
935
936
936
private String getConnectorBodyBySkipValidatingMissingParameter (String testCase ) {
937
- return switch (testCase ) {
938
- case "missing" -> completionModelConnectorEntity ;
939
- case "enabled" -> "{\n "
940
- + "\" name\" : \" OpenAI Connector\" ,\n "
941
- + "\" description\" : \" The connector to public OpenAI model service for GPT 3.5\" ,\n "
942
- + "\" version\" : 1,\n "
943
- + "\" client_config\" : {\n "
944
- + " \" max_connection\" : 20,\n "
945
- + " \" connection_timeout\" : 50000,\n "
946
- + " \" read_timeout\" : 50000\n "
947
- + " },\n "
948
- + "\" protocol\" : \" http\" ,\n "
949
- + "\" parameters\" : {\n "
950
- + " \" endpoint\" : \" api.openai.com\" ,\n "
951
- + " \" auth\" : \" API_Key\" ,\n "
952
- + " \" content_type\" : \" application/json\" ,\n "
953
- + " \" max_tokens\" : 7,\n "
954
- + " \" temperature\" : 0,\n "
955
- + " \" model\" : \" gpt-3.5-turbo-instruct\" ,\n "
956
- + " \" skip_validating_missing_parameters\" : \" true\" \n "
957
- + " },\n "
958
- + " \" credential\" : {\n "
959
- + " \" openAI_key\" : \" "
960
- + this .OPENAI_KEY
961
- + "\" \n "
962
- + " },\n "
963
- + " \" actions\" : [\n "
964
- + " {"
965
- + " \" action_type\" : \" predict\" ,\n "
966
- + " \" method\" : \" POST\" ,\n "
967
- + " \" url\" : \" https://${parameters.endpoint}/v1/completions\" ,\n "
968
- + " \" headers\" : {\n "
969
- + " \" Authorization\" : \" Bearer ${credential.openAI_key}\" \n "
970
- + " },\n "
971
- + " \" request_body\" : \" { \\ \" model\\ \" : \\ \" ${parameters.model}\\ \" , \\ \" prompt\\ \" : \\ \" ${parameters.prompt}\\ \" , \\ \" max_tokens\\ \" : ${parameters.max_tokens}, \\ \" temperature\\ \" : ${parameters.temperature} }\" \n "
972
- + " }\n "
973
- + " ]\n "
974
- + "}" ;
975
- case "disabled" -> "{\n "
976
- + "\" name\" : \" OpenAI Connector\" ,\n "
977
- + "\" description\" : \" The connector to public OpenAI model service for GPT 3.5\" ,\n "
978
- + "\" version\" : 1,\n "
979
- + "\" client_config\" : {\n "
980
- + " \" max_connection\" : 20,\n "
981
- + " \" connection_timeout\" : 50000,\n "
982
- + " \" read_timeout\" : 50000\n "
983
- + " },\n "
984
- + "\" protocol\" : \" http\" ,\n "
985
- + "\" parameters\" : {\n "
986
- + " \" endpoint\" : \" api.openai.com\" ,\n "
987
- + " \" auth\" : \" API_Key\" ,\n "
988
- + " \" content_type\" : \" application/json\" ,\n "
989
- + " \" max_tokens\" : 7,\n "
990
- + " \" temperature\" : 0,\n "
991
- + " \" model\" : \" gpt-3.5-turbo-instruct\" ,\n "
992
- + " \" skip_validating_missing_parameters\" : \" false\" \n "
993
- + " },\n "
994
- + " \" credential\" : {\n "
995
- + " \" openAI_key\" : \" "
996
- + this .OPENAI_KEY
997
- + "\" \n "
998
- + " },\n "
999
- + " \" actions\" : [\n "
1000
- + " {"
1001
- + " \" action_type\" : \" predict\" ,\n "
1002
- + " \" method\" : \" POST\" ,\n "
1003
- + " \" url\" : \" https://${parameters.endpoint}/v1/completions\" ,\n "
1004
- + " \" headers\" : {\n "
1005
- + " \" Authorization\" : \" Bearer ${credential.openAI_key}\" \n "
1006
- + " },\n "
1007
- + " \" request_body\" : \" { \\ \" model\\ \" : \\ \" ${parameters.model}\\ \" , \\ \" prompt\\ \" : \\ \" ${parameters.prompt}\\ \" , \\ \" max_tokens\\ \" : ${parameters.max_tokens}, \\ \" temperature\\ \" : ${parameters.temperature} }\" \n "
1008
- + " }\n "
1009
- + " ]\n "
1010
- + "}" ;
1011
- default -> throw new IllegalArgumentException ("Invalid test case" );
1012
- };
937
+ switch (testCase ) {
938
+ case "missing" :
939
+ return completionModelConnectorEntity ;
940
+ case "enabled" :
941
+ return "{\n "
942
+ + "\" name\" : \" OpenAI Connector\" ,\n "
943
+ + "\" description\" : \" The connector to public OpenAI model service for GPT 3.5\" ,\n "
944
+ + "\" version\" : 1,\n "
945
+ + "\" client_config\" : {\n "
946
+ + " \" max_connection\" : 20,\n "
947
+ + " \" connection_timeout\" : 50000,\n "
948
+ + " \" read_timeout\" : 50000\n "
949
+ + " },\n "
950
+ + "\" protocol\" : \" http\" ,\n "
951
+ + "\" parameters\" : {\n "
952
+ + " \" endpoint\" : \" api.openai.com\" ,\n "
953
+ + " \" auth\" : \" API_Key\" ,\n "
954
+ + " \" content_type\" : \" application/json\" ,\n "
955
+ + " \" max_tokens\" : 7,\n "
956
+ + " \" temperature\" : 0,\n "
957
+ + " \" model\" : \" gpt-3.5-turbo-instruct\" ,\n "
958
+ + " \" skip_validating_missing_parameters\" : \" true\" \n "
959
+ + " },\n "
960
+ + " \" credential\" : {\n "
961
+ + " \" openAI_key\" : \" "
962
+ + this .OPENAI_KEY
963
+ + "\" \n "
964
+ + " },\n "
965
+ + " \" actions\" : [\n "
966
+ + " {"
967
+ + " \" action_type\" : \" predict\" ,\n "
968
+ + " \" method\" : \" POST\" ,\n "
969
+ + " \" url\" : \" https://${parameters.endpoint}/v1/completions\" ,\n "
970
+ + " \" headers\" : {\n "
971
+ + " \" Authorization\" : \" Bearer ${credential.openAI_key}\" \n "
972
+ + " },\n "
973
+ + " \" request_body\" : \" { \\ \" model\\ \" : \\ \" ${parameters.model}\\ \" , \\ \" prompt\\ \" : \\ \" ${parameters.prompt}\\ \" , \\ \" max_tokens\\ \" : ${parameters.max_tokens}, \\ \" temperature\\ \" : ${parameters.temperature} }\" \n "
974
+ + " }\n "
975
+ + " ]\n "
976
+ + "}" ;
977
+ case "disabled" :
978
+ return "{\n "
979
+ + "\" name\" : \" OpenAI Connector\" ,\n "
980
+ + "\" description\" : \" The connector to public OpenAI model service for GPT 3.5\" ,\n "
981
+ + "\" version\" : 1,\n "
982
+ + "\" client_config\" : {\n "
983
+ + " \" max_connection\" : 20,\n "
984
+ + " \" connection_timeout\" : 50000,\n "
985
+ + " \" read_timeout\" : 50000\n "
986
+ + " },\n "
987
+ + "\" protocol\" : \" http\" ,\n "
988
+ + "\" parameters\" : {\n "
989
+ + " \" endpoint\" : \" api.openai.com\" ,\n "
990
+ + " \" auth\" : \" API_Key\" ,\n "
991
+ + " \" content_type\" : \" application/json\" ,\n "
992
+ + " \" max_tokens\" : 7,\n "
993
+ + " \" temperature\" : 0,\n "
994
+ + " \" model\" : \" gpt-3.5-turbo-instruct\" ,\n "
995
+ + " \" skip_validating_missing_parameters\" : \" false\" \n "
996
+ + " },\n "
997
+ + " \" credential\" : {\n "
998
+ + " \" openAI_key\" : \" "
999
+ + this .OPENAI_KEY
1000
+ + "\" \n "
1001
+ + " },\n "
1002
+ + " \" actions\" : [\n "
1003
+ + " {"
1004
+ + " \" action_type\" : \" predict\" ,\n "
1005
+ + " \" method\" : \" POST\" ,\n "
1006
+ + " \" url\" : \" https://${parameters.endpoint}/v1/completions\" ,\n "
1007
+ + " \" headers\" : {\n "
1008
+ + " \" Authorization\" : \" Bearer ${credential.openAI_key}\" \n "
1009
+ + " },\n "
1010
+ + " \" request_body\" : \" { \\ \" model\\ \" : \\ \" ${parameters.model}\\ \" , \\ \" prompt\\ \" : \\ \" ${parameters.prompt}\\ \" , \\ \" max_tokens\\ \" : ${parameters.max_tokens}, \\ \" temperature\\ \" : ${parameters.temperature} }\" \n "
1011
+ + " }\n "
1012
+ + " ]\n "
1013
+ + "}" ;
1014
+ default :
1015
+ throw new IllegalArgumentException ("Invalid test case" );
1016
+ }
1013
1017
}
1014
1018
1015
1019
public static Response registerRemoteModelWithInterface (String name , String connectorId , String testCase ) throws IOException {
0 commit comments