Skip to content

Commit a5b4a3f

Browse files
committed
fix: standardize call_id extraction in ServerConversationTracker
Updated the call_id extraction logic in the _ServerConversationTracker class to consistently use the "call_id" key from output items, removing the fallback to "callId". This change enhances code clarity and ensures uniformity in handling tool call items.
1 parent c626eb9 commit a5b4a3f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/agents/run.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def prepare_input(
177177
# Check if this is a tool call item
178178
if isinstance(output_item, dict):
179179
item_type = output_item.get("type")
180-
call_id = output_item.get("call_id") or output_item.get("callId")
180+
call_id = output_item.get("call_id")
181181
elif hasattr(output_item, "type") and hasattr(output_item, "call_id"):
182182
item_type = output_item.type
183183
call_id = output_item.call_id
@@ -192,7 +192,7 @@ def prepare_input(
192192
# Extract call_id from the output item
193193
raw_item = item.raw_item
194194
if isinstance(raw_item, dict):
195-
call_id = raw_item.get("call_id") or raw_item.get("callId")
195+
call_id = raw_item.get("call_id")
196196
elif hasattr(raw_item, "call_id"):
197197
call_id = raw_item.call_id
198198
else:
@@ -203,7 +203,7 @@ def prepare_input(
203203
# Extract call_id from the tool call item and store it for later lookup
204204
tool_call_raw_item: Any = item.raw_item
205205
if isinstance(tool_call_raw_item, dict):
206-
call_id = tool_call_raw_item.get("call_id") or tool_call_raw_item.get("callId")
206+
call_id = tool_call_raw_item.get("call_id")
207207
elif hasattr(tool_call_raw_item, "call_id"):
208208
call_id = tool_call_raw_item.call_id
209209
else:
@@ -229,7 +229,7 @@ def prepare_input(
229229
# Extract call_id from the tool call item
230230
tool_call_item_raw: Any = item.raw_item
231231
if isinstance(tool_call_item_raw, dict):
232-
call_id = tool_call_item_raw.get("call_id") or tool_call_item_raw.get("callId")
232+
call_id = tool_call_item_raw.get("call_id")
233233
elif hasattr(tool_call_item_raw, "call_id"):
234234
call_id = tool_call_item_raw.call_id
235235
else:
@@ -246,7 +246,7 @@ def prepare_input(
246246
if item.type == "tool_call_output_item":
247247
raw_item = item.raw_item
248248
if isinstance(raw_item, dict):
249-
call_id = raw_item.get("call_id") or raw_item.get("callId")
249+
call_id = raw_item.get("call_id")
250250
elif hasattr(raw_item, "call_id"):
251251
call_id = raw_item.call_id
252252
else:

0 commit comments

Comments
 (0)