-
Notifications
You must be signed in to change notification settings - Fork 664
FEAT: Sora target: support remix, image-to-video #1341
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,30 @@ def get_piece(self, n: int = 0) -> MessagePiece: | |
|
|
||
| return self.message_pieces[n] | ||
|
|
||
| def get_pieces_by_type(self, *, data_type: PromptDataType) -> list[MessagePiece]: | ||
| """ | ||
| Return all message pieces matching the given data type. | ||
|
|
||
| Args: | ||
| data_type: The converted_value_data_type to filter by. | ||
|
|
||
| Returns: | ||
| A list of matching MessagePiece objects (may be empty). | ||
| """ | ||
| return [p for p in self.message_pieces if p.converted_value_data_type == data_type] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Converted value data type... I think this is fine BUT we may want to have the same for original value data type at some point in which case we'd have to probably change the param name. That is technically breaking so maybe we just want to generalize this to have two input params ( I know it's not something you need here, just trying to think ahead. |
||
|
|
||
| def get_piece_by_type(self, *, data_type: PromptDataType) -> Optional[MessagePiece]: | ||
| """ | ||
| Return the first message piece matching the given data type, or None. | ||
|
|
||
| Args: | ||
| data_type: The converted_value_data_type to filter by. | ||
|
|
||
| Returns: | ||
| The first matching MessagePiece, or None if no match is found. | ||
| """ | ||
| return next((p for p in self.message_pieces if p.converted_value_data_type == data_type), None) | ||
|
|
||
| @property | ||
| def api_role(self) -> ChatMessageRole: | ||
| """ | ||
|
|
||
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.
In the image target, we pass text and image together and then the image gets edited based on the text. That is kind of similar to remix. I understand why sending the video would be a bad idea. That said, I would like us to think through how multimodal attacks with this would work (similarly with the image editing functionality). One could alternatively envision passing text + video and the target handles it from there (i.e., ignores the video but just takes the video_id and attaches it to the request). Putting the video_id into metadata is a little bit of a hack so I just want us to be conscious while making this choice.