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 {
  if (!_isInitialized) {
    throw const LiteRtLmException('Engine is not initialized.');
  }
  final handle = await LiteRtLmNativeRuntime.instance.createConversation(
    _handle,
    conversationConfig,
  );
  return Conversation._(
    handle,
    ToolManager(tools: conversationConfig.tools),
    automaticToolCalling: conversationConfig.automaticToolCalling,
  );
}