Skip to content

Commit 08844f0

Browse files
committed
fix
1 parent a9757de commit 08844f0

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/agents/extensions/models/litellm_model.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ def convert_message_to_openai(
371371
annotations=cls.convert_annotations_to_openai(message),
372372
audio=message.get("audio", None), # litellm deletes audio if not present
373373
tool_calls=tool_calls,
374+
reasoning_content=message.reasoning_content,
374375
)
375376

376377
@classmethod

src/agents/models/chatcmpl_converter.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
ResponseOutputRefusal,
3737
ResponseOutputText,
3838
ResponseReasoningItem,
39+
ResponseReasoningItemParam,
3940
)
4041
from openai.types.responses.response_input_param import FunctionCallOutput, ItemReference, Message
4142
from openai.types.responses.response_reasoning_item import Summary
@@ -206,6 +207,12 @@ def maybe_response_output_message(cls, item: Any) -> ResponseOutputMessageParam
206207
):
207208
return cast(ResponseOutputMessageParam, item)
208209
return None
210+
211+
@classmethod
212+
def maybe_reasoning_message(cls, item: Any) -> ResponseReasoningItemParam | None:
213+
if isinstance(item, dict) and item.get("type") == "reasoning":
214+
return cast(ResponseReasoningItemParam, item)
215+
return None
209216

210217
@classmethod
211218
def extract_text_content(
@@ -456,7 +463,11 @@ def ensure_assistant_message() -> ChatCompletionAssistantMessageParam:
456463
f"Encountered an item_reference, which is not supported: {item_ref}"
457464
)
458465

459-
# 7) If we haven't recognized it => fail or ignore
466+
# 7) reasoning message => not handled
467+
elif cls.maybe_reasoning_message(item):
468+
pass
469+
470+
# 8) If we haven't recognized it => fail or ignore
460471
else:
461472
raise UserError(f"Unhandled item type or structure: {item}")
462473

0 commit comments

Comments
 (0)