This commit is contained in:
Tibor Bossanyi
2023-04-03 16:41:22 +02:00
parent ec2f6bc907
commit 391551f57b
6 changed files with 21 additions and 7 deletions
+6 -3
View File
@@ -1,10 +1,13 @@
class OpenAIChat {
int id = 0;
late String messages; // JSON of ChatMessage
String modelName = "gpt-3.5-turbo";
double temperature = 0.1;
late String modelName;
late double temperature;
OpenAIChat(this.messages, {String? modelName, double? temperature});
OpenAIChat(this.messages, {String? modelName, double? temperature}) {
this.modelName = modelName ?? "gpt-3.5-turbo";
this.temperature = temperature ?? 0.1;
}
OpenAIChat.fromJson(Map json) {
id = json["id"];
+4
View File
@@ -7,6 +7,10 @@ import 'package:workouttest_util/service/api.dart';
import 'package:workouttest_util/util/logging.dart';
class OpenAIApi with Logging {
final String modelDavinci = "text-davinci-003";
final String modelGpt35 = "gpt-3.5-turbo";
final String modelGpt4 = "gpt-4-32k";
final String modelAda = "text-embedding-ada-002";
final APIClient _client = APIClient();
Future<String> getOpenAICompletion(String question) async {
+1 -1
View File
@@ -111,7 +111,7 @@ class APIWebClient with Common, Logging {
log(" ------------get response code: ${result.statusCode}");
if (result.statusCode == 200) {
return utf8.decode(result.bodyBytes);
return result.body;
} else if (result.statusCode == 404) {
throw const NotFoundException(message: "Not Found");
} else {