fix: Enhance Flow Copilot with RAG, Memory, and Structured JSON Output - #321
fix: Enhance Flow Copilot with RAG, Memory, and Structured JSON Output#321viikas04 wants to merge 13 commits into
Conversation
|
Warning Review limit reached
Next review available in: 59 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThe flow-copilot architecture now retrieves conversation memory and node documentation, generates structured flow blueprints, stores conversation details, and returns blueprint data. Gemini configurations support the new retrieval and generation nodes. Prompts and README instructions cover citations, setup, and knowledge-base ingestion. ChangesFlow Copilot RAG and Memory Pipeline
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
:robot_face: AgentKit Structural ValidationExisting Kits Modified (not allowed in feat: PRs)
Check Results
❌ Errors
🛑 Please fix the errors above before this PR can be merged. Refer to CONTRIBUTING.md and CLAUDE.md for the expected folder structure. |
|
Failure recorded at 2026-08-04T12:34:55Z UTC. If this PR is not fixed within 4 weeks it will be automatically closed. |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/flow-copilot/flows/flow-copilot.ts`:
- Around line 58-64: Update the flow input configuration for memoryNode_302 so
its generativeModelName dependency is configurable: add a matching
generativeModelName input alongside embeddingModelName, or remove the node’s
generative-model requirement if it is not needed. Keep the model-selection
configuration consistent between memoryNode_302 and the exposed flow inputs.
- Around line 227-256: Update the downstream references for
InstructorLLMNode_429 so both sinks consume its verified structured result:
change the structured result field used by memoryNode_302’s memoryValue content
and replace the stale LLMNode_474 generatedResponse template in
responseNode_triggerNode_1.values.content. Preserve the existing sink
configuration and route both references to the appropriate output field of
InstructorLLMNode_429.
In `@kits/flow-copilot/prompts/flow-copilot_ragnode-640_user_1.md`:
- Line 1: Replace the placeholder in the RAGNode_640 prompt with an instruction
that includes the current request/query and directs retrieval of relevant
Lamatic documentation. Define a clear output contract requiring the node to
return only the retrieved references or context that LLMNode_474 can use for
grounding, while preserving the request content in the prompt.
In `@kits/flow-copilot/README.md`:
- Around line 12-16: Add a human-readable setup section before “How to use” in
the README, covering kit deployment, Gemini credential configuration, and
preparation of the ingest-node-docs knowledge-base flow. Keep the existing Chat
Widget usage steps unchanged and follow the setup conventions used by other
kits/*/README.md files.
- Line 4: Add a blank line immediately after each Markdown section heading in
README.md, including the headings near lines 4, 12, 41, and 44, so the document
satisfies markdownlint MD022 without changing the heading text or surrounding
content.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 359b2b78-38f9-4e24-aa49-499f1a9f4dfb
📒 Files selected for processing (13)
kits/flow-copilot/README.mdkits/flow-copilot/flows/flow-copilot.tskits/flow-copilot/model-configs/flow-copilot_instructor-llmnode-429_generative-model-name.tskits/flow-copilot/model-configs/flow-copilot_memory-node-302_embedding-model-name.tskits/flow-copilot/model-configs/flow-copilot_memory-node-302_generative-model-name.tskits/flow-copilot/model-configs/flow-copilot_memory-retrieve-node-859_embedding-model-name.tskits/flow-copilot/model-configs/flow-copilot_ragnode-640_embedding-model-name.tskits/flow-copilot/model-configs/flow-copilot_ragnode-640_generative-model-name.tskits/flow-copilot/prompts/flow-copilot_instructor-llmnode-429_system_0.mdkits/flow-copilot/prompts/flow-copilot_instructor-llmnode-429_user_1.mdkits/flow-copilot/prompts/flow-copilot_llmnode-474_user_1.mdkits/flow-copilot/prompts/flow-copilot_ragnode-640_system_0.mdkits/flow-copilot/prompts/flow-copilot_ragnode-640_user_1.md
| "memoryNode_302": [ | ||
| { | ||
| "name": "embeddingModelName", | ||
| "label": "Embedding Model Name", | ||
| "type": "model" | ||
| } | ||
| ] |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
flow='kits/flow-copilot/flows/flow-copilot.ts'
ast-grep outline "$flow"
rg -n -C 6 \
-e '"memoryNode_302"' \
-e '"embeddingModelName"' \
-e '"generativeModelName"' \
"$flow"Repository: Lamatic/AgentKit
Length of output: 4769
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== candidate files =="
git ls-files | rg '(^|/)(flows|package\.json|README|lamatic\.config|.*model-configs.*)$|memory-node-302|memory-retrieve-node-859' | sed -n '1,200p'
echo
echo "== flow package/config snippets =="
for f in kits/flow-copilot/package.json kits/flow-copilot/README.md kits/flow-copilot/lamatic.config.ts; do
[ -f "$f" ] && { echo "--- $f"; sed -n '1,220p' "$f"; }
done
echo
echo "== model-config references =="
rg -n "memory-node-302|memory-retrieve-node-859|generative_model_name|embedding_model_name|generativeModelName|embeddingModelName" kits -SRepository: Lamatic/AgentKit
Length of output: 50373
Mission abort on missing generative model for Memory Add.
memoryNode_302 references generativeModelName, but the flow inputs only expose embeddingModelName. If inputs drives Lamatic Studio model selection, the user cannot configure this model. Add the matching generative-model input or fix the node configuration to not require it.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@kits/flow-copilot/flows/flow-copilot.ts` around lines 58 - 64, Update the
flow input configuration for memoryNode_302 so its generativeModelName
dependency is configurable: add a matching generativeModelName input alongside
embeddingModelName, or remove the node’s generative-model requirement if it is
not needed. Keep the model-selection configuration consistent between
memoryNode_302 and the exposed flow inputs.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/flow-copilot/prompts/flow-copilot_ragnode-640_user_1.md`:
- Line 2: Add exactly one trailing newline after the
{{triggerNode_1.output.chatMessage}} expression in the prompt content,
preserving the existing text and avoiding any heading or lint-suppression
changes.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 725d0083-ea7c-4753-99a4-95fa3fc58aaa
📒 Files selected for processing (1)
kits/flow-copilot/prompts/flow-copilot_ragnode-640_user_1.md
|
@coderabbitai review |
|
|
review |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/flow-copilot/flows/flow-copilot.ts`:
- Line 276: Update the flow-copilot projections so the full
InstructorLLMNode_429 blueprint is preserved: in
kits/flow-copilot/flows/flow-copilot.ts#L276-L276, expand memoryValue[0].content
to include trigger and nodes instead of only flowName, nodeSequence, and
assumptions; and in kits/flow-copilot/flows/flow-copilot.ts#L296-L296, expand
responseNode_triggerNode_1.values.content the same way or pass through the full
structured result. Keep the existing flowName, nodeSequence, and assumptions
fields intact while adding the missing trigger and nodes data.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: d647b457-a997-4165-bac1-68fba45e6464
📒 Files selected for processing (1)
kits/flow-copilot/flows/flow-copilot.ts
|
Hi @akshatvirmani — noticed the title was updated to include feat: again, which re-triggers the structural validation check (since this PR modifies an existing kit, which isn't allowed for feat: PRs). I've reverted it back to fix: to keep the check passing — let me know if you'd prefer it labeled differently for tracking purposes. |
|
@coderabbitai review |
|
Summary
This PR enhances the original Flow Copilot submission with a significantly richer pipeline:
lamaticnodedocs) to ground blueprint generation in actual platform capabilities, reducing hallucinated node types.flowName,trigger,nodes,nodeSequence,assumptions) for downstream/programmatic use.gemini-3.5-flash-lite.Current flow:
Chat Widget → Memory Retrieve → RAG → Generate Text → Generate JSON → Memory Add → Chat ResponseNotes for reviewers
Two platform-level issues were observed during development (documented, not blocking):
400 google error: * GenerateContentRequest.contents: contents is not specified. This appears to be a Lamatic platform-side issue in how the Memory Add node constructs its internal Gemini request — no prompt/content field is exposed in the node's UI to configure this directly. As a result, no records are persisted to theflowcopilotconversationmemorystore even after multiple real runs. The rest of the pipeline (RAG, Generate Text, Generate JSON, Chat Response) completes successfully regardless, so the user-facing response is unaffected.PR Checklist
1. Select Contribution Type
kits/<category>/<kit-name>/)bundles/<bundle-name>/)templates/<template-name>/)2. General Requirements
kebab-caseand matches the flow IDREADME.md(purpose, setup, usage)3. File Structure (Check what applies)
config.jsonpresent with valid metadata (name, description, tags, steps, author, env keys)flows/<flow-name>/(where applicable) include:config.json(Lamatic flow export)inputs.jsonmeta.jsonREADME.md.env.examplewith placeholder values only (kits only)config.jsonnode graphs (changes via Lamatic Studio export)4. Validation
npm install && npm run devworks locally (kits: UI runs; bundles/templates: flows are valid)[kit] Add <name> for <use case>)Flow Structure
Chat Widgetreceives the user request.Memory Retrieveloads previous conversation context.RAG Noderetrieves relevant Lamatic documentation fromlamaticnodedocs.Generate Textcreates a documentation-grounded flow blueprint.Generate JSONparses the blueprint into structured fields:flowNametriggernodesnodeSequenceassumptionsMemory Addstores the conversation context.Chat Responsereturns the generated blueprint.Added Files
Model configurations
flow-copilot_instructor-llmnode-429_generative-model-name.ts— configures Gemini 3.5 Flash Lite for structured JSON generation.flow-copilot_memory-node-302_embedding-model-name.ts— configures Gemini embeddings for memory storage.flow-copilot_memory-node-302_generative-model-name.ts— configures the memory generation model.flow-copilot_memory-retrieve-node-859_embedding-model-name.ts— configures embeddings for memory retrieval.flow-copilot_ragnode-640_embedding-model-name.ts— configures embeddings for RAG searches.flow-copilot_ragnode-640_generative-model-name.ts— configures the RAG generation model.Prompts
flow-copilot_instructor-llmnode-429_system_0.md— defines structured blueprint parsing.flow-copilot_instructor-llmnode-429_user_1.md— supplies the generated blueprint to the JSON parser.flow-copilot_llmnode-474_user_1.md— adds retrieved documentation to the text-generation prompt.flow-copilot_ragnode-640_system_0.md— defines grounded responses and numbered references.flow-copilot_ragnode-640_user_1.md— requests relevant node types, patterns, and best practices.Other files
flows/flow-copilot.ts— addsMemory Retrieve,RAG Node,Generate Text,Generate JSON,Memory Add, andChat Responsenodes. It connects these nodes into a retrieval, grounding, generation, parsing, persistence, and response pipeline.README.md— documents flow setup, documentation ingestion, thelamaticnodedocsvector store, model configuration, structured output, and multi-turn memory.High-Level Summary