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.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE0MDk4MTcsIm5iZiI6MTcyMTQwOTUxNywicGF0aCI6Ii8xNDA0NDc4NzkvMzIwMzE2NjMzLTdjOWQ2MzIwLTAzYzktNDgzOS05NjEzLTc5ZmQwM2UwOGY5YS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzE5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxOVQxNzE4MzdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lNzUzOWFlNWUxY2VjNjZjZWM5MjQ3NTZjN2YwOWE4ZDIyMzhlODg5NTYzMDhkYWU3ZDQ5ODAxZGNjYTU1ZDYwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.5GzYPywC6o4THX6fJPjdhY-sGt1l1RtIrbgalC1CwaU)