@@ -54,9 +54,9 @@ public class RemoteLanguageModel {
5454 *
5555 * Creates an instance of the class and sets up the key and the API type.
5656 *
57- * @param keyValue the API key.
58- * @param keyType either openai (default) or cohere or send empty string for
59- * default value.
57+ * @param keyValue the API key.
58+ * @param keyTypeString either openai (default) or cohere or send empty string
59+ * for default value.
6060 *
6161 * @throws IllegalArgumentException if the keyType passed is not "openai".
6262 *
@@ -77,6 +77,22 @@ public RemoteLanguageModel(String keyValue, String keyTypeString) {
7777 }
7878 }
7979
80+ /**
81+ * Constructor for the RemoteLanguageModel class.
82+ *
83+ * Creates an instance of the class and sets up the API key and the enum key
84+ * type.
85+ *
86+ * @param keyValue the API key.
87+ * @param keyType enum version from the key type (SupportedModels).
88+ *
89+ * @throws IllegalArgumentException if the keyType passed is not "openai".
90+ *
91+ */
92+ public RemoteLanguageModel (String keyValue , SupportedLangModels keyType ) {
93+ this .initiate (keyValue , keyType );
94+ }
95+
8096 /**
8197 * Get the supported models names as array of string
8298 *
@@ -85,30 +101,20 @@ public RemoteLanguageModel(String keyValue, String keyTypeString) {
85101 public List <String > getSupportedModels () {
86102 SupportedLangModels [] values = SupportedLangModels .values ();
87103 List <String > enumValues = new ArrayList <>();
88-
104+
89105 for (int i = 0 ; i < values .length ; i ++) {
90106 enumValues .add (values [i ].name ());
91107 }
92-
108+
93109 return enumValues ;
94110 }
95111
96112 /**
97- * Constructor for the RemoteLanguageModel class.
98- *
99- * Creates an instance of the class and sets up the API key and the enum key
100- * type.
101- *
102- * @param keyValue the API key.
103- * @param keyType enum version from the key type (SupportedModels).
104- *
105- * @throws IllegalArgumentException if the keyType passed is not "openai".
113+ * Common function to initiate the class from any constructor.
106114 *
115+ * @param keyValue the API key.
116+ * @param keyType enum version from the key type (SupportedModels).
107117 */
108- public RemoteLanguageModel (String keyValue , SupportedLangModels keyType ) {
109- this .initiate (keyValue , keyType );
110- }
111-
112118 private void initiate (String keyValue , SupportedLangModels keyType ) {
113119 // set the model type
114120 this .keyType = keyType ;
0 commit comments