Skip to content

Fix: pass string to draft_joke (use joke.joke)#2

Open
tanvircr7 wants to merge 1 commit intoavbiswas:mainfrom
tanvircr7:tanvircr7-patch-1
Open

Fix: pass string to draft_joke (use joke.joke)#2
tanvircr7 wants to merge 1 commit intoavbiswas:mainfrom
tanvircr7:tanvircr7-patch-1

Conversation

@tanvircr7
Copy link

@tanvircr7 tanvircr7 commented Sep 6, 2025

Fix: pass string to draft_joke (use joke.joke)

Summary

This PR fixes a small type/semantics issue in IterativeJokeGenerator.forward.

Previously, the loop set:

draft_joke = joke

where joke is a DSPy Prediction object. This relied on implicit coercion when passing draft_joke into the next call.
Now it explicitly sets:

draft_joke = joke.joke

so draft_joke is a plain string, consistent with the IdeaToJoke signature

draft_joke: Optional[str]

Why

Avoids brittle realince on implicit type coercion

should be draft_joke = joke.joke in the loop. The current code is relying on DSPy’s auto coercion, but that’s brittle and confusing. Explicitly unwrapping (.joke) makes the flow clearer and type-safe
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.

1 participant