Skip to content

Commit a965b29

Browse files
authored
Fix unhashable GenerateParams (#192)
This commit fixes the unhashable type: 'GenerateParams'
1 parent aa59558 commit a965b29

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

rigging/generator/base.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,12 @@ def clone(self) -> "GenerateParams":
257257
"""
258258
return self.model_copy(deep=True)
259259

260+
def __hash__(self) -> int:
261+
"""
262+
Create a hash based on the json representation of this object.
263+
"""
264+
return hash(self.model_dump_json())
265+
260266

261267
StopReason = t.Literal["stop", "length", "content_filter", "tool_calls", "unknown"]
262268
"""Reporting reason for generation completing."""

0 commit comments

Comments
 (0)