We will build a web app with Streamlit UI which features 4 Python functions as custom Langchain tools. Our agent will also have a short term conversational memory.
Code is available for download at Patreon:
https://www.patreon.com/posts/custom-langchain-78726691?utm_medium=clipboard_copy&utm_source=copyLink&utm_campaign=postshare_creator&utm_content=join_link
Try the free GPT-4 Auto Coder app : https://gpt4autocoder.streamlit.app/
UPDATE: One of our discord members found a bug in this code. Agent's meomry was resetting with each streamlit interactions. We fix this by adding the agent's memory innitialization to a session state as such: (rest of the code remains the same:
'''if "agent_memory" not in st.session_state:
st.session_state["agent_memory"] = ConversationBufferMemory(memory_key="chat_history") # You can use other memory types as well!
llm=OpenAI(temperature=0, verbose=True)
agent_chain = initialize_agent(tools, llm, agent="conversational-react-description", memory=st.session_state["agent_memory"], verbose=True) # verbose=True to see the agent's thought process'''
Join echohive discord: https://discord.gg/PPxTP3Cs3G
Langchain memory types:
https://youtu.be/7RcS8FHGdW4
Gpt-3 searches the internet: GPT 3 searches the internet with langchain. how to use langchain tutorial: Agents & Tools explained
https://youtu.be/tdEM-tVOBcc
Langchain documentation: https://langchain.readthedocs.io/en/latest/
Streamlit documentation: https://docs.streamlit.io/
OpenAI documentation:
https://platform.openai.com/docs/introduction
Timeline:
00:00 intro and Demo
02:29 Code review
07:42 Streamlit UI
10:50 Starting the app
#langchain #langchaintutorial #chatbotdevelopment #gpt3 #gpt #openai #streamlit #streamlittutorial