diff --git a/ollama/_client.py b/ollama/_client.py index dcd8126..111ebde 100644 --- a/ollama/_client.py +++ b/ollama/_client.py @@ -652,7 +652,7 @@ def web_search(self, query: str, max_results: int = 3) -> WebSearchResponse: return self._request( WebSearchResponse, 'POST', - 'https://ollama.com/api/web_search', + '/api/web_search', json=WebSearchRequest( query=query, max_results=max_results, @@ -675,7 +675,7 @@ def web_fetch(self, url: str) -> WebFetchResponse: return self._request( WebFetchResponse, 'POST', - 'https://ollama.com/api/web_fetch', + '/api/web_fetch', json=WebFetchRequest( url=url, ).model_dump(exclude_none=True), @@ -764,7 +764,7 @@ async def web_search(self, query: str, max_results: int = 3) -> WebSearchRespons return await self._request( WebSearchResponse, 'POST', - 'https://ollama.com/api/web_search', + '/api/web_search', json=WebSearchRequest( query=query, max_results=max_results, @@ -784,7 +784,7 @@ async def web_fetch(self, url: str) -> WebFetchResponse: return await self._request( WebFetchResponse, 'POST', - 'https://ollama.com/api/web_fetch', + '/api/web_fetch', json=WebFetchRequest( url=url, ).model_dump(exclude_none=True), diff --git a/tests/test_client.py b/tests/test_client.py index 449d6ab..3a0d8d6 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1217,14 +1217,14 @@ def test_client_web_fetch_requires_bearer_auth_header(monkeypatch: pytest.Monkey def _mock_request_web_search(self, cls, method, url, json=None, **kwargs): assert method == 'POST' - assert url == 'https://ollama.com/api/web_search' + assert url == '/api/web_search' assert json is not None and 'query' in json and 'max_results' in json return httpxResponse(status_code=200, content='{"results": {}, "success": true}') def _mock_request_web_fetch(self, cls, method, url, json=None, **kwargs): assert method == 'POST' - assert url == 'https://ollama.com/api/web_fetch' + assert url == '/api/web_fetch' assert json is not None and 'url' in json return httpxResponse(status_code=200, content='{"results": {}, "success": true}')