langchain icon indicating copy to clipboard operation
langchain copied to clipboard

core[patch]: Fix JsonOutputParser returns empty json when text ends with "\".

Open liugddx opened this issue 1 year ago • 5 comments

  • Issue: Close #20204
  • @baskaryan, @efriis, @eyurtsev, @hwchase17.

liugddx avatar Apr 11 '24 04:04 liugddx

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview May 15, 2024 2:35pm

vercel[bot] avatar Apr 11 '24 04:04 vercel[bot]

@eyurtsev This is a bug, please take a look, thanks.

liugddx avatar Apr 13 '24 14:04 liugddx

@eyurtsev PTAL

liugddx avatar Apr 24 '24 02:04 liugddx

@liugddx the unit test I added was meant to illustrate that the current change to the code is incorrect.

This change introduces a bug that mutates the original JSON!

image

eyurtsev avatar May 17 '24 15:05 eyurtsev

What you can do is restore the original test, and then create a new test that shows the streaming version. In that test, adjust the test case first so that it produces the correct stream and then determine how to update the code correctly so it doesn't mutate the original JSON being streamed and inserts additional \.

eyurtsev avatar May 17 '24 15:05 eyurtsev

closing due to inactivity

hwchase17 avatar Jun 19 '24 23:06 hwchase17