Getting Started with AI Chatbot
You can also directly get started with the chatbot by initialising it using the LikeMinds Chat SDK. This approach is useful when you want to add a chatbot to your application fast, and don't want to deal with the complexities of setting up a complete chat experience. We have made it super easy to get started with the chatbot by providing a simple widget that can be added to your app's UI to allow users to start a chat with the chatbot.
Prerequisites
Before getting started, ensure you have:
- Generated API key from LikeMinds dashboard
- The
likeminds_chat_flutter_core
dependency, which can be found here
Step-by-Step Integration Guide
Before following the steps below, ensure you have completed the steps mentioned in the Setting up Chatbot guide. Especially, the steps related to setting up the OpenAI Assistant and integrating it with LikeMinds Chat SDK.
Step 1 - Installation
Open the terminal, and run the following command in your Flutter project's directory.
flutter pub add likeminds_chat_core
Step 2 - Setup LikeMinds Chat
Setup the LMChatCore package in the main function with the following code
main(){
// Call setup function before the runApp() function
await LMChatCore.instance.initialize();
...
runApp(YourApp());
}
Step 3 - Setup the Chatbot Button
Add the LMChatAIButton
to your app's UI by placing it in the desired location within your app's widget tree. Ideally, a Floating Action Button (FAB) is the best place to put it.
Pass the required props to the LMChatAIButton
widget. A more detailed guide on the props can be found here. A sample is given below:
LMChatAIButton(
props: LMChatAIButtonProps(
apiKey: 'your-api-key',
uuid: 'user-unique-id',
userName: 'John Doe',
),
);
Now, whenever the button is pressed, the entire chat experience will be initialised with the provided props. A fresh chatroom (if not already present) will be created with the user's details. And the chatbot will be ready to take the user's queries.