-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
feat: Allow Connection of ChatGenerator to AnswerBuilder #7897
base: main
Are you sure you want to change the base?
Conversation
ChatGenerators only return replies, so when you connect a ChatGenerator to an AnswerBuilder, you have to use llm -> answer_builder as shown here:
The metadata is already contained in a ChatMessage. If we add support for metadata output of the ChatGenerator, we will be sending redundant data. |
Pull Request Test Coverage Report for Build 9606421122Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9606450913Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
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.
Thank you for your contribution @lbux . The PR looks quite good to me already! 👍 There are just four mypy issues we need to fix:
haystack/components/builders/answer_builder.py:110: error: Item "str" of "Union[str, ChatMessage]" has no attribute "meta" [union-attr]
haystack/components/builders/answer_builder.py:111: error: Item "str" of "Union[str, ChatMessage]" has no attribute "content" [union-attr]
haystack/components/builders/answer_builder.py:119: error: Argument 1 to "_extract_reference_idxs" of "AnswerBuilder" has incompatible type "object"; expected "str" [arg-type]
haystack/components/builders/answer_builder.py:131: error: Argument 1 to "_extract_answer_string" of "AnswerBuilder" has incompatible type "object"; expected "str" [arg-type]
In addition, we should extend the release note to explain a bit more that the AnswerBuilder now accepts ChatMessages as input in addition to strings and that the metadata of the ChatMessage will be added to the Answer. Please let me know if you need any help here. Happy to address these change requests and pushing the PR over the finish line. 🙂
Pull Request Test Coverage Report for Build 9668079863Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9668339128Details
💛 - Coveralls |
The mypy issues were resolved by explicitly casting as I did not want to just |
Related Issues
Proposed Changes:
This PR makes it possible to pass in a ChatMessage to AnswerBuilder
How did you test it?
Replicated str tests for ChatMessages.
Notes for the reviewer
Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
.