fixed nits

This commit is contained in:
nicole pardal 2025-09-19 08:03:41 -07:00
parent 10955d52ee
commit b9d435fad5
2 changed files with 4 additions and 11 deletions

View File

@ -1,26 +1,19 @@
from __future__ import annotations from __future__ import annotations
from browser_tool_helpers import Browser
from ollama import Client
import os import os
from typing import Any, Dict, List from typing import Any, Dict, List
from ollama import Client
try:
from .browser_tool_helpers import Browser # when run with -m
except Exception:
from browser_tool_helpers import Browser # when run as a script
def main() -> None: def main() -> None:
client = Client(headers={'Authorization': os.getenv('OLLAMA_API_KEY')}) client = Client(headers={'Authorization': os.getenv('OLLAMA_API_KEY')})
browser = Browser(initial_state=None, client=client) browser = Browser(initial_state=None, client=client)
# Minimal tool schemas (match other examples: names only) # Minimal tool schemas
browser_search_schema = {'type': 'function', 'function': {'name': 'browser.search'}} browser_search_schema = {'type': 'function', 'function': {'name': 'browser.search'}}
browser_open_schema = {'type': 'function', 'function': {'name': 'browser.open'}} browser_open_schema = {'type': 'function', 'function': {'name': 'browser.open'}}
browser_find_schema = {'type': 'function', 'function': {'name': 'browser.find'}} browser_find_schema = {'type': 'function', 'function': {'name': 'browser.find'}}
# Simple wrappers returning page text
def browser_search(query: str, topn: int = 10) -> str: def browser_search(query: str, topn: int = 10) -> str:
return browser.search(query=query, topn=topn)['pageText'] return browser.search(query=query, topn=topn)['pageText']

View File

@ -1,9 +1,9 @@
from __future__ import annotations from __future__ import annotations
import re
from dataclasses import dataclass, field from dataclasses import dataclass, field
from datetime import datetime from datetime import datetime
from typing import Any, Dict, List, Optional, Protocol, Tuple from typing import Any, Dict, List, Optional, Protocol, Tuple
import re
from urllib.parse import urlparse from urllib.parse import urlparse
from ollama import Client from ollama import Client