diff --git a/app/schema.graphql b/app/schema.graphql index 24ceb0e2c3..027c3fc79a 100644 --- a/app/schema.graphql +++ b/app/schema.graphql @@ -1452,6 +1452,7 @@ type PromptVersion implements Node { outputSchema: JSON modelName: String! modelProvider: String! + tags: [PromptVersionTag!]! } """A connection to a list of items.""" @@ -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!]! diff --git a/src/phoenix/server/api/types/PromptVersion.py b/src/phoenix/server/api/types/PromptVersion.py index db7442e84b..116e25d59f 100644 --- a/src/phoenix/server/api/types/PromptVersion.py +++ b/src/phoenix/server/api/types/PromptVersion.py @@ -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): @@ -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", + ), + ] diff --git a/src/phoenix/server/api/types/PromptVersionTag.py b/src/phoenix/server/api/types/PromptVersionTag.py new file mode 100644 index 0000000000..209a1a82a8 --- /dev/null +++ b/src/phoenix/server/api/types/PromptVersionTag.py @@ -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