mirror of
https://github.com/ollama/ollama-python.git
synced 2026-01-13 21:57:16 +08:00
client: point websearch to local ollama
This commit is contained in:
parent
9ddd5f0182
commit
f0edc1afa8
@ -652,7 +652,7 @@ class Client(BaseClient):
|
||||
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 @@ class Client(BaseClient):
|
||||
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 @@ class AsyncClient(BaseClient):
|
||||
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 @@ class AsyncClient(BaseClient):
|
||||
return await self._request(
|
||||
WebFetchResponse,
|
||||
'POST',
|
||||
'https://ollama.com/api/web_fetch',
|
||||
'/api/web_fetch',
|
||||
json=WebFetchRequest(
|
||||
url=url,
|
||||
).model_dump(exclude_none=True),
|
||||
|
||||
@ -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}')
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user