completion method

  1. @override
Future<Map<Object?, dynamic>?> completion(
  1. double contextId, {
  2. required String prompt,
  3. List<List<double>>? logitBias,
  4. String grammar = "",
  5. double temperature = 0.8,
  6. int nThreads = 0,
  7. int nPredict = -1,
  8. int nProbs = 0,
  9. int penaltyLastN = 64,
  10. double penaltyRepeat = 1.0,
  11. double penaltyFreq = 0.0,
  12. double penaltyPresent = 0.0,
  13. double mirostat = 0.0,
  14. double mirostatTau = 5.0,
  15. double mirostatEta = 0.1,
  16. bool penalizeNl = false,
  17. int topK = 40,
  18. double topP = 0.95,
  19. double minP = 0.05,
  20. double typicalP = 1.0,
  21. double xtcThreshold = 0.0,
  22. double xtcProbability = 0.0,
  23. int seed = -1,
  24. List<String>? stop,
  25. bool ignoreEos = false,
  26. bool emitRealtimeCompletion = false,
})
override

Implementation

@override
Future<Map<Object?, dynamic>?> completion(double contextId,
    {required String prompt,
    List<List<double>>? logitBias,
    String grammar = "",
    double temperature = 0.8,
    int nThreads = 0,
    int nPredict = -1,
    int nProbs = 0,
    int penaltyLastN = 64,
    double penaltyRepeat = 1.0,
    double penaltyFreq = 0.0,
    double penaltyPresent = 0.0,
    double mirostat = 0.0,
    double mirostatTau = 5.0,
    double mirostatEta = 0.1,
    bool penalizeNl = false,
    int topK = 40,
    double topP = 0.95,
    double minP = 0.05,
    double typicalP = 1.0,
    double xtcThreshold = 0.0,
    double xtcProbability = 0.0,
    int seed = -1,
    List<String>? stop,
    bool ignoreEos = false,
    bool emitRealtimeCompletion = false}) async {
  logitBias = logitBias ?? <List<double>>[];
  stop = stop ?? <String>[];
  return await methodChannel
      .invokeMethod<Map<Object?, dynamic>>("completion", {
    "contextId": contextId,
    "params": {
      "prompt": prompt,
      "logit_bias": logitBias,
      "grammar": grammar,
      "temperature": temperature,
      "n_threads": nThreads,
      "n_predict": nPredict,
      "n_probs": nProbs,
      "penalty_last_n": penaltyLastN,
      "penalty_repeat": penaltyRepeat,
      "penalty_freq": penaltyFreq,
      "penalty_present": penaltyPresent,
      "mirostat": mirostat,
      "mirostat_tau": mirostatTau,
      "mirostat_eta": mirostatEta,
      "penalize_nl": penalizeNl,
      "top_k": topK,
      "top_p": topP,
      "min_p": minP,
      "typical_p": typicalP,
      "xtc_threshold": xtcThreshold,
      "xtc_probability": xtcProbability,
      "seed": seed,
      "stop": stop,
      "ignore_eos": ignoreEos,
      "emit_realtime_completion": emitRealtimeCompletion,
    }
  });
}