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

bug: Runtime meta parameter is ignored in AnswerBuilder #8542

Open
sjrl opened this issue Nov 13, 2024 · 1 comment · May be fixed by #8544
Open

bug: Runtime meta parameter is ignored in AnswerBuilder #8542

sjrl opened this issue Nov 13, 2024 · 1 comment · May be fixed by #8544
Labels
type:bug Something isn't working

Comments

@sjrl
Copy link
Contributor

sjrl commented Nov 13, 2024

Describe the bug
When using an AnswerBuilder after a ChatGenerator I am also passing meta information to the AnswerBuilder. However, when I do this noticed that the meta information I pass is ignored.

Here is an example piece of code

from haystack import Pipeline
from haystack.dataclasses import ChatRole, ChatMessage
from haystack.components.builders import AnswerBuilder

builder = AnswerBuilder()
pipeline = Pipeline()
pipeline.add_component(name="builder", instance=builder)

# Test the pipeline
result = pipeline.run(
    data={
        "builder": {
            "query": "What's the answer?",
            "replies": [
                ChatMessage(
                    role=ChatRole.ASSISTANT,
                    content="This is the answer from the LLM.",
                    meta={"stuff": "meta data that always comes from the generator"},
                    name=None
                )
            ],
            "meta": [
                {"my_meta": "The meta data I want to add to the answer"}
            ]
        }
    }
)
print(result)
# {'builder':
#     {
#         'answers': [
#             GeneratedAnswer(
#                 data='This is the answer from the LLM.',
#                 query="What's the answer?",
#                 documents=[],
#                 meta={'stuff': 'meta data that always comes from the generator'})  # <-- Should also include meta I passed
#         ]
# }}

Expected behavior
Merge the meta data from the replies of the ChatGenerator + meta data passed as a run time variable

To Reproduce
Run the sample code

@sjrl sjrl changed the title Runtime meta parameter is ignored in AnswerBuilder bug: Runtime meta parameter is ignored in AnswerBuilder Nov 13, 2024
@sjrl sjrl added the type:bug Something isn't working label Nov 13, 2024
@lbux
Copy link
Contributor

lbux commented Nov 14, 2024

I see what I did wrong. I can fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants