validate method

void validate()

Implementation

void validate() {
  if (hasTopK() && (topK < 1)) {
    throw SDKException.validationFailed(
      'top_k must be >= 1 (got $topK)',
      fieldPath: 'RAGRetrievalOptions.top_k',
    );
  }
  if (hasScoreThreshold() && (!scoreThreshold.isFinite || scoreThreshold < 0.0 || scoreThreshold > 1.0)) {
    throw SDKException.validationFailed(
      'score_threshold must be in 0.0...1.0 (got $scoreThreshold)',
      fieldPath: 'RAGRetrievalOptions.score_threshold',
    );
  }
  final effectiveMultiQueryCount = hasMultiQueryCount() ? multiQueryCount : 3;
  if (effectiveMultiQueryCount < 1 || effectiveMultiQueryCount > 8) {
    throw SDKException.validationFailed(
      'multi_query_count must be in 1...8 (got $effectiveMultiQueryCount)',
      fieldPath: 'RAGRetrievalOptions.multi_query_count',
    );
  }
}