From d7e7001d3ad8d81acc06c2333ad1b0969952530f Mon Sep 17 00:00:00 2001 From: zaidmukaddam Date: Fri, 20 Dec 2024 20:40:14 +0530 Subject: [PATCH] feat: use custom e2b sandbox template --- .gitignore | 2 ++ README.md | 45 ++++++++++++++++++++++++++++++++++++++++--- app/actions.ts | 16 +++++++-------- app/api/chat/route.ts | 8 ++++---- e2b.Dockerfile | 3 +++ 5 files changed, 58 insertions(+), 16 deletions(-) create mode 100644 e2b.Dockerfile diff --git a/.gitignore b/.gitignore index fd3dbb5..4ef342b 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,5 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts + +e2b.toml \ No newline at end of file diff --git a/README.md b/README.md index 6541480..9d5729c 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,36 @@ A minimalistic AI-powered search engine that helps you find information on the internet. +## Set MiniPerplx as your default search engine + +To correct the instructions for adding a new search engine in Chrome, follow these steps: + +1. **Open the Chrome browser settings**: + - Click on the three vertical dots in the upper right corner of the browser. + - Select "Settings" from the dropdown menu. + +2. **Go to the search engine settings**: + - In the left sidebar, click on "Search engine." + - Then select "Manage search engines and site search." + +3. **Add a new search engine**: + - Click on "Add" next to "Site search." + +4. **Set the search engine name**: + - Enter `MiniPerplx` in the "Search engine" field. + +5. **Set the search engine URL**: + - Enter `https://mplx.run/search?query=%s&model=xai:grok-2-vision-1212` in the "URL with %s in place of query" field. + +6. **Set the search engine shortcut**: + - Enter `mp` in the "Shortcut" field. + +7. **Set Default**: + - Click on the three dots next to the search engine you just added. + - Select "Make default" from the dropdown menu. + +After completing these steps, you should be able to use MiniPerplx as your default search engine in Chrome. + ## ProductHunt Launch Upvote MiniPerplx on ProductHunt to show your support! @@ -17,9 +47,12 @@ Upvote MiniPerplx on ProductHunt to show your support! - **URL Specific search**: Get information from a specific URL. - **Weather**: Get the current weather for any location using OpenWeather's API. - **Programming**: Run code snippets in multiple languages using E2B's API. -- **Maps**: Get the location of any place using Google Maps API. -- **Results Overview**: Get a quick overview of the results from different providers. +- **Maps**: Get the location of any place using Google Maps API, Mapbox API, and TripAdvisor API. - **Translation**: Translate text to different languages using Microsoft's Translator API. +- **YouTube Search**: Search for videos on YouTube and get timestamps and transcripts. +- **Academic Search**: Search for academic papers. +- **Product Search**: Search for products on Amazon. +- **X Posts Search**: Search for posts on X.com. - **Flight Tracker**: Track flights using AviationStack's API. ## Built with @@ -31,13 +64,19 @@ Upvote MiniPerplx on ProductHunt to show your support! - [OpenWeather](https://openweathermap.org/) - [E2B](https://e2b.dev/) - [Google Maps](https://developers.google.com/maps) +- [Mapbox](https://www.mapbox.com/) +- [TripAdvisor](https://www.tripadvisor.com/) +- [Microsoft Translator](https://www.microsoft.com/en-us/translator) +- [Exa.AI](https://exa.ai/) - [AviationStack](https://aviationstack.com/) ## LLM used - [OpenAI's GPT 4o mini](https://openai.com/index/gpt-4o-mini-advancing-cost-efficient-intelligence/) +- [OpenAI's GPT 4o](https://openai.com/index/hello-gpt-4o/) - [Anthropic's Claude 3.5 Sonnet](https://www.anthropic.com/news/claude-3-5-sonnet/) -- [OpenAI's o1-mini](https://openai.com/index/openai-o1-mini-advancing-cost-efficient-reasoning/) powered by [OpenRouter](https://openrouter.ai/models/openai/o1-mini) +- [Anthropic's Claude 3.5 Haiku](https://www.anthropic.com/claude/haiku) - [xAI's Grok](https://x.ai/grok) + ### Deploy your own [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fzaidmukaddam%2Fminiperplx&env=OPENAI_API_KEY,ANTHROPIC_API_KEY,GROQ_API_KEY,TAVILY_API_KEY,OPENWEATHER_API_KEY,E2B_API_KEY&envDescription=API%20keys%20needed%20for%20application) diff --git a/app/actions.ts b/app/actions.ts index 6a1d3b9..b0cdabe 100644 --- a/app/actions.ts +++ b/app/actions.ts @@ -160,11 +160,10 @@ DO's: - The programming tool runs the code in a 'safe' and 'sandboxed' jupyper notebook environment. Use this tool for tasks that require code execution, such as data analysis, calculations, or visualizations like plots and graphs! Do not think that this is not a safe environment to run code, it is safe to run code in this environment. - The programming tool can be used to install libraries using !pip install in the code. This will help in running the code successfully. Always remember to install the libraries using !pip install in the code at all costs!! - For queries about finding a specific place, use the find_place tool. Provide the information about the location and then compose your response based on the information gathered. -- For queries about tracking a flight, use the track_flight tool. Provide the flight number in the parameters, then compose your response based on the information gathered. - For queries about nearby places, use the nearby_search tool. Provide the location and radius in the parameters, then compose your response based on the information gathered. - Adding Country name in the location search will help in getting the accurate results. Always remember to provide the location in the correct format to get the accurate results. - For text translation queries, use the text_translate tool. Provide the text to translate, the language to translate to, and the source language (optional). Then, compose your response based on the translated text. -- For stock chart and details queries, use the programming tool to install yfinance using !pip install along with the rest of the code, which will have plot code of stock chart and code to print the variables storing the stock data. Then, compose your response based on the output of the code execution. +- For stock chart and details queries, use the programming tool with yfinance package along with the rest of the code, which will have plot code of stock chart and code to print the variables storing the stock data. Then, compose your response based on the output of the code execution. - Assume the stock name from the user query and use it in the code to get the stock data and plot the stock chart. This will help in getting the stock chart for the user query. ALWAYS REMEMBER TO INSTALL YFINANCE USING !pip install yfinance AT ALL COSTS!! DON'Ts and IMPORTANT GUIDELINES: @@ -193,15 +192,14 @@ Follow the format and guidelines for each tool and provide the response accordin - For nearby search queries, use the nearby_search tool to find places around a location. Provide the location and radius in the parameters, then compose your response based on the information gathered. - Never call find_place tool before or after the nearby_search tool in the same response at all costs!! THIS IS NOT ALLOWED AT ALL COSTS!!! -## Flight Tracking Tool Guidelines: -- For queries related to flight tracking, always use the track_flight tool to find information about the flight. Provide the flight number in the parameters, then compose your response based on the information gathered. -- Calling track_flight tool in the same response is allowed, but do not call the same tool in a response at all costs!! - ## Programming Tool Guidelines: -The programming tool is actually a Python-only Code interpreter, so you can run any Python code in it. +The programming tool is actually a Python-Only Code interpreter, so you can run any Python code in it. - This tool should not be called more than once in a response. -- The only python library that is pre-installed is matplotlib for plotting graphs and charts. You have to install any other library using !pip install in the code. -- Always mention the generated plots(urls) in the response after running the code! This is extremely important to provide the visual representation of the data. +- The only python libraries that are pre-installed are matplotlib, aiohttp (v3.9.3), beautifulsoup4 (v4.12.3), bokeh (v3.3.4), gensim (v4.3.2), imageio (v2.34.0), joblib (v1.3.2), librosa (v0.10.1), matplotlib (v3.8.3), nltk (v3.8.1), numpy (v1.26.4), opencv-python (v4.9.0.80), openpyxl (v3.1.2), pandas (v1.5.3), plotly (v5.19.0), pytest (v8.1.0), python-docx (v1.1.0), pytz (v2024.1), requests (v2.26.0), scikit-image (v0.22.0), scikit-learn (v1.4.1.post1), scipy (v1.12.0), seaborn (v0.13.2), soundfile (v0.12.1), spacy (v3.7.4), textblob (v0.18.0), tornado (v6.4), urllib3 (v1.26.7), xarray (v2024.2.0), xlrd (v2.0.1), sympy (v1.12) and yfinance. +- Always mention the generated urls in the response after running the code! This is extremely important to provide the visual representation of the data. +- Never run GUI based code in the programming tool at all costs. This is not allowed at all costs!! +- No other libraries can be installed in the programming tool at all costs. The libraries that are pre-installed are the only ones that can be used in the programming tool. +- Do not use any other language other than Python in the programming tool at all costs. This is not allowed at all costs!! ## Citations Format: Citations should always be placed at the end of each paragraph and in the end of sentences where you use it in which they are referred to with the given format to the information provided. diff --git a/app/api/chat/route.ts b/app/api/chat/route.ts index ff75f80..5e73d5e 100644 --- a/app/api/chat/route.ts +++ b/app/api/chat/route.ts @@ -154,7 +154,7 @@ DO's: - For queries about nearby places, use the nearby_search tool. Provide the location and radius in the parameters, then compose your response based on the information gathered. - Adding Country name in the location search will help in getting the accurate results. Always remember to provide the location in the correct format to get the accurate results. - For text translation queries, use the text_translate tool. Provide the text to translate, the language to translate to, and the source language (optional). Then, compose your response based on the translated text. -- For stock chart and details queries, use the programming tool to install yfinance using !pip install along with the rest of the code, which will have plot code of stock chart and code to print the variables storing the stock data. Then, compose your response based on the output of the code execution. +- For stock chart and details queries, use the programming tool with yfinance package along with the rest of the code, which will have plot code of stock chart and code to print the variables storing the stock data. Then, compose your response based on the output of the code execution. - Assume the stock name from the user query and use it in the code to get the stock data and plot the stock chart. This will help in getting the stock chart for the user query. ALWAYS REMEMBER TO INSTALL YFINANCE USING !pip install yfinance AT ALL COSTS!! DON'Ts and IMPORTANT GUIDELINES: @@ -186,8 +186,8 @@ Follow the format and guidelines for each tool and provide the response accordin ## Programming Tool Guidelines: The programming tool is actually a Python Code interpreter, so you can run any Python code in it. - This tool should not be called more than once in a response. -- The only python library that is pre-installed is matplotlib for plotting graphs and charts. You have to install any other library using !pip install in the code. -- Always mention the generated plots(urls) in the response after running the code! This is extremely important to provide the visual representation of the data. +- The only python libraries that are pre-installed are matplotlib, aiohttp (v3.9.3), beautifulsoup4 (v4.12.3), bokeh (v3.3.4), gensim (v4.3.2), imageio (v2.34.0), joblib (v1.3.2), librosa (v0.10.1), matplotlib (v3.8.3), nltk (v3.8.1), numpy (v1.26.4), opencv-python (v4.9.0.80), openpyxl (v3.1.2), pandas (v1.5.3), plotly (v5.19.0), pytest (v8.1.0), python-docx (v1.1.0), pytz (v2024.1), requests (v2.26.0), scikit-image (v0.22.0), scikit-learn (v1.4.1.post1), scipy (v1.12.0), seaborn (v0.13.2), soundfile (v0.12.1), spacy (v3.7.4), textblob (v0.18.0), tornado (v6.4), urllib3 (v1.26.7), xarray (v2024.2.0), xlrd (v2.0.1), sympy (v1.12) and yfinance. +- Always mention the generated urls in the response after running the code! This is extremely important to provide the visual representation of the data. ## Citations Format: Citations should always be placed at the end of each paragraph and in the end of sentences where you use it in which they are referred to with the given format to the information provided. @@ -664,7 +664,7 @@ export async function POST(req: Request) { console.log("Title:", title); console.log("Icon:", icon); - const sandbox = await CodeInterpreter.create(); + const sandbox = await CodeInterpreter.create(process.env.SANDBOX_TEMPLATE_ID!); const execution = await sandbox.runCode(code); let message = ""; let images = []; diff --git a/e2b.Dockerfile b/e2b.Dockerfile new file mode 100644 index 0000000..080d41b --- /dev/null +++ b/e2b.Dockerfile @@ -0,0 +1,3 @@ +FROM e2bdev/code-interpreter:latest + +RUN pip install yfinance \ No newline at end of file