langchain
langchain copied to clipboard
implemented fix respons to chat base
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.
@hwchase17 this one would solve a lot of issues I'm encountering and it doesn't break tests!
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 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!
after changes to agents and refactors, this should probably go in the output parsing now?