Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ollama/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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),
Expand Down Expand Up @@ -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,
Expand All @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}')

Expand Down
Loading