Skip to content
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

[DNM] Complex image type handling #1801

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

[DNM] Complex image type handling #1801

wants to merge 6 commits into from

Conversation

isaacbmiller
Copy link
Collaborator

Inspired by #1763 and to close #1767.

Goal is to support images inside arbitrary pydantic objects and to eventually make it easy to add support for other modalities.

@isaacbmiller isaacbmiller marked this pull request as draft November 15, 2024 02:35
"class ColorSignature(dspy.Signature):\n",
" \"\"\"Output the color of the designated image.\"\"\"\n",
" image_1: dspy.Image = dspy.InputField(desc=\"An image\")\n",
" image_2: dspy.Image = dspy.InputField(desc=\"An image\")\n",
" images: List[dspy.Image] = dspy.InputField(desc=\"An image\")\n",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
" images: List[dspy.Image] = dspy.InputField(desc=\"An image\")\n",
" images: List[dspy.Image] = dspy.InputField(desc=\"A list of images\")\n",

@JehandadK
Copy link

Thanks for the PR @isaacbmiller. I tried this branch with this signature and sharing relevant logs here with you:

class CreateTitleAndDescription(dspy.Signature):
    """Taking in a list of images and a category tree to output title, description and attributes."""

    images: List[dspy.Image] = dspy.InputField(desc="list of images about the item")
    categories: str = dspy.InputField(desc="category tree of the item")
    title: str = dspy.OutputField(desc=title_desc)
    description: str = dspy.OutputField(desc=description_desc)
    {
      'role': 'user',
      'content': '[[ ## images ## ]]\n["https://static-sd.mercdn.net/photos/m34859626959_1.jpg", "https://static-sd.mercdn.net/photos/m34859626959_2.jpg", "https://static-sd.mercdn.net/photos/m34859626959_3.jpg"]\n\n[[ ## categories ## ]]\nゲーム・おもちゃ・グッズ > トレーディングカード\n\nRespond with the corresponding output fields, starting with the field `[[ ## title ## ]]`, then `[[ ## description ## ]]`, and then ending with the marker for `[[ ## completed ## ]]`.'
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Image support inside complex types
2 participants