From the course: Level up LLM applications development with LangChain and OpenAI
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Build the layout with Streamlit components
From the course: Level up LLM applications development with LangChain and OpenAI
Build the layout with Streamlit components
- All right, so we're going to dedicate this part to develop our interactive app, so the user interface, to create a chat application. And so we start by initializing the chat history, and every chat history starts with a system message. So we're going to begin by first checking if we actually have a messages in the session state. So this is how it works with stream leads. We're going to have a session state, so that's going to be a first condition to check. And then if there is no key called messages, we're going to create one. So that's going to be session state. Then messages like this, that we initialize as an empty array. And next we continue with the same messages in the session states and we append a first message, which will be system. So we just need to replace author with role. So that is going to be very similar to when you create and send a first request to open ai. The list of messages always starts with a system message. Well that's going to be role system. And then the…