Skip to content

Commit 6d07f25

Browse files
committed
fixed nits
1 parent f88e1a4 commit 6d07f25

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

examples/browser_tool.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,19 @@
11
from __future__ import annotations
2-
2+
from browser_tool_helpers import Browser
3+
from ollama import Client
34
import os
45
from typing import Any, Dict, List
56

6-
from ollama import Client
7-
8-
try:
9-
from .browser_tool_helpers import Browser # when run with -m
10-
except Exception:
11-
from browser_tool_helpers import Browser # when run as a script
12-
137

148
def main() -> None:
159
client = Client(headers={'Authorization': os.getenv('OLLAMA_API_KEY')})
1610
browser = Browser(initial_state=None, client=client)
1711

18-
# Minimal tool schemas (match other examples: names only)
12+
# Minimal tool schemas
1913
browser_search_schema = {'type': 'function', 'function': {'name': 'browser.search'}}
2014
browser_open_schema = {'type': 'function', 'function': {'name': 'browser.open'}}
2115
browser_find_schema = {'type': 'function', 'function': {'name': 'browser.find'}}
2216

23-
# Simple wrappers returning page text
2417
def browser_search(query: str, topn: int = 10) -> str:
2518
return browser.search(query=query, topn=topn)['pageText']
2619

examples/browser_tool_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from __future__ import annotations
22

3-
import re
43
from dataclasses import dataclass, field
54
from datetime import datetime
65
from typing import Any, Dict, List, Optional, Protocol, Tuple
6+
import re
77
from urllib.parse import urlparse
88

99
from ollama import Client

0 commit comments

Comments
 (0)