deepset-ai / haystack

AI orchestration framework to build customizable, production-ready LLM applications. Connect components (models, vector DBs, file converters) to pipelines or agents that can interact with your data. With advanced retrieval methods, it's best suited for building RAG, question answering, semantic search or conversational agent chatbots.
https://haystack.deepset.ai
Apache License 2.0
17.72k stars 1.92k forks source link

fix: ChatPromptBuilder from_dict if template is None #8165

Closed faymarie closed 3 months ago

faymarie commented 3 months ago

Related Issues

When initialisizing ChatPromptBuilder component from_dict with value {"template": None}, we receive 'NoneType' object is not iterable.

Proposed Changes:

Fix from_dict method.

How did you test it?

Unit test

Notes for the reviewer

Checklist

coveralls commented 3 months ago

Pull Request Test Coverage Report for Build 10265959872

Details


Totals Coverage Status
Change from base Build 10247553761: 0.001%
Covered Lines: 6914
Relevant Lines: 7670

💛 - Coveralls
faymarie commented 3 months ago
        template = init_parameters.get("template")
        if template:
            init_parameters["template"] = [ChatMessage.from_dict(d) for d in template]

You are right. Better to keep it None! Pushed the change. We would be happy to have it in the upcoming release already! @julian-risch