This repository enables AI-powered search and insights generation using LangGraph and OpenAI's GPT-4o, leveraging both Tavily and DuckDuckGo search tools. The project facilitates intelligent web searching and content processing to provide insightful responses based on user queries.
This project integrates various tools and agents to perform web searches and generate insights. It uses LangGraph for state management and OpenAI's GPT-4o for natural language processing. The search functionality is powered by Tavily and DuckDuckGo, providing flexibility and robustness in obtaining information from the web.
- Web Search: Perform web searches using Tavily or DuckDuckGo.
- Content Processing: Process and extract text from web pages.
- Insight Generation: Generate insights based on the processed content.
- State Management: Use LangGraph for managing states and workflows.
- Streamlit and Gradio Interfaces: User interfaces for interaction.
To get started, clone the repository and install the required dependencies:
git clone https://github.com/yourusername/agentic_search_openai_langgraph.git
cd agentic_search_openai_langgraph
pip install -r requirements.txt
Create a .env
file in the root directory of the project and add your API keys and other configuration details. You can use the .env.example
file as a template:
cp .env.example .env
Edit the .env
file to include your API keys:
LANGCHAIN_TRACING_V2=true
LANGCHAIN_ENDPOINT=https://api.smith.langchain.com
LANGCHAIN_API_KEY=your_langchain_api_key
LANGCHAIN_PROJECT=your_langchain_project
OPENAI_API_KEY=your_openai_api_key
TAVILY_API_KEY=your_tavily_api_key
In tools.py
, you can configure which search tool to use by modifying the get_tools
function:
def get_tools():
# return [internet_search] # Uncomment this and comment the line below to use Tavily instead of DuckDuckGo Search.
return [internet_search_DDGO, process_content] # Uncomment this and comment the line above to use DuckDuckGo Search instead of Tavily.
To run the Streamlit application:
streamlit run app_st.py
This will launch a web interface where you can enter your query and get insights.
Here is an example of the Streamlit application in action:
To run the Gradio application:
python main.py
This will launch a Gradio interface for interaction.
agentic_search_openai_langgraph
├── .env.example # Example environment configuration file.
├── agents.py # Defines the agents and their behaviors.
├── app_steamlit.py # Streamlit application for user interaction.
├── graph.py # Manages the state graph and workflow execution.
├── app_gradio.py # Gradio application for user interaction.
├── readme.md # Project README file.
├── requirements.txt # Python dependencies.
└── tools.py # Defines the tools for web searching and content processing.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Open a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.