createConversation method

Future<Conversation> createConversation([
  1. ConversationConfig conversationConfig = const ConversationConfig()
])

Creates a new conversation from the initialized engine.

Implementation

Future<Conversation> createConversation([
  ConversationConfig conversationConfig = const ConversationConfig(),
]) async {
  _ensureInitialized();
  try {
    final handle = await LiteRtLmNativeRuntime.instance.createConversation(
      _handle,
      conversationConfig,
    );
    return Conversation._(
      handle,
      ToolManager(tools: conversationConfig.tools),
      automaticToolCalling: conversationConfig.automaticToolCalling,
    );
  } on LiteRtLmNativeException {
    _state = _EngineState.failed;
    rethrow;
  }
}