Open Puzer opened 1 year ago
The plan is to support full serialization properly for all of this ASAP, but we haven’t exactly explored multi-LM programs.
setting .lm of a module right now is… not documented so it actually has odd side effects, be careful, but we can easily spend time on this right now if you need it
The effective thing to do now is
with dspy.settings.context(lm=…): …. Inside this block, the lm is different (you can also nest this pattern)
The effective thing to do now is
with dspy.settings.context(lm=…): …. Inside this block, the lm is different (you can also nest this pattern)
Yep, it works.
I tried to assign Predictor.lm manually, it might work fine for my case, but I've got unexpected behaviour due to query_only=True.
May I ask you to explain what is use-case of using query_only=True ? I understand what it do (skips demos and guidelines), but why ? :) https://github.com/stanfordnlp/dspy/blob/54a60140b0e5419d6d2ce1e3d835faba1c6ceccb/dspy/predict/predict.py#L89
I want to understand plans for serialization and deserialization of LLMs from state.
If I try to dump_state() of a Predictor or Module I see that conceptually you've been thinking about this use-case. From what I get it's not implemented yet (e.g. I can assign LLM for some module\predictor e.g. by module.predictors()[0].lm = dspy.OpenAI(...), but when I try to save state, JSON of course can't serialize OpenAI class)
Why it's important:
In general for now I assume that the main use case is to use "global" and avoid using "local" assignment of LLMs. E.g. there is a simple code where "local" LLM didn't propagate into compiled model properly.