Skip to content

Commit

Permalink
fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
constantinidan committed Oct 2, 2024
1 parent 586bed0 commit a854002
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 10 additions & 1 deletion literalai/observability/generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 1 addition & 2 deletions literalai/prompt_engineering/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,11 @@ 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,
"updatedAt": self.updated_at,
"type": self.type.value if isinstance(self.type, GenerationType) else self.type,
"type": self.type,
"name": self.name,
"version": self.version,
"url": self.url,
Expand Down

0 comments on commit a854002

Please sign in to comment.