generateContent method

Implementation

Future<Resp.GenerateContentResponse> generateContent(
    GenerateContentRequest request,
    ) async {
  try {
    final response = await _dio.post(
      "$DOMAIN/${_fullModelName(model)}:generateContent",
      data: request.toJson(),
      options: _createCommonOptions(),
    );

    _validateResponse(response);
    return Resp.GenerateContentResponse.fromJson(response.data as Map<String,dynamic>);
  } catch (error) {
    print("error ${error.toString()}");
    rethrow;
  }
}