chatSync method Null safety
Sends a prompt without streaming and returns the full response.
Uses the non-streaming API endpoint. More efficient for short responses where real-time display is not needed.
Implementation
Future<String> chatSync(String prompt, {bool addToHistory = true}) async {
if (addToHistory) {
_conversationHistory.add({'role': 'user', 'content': prompt});
}
final response = await _performNonStream(prompt);
if (addToHistory) {
_conversationHistory.add({'role': 'assistant', 'content': response});
}
return response;
}