neo4j / neo4j-graphrag-python

Neo4j GraphRAG for Python
https://neo4j.com/docs/neo4j-graphrag-python/current/
Other
231 stars 37 forks source link

Make pipeline work with parallel runs #119

Closed stellasia closed 2 months ago

stellasia commented 2 months ago

Description

Initial issue

The component's results were saved using the component name as key, and the component status were saved in the component directly, which makes the following not behaving as expected (and returning the same result for both 'runs'):

    pipe = Pipeline()
    pipe.add_component(ComponentAdd(), "add")
    run_params = [[1, 20], [10, 2]]
    runs = []
    for a, b in run_params:
        runs.append(pipe.run({"add": {"number1": a, "number2": b}}))
    results = await asyncio.gather(*runs)
    print(result)

(note: this code has been turned into a unit test)

What's in this PR?

Type of Change

Complexity

Note

Please provide an estimated complexity of this PR of either Low, Medium or High

Complexity: Medium

How Has This Been Tested?

Checklist

The following requirements should have been met (depending on the changes in the branch):