Skip to content

Commit d3ddff3

Browse files
committed
formatting issues
1 parent 81c71ba commit d3ddff3

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

examples/web-search-crawl.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# ]
77
# ///
88
import os
9-
from typing import Optional, Union
9+
from typing import Union
1010

1111
from rich import print
1212

@@ -20,7 +20,6 @@ def format_tool_results(
2020
if isinstance(results, WebSearchResponse):
2121
output = []
2222
output.append(f'Search results for "{user_search}":')
23-
print()
2423
for i, result in enumerate(results.results, 1):
2524
title = getattr(result, 'title', None)
2625
url_value = getattr(result, 'url', None)
@@ -44,7 +43,8 @@ def format_tool_results(
4443
output.append('')
4544
return '\n'.join(output).rstrip()
4645

47-
client = Client(headers={'Authorization': (os.getenv('OLLAMA_API_KEY'))})
46+
api_key = os.getenv('OLLAMA_API_KEY')
47+
client = Client(headers={'Authorization': f"Bearer {s.getenv('OLLAMA_API_KEY')}"} if api_key else None)
4848
available_tools = {'web_search': client.web_search, 'web_fetch': client.web_fetch}
4949

5050
query = "ollama's new engine"

ollama/_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ def web_search(self, query: str, max_results: int = 3) -> WebSearchResponse:
652652
return self._request(
653653
WebSearchResponse,
654654
'POST',
655-
'https://ollama.com/api/web_search',
655+
'http://localhost:8080/api/web_search',
656656
json=WebSearchRequest(
657657
query=query,
658658
max_results=max_results,
@@ -675,7 +675,7 @@ def web_fetch(self, url: str) -> WebFetchResponse:
675675
return self._request(
676676
WebFetchResponse,
677677
'POST',
678-
'https://ollama.com/api/web_fetch',
678+
'http://localhost:8080/api/web_fetch',
679679
json=WebFetchRequest(
680680
url=url,
681681
).model_dump(exclude_none=True),
@@ -764,7 +764,7 @@ async def websearch(self, query: str, max_results: int = 3) -> WebSearchResponse
764764
return await self._request(
765765
WebSearchResponse,
766766
'POST',
767-
'https://ollama.com/api/web_search',
767+
'http://localhost:8080/api/web_search',
768768
json=WebSearchRequest(
769769
query=query,
770770
max_results=max_results,
@@ -784,7 +784,7 @@ async def webfetch(self, url: str) -> WebFetchResponse:
784784
return await self._request(
785785
WebFetchResponse,
786786
'POST',
787-
'https://ollama.com/api/web_fetch',
787+
'http://localhost:8080/api/web_fetch',
788788
json=WebFetchRequest(
789789
url=url,
790790
).model_dump(exclude_none=True),

0 commit comments

Comments
 (0)