Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/agents/extensions/models/litellm_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ async def _fetch_response(
)

# Fix for interleaved thinking bug: reorder messages to ensure tool_use comes before tool_result # noqa: E501
if 'anthropic' in self.model.lower() or 'claude' in self.model.lower():
if "anthropic" in self.model.lower() or "claude" in self.model.lower():
converted_messages = self._fix_tool_message_ordering(converted_messages)

if system_instructions:
Expand Down
21 changes: 10 additions & 11 deletions tests/extensions/memory/test_sqlalchemy_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,19 +219,20 @@ async def test_get_items_same_timestamp_consistent_order():
)
)
id_map = {
json.loads(message_json)["id"]: row_id
for row_id, message_json in rows.fetchall()
json.loads(message_json)["id"]: row_id for row_id, message_json in rows.fetchall()
}
shared = datetime(2025, 10, 15, 17, 26, 39, 132483)
older = shared - timedelta(milliseconds=1)
await sess.execute(
update(session._messages)
.where(session._messages.c.id.in_(
[
id_map["rs_same_ts"],
id_map["msg_same_ts"],
]
))
.where(
session._messages.c.id.in_(
[
id_map["rs_same_ts"],
id_map["msg_same_ts"],
]
)
)
.values(created_at=shared)
)
await sess.execute(
Expand Down Expand Up @@ -320,9 +321,7 @@ async def test_pop_item_same_timestamp_returns_latest():
async with session._session_factory() as sess:
await sess.execute(
text(
"UPDATE agent_messages "
"SET created_at = :created_at "
"WHERE session_id = :session_id"
"UPDATE agent_messages SET created_at = :created_at WHERE session_id = :session_id"
),
{
"created_at": "2025-10-15 17:26:39.132483",
Expand Down
11 changes: 7 additions & 4 deletions tests/test_openai_chatcompletions_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,13 @@ def test_extract_all_content_rejects_invalid_input_audio():
"""
input_audio requires both data and format fields to be present.
"""
audio_missing_data = cast(ResponseInputAudioParam, {
"type": "input_audio",
"input_audio": {"format": "wav"},
})
audio_missing_data = cast(
ResponseInputAudioParam,
{
"type": "input_audio",
"input_audio": {"format": "wav"},
},
)
with pytest.raises(UserError):
Converter.extract_all_content([audio_missing_data])

Expand Down
8 changes: 2 additions & 6 deletions tests/test_strict_schema_oneof.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,7 @@ def test_oneof_with_refs():
schema = {
"type": "object",
"properties": {
"value": {
"oneOf": [{"$ref": "#/$defs/StringType"}, {"$ref": "#/$defs/IntType"}]
}
"value": {"oneOf": [{"$ref": "#/$defs/StringType"}, {"$ref": "#/$defs/IntType"}]}
},
"$defs": {
"StringType": {"type": "string"},
Expand All @@ -254,9 +252,7 @@ def test_oneof_with_refs():
expected = {
"type": "object",
"properties": {
"value": {
"anyOf": [{"$ref": "#/$defs/StringType"}, {"$ref": "#/$defs/IntType"}]
}
"value": {"anyOf": [{"$ref": "#/$defs/StringType"}, {"$ref": "#/$defs/IntType"}]}
},
"$defs": {
"StringType": {"type": "string"},
Expand Down