refactor: Replace Chains with Runnables across applicable classes#84
Merged
Conversation
…asses for improved structure and tracing capabilities
youssefcamao
approved these changes
Sep 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request refactors the codebase to replace the legacy "Chain" terminology with the Langchains "Runnable" terminology. It updates class names, file names, and dependency injections throughout the project, improving code clarity and consistency. The changes also rename tracer classes and their usage to match the new naming convention.
Core Terminology Refactor
AsyncChainwithAsyncRunnableacross the codebase, updating class definitions in files such asinformation_enhancer.py,summarizer.py,graph_base.py, and answer generation/rephrasing chains. ([[1]](https://github.com/stackitcloud/rag-template/pull/84/files#diff-9dc8459159718f57a3fa0bf9957a7371f3a048f48316801a73dc308e41f2bb1bL9-R15),[[2]](https://github.com/stackitcloud/rag-template/pull/84/files#diff-667a3ff4405d85b37364dacfd6010fc86d7f54378759061f54ea92a94bb28046L8-R14),[[3]](https://github.com/stackitcloud/rag-template/pull/84/files#diff-5339bc54ab240f4fc8ff429c1eb10b9426078d68eb135d4c5d07762da0b3d6a4L10-R13),[[4]](https://github.com/stackitcloud/rag-template/pull/84/files#diff-383d1b454a8f86bcd6e83561f9404bf94b3fe9877d1a045bcb3586105b0fa5cdL10-R17),[[5]](https://github.com/stackitcloud/rag-template/pull/84/files#diff-8133279f7c0d324fdfc28838bb487748c091179dc11fc23c79c4f3f489bc3827L9-R16))async_chain.pytoasync_runnable.pyand updated the base class name accordingly. ([libs/rag-core-lib/src/rag_core_lib/runnables/async_runnable.pyL10-R10](https://github.com/stackitcloud/rag-template/pull/84/files#diff-ab5426af1a107aabc1976b764b6cacb37827d2196a730c172d03f5da64ad39c9L10-R10))Tracer Class and Dependency Updates
TracedGraphwithTracedRunnableand updated the corresponding file name fromtraced_chain.pytotraced_runnable.py. ([libs/rag-core-lib/src/rag_core_lib/tracers/traced_runnable.pyL10-R16](https://github.com/stackitcloud/rag-template/pull/84/files#diff-d6877e89effd4fb71dd24a4ce13a5ded94fac87eab9ff78eee0345d6f7100b83L10-R16))LangfuseTracedGraphwithLangfuseTracedRunnableand updated the file name fromlangfuse_traced_chain.pytolangfuse_traced_runnable.py. ([libs/rag-core-lib/src/rag_core_lib/impl/tracers/langfuse_traced_runnable.pyL9-R12](https://github.com/stackitcloud/rag-template/pull/84/files#diff-b9a916afc928c0acd5b57f6bd46a1213dc898d37f01bd2372d0033cb1941b7caL9-R12))admin-api-libandrag-core-apito useLangfuseTracedRunnableinstead ofLangfuseTracedGraph. ([[1]](https://github.com/stackitcloud/rag-template/pull/84/files#diff-8b7c1816cb3e0a40b7965721c550eefdc184c5d914ec023e36527255613381e7L68-R68),[[2]](https://github.com/stackitcloud/rag-template/pull/84/files#diff-8b7c1816cb3e0a40b7965721c550eefdc184c5d914ec023e36527255613381e7L150-R150),[[3]](https://github.com/stackitcloud/rag-template/pull/84/files#diff-483b37f4ebbc24c973c3b170542171d90c65f3c6b68f1a6d598ce8964a94be7bL67-R67),[[4]](https://github.com/stackitcloud/rag-template/pull/84/files#diff-483b37f4ebbc24c973c3b170542171d90c65f3c6b68f1a6d598ce8964a94be7bL221-R221))API and Service Integration
DefaultChat,UseCaseChat) to acceptTracedRunnableinstead ofTracedGraph. ([[1]](https://github.com/stackitcloud/rag-template/pull/84/files#diff-3a92501b36d164b12ce941a944afcbfc440f7fb7093635cb1a405b714ecc6345L8-R14),[[2]](https://github.com/stackitcloud/rag-template/pull/84/files#diff-3532c3cdfb76374337d778f1aeef03f010fb44852319f3e09dcbfc1025852d97L7-R13))These changes ensure the codebase is up-to-date with the latest LangChain abstractions and make the tracing and runnable logic clearer and more maintainable.