MCPcopy
hub / github.com/stanfordnlp/dspy / forward

Method forward

tests/utils/test_settings.py:64–69  ·  view source on GitHub ↗
(self, question: str)

Source from the content-addressed store, hash-verified

62 self.predict = dspy.Predict("question -> answer")
63
64 def forward(self, question: str) -> str:
65 lm = dspy.LM("openai/gpt-4o-mini", cache=False) if "France" in question else dspy.settings.lm
66 with dspy.context(lm=lm):
67 time.sleep(1)
68 assert dspy.settings.lm.model == lm.model
69 return self.predict(question=question)
70
71 with mock.patch("litellm.completion") as mock_completion:
72 mock_completion.return_value = ModelResponse(

Callers

nothing calls this directly

Calls 2

contextMethod · 0.80
predictMethod · 0.80

Tested by

no test coverage detected