getChatResponse method
Future<ChatResponse>
getChatResponse({
- required Iterable<
ChatMessage> messages, - ChatOptions? options,
- CancellationToken? cancellationToken,
override
Sends a chat request and returns the complete response.
Implementation
@override
Future<ChatResponse> getChatResponse({
required Iterable<ChatMessage> messages,
ChatOptions? options,
CancellationToken? cancellationToken,
}) async {
final key = getCacheKey(messages, options);
final cached = await getCachedResponse(key);
if (cached != null) return cached;
final response = await super.getChatResponse(
messages: messages,
options: options,
cancellationToken: cancellationToken,
);
await setCachedResponse(key, response);
return response;
}