Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
| try: | ||
| result = self._run_single_sync(gen, messages, generation_kwargs, tools, streaming_callback) | ||
| replies = result.get("replies", []) | ||
| self._check_finish_reasons(replies) |
There was a problem hiding this comment.
I believe when the last generator in the list returns a filtered or length reply, the reply is discarded and run raises. With a single generator and fallback_on_incomplete_response=True:
RuntimeError: All 1 chat generators failed. Last error: Reply has finish_reason='length'. Failed chat generators: [Gen]
I'm not sure this is intended. A truncated reply is probably more useful than an exception when there is nothing left to fall back to. Do you think we should return the last generators reply in that case?
There was a problem hiding this comment.
While I see your point, I'm not entirely convinced we should return the last reply
- This would be different from the general behavior of this component: if all generators fail, we raise. It seems reasonable to me that the new fallback conditions stick to this rule.
- The user can still configure an appropriate fallback, e.g. a generator with a higher
max_tokensetting - For content filtering, a reply with no text is often returned
Happy to discuss further...
| try: | ||
| result = self._run_single_sync(gen, messages, generation_kwargs, tools, streaming_callback) | ||
| replies = result.get("replies", []) | ||
| self._check_finish_reasons(replies) |
There was a problem hiding this comment.
When streaming, the first generator's whole reply has already gone to the callback before we fall back, so the user sees both replies back to back (['truncated answ', 'full answer']). Could be worth mentioning in the param docstrings.
| @@ -49,22 +49,36 @@ class FallbackChatGenerator: | |||
| - Any other exception | |||
There was a problem hiding this comment.
Lets update the class docstring. It still says "Falls back on any exception raised by a generator" and the list here only covers exceptions.
…i/haystack into fallback-finish-reason
Related Issues
Proposed Changes:
FallbackChatGeneratorcan now switch to the next Chat Generator also if the current response is content filtered or incomplete (these are not errors but finish reasons)How did you test it?
CI, new tests
Notes for the reviewer
Haven't added this new feature to docs because I realized that the page needs a complete refresh. Tracked in https://github.com/deepset-ai/haystack-private/issues/674
Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:and added!in case the PR includes breaking changes.