diff --git a/app/schema.graphql b/app/schema.graphql index 3d76999e0f..fa97d49263 100644 --- a/app/schema.graphql +++ b/app/schema.graphql @@ -1034,19 +1034,19 @@ input Granularity { samplingIntervalMinutes: Int! } -type Image { +type ImagePart { type: String! - url: String! + image: ImageResult! } -input ImageInput { +type ImageResult { type: String! url: String! } -type ImagePart { +input ImageResultInput { type: String! - image: Image! + url: String! } type Inferences { @@ -1275,7 +1275,7 @@ union Part = TextPart | ImagePart | ToolCallPart | ToolResultPart input PartInput { type: String! text: String = null - image: ImageInput = null + image: ImageResultInput = null toolCall: String = null toolResult: ToolResultInput = null } diff --git a/app/src/pages/playground/__generated__/UpsertPromptFromTemplateDialogCreateMutation.graphql.ts b/app/src/pages/playground/__generated__/UpsertPromptFromTemplateDialogCreateMutation.graphql.ts index a5e516c6ed..6371ed86e3 100644 --- a/app/src/pages/playground/__generated__/UpsertPromptFromTemplateDialogCreateMutation.graphql.ts +++ b/app/src/pages/playground/__generated__/UpsertPromptFromTemplateDialogCreateMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<515bce9662b4ee4397090ee8012c8834>> * @lightSyntaxTransform * @nogrep */ @@ -35,13 +35,13 @@ export type PromptMessageInput = { role: string; }; export type PartInput = { - image?: ImageInput | null; + image?: ImageResultInput | null; text?: string | null; toolCall?: string | null; toolResult?: ToolResultInput | null; type: string; }; -export type ImageInput = { +export type ImageResultInput = { type: string; url: string; }; diff --git a/app/src/pages/playground/__generated__/UpsertPromptFromTemplateDialogUpdateMutation.graphql.ts b/app/src/pages/playground/__generated__/UpsertPromptFromTemplateDialogUpdateMutation.graphql.ts index 4325b626c8..7de4997e87 100644 --- a/app/src/pages/playground/__generated__/UpsertPromptFromTemplateDialogUpdateMutation.graphql.ts +++ b/app/src/pages/playground/__generated__/UpsertPromptFromTemplateDialogUpdateMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<66bc0ae785e0ca43c9f36b6d80cf4ff0>> + * @generated SignedSource<<42a7e77741aa065069d95f19c40c48aa>> * @lightSyntaxTransform * @nogrep */ @@ -34,13 +34,13 @@ export type PromptMessageInput = { role: string; }; export type PartInput = { - image?: ImageInput | null; + image?: ImageResultInput | null; text?: string | null; toolCall?: string | null; toolResult?: ToolResultInput | null; type: string; }; -export type ImageInput = { +export type ImageResultInput = { type: string; url: string; }; diff --git a/app/src/pages/playground/__generated__/fetchPlaygroundPromptQuery.graphql.ts b/app/src/pages/playground/__generated__/fetchPlaygroundPromptQuery.graphql.ts index d88327aa0f..4b5407c1ea 100644 --- a/app/src/pages/playground/__generated__/fetchPlaygroundPromptQuery.graphql.ts +++ b/app/src/pages/playground/__generated__/fetchPlaygroundPromptQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<822edbb3ebfd1c4e5189cc9a7f581f1d>> + * @generated SignedSource<<4820b3403003e29b662ed2f915d43b45>> * @lightSyntaxTransform * @nogrep */ @@ -271,7 +271,7 @@ v9 = { { "alias": null, "args": null, - "concreteType": "Image", + "concreteType": "ImageResult", "kind": "LinkedField", "name": "image", "plural": false, diff --git a/app/src/pages/prompt/__generated__/PromptChatMessagesCard__main.graphql.ts b/app/src/pages/prompt/__generated__/PromptChatMessagesCard__main.graphql.ts index 11d6ad03fa..202b2b5cd9 100644 --- a/app/src/pages/prompt/__generated__/PromptChatMessagesCard__main.graphql.ts +++ b/app/src/pages/prompt/__generated__/PromptChatMessagesCard__main.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<821bba8f73bedb9b0749d9148d845a73>> + * @generated SignedSource<<58976236a11d0e5cff4405942ac109d4>> * @lightSyntaxTransform * @nogrep */ @@ -128,7 +128,7 @@ return { { "alias": null, "args": null, - "concreteType": "Image", + "concreteType": "ImageResult", "kind": "LinkedField", "name": "image", "plural": false, diff --git a/app/src/pages/prompt/__generated__/PromptCodeExportCard__main.graphql.ts b/app/src/pages/prompt/__generated__/PromptCodeExportCard__main.graphql.ts index 5e3431e795..e8f4b4a90f 100644 --- a/app/src/pages/prompt/__generated__/PromptCodeExportCard__main.graphql.ts +++ b/app/src/pages/prompt/__generated__/PromptCodeExportCard__main.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<009be691b4747a62a042dae2d4174855>> * @lightSyntaxTransform * @nogrep */ @@ -187,7 +187,7 @@ return { { "alias": null, "args": null, - "concreteType": "Image", + "concreteType": "ImageResult", "kind": "LinkedField", "name": "image", "plural": false, diff --git a/app/src/pages/prompt/__generated__/promptLoaderQuery.graphql.ts b/app/src/pages/prompt/__generated__/promptLoaderQuery.graphql.ts index 4ce9d82d1b..f6cef4f2a7 100644 --- a/app/src/pages/prompt/__generated__/promptLoaderQuery.graphql.ts +++ b/app/src/pages/prompt/__generated__/promptLoaderQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<884c644a5aadffaef9f333b3488d992f>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -233,7 +233,7 @@ return { { "alias": null, "args": null, - "concreteType": "Image", + "concreteType": "ImageResult", "kind": "LinkedField", "name": "image", "plural": false, diff --git a/app/src/pages/prompt/__generated__/promptVersionLoaderQuery.graphql.ts b/app/src/pages/prompt/__generated__/promptVersionLoaderQuery.graphql.ts index d95907925e..5311dcea3e 100644 --- a/app/src/pages/prompt/__generated__/promptVersionLoaderQuery.graphql.ts +++ b/app/src/pages/prompt/__generated__/promptVersionLoaderQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<01031b601f17f990c28f56c095356fd0>> * @lightSyntaxTransform * @nogrep */ @@ -252,7 +252,7 @@ return { { "alias": null, "args": null, - "concreteType": "Image", + "concreteType": "ImageResult", "kind": "LinkedField", "name": "image", "plural": false, diff --git a/schemas/openapi.json b/schemas/openapi.json index 25002be7b6..4dad97cddf 100644 --- a/schemas/openapi.json +++ b/schemas/openapi.json @@ -1722,42 +1722,42 @@ "type": "object", "title": "HTTPValidationError" }, - "Image": { + "ImagePart": { "properties": { "type": { "type": "string", - "const": "image_result", + "const": "image", "title": "Type" }, - "url": { - "type": "string", - "title": "Url" + "image": { + "$ref": "#/components/schemas/ImageResult" } }, "type": "object", "required": [ "type", - "url" + "image" ], - "title": "Image" + "title": "ImagePart" }, - "ImagePart": { + "ImageResult": { "properties": { "type": { "type": "string", - "const": "image", + "const": "image_result", "title": "Type" }, - "image": { - "$ref": "#/components/schemas/Image" + "url": { + "type": "string", + "title": "Url" } }, "type": "object", "required": [ "type", - "image" + "url" ], - "title": "ImagePart" + "title": "ImageResult" }, "InsertedSpanAnnotation": { "properties": { diff --git a/src/phoenix/server/api/helpers/prompts/models.py b/src/phoenix/server/api/helpers/prompts/models.py index 17b74611bd..5e305cb068 100644 --- a/src/phoenix/server/api/helpers/prompts/models.py +++ b/src/phoenix/server/api/helpers/prompts/models.py @@ -58,7 +58,7 @@ class TextPart(PartBase): text: str -class Image(BaseModel): +class ImageResult(BaseModel): type: Literal["image_result"] # http url, or base64 encoded image url: str @@ -67,7 +67,7 @@ class Image(BaseModel): class ImagePart(PartBase): type: Literal["image"] # the image data - image: Image + image: ImageResult class ToolCallPart(PartBase): diff --git a/src/phoenix/server/api/input_types/PromptVersionInput.py b/src/phoenix/server/api/input_types/PromptVersionInput.py index 2eda98a3fa..9a2a099d96 100644 --- a/src/phoenix/server/api/input_types/PromptVersionInput.py +++ b/src/phoenix/server/api/input_types/PromptVersionInput.py @@ -4,7 +4,7 @@ from strawberry.scalars import JSON from phoenix.server.api.helpers.prompts.models import ( - Image, + ImageResult, PromptChatTemplateV1, PromptTemplateFormat, PromptTemplateType, @@ -26,8 +26,8 @@ class JSONSchemaInput: definition: JSON -@strawberry.experimental.pydantic.input(Image) -class ImageInput: +@strawberry.experimental.pydantic.input(ImageResult) +class ImageResultInput: type: str url: str @@ -43,7 +43,7 @@ class ToolResultInput: class PartInput: type: str text: Optional[str] = None - image: Optional[ImageInput] = None + image: Optional[ImageResultInput] = None tool_call: Optional[str] = None tool_result: Optional[ToolResultInput] = None diff --git a/src/phoenix/server/api/types/PromptVersionTemplate.py b/src/phoenix/server/api/types/PromptVersionTemplate.py index faa396449b..8b4675a638 100644 --- a/src/phoenix/server/api/types/PromptVersionTemplate.py +++ b/src/phoenix/server/api/types/PromptVersionTemplate.py @@ -8,8 +8,8 @@ from typing_extensions import TypeAlias, assert_never from phoenix.db.models import PromptVersion as ORMPromptVersion -from phoenix.server.api.helpers.prompts.models import Image as ImageModel from phoenix.server.api.helpers.prompts.models import ImagePart as ImagePartModel +from phoenix.server.api.helpers.prompts.models import ImageResult as ImageResultModel from phoenix.server.api.helpers.prompts.models import ( PromptChatTemplateV1, PromptStringTemplateV1, @@ -25,8 +25,8 @@ from phoenix.server.api.helpers.prompts.models import ToolResultPart as ToolResultPartModel -@strawberry.experimental.pydantic.type(ImageModel) -class Image: +@strawberry.experimental.pydantic.type(ImageResultModel) +class ImageResult: type: str url: strawberry.auto @@ -47,7 +47,7 @@ class TextPart: @strawberry.experimental.pydantic.type(ImagePartModel) class ImagePart: type: str - image: Image + image: ImageResult @strawberry.experimental.pydantic.type(ToolCallPartModel)