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
The System message says the [[ ## answer ## ]] should be followed by [[ ## completed ## ]]. This is not a response from the LM! It is a answer constructed inside Adapter.format_assistant_message_content().
Steps to reproduce
import dspy
dspy.settings.configure(lm=dspy.LM("openai/gpt-4o-mini"))
class MySignature(dspy.Signature):
question: str = dspy.InputField()
history: dspy.History = dspy.InputField()
answer: str = dspy.OutputField()
history = dspy.History(
messages=[
{"question": "What is the capital of France?", "answer": "Paris"},
{"question": "What is the capital of Germany?", "answer": "Berlin"},
]
)
predict = dspy.Predict(MySignature)
outputs = predict(question="What is the capital of France?", history=history)
print('System message:')
print(dspy.settings.lm.history[-1]['messages'][0]['content'])
print('Constructed assistant message:')
print(dspy.settings.lm.history[-1]['messages'][2]['content'])
System message:
Your input fields are:
1. `question` (str)
2. `history` (History)
Your output fields are:
1. `answer` (str)
All interactions will be structured in the following way, with the appropriate values filled in.
[[ ## question ## ]]
{question}
[[ ## history ## ]]
{history}
[[ ## answer ## ]]
{answer}
[[ ## completed ## ]]
In adhering to this structure, your objective is:
Given the fields `question`, `history`, produce the fields `answer`.
Constructed assistant message:
[[ ## answer ## ]]
Paris
The [[ ## answer ## ]] tag constructed by Adapter.format_assistant_message_content() should have a [[ ## completed ## ]] tag after it.
Thanks for your excellent work on DSPy!
DSPy version
2.6.23
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
What happened?
The DSPy History example produces an incorrectly formatted assistant message.
https://dspy.ai/api/primitives/History/
The System message says the [[ ## answer ## ]] should be followed by [[ ## completed ## ]]. This is not a response from the LM! It is a answer constructed inside Adapter.format_assistant_message_content().
Steps to reproduce
The [[ ## answer ## ]] tag constructed by Adapter.format_assistant_message_content() should have a [[ ## completed ## ]] tag after it.
Thanks for your excellent work on DSPy!
DSPy version
2.6.23
The text was updated successfully, but these errors were encountered: