{"id":21569368,"url":"https://github.com/aweirddev/cheapest-search","last_synced_at":"2025-03-18T05:45:03.386Z","repository":{"id":252082170,"uuid":"839370195","full_name":"AWeirdDev/cheapest-search","owner":"AWeirdDev","description":"Search on the internet just like a human. That's cheap.","archived":false,"fork":false,"pushed_at":"2024-08-08T13:43:21.000Z","size":350,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-24T12:32:28.085Z","etag":null,"topics":["agent","ai","google","google-search","groq","search"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AWeirdDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-07T13:24:40.000Z","updated_at":"2024-08-09T13:36:24.000Z","dependencies_parsed_at":"2024-08-07T16:26:45.462Z","dependency_job_id":"9553e6db-5ab1-4038-96cb-7ea13a1708f8","html_url":"https://github.com/AWeirdDev/cheapest-search","commit_stats":null,"previous_names":["aweirddev/cheapest-search"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AWeirdDev%2Fcheapest-search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AWeirdDev%2Fcheapest-search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AWeirdDev%2Fcheapest-search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AWeirdDev%2Fcheapest-search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AWeirdDev","download_url":"https://codeload.github.com/AWeirdDev/cheapest-search/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244166676,"owners_count":20409178,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","ai","google","google-search","groq","search"],"created_at":"2024-11-24T11:09:17.184Z","updated_at":"2025-03-18T05:45:03.355Z","avatar_url":"https://github.com/AWeirdDev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cheapest-search\nHere we have the cheapest search engine to ever exist, with Groq. Only PERP fans would understand this.\n\n**Key features**:\n- Search on the internet like a human\n- Async-based\n- Faster with Groq®️\n\n\nThis project is not yet installable via `pip`, but it will be supported sooner (I assume). For now, use `git clone` to clone this project and make it yours.\n\n\u003e Beware of Google blocks. You might get blocked for a while if there are mass requests.\n\n```python\nfrom search import pipeline\n\nawait pipeline(\n    \"who invented planes?\",\n    max_searches=5,  # for faster results, 5-10 is a good range\n    verbose=True     # what the ai doin'?????\n)\n```\n\nhttps://github.com/user-attachments/assets/59d7d77e-2809-444e-aa2c-96c6897723c3\n\n## 🐣 Essentials\nYo is that Chick Fil-a? Anyway, let's see what we need to do first. That is:\n- Clone this project\n- Install packages\n- Get your [Groq](https://console.groq.com) API key\n- Configure Groq\n\n### i. Cloning\nClone this project with `git`:\n```bash\ngit clone https://github.com/AWeirdDev/cheapest-search\ncd cheapest-search\n```\n\n\n### ii. Install Packages\nInstall everything! Don't worry, we strive to keep everything minimal. All you need is the `groq` and my custom `researches` package.\n\n```bash\npip install -r requirements.txt\n# or:\npip install -U groq researches\n```\n\n\u003e [!NOTE]\n\u003e `httpx` comes along with `groq` or `researches`, so you don't need to install it separately.\n\n### iii. Configuring Groq\n[Get an API key](https://console.groq.com) first.\n\nWe have two ways to configure Groq, yet it's always recommended to use a virtual environment.\n\n\u003cdetails\u003e\n\u003csummary\u003e\n\nWith virtual environment (`pipenv`, `venv`, ...)\n\n\u003c/summary\u003e\n\n1. Setup your virtual environment. Here, we'll use `pipenv` as it's easy to setup with Visual Studio Code:\n\n```bash\npip install pipenv\npipenv --python 3.x  # \"x\" is your python version (e.g., 3.12)\n```\n\n2. Press \u003ckbd\u003e⌘ Command (ctrl)\u003c/kbd\u003e \u003ckbd\u003eshift\u003c/kbd\u003e \u003ckbd\u003eP\u003c/kbd\u003e and type \"select interpreter,\" then select your virtual environment.\n3. Add a `.env` in the working directory and add your Groq API key:\n```ini\nGROQ_API_KEY=uwu\n```\n\n4. Refresh your terminal to load the environment.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n\nAdd your API key responsibly just like Rabbit R1 or use `os.environ`\n\n\u003c/summary\u003e\n\nThere's a quick method available, yet you'll need to configure your own `AsyncGroq` class:\n```python\nfrom groq import AsyncGroq\nfrom search import configure_groq\n\nconfigure_groq(\n    AsyncGroq(\n        api_key=\"xxxx\"  # ...or use os.environ\n    )\n)\n\n# ...do stuff\n```\n\n\u003c/details\u003e\n\n\n## 🥳 Use\nFor people who want it to try out, you can use `pipeline()` to be more clear of the usage. If you want to handle your own, use the `Agent` class.\n\n### pipeline\nFor quick starters, use `pipeline` to get the result quickly.\n```python\nimport asyncio\nfrom search import pipeline\n\nasync def main():\n    await pipeline(\n        \"who invented papers?\",\n        max_searches=5,\n        cap=-2,  # when 3 messages left, we'll remind groq to be faster!\n        verbose=True  # get details behind the scenes\n    )\n\nasyncio.run(main())\n```\n\n### Agent\n```python\nimport asyncio\nfrom search import Agent\n\nasync def main():\n    agent = Agent(\n        \"what's the song never gonna give you up about\",\n        max_searches=5,\n    )\n\n    async for res in agent.start():\n        if res.type == \"ai\":\n            # AI's response\n            print(res.text)\n\n        elif res.type == \"usage\":\n            print(res.completion_token)\n            print(res.prompt_tokens)\n\n        elif res.type == \"searcher\":\n            # Searcher response (from google search)\n            print(res.searcher)\n\n        elif res.type == \"thoughts\":\n            # AI's thoughts before an action\n            print(res.thoughts)\n\n        elif res.type == \"summarization\":\n            # AI's summary (done)\n            print(res.summarization)\n            break\n\n        elif res.type == \"error\":\n            # Error\n            print(res.error, res.would_retry)\n\n    print(\"done!\")\n\nasyncio.run(main())\n```\n\n## How it works\nWe look for information. We search. We extract data. This explains that we humans do when we hop on search engines: to look for the exact piece of information we want! However, sometimes we can't quite see the whole picture: data is everywhere, and considering the average attention we'd all skip for everything and say \"i aint reading allat.\"\n\nWhat if we let an AI do it? They'll read the data, extract them and generate a brief summary. Isn't that just faster and easier? Plus, if we used Groq, everything is sped up 2-4x!\n\nLet's say we want to search the song \"slow dancing in the dark,\" and we don't know what it's about.\n\nThe LLM extracts it, and makes sure what it wants to do.\n\n\u003e **Llama 3** \u003ckbd\u003eAI\u003c/kbd\u003e\n\u003e \n\u003e ```yaml\n\u003e # steps: I should look it up using \"search.\" I should specify the wording \"song\" in my query otherwise I might get information on a different topic.\n\u003e search: joji slow dancing in the dark song\n\u003e ```\n\nAs you can see, the AI is aware of what they should be searching, thanks to the \"# steps\" comment, making the AI more clear of the context.\n\nWe then parse the response, format the grammar to meet our requirements, and search it on the web with `researches`.\n\nRepeat the loop, and we can get fascinating results!\n\n## Questions\nIt's funny, no one has ever \"frequently\" asked those questions from the FAQs if you really think about it.\n\n**What does this differ from MindSearch?**\u003cbr /\u003e\nMindSearch is made in China and this is made in Taiwan. To be more explicit, this project strives to keep everything simple since extra dependencies are always frustrating!\n\n**Is there an API documentation?**\u003cbr /\u003e\nI'll consider making one. [Issues](https://github.com/AWeirdDev/cheapest-search/issues/new?title=gimme+gimme+docs)\n\n**How can I get started?**\u003cbr /\u003e\nRead the \"Use\" category above.\n\n# Donate\nSupport this project (and quite possibly, support me) by donating!\n\n[☕ Buy me a coffee!](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTAs_TDUTeHiZQ1tqLJlvItaBOjcmRTeoSbHw\u0026s)\n\nnya ichi ni san\n\n***\n\n(c) 2024 AWeirdDev\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faweirddev%2Fcheapest-search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faweirddev%2Fcheapest-search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faweirddev%2Fcheapest-search/lists"}