refactor(llmrails): extract generation workflow (4/9)#2126
Draft
Pouyanpi wants to merge 1 commit into
Draft
Conversation
This was referenced Jul 2, 2026
This was referenced Jul 2, 2026
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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.
Description
Moves request normalization, request context, response shaping, tracing, and the standard generation workflow into generation helpers.
Why
generate_asyncbecomes orchestration around an owned generation boundary while preserving the public API.What Changed
developassistant tool-call handling.Review Guidance
Use the LLMRails decomposition review matrix to validate generation, options, response shaping, tool-call, tracing, and retrieval scenarios against the recorded #2122 baseline.
Focus on validation order, context cleanup, metadata capture, cache behavior, response fields, and delegation equivalence. Tracing ownership is intentionally consolidated under
generationin part 8.This nine-part stack turns
LLMRailsinto a public compatibility shell while moving owned behavior into focused modules. Review each PR only against its parent. Parts 2-6 intentionally stage behavior-preserving extraction; part 7 consolidates shared type contracts and logger naming; part 8 establishes the final package ownership; part 9 contains the explicit semantic follow-ups.For parts 2-6, please distinguish stack-local correctness or compatibility problems from naming and placement concerns already resolved in parts 7-8. If an intermediate name or location is correct and mergeable at that point, prefer reviewing its final form in the resolving PR instead of requesting duplicate churn. Public API changes, behavior changes, import cycles, or an independently broken intermediate branch remain in scope wherever they appear. Much of the apparent added LOC is moved code plus focused tests; the corresponding implementation is removed or delegated from
llmrails.pyin the same PR.Stack Position
Part 4 of 9.
restack/llmrails-01-public-contract-testsdeveloprestack/llmrails-02-startuprestack/llmrails-01-public-contract-testsrestack/llmrails-03-runtime-conversationrestack/llmrails-02-startuprestack/llmrails-04-generationrestack/llmrails-03-runtime-conversationrestack/llmrails-05-streamingrestack/llmrails-04-generationrestack/llmrails-06-checks-finalrestack/llmrails-05-streamingrestack/llmrails-07-consistencyrestack/llmrails-06-checks-finalrestack/llmrails-08-boundary-ownershiprestack/llmrails-07-consistencyrestack/llmrails-09-followupsrestack/llmrails-08-boundary-ownershipVerification
AI Assistance
Checklist