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

Method aforward

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

Source from the content-addressed store, hash-verified

103 self.predict = dspy.Predict("question -> answer")
104
105 async def aforward(self, question: str) -> str:
106 lm = (
107 dspy.LM("openai/gpt-4o-mini", cache=False)
108 if "France" in question
109 else dspy.LM("openai/gpt-4o", cache=False)
110 )
111 with dspy.context(lm=lm, trace=[]):
112 await asyncio.sleep(1)
113 assert dspy.settings.lm.model == lm.model
114 result = await self.predict.acall(question=question)
115 assert len(dspy.settings.trace) == 1
116 return result
117
118 module = MyModule()
119

Callers

nothing calls this directly

Calls 2

contextMethod · 0.80
acallMethod · 0.45

Tested by

no test coverage detected