diff --git a/README.md b/README.md index 16b1ff2..3773d5e 100755 --- a/README.md +++ b/README.md @@ -225,13 +225,13 @@ Exceptions: ## 1. chat() - AI chat ```python -def chat(self, keywords: str, model: str = "gpt-3.5", timeout: int = 20) -> str: +def chat(self, keywords: str, model: str = "gpt-4o-mini", timeout: int = 20) -> str: """Initiates a chat session with DuckDuckGo AI. Args: keywords (str): The initial message or question to send to the AI. - model (str): The model to use: "gpt-3.5", "claude-3-haiku", "llama-3-70b", "mixtral-8x7b". - Defaults to "gpt-3.5". + model (str): The model to use: "gpt-4o-mini", "claude-3-haiku", "llama-3-70b", "mixtral-8x7b". + Defaults to "gpt-4o-mini". timeout (int): Timeout value for the HTTP client. Defaults to 20. Returns: diff --git a/duckduckgo_search/cli.py b/duckduckgo_search/cli.py index c49760a..8445baa 100644 --- a/duckduckgo_search/cli.py +++ b/duckduckgo_search/cli.py @@ -141,7 +141,7 @@ def version(): "-m", "--model", prompt="""DuckDuckGo AI chat. Choose a model: -[1]: gpt-3.5 +[1]: gpt-4o-mini [2]: claude-3-haiku [3]: llama-3-70b [4]: mixtral-8x7b @@ -153,7 +153,7 @@ def version(): def chat(load, proxy, multiline, timeout, model): """CLI function to perform an interactive AI chat using DuckDuckGo API.""" client = DDGS(proxy=_expand_proxy_tb_alias(proxy)) - model = ["gpt-3.5", "claude-3-haiku", "llama-3-70b", "mixtral-8x7b"][int(model) - 1] + model = ["gpt-4o-mini", "claude-3-haiku", "llama-3-70b", "mixtral-8x7b"][int(model) - 1] cache_file = "ddgs_chat_conversation.json" if load and Path(cache_file).exists(): diff --git a/duckduckgo_search/duckduckgo_search.py b/duckduckgo_search/duckduckgo_search.py index f357691..11c6515 100644 --- a/duckduckgo_search/duckduckgo_search.py +++ b/duckduckgo_search/duckduckgo_search.py @@ -133,13 +133,13 @@ def _get_vqd(self, keywords: str) -> str: resp_content = self._get_url("POST", "https://duckduckgo.com", data={"q": keywords}) return _extract_vqd(resp_content, keywords) - def chat(self, keywords: str, model: str = "gpt-3.5", timeout: int = 20) -> str: + def chat(self, keywords: str, model: str = "gpt-4o-mini", timeout: int = 20) -> str: """Initiates a chat session with DuckDuckGo AI. Args: keywords (str): The initial message or question to send to the AI. - model (str): The model to use: "gpt-3.5", "claude-3-haiku", "llama-3-70b", "mixtral-8x7b". - Defaults to "gpt-3.5". + model (str): The model to use: "gpt-4o-mini", "claude-3-haiku", "llama-3-70b", "mixtral-8x7b". + Defaults to "gpt-4o-mini". timeout (int): Timeout value for the HTTP client. Defaults to 20. Returns: @@ -147,7 +147,7 @@ def chat(self, keywords: str, model: str = "gpt-3.5", timeout: int = 20) -> str: """ models = { "claude-3-haiku": "claude-3-haiku-20240307", - "gpt-3.5": "gpt-3.5-turbo-0125", + "gpt-4o-mini": "gpt-4o-mini", "llama-3-70b": "meta-llama/Llama-3-70b-chat-hf", "mixtral-8x7b": "mistralai/Mixtral-8x7B-Instruct-v0.1", } diff --git a/duckduckgo_search/duckduckgo_search_async.py b/duckduckgo_search/duckduckgo_search_async.py index b02cf69..a6467b7 100644 --- a/duckduckgo_search/duckduckgo_search_async.py +++ b/duckduckgo_search/duckduckgo_search_async.py @@ -36,13 +36,13 @@ async def __aexit__( ) -> None: pass - async def achat(self, keywords: str, model: str = "gpt-3.5") -> str: + async def achat(self, keywords: str, model: str = "gpt-4o-mini") -> str: """Initiates async chat session with DuckDuckGo AI. Args: keywords (str): The initial message or question to send to the AI. - model (str): The model to use: "gpt-3.5", "claude-3-haiku", "llama-3-70b", "mixtral-8x7b". - Defaults to "gpt-3.5". + model (str): The model to use: "gpt-4o-mini", "claude-3-haiku", "llama-3-70b", "mixtral-8x7b". + Defaults to "gpt-4o-mini". Returns: str: The response from the AI. diff --git a/tests/test_duckduckgo_search.py b/tests/test_duckduckgo_search.py index eeb1431..8c5fa5b 100644 --- a/tests/test_duckduckgo_search.py +++ b/tests/test_duckduckgo_search.py @@ -15,7 +15,7 @@ def test_context_manager(): assert 20 <= len(results) <= 30 -@pytest.mark.parametrize("model", ["gpt-3.5", "claude-3-haiku", "llama-3-70b", "mixtral-8x7b"]) +@pytest.mark.parametrize("model", ["gpt-4o-mini", "claude-3-haiku", "llama-3-70b", "mixtral-8x7b"]) def test_chat(model): results = DDGS().chat("cat", model=model) assert len(results) >= 1 diff --git a/tests/test_duckduckgo_search_async.py b/tests/test_duckduckgo_search_async.py index 99b32d0..b5d0223 100644 --- a/tests/test_duckduckgo_search_async.py +++ b/tests/test_duckduckgo_search_async.py @@ -16,7 +16,7 @@ async def test_context_manager(): @pytest.mark.asyncio -@pytest.mark.parametrize("model", ["gpt-3.5", "claude-3-haiku", "llama-3-70b", "mixtral-8x7b"]) +@pytest.mark.parametrize("model", ["gpt-4o-mini", "claude-3-haiku", "llama-3-70b", "mixtral-8x7b"]) async def test_chat(model): results = await AsyncDDGS().achat("cat", model=model) assert len(results) >= 1