Skip to content

feat: implement pre-assessment node for DeepModeling workflow #2910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

devin-ai-integration[bot]
Copy link
Contributor

Issue

Why is this change needed?

The current DeepModeling workflow processes any user input through the full schema generation pipeline, including irrelevant inputs like "Hello!" or incomplete requests. This leads to unnecessary processing and poor user experience. This PR implements a pre-assessment node that filters inputs before the full DeepModeling process, similar to how other AI tools like ChatGPT Deep Research and Claude Deep Research handle irrelevant requests.

What does this change do?

High-Level Changes

  1. New PreAssessmentAgent: AI agent that classifies user input into three categories:

    • irrelevant: Not related to database design (e.g., greetings, unrelated topics)
    • insufficient: DB-related but lacks detail to proceed (e.g., "I need a database")
    • sufficient: DB-related with enough context to begin design
  2. Updated Workflow: The DeepModeling process now starts with pre-assessment instead of requirements analysis:

    OLD: START → analyzeRequirements → ...
    NEW: START → preAssessment → analyzeRequirements → ...
    
  3. Conditional Routing: Based on assessment results:

    • sufficient → proceeds to analyzeRequirements (normal flow)
    • irrelevant/insufficient → routes to finalizeArtifacts (ends workflow)

Technical Implementation

Core Components:

  • PreAssessmentAgent: Uses GPT-4o-mini with structured prompts for input classification
  • preAssessmentNode: Workflow node with retry logic and timeline logging
  • routeAfterPreAssessment: Conditional routing function
  • Updated WorkflowState and LangGraph annotations for preAssessmentResult

JSON Response Parsing:

  • Robust JSON extraction from AI responses with multiple fallback strategies
  • Validation using valibot schema for type safety
  • Error handling for malformed responses

Updated Workflow Diagram

graph TD;
start([start]):::first
preAssessment(preAssessment)
analyzeRequirements(analyzeRequirements)
saveRequirementToArtifact(saveRequirementToArtifact)
dbAgent(dbAgent)
generateUsecase(generateUsecase)
prepareDML(prepareDML)
validateSchema(validateSchema)
finalizeArtifacts(finalizeArtifacts)
end([end]):::last
start --> preAssessment;
dbAgent --> generateUsecase;
finalizeArtifacts --> end;
generateUsecase --> prepareDML;
prepareDML --> validateSchema;
saveRequirementToArtifact --> dbAgent;
preAssessment -.-> analyzeRequirements;
preAssessment -.-> finalizeArtifacts;
analyzeRequirements -.-> saveRequirementToArtifact;
analyzeRequirements -.-> finalizeArtifacts;
validateSchema -.-> dbAgent;
validateSchema -.-> finalizeArtifacts;
preAssessment -.-> preAssessment;
analyzeRequirements -.-> analyzeRequirements;
classDef default fill:#f2f0ff,line-height:1.2;
classDef first fill-opacity:0;
classDef last fill:#bfb6fc;

Files Changed

New Files

  • preAssessmentNode.ts - Main workflow node implementation
  • routeAfterPreAssessment.ts - Conditional routing logic
  • preAssessmentAgent/ - Complete agent implementation with prompts, JSON parser, and core logic

Modified Files

  • createGraph.ts - Updated workflow entry point and routing
  • types.ts & langGraphUtils.ts - Added preAssessmentResult to state
  • README.md & createGraph.test.ts - Updated documentation and tests

Human Review Checklist

Critical Areas to Review:

  1. Prompt Engineering Quality (preAssessmentAgent/prompts.ts):

    • Are the assessment criteria comprehensive enough?
    • Will the examples guide the AI to make good decisions?
    • Are edge cases covered in the prompt?
  2. Workflow Routing Logic (routeAfterPreAssessment.ts):

    • Does the three-way routing handle all decision types correctly?
    • Are there any missing edge cases in the conditional logic?
  3. JSON Parsing Robustness (preAssessmentAgent/jsonParser.ts):

    • Will the extraction logic handle various AI response formats?
    • Is the validation schema appropriate for the expected responses?
  4. Integration Points (createGraph.ts):

    • Are the workflow edges configured correctly?
    • Does the new entry point maintain compatibility with existing flows?
  5. Error Handling (preAssessmentNode.ts):

    • Is the retry logic appropriate (max 3 attempts)?
    • Are error messages helpful for debugging?

Testing Considerations:

  • This implementation needs testing with real user scenarios
  • Current tests verify structure but not decision quality
  • Consider testing with various input types: greetings, incomplete requests, valid DB requirements

Potential Risks:

  • False positives: Valid DB design requests being rejected
  • False negatives: Irrelevant inputs proceeding to full workflow
  • Performance impact: Additional AI call before every workflow

Link to Devin run: https://app.devin.ai/sessions/b7f232be53454fd6a245403f77fc23ef
Requested by: @MH4GF

- Add PreAssessmentAgent to analyze user input relevance to database design
- Implement three-way decision logic: irrelevant, insufficient, sufficient
- Create preAssessmentNode with retry logic and timeline logging
- Add routeAfterPreAssessment for conditional workflow branching
- Update WorkflowState and LangGraph annotations for preAssessmentResult
- Integrate preAssessment as new entry point before analyzeRequirements
- Update workflow documentation and test expectations
- All existing tests pass with new workflow structure

Addresses GitHub issue #5278: improve handling of irrelevant input
by adding pre-assessment before DeepModeling process.

Co-Authored-By: hirotaka.miyagi@route06.co.jp <h.miyagi.cnw@gmail.com>
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link

changeset-bot bot commented Aug 5, 2025

⚠️ No Changeset found

Latest commit: 1554580

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Aug 5, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
liam-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 5, 2025 7:25am
liam-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 5, 2025 7:25am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
liam-docs ⬜️ Ignored (Inspect) Aug 5, 2025 7:25am
liam-erd-sample ⬜️ Skipped (Inspect) Aug 5, 2025 7:25am

Copy link
Contributor

coderabbitai bot commented Aug 5, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Join our Discord community for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

supabase bot commented Aug 5, 2025

Updates to Preview Branch (devin/1754377586-pre-assessment-node) ↗︎

Deployments Status Updated
Database Tue, 05 Aug 2025 07:22:16 UTC
Services Tue, 05 Aug 2025 07:22:16 UTC
APIs Tue, 05 Aug 2025 07:22:16 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations Tue, 05 Aug 2025 07:22:21 UTC
Migrations Tue, 05 Aug 2025 07:22:23 UTC
Seeding Tue, 05 Aug 2025 07:22:26 UTC
Edge Functions Tue, 05 Aug 2025 07:22:26 UTC

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

@FunamaYukina
Copy link
Member

📝
(aside)
I tried it in a local environment.
The preAssessment node seems to be working, and I think the flow is good, but for some reason PmAgent responded.🤔
(I think the response from the Db agent is from finalizeArtifact.)

https://smith.langchain.com/o/eed4d2d8-0bd8-4ca4-a452-4da88ef63fd6/projects/p/99d63e81-58f9-475a-8985-409b591e26b0?timeModel=%7B%22duration%22%3A%227d%22%7D&peek=4f10cabe-dee4-4744-8371-fdfad86fdb4e&peeked_trace=e9b89f29-2982-4617-bcf6-dcefcc49c1da

ss 3688 ss 3687

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