docs: dspy integration blog#34
Conversation
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
ajbozarth
left a comment
There was a problem hiding this comment.
Great start, here's a few items to address:
There's a typo in the file name: dspy-inegration.md -> dspy-integration.md
ajbozarth
left a comment
There was a problem hiding this comment.
I ran the code snippets as well and got the following additional notes:
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
ajbozarth
left a comment
There was a problem hiding this comment.
model="mellea-ollama" appears in 12 of the 15 code examples. Per the source, this parameter is metadata only — it doesn't select the Ollama backend; the actual model comes from start_session() configuration. Suggest dropping it from all examples (the default "mellea" is fine) to avoid implying it matters.
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
planetf1
left a comment
There was a problem hiding this comment.
Tested with mellea_dspy==0.1.0 and dspy on Python 3.12. Five findings below — two code-correctness items (A, B) and three reader-experience gaps (C–E). None repeats prior comments.
planetf1
left a comment
There was a problem hiding this comment.
Narrative nit — a short 'which to pick' paragraph at the end of the feature tour.
planetf1
left a comment
There was a problem hiding this comment.
Just the one blocker with the sample code that should be addressed - otherwise just nits/style comments
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
|
@akihikokuroda a couple follow ups, but otherwise all of @planetf1 review items have been addressed |
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
Co-authored-by: Alex Bozarth <ajbozart@us.ibm.com>
Co-authored-by: Alex Bozarth <ajbozart@us.ibm.com>
|
Thanks @ajbozarth for the response above -- I think there's still a remaining issue.
there's a default case of In our There's also the Refine example which uses So this is about a concern there are silient errors and/or not showing fully how the requirement works -- even though running it, it looks as if it might work |
|
This could work for Complete fixed BestOfN snippet — combining the session-state restore with handled requirement patterns: import dspy
from mellea import start_session
from mellea_dspy import MelleaLM, MelleaBestOfN
m = start_session()
dspy.configure(lm=MelleaLM(mellea_session=m)) # neutral global LM, no inherited requirements
qa = dspy.ChainOfThought("question -> answer")
best_of_5 = MelleaBestOfN(
module=qa,
N=5,
requirements=[
"Must be under 3 words", # routes to _create_max_words_reward
"Must be professional", # routes to _create_professional_reward
],
threshold=0.8,
)
result = best_of_5(question="What is the capital of Belgium?")
print(result.answer)
# BrusselsMaybe also add an explanation of BestForN about the fact we're just pattern checking (in verification.py) For the Refine example, we just need to correct the phrase requirements=[
"Must be under 50 words",
"Must mention AI", # single term — extracts "ai", substring match
], |
Signed-off-by: Akihiko Kuroda <akihikokuroda2020@gmail.com>
planetf1
left a comment
There was a problem hiding this comment.
LGTM - thanks for the last batch of fixes - tested code execution and it's working as described!
|
Scheduled merge for |
dspy integration blog
/schedule 2026-05-06