chatWithToolsBackground method

  1. @override
Future<ChatResponse> chatWithToolsBackground(
  1. List<ChatMessage> messages,
  2. List<Tool>? tools
)
override

Create a response with background processing

When background=true, the response will be processed asynchronously. You can retrieve the result later using getResponse() or cancel it with cancelResponse().

Implementation

@override
Future<ChatResponse> chatWithToolsBackground(
  List<ChatMessage> messages,
  List<Tool>? tools,
) async {
  final requestBody = _buildRequestBody(messages, tools, false, true);
  final responseData = await client.postJson(responsesEndpoint, requestBody);
  return _parseResponse(responseData);
}