From fc7484d15cb7a22618892dbdef1a254c100dca1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugues=20de=20Saxc=C3=A9?= Date: Wed, 3 Jul 2024 12:30:46 +0200 Subject: [PATCH 1/2] fix: remove BaseMessage id --- literalai/my_types.py | 1 - 1 file changed, 1 deletion(-) diff --git a/literalai/my_types.py b/literalai/my_types.py index 6f0e06f..92dc03a 100644 --- a/literalai/my_types.py +++ b/literalai/my_types.py @@ -140,7 +140,6 @@ def from_dict( def to_dict(self): return { - "id": self.id, "promptId": self.prompt_id, "provider": self.provider, "model": self.model, From 0ef48770fd9f2647339c919016b54afc83d7cfa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugues=20de=20Saxc=C3=A9?= Date: Wed, 3 Jul 2024 13:27:19 +0200 Subject: [PATCH 2/2] fix: conditionally add id to BaseMessage --- literalai/my_types.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/literalai/my_types.py b/literalai/my_types.py index 92dc03a..8197e16 100644 --- a/literalai/my_types.py +++ b/literalai/my_types.py @@ -139,7 +139,7 @@ def from_dict( raise ValueError(f"Unknown generation type: {type}") def to_dict(self): - return { + _dict = { "promptId": self.prompt_id, "provider": self.provider, "model": self.model, @@ -155,6 +155,9 @@ def to_dict(self): "tokenThroughputInSeconds": self.token_throughput_in_s, "duration": self.duration, } + if self.id: + _dict["id"] = self.id + return _dict @dataclass(repr=False)