createConversation method

Future<Conversation> createConversation([
  1. ConversationConfig? config
])

Starts a conversation, with its own @litert-lm/core conversation.

On the web the model file's own sampler cannot be read: a config without ConversationConfig.samplerConfig samples with 0.8 / 40 / 0.95 / seed 1, which is said once per engine. Throws ConstraintUnsupportedException for a response format (the web conversation API has no constrained decoding), UnsupportedError for speculative decoding, a thinking token budget, an initial image or audio by file path or for an encoder the engine did not load, and LiteRtLmNativeException with the runtime's message when it refuses the conversation.

Implementation

Future<Conversation> createConversation([ConversationConfig? config]) {
  if (config?.samplerConfig == null && !_samplerDefaultNoted) {
    _samplerDefaultNoted = true;
    // ignore: avoid_print
    print(
      '[litertlm_dart] On the web the model file\'s own sampler cannot be '
      'read: a conversation without a samplerConfig samples with '
      'temperature 0.8, topK 40, topP 0.95, seed 1. Shown once per engine.',
    );
  }
  return _createConversation(config);
}