Skip to content

Commit

Permalink
Rename Image model to ImageResult
Browse files Browse the repository at this point in the history
  • Loading branch information
cephalization committed Jan 14, 2025
1 parent dcf9abd commit f90aa02
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 45 deletions.
12 changes: 6 additions & 6 deletions app/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
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.

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.

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.

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

26 changes: 13 additions & 13 deletions schemas/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions src/phoenix/server/api/helpers/prompts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -67,7 +67,7 @@ class Image(BaseModel):
class ImagePart(PartBase):
type: Literal["image"]
# the image data
image: Image
image: ImageResult


class ToolCallPart(PartBase):
Expand Down
8 changes: 4 additions & 4 deletions src/phoenix/server/api/input_types/PromptVersionInput.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from strawberry.scalars import JSON

from phoenix.server.api.helpers.prompts.models import (
Image,
ImageResult,
PromptChatTemplateV1,
PromptTemplateFormat,
PromptTemplateType,
Expand All @@ -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

Expand All @@ -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

Expand Down
8 changes: 4 additions & 4 deletions src/phoenix/server/api/types/PromptVersionTemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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

Expand All @@ -47,7 +47,7 @@ class TextPart:
@strawberry.experimental.pydantic.type(ImagePartModel)
class ImagePart:
type: str
image: Image
image: ImageResult


@strawberry.experimental.pydantic.type(ToolCallPartModel)
Expand Down

0 comments on commit f90aa02

Please sign in to comment.