stanfordnlp / dspy

DSPy: The framework for programming—not prompting—foundation models
https://dspy-docs.vercel.app/
MIT License
17.36k stars 1.33k forks source link

how to set dspy to make the result to be chinese or english? #1210

Closed wuyuzhe closed 5 days ago

wuyuzhe commented 3 months ago

i found that , dspy's result always be english ,how to set dspy,to make the result to chinese or other languages

arnavsinghvi11 commented 3 months ago

729 and #809 address some of this. Additionally, you can specify this in the description of the OutputField by setting dspy.OutputField(desc = ...)

wuyuzhe commented 3 months ago

thank you for your answer. i did it with dspy.Predict. but it do not well in other modules.

cleverpig commented 2 months ago

add rationale_type! https://github.com/stanfordnlp/dspy/issues/809 https://github.com/stanfordnlp/dspy/blob/1a56e69465ef14ab9b7554184e99712766dd77dd/dspy/predict/chain_of_thought.py#L32

okhat commented 5 days ago

Thanks for opening this! We released DSPy 2.5 yesterday. I think the new dspy.LM and the underlying dspy.ChatAdapter which you can customize will probably resolve this problem.

Here's the (very short) migration guide, it should typically take you 2-3 minutes to change the LM definition and you should be good to go: https://github.com/stanfordnlp/dspy/blob/main/examples/migration.ipynb

Please let us know if this resolves your issue. I will close for now but please feel free to re-open if the problem persists.