Skip to content

Commit 0c7ec1d

Browse files
committed
prvoide equality
1 parent 6ddee62 commit 0c7ec1d

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

langfuse/model.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,16 @@ def __eq__(self, other):
271271
return (
272272
self.name == other.name
273273
and self.version == other.version
274+
and len(self.prompt) == len(other.prompt)
274275
and all(
275-
m1["role"] == m2["role"] and m1["content"] == m2["content"]
276+
# chatmessage equality
277+
(m1["type"] == "message" and m2["type"] == "message"
278+
and m1["role"] == m2["role"] and m1["content"] == m2["content"])
279+
or
280+
# placeholder equality
281+
(m1["type"] == "placeholder" and m2["type"] == "placeholder"
282+
and m1["name"] == m2["name"])
276283
for m1, m2 in zip(self.prompt, other.prompt)
277-
if m1["type"] == "message" and m2["type"] == "message"
278284
)
279285
and self.config == other.config
280286
)

0 commit comments

Comments
 (0)