Skip to content

Commit 95941d9

Browse files
authored
Fix MessageHistory.to_list() returning mutable reference (#48)
* small bug fix in MessageHistory that lead to inaccurate logs
1 parent de894cf commit 95941d9

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
**Core**
13+
14+
- Fixed `MessageHistory.to_list()` returning a reference to the internal list instead of a copy, causing simulator logs to contain future conversation messages that hadn't occurred at the time of logging. (PR: #PR_NUMBER_PLACEHOLDER)
15+
1016
### Added
1117

1218
**Core**

maseval/core/history.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def to_list(self) -> List[Dict[str, Any]]:
110110
Returns:
111111
List of message dictionaries in OpenAI format
112112
"""
113-
return self._messages
113+
return list(self._messages)
114114

115115
def add_message(
116116
self,

0 commit comments

Comments
 (0)