Skip to content

Commit

Permalink
fix(prompts): remove template type from input for create prompt mutat…
Browse files Browse the repository at this point in the history
…ions (#6196)
  • Loading branch information
axiomofjoy authored Jan 29, 2025
1 parent efa7eee commit 4b8c938
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 38 deletions.
1 change: 0 additions & 1 deletion app/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ type ChatCompletionToolCall {

input ChatPromptVersionInput {
description: String = null
templateType: PromptTemplateType!
templateFormat: PromptTemplateFormat!
template: PromptChatTemplateInput!
invocationParameters: JSON! = {}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion app/src/pages/playground/fetchPlaygroundPrompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ export const instanceToPromptVersion = (instance: PlaygroundInstance) => {
const newPromptVersion = {
modelName: instance.model.modelName || DEFAULT_MODEL_NAME,
modelProvider: instance.model.provider,
templateType: "CHAT",
template: {
messages: templateMessages,
},
Expand Down
2 changes: 0 additions & 2 deletions src/phoenix/server/api/input_types/PromptVersionInput.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from phoenix.server.api.helpers.prompts.models import (
ImageContentValue,
PromptTemplateFormat,
PromptTemplateType,
PromptToolDefinition,
TextContentValue,
ToolCallContentValue,
Expand Down Expand Up @@ -79,7 +78,6 @@ class PromptChatTemplateInput:
@strawberry.input
class ChatPromptVersionInput:
description: Optional[str] = None
template_type: PromptTemplateType
template_format: PromptTemplateFormat
template: PromptChatTemplateInput
invocation_parameters: JSON = strawberry.field(default_factory=dict)
Expand Down
2 changes: 2 additions & 0 deletions src/phoenix/server/api/mutations/prompt_mutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ async def create_chat_prompt(
**strawberry.asdict(input.prompt_version),
"tools": tools,
},
template_type="CHAT",
user_id=user_id,
)
except ValidationError as error:
Expand Down Expand Up @@ -144,6 +145,7 @@ async def create_chat_prompt_version(
**strawberry.asdict(input.prompt_version),
"tools": tools,
},
template_type="CHAT",
user_id=user_id,
)
except ValidationError as error:
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/auth/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,6 @@ def test_authenticated_users_are_recorded_in_prompts(
"description": "prompt-description",
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand Down Expand Up @@ -1058,7 +1057,6 @@ def test_authenticated_users_are_recorded_in_prompts(
"promptId": prompt_id,
"promptVersion": {
"description": "new-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand Down
26 changes: 0 additions & 26 deletions tests/unit/server/api/mutations/test_prompt_mutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ class TestPromptMutations:
"description": "prompt-description",
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand All @@ -183,7 +182,6 @@ class TestPromptMutations:
"description": "prompt-description",
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand All @@ -209,7 +207,6 @@ class TestPromptMutations:
"description": "prompt-description",
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand Down Expand Up @@ -248,7 +245,6 @@ class TestPromptMutations:
"description": "prompt-description",
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand Down Expand Up @@ -296,7 +292,6 @@ class TestPromptMutations:
"description": "prompt-description",
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand Down Expand Up @@ -377,7 +372,6 @@ async def test_create_chat_prompt_fails_on_name_conflict(
"description": "prompt-description",
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand Down Expand Up @@ -413,7 +407,6 @@ async def test_create_chat_prompt_fails_on_name_conflict(
"description": "prompt-description",
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {"messages": [{"role": "USER", "content": "hello world"}]},
"invocationParameters": {"temperature": 0.4},
Expand All @@ -434,7 +427,6 @@ async def test_create_chat_prompt_fails_on_name_conflict(
"description": "prompt-description",
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand Down Expand Up @@ -462,7 +454,6 @@ async def test_create_chat_prompt_fails_on_name_conflict(
"description": "prompt-description",
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand Down Expand Up @@ -492,7 +483,6 @@ async def test_create_chat_prompt_fails_on_name_conflict(
"description": "prompt-description",
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand Down Expand Up @@ -531,7 +521,6 @@ async def test_create_chat_prompt_fails_on_name_conflict(
"description": "prompt-description",
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand Down Expand Up @@ -593,7 +582,6 @@ async def test_create_chat_prompt_fails_with_invalid_input(
"promptId": str(GlobalID("Prompt", "1")),
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand All @@ -617,7 +605,6 @@ async def test_create_chat_prompt_fails_with_invalid_input(
"promptId": str(GlobalID("Prompt", "1")),
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand All @@ -642,7 +629,6 @@ async def test_create_chat_prompt_fails_with_invalid_input(
"promptId": str(GlobalID("Prompt", "1")),
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand Down Expand Up @@ -680,7 +666,6 @@ async def test_create_chat_prompt_fails_with_invalid_input(
"promptId": str(GlobalID("Prompt", "1")),
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand All @@ -707,7 +692,6 @@ async def test_create_chat_prompt_fails_with_invalid_input(
"promptId": str(GlobalID("Prompt", "1")),
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand Down Expand Up @@ -765,7 +749,6 @@ async def test_create_chat_prompt_version_succeeds_with_valid_input(
"description": "prompt-description",
"promptVersion": {
"description": "initial-version",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand Down Expand Up @@ -837,7 +820,6 @@ async def test_create_chat_prompt_version_fails_with_nonexistent_prompt_id(
"promptId": str(GlobalID("Prompt", "100")),
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand All @@ -864,7 +846,6 @@ async def test_create_chat_prompt_version_fails_with_nonexistent_prompt_id(
"promptId": str(GlobalID("Prompt", "1")),
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {"messages": [{"role": "USER", "content": "hello world"}]},
"invocationParameters": {"temperature": 0.4},
Expand All @@ -881,7 +862,6 @@ async def test_create_chat_prompt_version_fails_with_nonexistent_prompt_id(
"promptId": str(GlobalID("Prompt", "1")),
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand All @@ -908,7 +888,6 @@ async def test_create_chat_prompt_version_fails_with_nonexistent_prompt_id(
"promptId": str(GlobalID("Prompt", "1")),
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand All @@ -935,7 +914,6 @@ async def test_create_chat_prompt_version_fails_with_nonexistent_prompt_id(
"promptId": str(GlobalID("Prompt", "1")),
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand Down Expand Up @@ -973,7 +951,6 @@ async def test_create_chat_prompt_version_fails_with_nonexistent_prompt_id(
"promptId": str(GlobalID("Prompt", "1")),
"promptVersion": {
"description": "prompt-version-description",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand Down Expand Up @@ -1034,7 +1011,6 @@ async def test_create_chat_prompt_version_fails_with_invalid_input(
"description": "prompt-description",
"promptVersion": {
"description": "initial-version",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand Down Expand Up @@ -1075,7 +1051,6 @@ async def test_create_chat_prompt_version_fails_with_invalid_input(
"description": "prompt-description",
"promptVersion": {
"description": "initial-version",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand Down Expand Up @@ -1164,7 +1139,6 @@ async def test_clone_prompt_succeeds_with_valid_input(
"description": "prompt-description",
"promptVersion": {
"description": "initial-version",
"templateType": "CHAT",
"templateFormat": "MUSTACHE",
"template": {
"messages": [
Expand Down

0 comments on commit 4b8c938

Please sign in to comment.