Skip to content

Commit 8150e04

Browse files
committed
fix formatting
1 parent 1b2c77d commit 8150e04

File tree

2 files changed

+7
-22
lines changed

2 files changed

+7
-22
lines changed

examples/gpt-oss-tools-browser-stream.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
def heading(text):
2727
print(text)
28-
print('=' * (len(text) +3))
28+
print('=' * (len(text) + 3))
2929

3030

3131
async def _browser_search_async(query: str, topn: int = 10, source: str | None = None) -> str:
@@ -46,14 +46,7 @@ async def _browser_search_async(query: str, topn: int = 10, source: str | None =
4646

4747

4848
async def _browser_open_async(id: int | str = -1, cursor: int = -1, loc: int = -1, num_lines: int = -1, *, view_source: bool = False, source: str | None = None) -> str:
49-
payload = {
50-
'id': id,
51-
'cursor': cursor,
52-
'loc': loc,
53-
'num_lines': num_lines,
54-
'view_source': view_source,
55-
'source': source
56-
}
49+
payload = {'id': id, 'cursor': cursor, 'loc': loc, 'num_lines': num_lines, 'view_source': view_source, 'source': source}
5750

5851
harmony_message = HarmonyMessage(
5952
author=Author(role=Role.USER),
@@ -146,8 +139,8 @@ def browser_find(pattern: str, cursor: int = -1) -> str:
146139
model=model,
147140
messages=messages,
148141
tools=[browser_search_schema, browser_open_schema, browser_find_schema],
149-
options={'num_ctx': 32000}, # 8192 is the recommended lower limit for the context window
150-
stream=True
142+
options={'num_ctx': 8192}, # 8192 is the recommended lower limit for the context window
143+
stream=True,
151144
)
152145

153146
tool_calls = []

examples/gpt-oss-tools-browser.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
def heading(text):
2525
print(text)
26-
print('=' * (len(text) +3))
26+
print('=' * (len(text) + 3))
2727

2828

2929
async def _browser_search_async(query: str, topn: int = 10, source: str | None = None) -> str:
@@ -44,14 +44,7 @@ async def _browser_search_async(query: str, topn: int = 10, source: str | None =
4444

4545

4646
async def _browser_open_async(id: int | str = -1, cursor: int = -1, loc: int = -1, num_lines: int = -1, *, view_source: bool = False, source: str | None = None) -> str:
47-
payload = {
48-
'id': id,
49-
'cursor': cursor,
50-
'loc': loc,
51-
'num_lines': num_lines,
52-
'view_source': view_source,
53-
'source': source
54-
}
47+
payload = {'id': id, 'cursor': cursor, 'loc': loc, 'num_lines': num_lines, 'view_source': view_source, 'source': source}
5548

5649
harmony_message = HarmonyMessage(
5750
author=Author(role=Role.USER),
@@ -98,7 +91,6 @@ def browser_find(pattern: str, cursor: int = -1) -> str:
9891
return asyncio.run(_browser_find_async(pattern=pattern, cursor=cursor))
9992

10093

101-
10294
# Schema definitions for each browser tool
10395
browser_search_schema = {
10496
'type': 'function',
@@ -141,7 +133,7 @@ def browser_find(pattern: str, cursor: int = -1) -> str:
141133
model=model,
142134
messages=messages,
143135
tools=[browser_search_schema, browser_open_schema, browser_find_schema],
144-
options={'num_ctx': 32000} # 8192 is the recommended lower limit for the context window
136+
options={'num_ctx': 8192}, # 8192 is the recommended lower limit for the context window
145137
)
146138

147139
if hasattr(response.message, 'thinking') and response.message.thinking:

0 commit comments

Comments
 (0)