-
Notifications
You must be signed in to change notification settings - Fork 18
feat: add chunking to ChangeTone, ContextWrite, ProofreadProvider, ReformulateProvider, TopicsProvider, and TranslateProvider #240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ce995c1 to
72c3dff
Compare
…formulateProvider, TopicsProvider, and TranslateProvider Signed-off-by: Lukas Schaefer <[email protected]>
Signed-off-by: Lukas Schaefer <[email protected]>
b42002d to
c9ecd9c
Compare
julien-nc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some task types like proofread, the output can be weird as one chunk could be correct and another one incorrect. So one completion request might produce there are no spelling or grammar mistakes and the other one would list the mistakes, ending up in a confusing/contradicting answer.
Maybe the proofread prompt could be adjusted to something like "do not output anything if there is no mistake or correction suggestion". And in the end we assemble the results and if all the chunks were clean, we artificially set the response to there are no spelling or grammar mistakes. Wdyt?
c8b9842 to
c9ecd9c
Compare
I did try to change the prompt to attempt to output nothing, but it really doesn't want to do that. It will either ignore that instruction or literally say 'empty string' or 'nothing' or it will output an empty json list. This happens with many different models. Also I don't think we can just set the response to |
|
We could use another LLM request to combine the outputs |
@lukasdotcom That sounds safer indeed. This will hopefully get rid of the contradiction 😁 |
one other method could be to use structured outputs and instruct the LLM to output changes in different JSON keys. Even smaller models are capable of that now. the actual text can be wrapped in something like |
The advantage I see of @marcelklehr method is that it would also allow for duplicate recommendations to be removed. Like if the person misspelled the same word multiple times in different chunks, but the JSON could save an llm request. |
|
What would be the benefit of having the LLM wrap the output in json? We still need to combine potentially conflicting outputs somehow |
That llms will actually output an empty string. |
e1bd8f9 to
48f1f4f
Compare
Implemented another LLM request when multiple chunks exist to merge all the feedback into one list. Also made the formatting nicer because a lot of the time the LLM spit out a numbered list and it looks weird when it counts 1, 2, 3, 1, 2... |
Signed-off-by: Lukas Schaefer <[email protected]>
48f1f4f to
e58dbf6
Compare
julien-nc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works nicely with gpt-3.5.
We should improve the system prompts to increase the chances the answer is given in the same language as the input text. Can be done in another issue/PR.
The implementation for TopicsProvider isn't that great, but is passable.
Also I added progress to all the chunked providers because it made debugging easier.