Skip to content

Commit 1c4830b

Browse files
docs(examples): fix two stale example comments (openai#3877)
## Summary - `examples/parsing_tools_stream.py:27`: the comment credits `.parse_stream()` for the tool-call deserialization, but no such method exists in the SDK (`grep -rn parse_stream src/openai` → 0) — the wrapping comes from `pydantic_function_tool(...)`. The comment drifted when the example moved from `client.beta.chat.completions.stream`. - `examples/realtime/audio_util.py:16`: `CHUNK_LENGTH_S = 0.05 # 100ms` — 0.05 s is 50 ms (1200 frames at the module's 24 kHz rate). Comment corrected. Comment-only changes in examples/. ## Checklist - [x] I understand that this repository is auto-generated and my pull request may not be merged Co-authored-by: Marcus Wood <marcuswood@openai.com>
1 parent fd78a48 commit 1c4830b

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎examples/parsing_tools_stream.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class GetWeather(BaseModel):
2424
},
2525
],
2626
tools=[
27-
# because we're using `.parse_stream()`, the returned tool calls
27+
# because the tool is built with `pydantic_function_tool(...)`, the returned tool calls
2828
# will be automatically deserialized into this `GetWeather` type
2929
openai.pydantic_function_tool(GetWeather, name="get_weather"),
3030
],

‎examples/realtime/audio_util.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from openai.resources.realtime.realtime import AsyncRealtimeConnection
1515

16-
CHUNK_LENGTH_S = 0.05 # 100ms
16+
CHUNK_LENGTH_S = 0.05 # 50ms
1717
SAMPLE_RATE = 24000
1818
FORMAT = pyaudio.paInt16
1919
CHANNELS = 1

0 commit comments

Comments
 (0)