You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File [~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:234](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:234), in with_callbacks.<locals>.wrapper(instance, *args, **kwargs)
[232](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:232) # If no callbacks are provided, just call the function
[233](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:233) if not callbacks:
--> [234](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:234) return fn(instance, *args, **kwargs)
[236](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:236) # Generate call ID as the unique identifier for the call, this is useful for instrumentation.
[237](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:237) call_id = uuid.uuid4().hex
File [~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/primitives/program.py:24](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/primitives/program.py:24), in Module.__call__(self, *args, **kwargs)
[22](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/primitives/program.py:22) @with_callbacks
[23](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/primitives/program.py:23) def __call__(self, *args, **kwargs):
---> [24](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/primitives/program.py:24) return self.forward(*args, **kwargs)
File [~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/functional/functional.py:322](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/functional/functional.py:322), in TypedPredictor.forward(self, **kwargs)
[320](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/functional/functional.py:320) signature = self._prepare_signature()
[321](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/functional/functional.py:321) for try_i in range(self.max_retries):
--> [322](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/functional/functional.py:322) result = self.predictor(**modified_kwargs, new_signature=signature)
[323](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/functional/functional.py:323) errors = {}
[324](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/functional/functional.py:324) parsed_results = []
File [~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:234](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:234), in with_callbacks.<locals>.wrapper(instance, *args, **kwargs)
[232](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:232) # If no callbacks are provided, just call the function
[233](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:233) if not callbacks:
--> [234](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:234) return fn(instance, *args, **kwargs)
[236](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:236) # Generate call ID as the unique identifier for the call, this is useful for instrumentation.
[237](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:237) call_id = uuid.uuid4().hex
File [~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:93](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:93), in Predict.__call__(self, **kwargs)
[91](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:91) @with_callbacks
[92](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:92) def __call__(self, **kwargs):
---> [93](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:93) return self.forward(**kwargs)
File [~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:127](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:127), in Predict.forward(self, **kwargs)
[124](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:124) import dspy
[126](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:126) if isinstance(lm, dspy.LM):
--> [127](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:127) completions = v2_5_generate(lm, config, signature, demos, kwargs, _parse_values=self._parse_values)
[128](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:128) else:
[129](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:129) warn_once(
[130](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:130) "\t*** In DSPy 2.5, all LM clients except `dspy.LM` are deprecated, "
[131](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:131) "underperform, and are about to be deleted. ***\n"
(...)
[136](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:136) " \t\thttps://github.com/stanfordnlp/dspy/blob/main/examples/migration.ipynb"
[137](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:137) )
File [~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:234](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:234), in v2_5_generate(lm, lm_kwargs, signature, demos, inputs, _parse_values)
[230](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:230) import dspy
[232](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:232) adapter = dspy.settings.adapter or dspy.ChatAdapter()
--> [234](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:234) return adapter(
[235](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:235) lm, lm_kwargs=lm_kwargs, signature=signature, demos=demos, inputs=inputs, _parse_values=_parse_values
[236](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/predict/predict.py:236) )
File [~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/base.py:46](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/base.py:46), in Adapter.__call__(self, lm, lm_kwargs, signature, demos, inputs, _parse_values)
[44](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/base.py:44) if _parse_values and not isinstance(self, JSONAdapter):
[45](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/base.py:45) return JSONAdapter()(lm, lm_kwargs, signature, demos, inputs, _parse_values=_parse_values)
---> [46](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/base.py:46) raise e
File [~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/base.py:30](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/base.py:30), in Adapter.__call__(self, lm, lm_kwargs, signature, demos, inputs, _parse_values)
[27](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/base.py:27) if isinstance(output, dict):
[28](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/base.py:28) output, output_logprobs = output["text"], output["logprobs"]
---> [30](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/base.py:30) value = self.parse(signature, output, _parse_values=_parse_values)
[32](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/base.py:32) assert set(value.keys()) == set(signature.output_fields.keys()), \
[33](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/base.py:33) f"Expected {signature.output_fields.keys()} but got {value.keys()}"
[35](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/base.py:35) if output_logprobs is not None:
File [~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:234](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:234), in with_callbacks.<locals>.wrapper(instance, *args, **kwargs)
[232](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:232) # If no callbacks are provided, just call the function
[233](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:233) if not callbacks:
--> [234](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:234) return fn(instance, *args, **kwargs)
[236](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:236) # Generate call ID as the unique identifier for the call, this is useful for instrumentation.
[237](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/utils/callback.py:237) call_id = uuid.uuid4().hex
File [~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/chat_adapter.py:65](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/chat_adapter.py:65), in ChatAdapter.parse(self, signature, completion, _parse_values)
[62](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/chat_adapter.py:62) def parse(self, signature, completion, _parse_values=True):
[63](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/chat_adapter.py:63) sections = [(None, [])]
---> [65](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/chat_adapter.py:65) for line in completion.splitlines():
[66](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/chat_adapter.py:66) match = field_header_pattern.match(line.strip())
[67](r-miniconda-arm64/dspy/lib/python3.11/site-packages/dspy/adapters/chat_adapter.py:67) if match:
AttributeError: 'NoneType' object has no attribute 'splitlines'
Unfortunately I cannot share the prompt
The text was updated successfully, but these errors were encountered:
I can not reproduce this. For me "TypedPredictor" works although its depricated.
Both of the following is working (also with your version):
import dspy
llm = dspy.LM("azure/gpt-4o", api_key=azure_api_key, api_version=api_version, api_base=api_base_url)
class BasicQA(dspy.Signature):
"""Answer questions with short factoid answers."""
question = dspy.InputField()
answer = dspy.OutputField(desc="often between 1 and 5 words")
generate_answer = dspy.Predict(BasicQA)
answer = generate_answer(question="What is the capital of France?")
print(answer)
class BasicQA(dspy.Signature):
"""Answer questions with short factoid answers."""
question: str = dspy.InputField()
answer: str = dspy.OutputField(desc="often between 1 and 5 words")
#Pass signature to Predict module
generate_answer = dspy.TypedPredictor(BasicQA)
answer = generate_answer(question="What is the capital of France?")
print(answer)
I am getting this strange error with Azure GPT4-o
Unfortunately I cannot share the prompt
The text was updated successfully, but these errors were encountered: