Skip to content

LM: todo!() panics on AssistantContent::Image #75

Open

Description

@darinkishore

Problem

lm/mod.rs has two todo!() panics for AssistantContent::Image:

  • Line 393 (inside execute_tool_loop)
  • Line 501 (inside call)

If a model returns an image response, this panics at runtime instead of returning a proper error.

Fix

Replace with:

AssistantContent::Image(_) => {
    return Err(anyhow::anyhow!("Image responses are not yet supported"));
}

Or, if image support is planned, return a structured PredictError variant.

Related

Activity

  1. darinkishore commented on Feb 12, 2026

    @darinkishore
    CollaboratorAuthor

    Confirmed — exact locations

    crates/dspy-rs/src/core/lm/mod.rs:

    • Line 393: AssistantContent::Image(_image) => todo!(), — inside execute_tool_loop, in the iteration match arm
    • Line 501: AssistantContent::Image(_image) => todo!(), — inside call, in the initial response match arm

    Both are in match arms handling the LM response type. If any model returns an image (e.g., DALL-E via tool, or multimodal output), this panics the entire runtime.

    Minimal fix: replace both with return Err(anyhow::anyhow!("Image responses are not yet supported")).

    Better fix (if #67 typed errors land first): return Err(LmCallError::UnsupportedContent).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions