v1.0.7 openai with model name and temperature
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:workouttest_util/model/openai.dart';
|
||||
import 'package:workouttest_util/service/api.dart';
|
||||
import 'package:workouttest_util/util/logging.dart';
|
||||
|
||||
@@ -19,4 +21,17 @@ class OpenAIApi with Logging {
|
||||
}
|
||||
return response ?? "";
|
||||
}
|
||||
|
||||
Future<String> getOpenAICompletionWithModel(OpenAI openai) async {
|
||||
String? response;
|
||||
try {
|
||||
String body = const JsonEncoder().convert(openai.toJson());
|
||||
response = await _client.post("openai/completion_with_model", body);
|
||||
} on TimeoutException catch (_) {
|
||||
log("Timeout from OpenAI");
|
||||
} on Exception catch (e) {
|
||||
log(e.toString());
|
||||
}
|
||||
return response ?? "";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user