100+ AI Agents, Agent Skills and RAG Apps - Free and Open Source.
New Demo
ShubhamSaboo82830cd8d608
diff --git a/web_search_ai_agent/README.md b/web_search_ai_agent/README.mdnew file mode 100644index 00000000..9d5f0c6b--- /dev/null+++ b/web_search_ai_agent/README.md@@ -0,0 +1,43 @@+## 🎯 Generative AI Search Assistant+This Streamlit app combines the power of search engines and LLMs to provide you with pinpointed answers to your queries. By leveraging OpenAI's GPT-4o and the DuckDuckGo search engine, this AI search assistant delivers accurate and concise responses to your questions.++### Features+- Get pinpointed answers to your queries+- Utilize DuckDuckGo search engine for web searching+- Use OpenAI GPT-4o for intelligent answer generation++### How to get Started?++1. Clone the GitHub repository++```bash+git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git+```+2. Install the required dependencies:++```bash+pip install -r requirements.txt+```+3. Get your OpenAI API Key++- Sign up for an [OpenAI account](https://platform.openai.com/) (or the LLM provider of your choice) and obtain your API key.++4. Run the Streamlit App+```bash+streamlit run ai_webagent.py+```++### How It Works?++- Upon running the app, you will be prompted to enter your OpenAI API key. This key is used to authenticate and access the OpenAI language models.++- Once you provide a valid API key, an instance of the Assistant class is created. This assistant utilizes the GPT-4 language model from OpenAI and the DuckDuckGo search engine tool.++- Enter your search query in the provided text input field.++- The assistant will perform the following steps:+ - Conduct a web search using DuckDuckGo based on your query+ - Analyze the search results and extract relevant information+ - Generate a concise and targeted answer using the GPT-4 language model++- The pinpointed answer will be displayed in the app, providing you with the information you need.\ No newline at end of filediff --git a/web_search_ai_agent/ai_webagent.py b/web_search_ai_agent/ai_webagent.pynew file mode 100644index 00000000..a23fd59e--- /dev/null+++ b/web_search_ai_agent/ai_webagent.py@@ -0,0 +1,31 @@+# Import the required libraries+import streamlit as st+from phi.assistant import Assistant+from phi.tools.duckduckgo import DuckDuckGo+from phi.llm.openai import OpenAIChat++# Set up the Streamlit app+st.title("AI Search Assistant 🤖")+st.caption("This app allows you to search the web using AI")++# Get OpenAI API key from user+openai_access_token = st.text_input("OpenAI API Key", type="password")++# If OpenAI API key is provided, create an instance of Assistant+if openai_access_token:+ # Create an instance of the Assistant+ assistant = Assistant(+ llm=OpenAIChat(+ model="gpt-4o",+ max_tokens=1024,+ temperature=0.9,+ api_key=openai_access_token) , tools=[DuckDuckGo()], show_tool_calls=True+ )++ # Get the search query from the user+ query= st.text_input("Enter the Search Query", type="default")++ if query:+ # Search the web using the AI Assistant+ response = assistant.run(query, stream=False)+ st.write(response)\ No newline at end of filediff --git a/web_search_ai_agent/requirements.txt b/web_search_ai_agent/requirements.txtnew file mode 100644index 00000000..be217497--- /dev/null+++ b/web_search_ai_agent/requirements.txt@@ -0,0 +1,4 @@+streamlit+openai+phidata+duckduckgo-search\ No newline at end of file