diff --git a/literalai/observability/generation.py b/literalai/observability/generation.py index d090340..026fc89 100644 --- a/literalai/observability/generation.py +++ b/literalai/observability/generation.py @@ -13,10 +13,19 @@ @unique -class GenerationType(Enum): +class GenerationType(str, Enum): CHAT = "CHAT" COMPLETION = "COMPLETION" + def __str__(self): + return self.value + + def __repr__(self): + return f"GenerationType.{self.name}" + + def to_json(self): + return self.value + class GenerationMessage(TypedDict, total=False): uuid: Optional[str] diff --git a/literalai/prompt_engineering/prompt.py b/literalai/prompt_engineering/prompt.py index d44283a..510b408 100644 --- a/literalai/prompt_engineering/prompt.py +++ b/literalai/prompt_engineering/prompt.py @@ -79,7 +79,6 @@ class Prompt(Utils): variables_default_values: Optional[Dict[str, Any]] def to_dict(self) -> PromptDict: - # Convert the Prompt instance to a dictionary matching the PromptDict structure return { "id": self.id, "createdAt": self.created_at,