Skip to content

Commit

Permalink
prompt version tags
Browse files Browse the repository at this point in the history
  • Loading branch information
axiomofjoy committed Dec 20, 2024
1 parent 07adbc5 commit 47a8450
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def upgrade() -> None:
)

op.create_table(
"prompt_tags",
"prompt_version_tags",
sa.Column("id", sa.Integer, primary_key=True),
sa.Column("name", sa.String, nullable=False),
sa.Column("description", sa.String, nullable=True),
Expand Down Expand Up @@ -182,7 +182,7 @@ def upgrade() -> None:


def downgrade() -> None:
op.drop_table("prompt_tags")
op.drop_table("prompt_version_tags")
op.drop_table("prompt_versions")
op.drop_table("prompts_prompt_labels")
op.drop_table("prompts")
Expand Down
16 changes: 8 additions & 8 deletions src/phoenix/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,8 +841,8 @@ class Prompt(Base):
uselist=True,
)

prompt_tags: Mapped[list["PromptTag"]] = relationship(
"PromptTag",
prompt_version_tags: Mapped[list["PromptVersionTag"]] = relationship(
"PromptVersionTag",
back_populates="prompt",
cascade="all, delete-orphan",
uselist=True,
Expand Down Expand Up @@ -911,16 +911,16 @@ class PromptVersion(Base):

prompt: Mapped["Prompt"] = relationship("Prompt", back_populates="prompt_versions")

prompt_tags: Mapped[list["PromptTag"]] = relationship(
"PromptTag",
prompt_version_tags: Mapped[list["PromptVersionTag"]] = relationship(
"PromptVersionTag",
back_populates="prompt_version",
cascade="all, delete-orphan",
uselist=True,
)


class PromptTag(Base):
__tablename__ = "prompt_tags"
class PromptVersionTag(Base):
__tablename__ = "prompt_version_tags"

id: Mapped[int] = mapped_column(primary_key=True)
name: Mapped[str] = mapped_column(String, nullable=False)
Expand All @@ -941,9 +941,9 @@ class PromptTag(Base):
nullable=True,
)

prompt: Mapped["Prompt"] = relationship("Prompt", back_populates="prompt_tags")
prompt: Mapped["Prompt"] = relationship("Prompt", back_populates="prompt_version_tags")
prompt_version: Mapped["PromptVersion"] = relationship(
"PromptVersion", back_populates="prompt_tags"
"PromptVersion", back_populates="prompt_version_tags"
)

__table_args__ = (UniqueConstraint("name", "prompt_id"),)

0 comments on commit 47a8450

Please sign in to comment.