Search the web wiith Tavily and answer the prompt including the target-URL with a LangChain GPT-agent
Hi!
This agent searches the with Tavily using the TavilySearchResults tool from Langchain and answers the prompt, including the target-url webadress. Please note, that a (free) API-key is needed to use Tavily.
As always, I used streamlit to create a prototype webapp for displaying.
The following libraries are needed:
-
os (to set up API-keys for OpenAI and Tavily)
-
langchain
-
streamlit
As always, the code is thoroughly commented.
Have fun!
![websearch_agent_screenshot](https://private-user-images.githubusercontent.com/140447879/320316633-7c9d6320-03c9-4839-9613-79fd03e08f9a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjUzMzc3NjksIm5iZiI6MTcyNTMzNzQ2OSwicGF0aCI6Ii8xNDA0NDc4NzkvMzIwMzE2NjMzLTdjOWQ2MzIwLTAzYzktNDgzOS05NjEzLTc5ZmQwM2UwOGY5YS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTAzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwM1QwNDI0MjlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01N2ExMWM2YjdhZWJiMDQ3ZTVmYTI0MWY5MmNlZDc0NDE3OWEzODg3MGRlNDA3MTdhMjg0NmMzYjNlZTIzNTNiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.QQnfyDXSX27-h1mtxmUjgmJIrBIGsnYkiKfjnHQqKkQ)