getCodeAsk method

Future<AskAnswer?> getCodeAsk({
  1. String? q,
  2. String? repo,
})

Answers a question about the caller org's code with a CITED answer: retrieval packs grounding context, then the synthesizer writes the answer over exactly those spans, which come back alongside it.

Answers a question about the caller org's code with a CITED answer: retrieval packs grounding context, then the synthesizer writes the answer over exactly those spans, which come back alongside it. It never answers without grounding — with no matched code the answer is empty and says so, and with no synthesizer available the citations still come back with "degraded": true so the caller can reason over the spans itself.

Parameters:

  • String q: Q is the question to answer. Required, max 4000 bytes.

  • String repo: Repo narrows retrieval to one repository. Empty searches every repo the org has indexed.

Implementation

Future<AskAnswer?> getCodeAsk({ String? q, String? repo, }) async {
  final response = await getCodeAskWithHttpInfo( q: q, repo: repo, );
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AskAnswer',) as AskAnswer;

  }
  return null;
}