Hi!
This prototype Langchain substance GPT-agent webapp uses the LLMChain and WikipediaAPIWrapper functions from Langchain to query Wikipedia for multiple tasks in one run.
If the user enters a specific substance, the GPT-agent will first query Wikipedia for a short summary of the substance and then give information about the physiological effects the substance has on the human body. Using the ConversationBufferMemory function from Langchain, the app also displays the query history and the specific Wikipedia article.
The webapp is set up through Streamlit, a very good framework for prototype webapps.
The following libraries are needed for the project:
-
os (for setting the OpenAI API-key)
-
langchain
-
streamlit
As always, the code is thoroughly commented.
Have fun!
![substance_agent_screenshot](https://private-user-images.githubusercontent.com/140447879/320315657-e4a6eb8f-af94-4e2d-b3ca-700a38a29d24.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU0MTgzODgsIm5iZiI6MTcyNTQxODA4OCwicGF0aCI6Ii8xNDA0NDc4NzkvMzIwMzE1NjU3LWU0YTZlYjhmLWFmOTQtNGUyZC1iM2NhLTcwMGEzOGEyOWQyNC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTA0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwNFQwMjQ4MDhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yYjNiNGFlODhiMDU5ZGY3M2I2ZDM0ZGFmMWE0YTE3YjI2MjBkODk3OWU2ZGQ5MzE3ZDVkMTE0OTYzYjI2M2Q2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.e6GIyv02J04uKvpcpYVk7J4oVMQRUxxf9A7IG_vGFqU)