langchain icon indicating copy to clipboard operation
langchain copied to clipboard

implemented fix respons to chat base

Open eavanvalkenburg opened this issue 1 year ago • 4 comments

I was getting a lot of non-conforming responses from azure openai gpt-35-turbo, so implemented fix_test function with a prompt, this allows agents that use non-chat to keep the same approach that is currently implemented, while chat models that have a scratchpad based on BaseMessages to provide fix messages into the flow to correct behaviour in terms of output.

eavanvalkenburg avatar Apr 12 '23 14:04 eavanvalkenburg

@hwchase17 this one would solve a lot of issues I'm encountering and it doesn't break tests!

eavanvalkenburg avatar Apr 13 '23 14:04 eavanvalkenburg

Nice work, this will help a lot. I was thinking the fixing prompt can be automatically generated like this btw https://github.com/hwchase17/langchain/pull/2656#issuecomment-1506399807

yummydum avatar Apr 16 '23 00:04 yummydum

@yummydum I agree there are other ways to do it, this one worked well for me, I'm thinking maybe also allowing a str and function that you can set from the user side, where you can run other code as well, i don't think always putting in the full formatting instructions always make sense (especially from a token perspective), but with a function you might be able to build something that the first time it gives back a simple str, and when it makes a mistake multiple times that you then resubmit the full formatting instructions, or something similar!

eavanvalkenburg avatar Apr 16 '23 12:04 eavanvalkenburg

after changes to agents and refactors, this should probably go in the output parsing now?

hwchase17 avatar Apr 24 '23 23:04 hwchase17