estimateReviewCost method

Future<EstimateReviewCostResponse> estimateReviewCost(
  1. EstimateReviewCostRequest request,
  2. String document, {
  3. String? $fields,
})

Estimates what a review of a document would cost on the caller's Gemini API key.

The estimate comes from what past reviews with the same model, depth, and thinking level cost, adjusted to this document's size and repriced at the Gemini API's current list prices. It covers one review attempt that runs to completion, and doesn't include retries after errors.

request - The metadata request object.

Request parameters:

document - Required. The document to review. Value must have pattern ^documents/\[^/\]+$.

$fields - Selector specifying which fields to include in a partial response.

Completes with a EstimateReviewCostResponse.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<EstimateReviewCostResponse> estimateReviewCost(
  EstimateReviewCostRequest request,
  core.String document, {
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    'fields': ?$fields == null ? null : [$fields],
  };

  final url_ =
      'v1/' + core.Uri.encodeFull('$document') + ':estimateReviewCost';

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return EstimateReviewCostResponse.fromJson(
    response_ as core.Map<core.String, core.dynamic>,
  );
}