
prerna.reactor.model.GetMyOpenAiKeyModelsListReactor Maven / Gradle / Ivy
The newest version!
package prerna.reactor.model;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.TreeSet;
import org.json.JSONArray;
import org.json.JSONObject;
import prerna.reactor.AbstractReactor;
import prerna.reactor.utils.GetRequestReactor;
import prerna.sablecc2.om.NounStore;
import prerna.sablecc2.om.PixelDataType;
import prerna.sablecc2.om.ReactorKeysEnum;
import prerna.sablecc2.om.nounmeta.NounMetadata;
public class GetMyOpenAiKeyModelsListReactor extends AbstractReactor {
private static final String OPENAI_MODEL_LIST_ENDPOINT = "https://api.openai.com/v1/models";
public GetMyOpenAiKeyModelsListReactor() {
this.keysToGet = new String[]{"openaiKey" , "organizationId"};
this.keyRequired = new int [] { 1 , 0 };
}
@Override
public NounMetadata execute() {
this.organizeKeys();
String openaiKey = this.keyValue.get(this.keysToGet[0]);
String organizationId = this.keyValue.get(this.keysToGet[1]);
NounStore ns = new NounStore(ReactorKeysEnum.ALL.getKey());
ns.makeNoun(ReactorKeysEnum.URL.getKey()).addLiteral(OPENAI_MODEL_LIST_ENDPOINT);
Map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy