Skip to content
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

fix(dspy): Fix template.extract to be more robust #1097

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dat-boris
Copy link
Contributor

@dat-boris dat-boris commented Jun 2, 2024

While experimenting with GPT4/Gemini, noticed that sometimes the completion will contain the input.

In that case, the previous template.extract will fail to extract (see test_single_output_with_noise test). This provides a fix for such a situation.

@okhat
Copy link
Collaborator

okhat commented Jun 4, 2024

OK this may be a great thing to think about including but it's also a breaking change in some sense. It changes behavior for exiting code quite a bit. So we can't directly merge to main. I'll keep this open while we're exploring better parsing in general in the next few days and will update here

@dat-boris
Copy link
Contributor Author

dat-boris commented Jun 8, 2024

Thanks @okhat - appreciate the feedback, and thanks for creating + maintaining DSpy!

it's also a breaking change in some sense. It changes behavior for exiting code quite a bit.

Yeah agree that will change the existing behaviour - some of which is thankfully is documented with some of the existing test cases (and new ones). IMHO the change is a net improvement to the parsing behaviour since we always want to remove those un-necessary repeat of input in the output, and this doesnt change the behaviour if such input is not found. But totally understand that there's lots of edge cases to be considered!

I'll keep this open while we're exploring better parsing in general in the next few days and will update here

Sounds great! Yeah it sounds like that existing parsing can be improved (e.g. if we can shift to using structured output) - looking forward to it, as it will help with my current use case :-)

p.s. big fan of the MLOps session you did a few months ago to talk about DSpy!

@oldcai
Copy link

oldcai commented Jun 9, 2024

@okhat With OpenAI, only 'gpt-3.5-turbo-instruct' works well for completion. Other models, even 'gpt-4-1106-preview', tend to repeat the input.

@dat-boris I had some tests, and it works great. Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants