-
Notifications
You must be signed in to change notification settings - Fork 79
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
[sdk] 1/n Standardize Input Schema - Input Attachment Data #929
Conversation
ec4c86d
to
e692c1b
Compare
e692c1b
to
4df579e
Compare
""" | ||
|
||
kind: Literal["file_uri", "base64"] | ||
value: str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This type and code is pretty much a duplicate of
class OutputDataWithStringValue(BaseModel):
"""
This represents the output content that is storied as a string, but we use
both the `kind` field here and the `mime_type` in ExecuteResult to convert
the string into the output format we want.
"""
kind: Literal["file_uri", "base64"]
value: str
Should this be merged into one type and abstracted? My take on that is no because That would reduce the explicitness and readability of this addition, but unsure what's right here.
Nice, LGTM, just some comments. Would you be able to hook this up to the editor in a subsequent PR so that we are using the correct types there? I wonder if we can just remove the attachments stuff from PromptInputObjectSchema now with this? There's technically support for attachment metadata there but it could also just be set with the JSON toggle |
4df579e
to
eddc8f3
Compare
Looking into this, I have a couple of questions; will sync offline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One change required, otherwise looks good. This doesn't actually update the model parsers it seems to actually use this new type yet, coming on top of this I assume?
python/src/aiconfig/schema.py
Outdated
@@ -152,7 +161,7 @@ class Attachment(BaseModel): | |||
""" | |||
|
|||
# The data representing the attachment | |||
data: Any | |||
data: Union[AttachmentDataWithStringValue, Any] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data: Union[AttachmentDataWithStringValue, Any] | |
data: Union[AttachmentDataWithStringValue, str, Any] |
Technically, an attachment can also be a string, just like ExecuteResult.data
: data: Union[OutputDataWithValue, str, Any]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
discussed offline: updating to include str
to be explicit, since we know some models like gemini take in multiple parts or stablediffusion has a 'negative prompt` which is just as much as input. We can iterate as we go about how this looks.
Typescript is defined as JSONValue so no need to add explicit string; Already supported.
Starting point of standardizing Input Schema for prompts This diff introduces the type `AttachmentDataWithStringValue` to python and typescript sdk which will allow attachments to have structure as well as validation in python (pydantic validation). ## testplan <img width="1273" alt="Screenshot 2024-01-15 at 5 52 11 PM" src="https://github.com/lastmile-ai/aiconfig/assets/141073967/0e5b1c83-cf94-4b2e-b267-8e45b4296593">
eddc8f3
to
dd1a4fa
Compare
Yes; those diffs will come on top |
Wasn't exported in the pr it was implemented in #929
`AttachmentDataWithStringValue` was created in #929 Wasn't exported. This diff exports it
`AttachmentDataWithStringValue` was created in #929 Wasn't exported. This diff exports it
[easy] [ts][sdk] export `AttachmentDataWithStringValue` type `AttachmentDataWithStringValue` was created in #929 Wasn't exported. This diff exports it
With a new input attachment type `AttachmentDataWithStringValue` defined, This diff updates the ASR Model parser to validate input is in the expected form/type. Also made some updates to to make input attachment validation clearer. ## Testplan ### Dependencies Sapling removed the dependency pr. Depends on #929
With a new input attachment type `AttachmentDataWithStringValue` defined, This diff updates the HF image to text Model parser to validate input is in the expected form/type. Also made some updates to to make input attachment validation clearer. ## Testplan ### Dependencies Sapling removed the dependency pr. Depends on #929
With a new input attachment type `AttachmentDataWithStringValue` defined, This diff updates the ASR Model parser to validate input is in the expected form/type. Also made some updates to to make input attachment validation clearer. ## Testplan <img width="1312" alt="Screenshot 2024-01-16 at 3 29 02 PM" src="https://github.com/lastmile-ai/aiconfig/assets/141073967/f3574860-7d1b-4768-a536-7c6cd875af3c"> ### Dependencies Sapling removed the dependency pr. Depends on #929
With a new input attachment type `AttachmentDataWithStringValue` defined, This diff updates the HF image to text Model parser to validate input is in the expected form/type. Also made some updates to to make input attachment validation clearer. ## Testplan ### Dependencies Sapling removed the dependency pr. Depends on #929
With a new input attachment type `AttachmentDataWithStringValue` defined, This diff updates the HF image to text Model parser to validate input is in the expected form/type. Also made some updates to to make input attachment validation clearer. ## Testplan <img width="1167" alt="Screenshot 2024-01-16 at 3 32 52 PM" src="https://github.com/lastmile-ai/aiconfig/assets/141073967/bfb6af75-a924-44d4-9a66-25374814d569"> ### Dependencies Sapling removed the dependency pr. Depends on #929
With a new input attachment type `AttachmentDataWithStringValue` defined, This diff updates the HF image to text Model parser to validate input is in the expected form/type. Also made some updates to to make input attachment validation clearer. ## Testplan <img width="1167" alt="Screenshot 2024-01-16 at 3 32 52 PM" src="https://github.com/lastmile-ai/aiconfig/assets/141073967/bfb6af75-a924-44d4-9a66-25374814d569"> ### Dependencies Sapling removed the dependency pr. Depends on #929
[rfc][sdk] 1/n Standardize Input Schema - Input Attachment Data
Starting point of standardizing Input Schema for prompts
This diff introduces the type
AttachmentDataWithStringValue
to python and typescript sdk which will allow attachments to have structure as well as validation in python (pydantic validation).testplan