continueConversation method
Future<ChatResponse>
continueConversation(
- String previousResponseId,
- List<
ChatMessage> newMessages, { - List<
Tool> ? tools, - bool background = false,
override
Create a new response that continues from a previous response
This enables stateful conversations where the provider maintains the conversation history automatically.
Implementation
@override
Future<ChatResponse> continueConversation(
String previousResponseId,
List<ChatMessage> newMessages, {
List<Tool>? tools,
bool background = false,
}) async {
// Create a new config with the previous response ID
final updatedConfig =
config.copyWith(previousResponseId: previousResponseId);
final tempResponses = OpenAIResponses(client, updatedConfig);
final requestBody =
tempResponses._buildRequestBody(newMessages, tools, false, background);
final responseData = await client.postJson(responsesEndpoint, requestBody);
return _parseResponse(responseData);
}