Skip to content

refactor: Replace Chains with Runnables across applicable classes#84

Merged
a-klos merged 1 commit into
mainfrom
refactor/class-renaming
Sep 2, 2025
Merged

refactor: Replace Chains with Runnables across applicable classes#84
a-klos merged 1 commit into
mainfrom
refactor/class-renaming

Conversation

@a-klos
Copy link
Copy Markdown
Member

@a-klos a-klos commented Sep 2, 2025

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

  • Replaced all instances of AsyncChain with AsyncRunnable across the codebase, updating class definitions in files such as information_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))
  • Renamed the file async_chain.py to async_runnable.py and 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

  • Replaced TracedGraph with TracedRunnable and updated the corresponding file name from traced_chain.py to traced_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))
  • Replaced LangfuseTracedGraph with LangfuseTracedRunnable and updated the file name from langfuse_traced_chain.py to langfuse_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))
  • Updated dependency containers in both admin-api-lib and rag-core-api to use LangfuseTracedRunnable instead of LangfuseTracedGraph. ([[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

  • Updated constructor parameters in API endpoint and service classes (DefaultChat, UseCaseChat) to accept TracedRunnable instead of TracedGraph. ([[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.

…asses for improved structure and tracing capabilities
@a-klos a-klos merged commit 0fb959a into main Sep 2, 2025
15 checks passed
@a-klos a-klos deleted the refactor/class-renaming branch September 2, 2025 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants