keyFor static method

String keyFor(
  1. String prompt, {
  2. required String model,
  3. double? temperature,
})

Computes a cache key from the prompt, model and temperature.

Implementation

static String keyFor(
  String prompt, {
  required String model,
  double? temperature,
}) {
  return crypto.sha256
      .convert(utf8.encode('$model|${temperature ?? 0}|$prompt'))
      .toString();
}