Performance: LangChain architecture overview
MEDIUM IMPACT
This affects the speed and responsiveness of applications built with LangChain by influencing how data flows and how many external calls are made.
from langchain.schema.runnable import RunnableParallel chain = RunnableParallel(chain1, chain2, chain3) result = chain.invoke(input_data)
from langchain.chains import SimpleSequentialChain chain = SimpleSequentialChain(chains=[chain1, chain2, chain3]) result = chain.run(input_data)
| Pattern | Data Calls | Wait Time | User Interaction Delay | Verdict |
|---|---|---|---|---|
| Sequential Chains | Multiple sequential calls | Sum of all calls | High delay before response | [X] Bad |
| Concurrent Chains | Multiple parallel calls | Max of all calls | Lower delay, faster response | [OK] Good |