Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(prompts): add prompt version tags graphql schema with mocks #5847

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading