stanfordnlp / dspy

DSPy: The framework for programming—not prompting—language models
https://dspy.ai
MIT License
19.26k stars 1.47k forks source link

Question: When creating a DSPy model with multiple outputs, does DSPy call the LLM API once per output? #1692

Closed rhiever closed 1 month ago

rhiever commented 1 month ago

For example, if I set up a model with a CoT reasoning output and then a final text output, will it call the LLM API twice?

okhat commented 1 month ago

Only one call if possible, overall in total, for every dspy.Predict call. But retries may happen if strictly necessary.

okhat commented 1 month ago

Use dspy.inspect_history(n=5) to view the last 5 prompts sent by DSPy and the outputs too!

rhiever commented 1 month ago

Brilliant, thank you @okhat.