code: ## Conversational Q&A Chatbot
  import streamlit as st
  
  from langchain.schema import HumanMessage,SystemMessage,AIMessage
  from langchain.chat_models import ChatOpenAI
  
  ## Streamlit UI
  st.set_page_config(page_title="Conversational Q&A Chatbot")
  st.header("Hey, Let's Chat")
  
  from dotenv import load_dotenv
  load_dotenv()
  import os
  
  chat=ChatOpenAI(temperature=0.5)
  
  if 'flowmessages' not in st.session_state:
      st.session_state['flowmessages']=[
          SystemMessage(content="Yor are a comedian AI assitant")
      ]
  
  ## Function to load OpenAI model and get respones
  
  def get_chatmodel_response(question):
  
      st.session_state['flowmessages'].append(HumanMessage(content=question))
      answer=chat(st.session_state['flowmessages'])
      st.session_state['flowmessages'].append(AIMessage(content=answer.content))
      return answer.content
  
  input=st.text_input("Input: ",key="input")
  response=get_chatmodel_response(input)
  
  submit=st.button("Ask the question")
  
  ## If ask button is clicked
  
  if submit:
      st.subheader("The Response is")
      st.write(response)
apis: langchain.schema.SystemMessage langchain.schema.AIMessage langchain.schema.HumanMessage langchain.chat_models.ChatOpenAI
extract_api: [((189, 248), 'streamlit.set_page_config', 'st.set_page_config', ([], {'page_title': '"""Conversational Q&A Chatbot"""'}), "(page_title='Conversational Q&A Chatbot')\n", (207, 248), True, 'import streamlit as st\n'), ((250, 278), 'streamlit.header', 'st.header', (['"""Hey, Let\'s Chat"""'], {}), '("Hey, Let\'s Chat")\n', (259, 278), True, 'import streamlit as st\n'), ((314, 327), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (325, 327), False, 'from dotenv import load_dotenv\n'), ((347, 374), 'langchain.chat_models.ChatOpenAI', 'ChatOpenAI', ([], {'temperature': '(0.5)'}), '(temperature=0.5)\n', (357, 374), False, 'from langchain.chat_models import ChatOpenAI\n'), ((873, 910), 'streamlit.text_input', 'st.text_input', (['"""Input: """'], {'key': '"""input"""'}), "('Input: ', key='input')\n", (886, 910), True, 'import streamlit as st\n'), ((960, 989), 'streamlit.button', 'st.button', (['"""Ask the question"""'], {}), "('Ask the question')\n", (969, 989), True, 'import streamlit as st\n'), ((1040, 1071), 'streamlit.subheader', 'st.subheader', (['"""The Response is"""'], {}), "('The Response is')\n", (1052, 1071), True, 'import streamlit as st\n'), ((1077, 1095), 'streamlit.write', 'st.write', (['response'], {}), '(response)\n', (1085, 1095), True, 'import streamlit as st\n'), ((470, 525), 'langchain.schema.SystemMessage', 'SystemMessage', ([], {'content': '"""Yor are a comedian AI assitant"""'}), "(content='Yor are a comedian AI assitant')\n", (483, 525), False, 'from langchain.schema import HumanMessage, SystemMessage, AIMessage\n'), ((674, 704), 'langchain.schema.HumanMessage', 'HumanMessage', ([], {'content': 'question'}), '(content=question)\n', (686, 704), False, 'from langchain.schema import HumanMessage, SystemMessage, AIMessage\n'), ((802, 835), 'langchain.schema.AIMessage', 'AIMessage', ([], {'content': 'answer.content'}), '(content=answer.content)\n', (811, 835), False, 'from langchain.schema import HumanMessage, SystemMessage, AIMessage\n')]