Skip to content

Commit

Permalink
chore(prompts): add prompt version tags graphql schema with mocks (#5847
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mikeldking authored Dec 30, 2024
1 parent b65d1c9 commit 2748f13
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,7 @@ type PromptVersion implements Node {
outputSchema: JSON
modelName: String!
modelProvider: String!
tags: [PromptVersionTag!]!
}

"""A connection to a list of items."""
Expand All @@ -1472,6 +1473,13 @@ type PromptVersionEdge {
node: PromptVersion!
}

type PromptVersionTag implements Node {
"""The Globally Unique ID of this object"""
id: GlobalID!
name: String!
description: String
}

type Query {
modelProviders: [GenerativeProvider!]!
models(input: ModelsInput = null): [GenerativeModel!]!
Expand Down
20 changes: 20 additions & 0 deletions src/phoenix/server/api/types/PromptVersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
import strawberry
from strawberry.relay import Node, NodeID
from strawberry.scalars import JSON
from strawberry.types import Info

from phoenix.server.api.context import Context
from phoenix.server.api.types.PromptVersionTemplate import PromptTemplate

from .PromptVersionTag import PromptVersionTag


@strawberry.enum
class PromptTemplateType(str, Enum):
Expand Down Expand Up @@ -36,3 +40,19 @@ class PromptVersion(Node):
output_schema: Optional[JSON] = None
model_name: str
model_provider: str

@strawberry.field
def tags(self, info: Info[Context, None]) -> list[PromptVersionTag]:
# TODO fill out details
return [
PromptVersionTag(
id_attr=1,
name="tag 1",
description="tag 1 description",
),
PromptVersionTag(
id_attr=2,
name="tag 2",
description="tag 2 description",
),
]
11 changes: 11 additions & 0 deletions src/phoenix/server/api/types/PromptVersionTag.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from typing import Optional

import strawberry
from strawberry.relay import Node, NodeID


@strawberry.type
class PromptVersionTag(Node):
id_attr: NodeID[int]
name: str
description: Optional[str] = None

0 comments on commit 2748f13

Please sign in to comment.