dspy
dspy copied to clipboard
Implement a more lenient fields parsing for newlines in ChatAdapter
This allows the parser to parse the response, even if the newlines aren't present correctly due to the model not including newlines.
Example error:
Adapter ChatAdapter failed to parse the LM response.
LM Response: [[ ## next_thought ## ]]
The user wants me to ...snip...transactions.[[ ## next_tool_name ## ]]
redacted[[ ## next_tool_args ## ]]
{
"query": "redacted"
}
[[ ## completed ## ]]
Expected to find output fields in the LM response: [next_thought, next_tool_name, next_tool_args]
Actual output fields parsed from the LM response: [next_thought]