(messages: list[dict[str, Any]])
| 675 | |
| 676 | |
| 677 | def _split_leading_system(messages: list[dict[str, Any]]) -> tuple[list[dict[str, Any]], list[dict[str, Any]]]: |
| 678 | leading: list[dict[str, Any]] = [] |
| 679 | idx = 0 |
| 680 | while idx < len(messages): |
| 681 | msg = messages[idx] |
| 682 | if isinstance(msg, dict) and msg.get("role") == "system": |
| 683 | leading.append(msg) |
| 684 | idx += 1 |
| 685 | continue |
| 686 | break |
| 687 | return leading, messages[idx:] |
| 688 | |
| 689 | |
| 690 | def _latest_user_text(messages: list[dict[str, Any]]) -> str: |
no test coverage detected