8000 check if hasattr reasoning_content · openai/openai-agents-python@42aeffc · GitHub
[go: up one dir, main page]

Skip to content

Commit 42aeffc

Browse files
committed
check if hasattr reasoning_content
1 parent 1c38709 commit 42aeffc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/agents/models/openai_chatcompletions.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,10 @@ async def stream_response(
208208
continue
209209

210210
delta = chunk.choices[0].delta
211-
reasoning_content = getattr(delta, "reasoning_content")
212-
content = reasoning_content if reasoning_content else delta.content
211+
if hasattr(delta, "reasoning_content"):
212+
content = delta.reasoning_content if delta.reasoning_content else delta.content
213+
else:
214+
content = delta.content
213215

214216
# Handle text
215217
if content:

0 commit comments

Comments
 (0)
0