import 'dart:async'; import 'package:workouttest_util/service/api.dart'; import 'package:workouttest_util/util/logging.dart'; class OpenAIApi with Logging { final APIClient _client = APIClient(); Future getOpenAICompletion(String question) async { String? response; try { final body = await _client.post("openai/completion", question); response = body; } on TimeoutException catch (_) { log("Timeout from OpenAI"); } on Exception catch (e) { log(e.toString()); } return response ?? ""; } }