Building chatbots with System Message
In this guide, we will modify the "Basic Chat with Prompt and History" example, integrating the ChatPromptTemplate with the SystemMessagePromptTemplate and HumanMessagePromptTemplate components. By following these steps, you'll be able to build a personalized chatbot that can interpret and respond based on user-defined System messages.
Navigate to the "Community Examples" section.
Locate the "Basic Chat with Prompt and History" example, and click on "Fork Example".
Once in the editor, find the "PromptTemplate" component and remove it.
Now, add these three components: ChatPromptTemplate, SystemMessagePromptTemplate, and HumanMessagePromptTemplate.
Click on the "Build" button to implement your changes.
Open the chat interface to test your modifications.
You should now be able to see and use the defined variables in the chat interface.
Click on 'role' to examine the variable you established in the canvas.
Now, let's define the 'behavior' variable.
Enter the text: "writes the word 'Langflow' at the end of every sentence."
Test your chatbot by typing "How can you help me?"
If everything was set up correctly, your chatbot should respond appropriately, following the defined behavior.
Congratulations! You have successfully customized and built your chatbot.
By following these instructions, you have created a dynamic chatbot capable of understanding and responding based on custom system messages, enhancing the user experience and interaction. Enjoy your personalized assistant!