OpenAI: added model option

This commit is contained in:
M66B
2023-03-08 20:34:39 +01:00
parent 6b819dcd64
commit 7939ee1658
5 changed files with 58 additions and 6 deletions

View File

@@ -53,7 +53,7 @@ public class OpenAI {
return (enabled && !TextUtils.isEmpty(apikey));
}
static Message[] completeChat(Context context, Message[] messages, int n) throws JSONException, IOException {
static Message[] completeChat(Context context, String model, Message[] messages, int n) throws JSONException, IOException {
// https://platform.openai.com/docs/guides/chat/introduction
// https://platform.openai.com/docs/api-reference/chat/create
@@ -66,7 +66,7 @@ public class OpenAI {
}
JSONObject jquestion = new JSONObject();
jquestion.put("model", "gpt-3.5-turbo");
jquestion.put("model", model);
jquestion.put("messages", jmessages);
jquestion.put("n", n);
JSONObject jresponse = call(context, "v1/chat/completions", jquestion);