Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeldking authored and axiomofjoy committed Apr 8, 2024
1 parent 35d6e45 commit a26d2d4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
8 changes: 8 additions & 0 deletions src/phoenix/db/migrations/versions/cf03bd6bae1d_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ def upgrade() -> None:
sa.Column("cumulative_llm_token_count_completion", sa.Integer, nullable=False),
)

op.create_table(
"span_annotations",
sa.Column("id", sa.Integer, primary_key=True),
sa.Column("span_rowid", sa.Integer, sa.ForeignKey("traces.id"), nullable=False),
sa.Column("name", sa.String, nullable=False),
sa.UniqueConstraint("name", "span_rowid"),
)

op.bulk_insert(
projects_table,
[
Expand Down
12 changes: 6 additions & 6 deletions src/phoenix/db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ async def init_models(engine: AsyncEngine) -> None:
class SpanAnnotation(Base):
__tablename__ = "span_annotations"
id: Mapped[int] = mapped_column(primary_key=True)
span_rowid: Mapped[int] = mapped_column(ForeignKey("spans.id"), required=True)
name: Mapped[str] = mapped_column(required=True)
label: Mapped[str] = mapped_column()
score: Mapped[float] = mapped_column()
explanation: Mapped[str] = mapped_column()
meta: Mapped[Dict[str, Any]] = mapped_column(JSON, required=True, key="metadata")
span_rowid: Mapped[int] = mapped_column(ForeignKey("spans.id"))
name: Mapped[str]
label: Mapped[str]
score: Mapped[float]
explanation: Mapped[str]
meta: Mapped[Dict[str, Any]] = mapped_column(JSON, key="metadata")
__table_args__ = (
UniqueConstraint(
"span_rowid",
Expand Down

0 comments on commit a26d2d4

Please sign in to comment.