mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-07-16 05:20:51 +00:00
24 lines
786 B
Python
24 lines
786 B
Python
# SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai>
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
from haystack.core.pipeline import Pipeline
|
|
from haystack.testing.sample_components import AddFixedValue, Double
|
|
|
|
import logging
|
|
|
|
logging.basicConfig(level=logging.DEBUG)
|
|
|
|
|
|
def test_pipeline(tmp_path):
|
|
pipeline = Pipeline()
|
|
pipeline.add_component("first_addition", AddFixedValue(add=2))
|
|
pipeline.add_component("second_addition", AddFixedValue())
|
|
pipeline.add_component("double", Double())
|
|
pipeline.connect("first_addition", "double")
|
|
pipeline.connect("double", "second_addition")
|
|
|
|
pipeline.draw(tmp_path / "linear_pipeline.png")
|
|
|
|
results = pipeline.run({"first_addition": {"value": 1}})
|
|
assert results == {"second_addition": {"result": 7}}
|