-
-
Notifications
You must be signed in to change notification settings - Fork 7
Fix: Ensure response is generated when no tools are used #249
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
Conversation
This commit addresses an issue where the system would not generate a response if a query did not trigger any tool usage while `useSpecificAPI` was enabled. The fix involves two changes: 1. The `while` loop condition in `app/actions.tsx` has been modified to remove the dependency on `toolOutputs.length`. This ensures that the application waits for a response (`answer`) to be generated, regardless of whether tools are used. 2. The system prompt for the `researcher` agent in `lib/agents/researcher.tsx` has been enhanced to explicitly instruct the AI to provide a direct answer when no tools are necessary.
|
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughUpdates adjust the submit loop condition in app/actions.tsx to wait solely for an answer. The researcher agent now accepts a dynamic system prompt, removes the mcp parameter, and prefers the provided prompt over the default. Tool acquisition aligns with the signature change. No other public APIs changed. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant A as submit()
participant R as researcher()
participant T as Tools
participant M as Model
participant UI as uiStream/streamText
U->>A: Trigger submit
rect rgba(200,230,255,0.3)
note right of A: Loop until answer is produced<br/>(condition: answer.length === 0)
A->>R: researcher(dynamicSystemPrompt, uiStream, streamText, messages, useSpecificModel?)
R->>R: Select systemToUse = dynamicSystemPrompt or default
alt Tools required
R->>T: getTools() (no mcp)
T-->>R: tool handles
R->>M: Stream with tools + systemToUse
else Direct answer
R->>M: Stream with systemToUse (no tools)
end
M-->>R: Tokens / tool calls
R-->>A: Streamed content and tool outputs
end
A->>UI: Update streamed UI
UI-->>U: Rendered answer
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code graph analysis (1)lib/agents/researcher.tsx (3)
🔇 Additional comments (3)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
User description
This commit addresses an issue where the system would not generate a response if a query did not trigger any tool usage while
useSpecificAPIwas enabled.The fix involves two changes:
whileloop condition inapp/actions.tsxhas been modified to remove the dependency ontoolOutputs.length. This ensures that the application waits for a response (answer) to be generated, regardless of whether tools are used.researcheragent inlib/agents/researcher.tsxhas been enhanced to explicitly instruct the AI to provide a direct answer when no tools are necessary.PR Type
Bug fix
Description
Fix response generation when no tools are used
Remove tool dependency from loop condition
Add explicit instruction for direct answers
Diagram Walkthrough
File Walkthrough
actions.tsx
Remove tool dependency from loop conditionapp/actions.tsx
toolOutputs.length === 0dependency
researcher.tsx
Add direct answer instruction to system promptlib/agents/researcher.tsx
Summary by CodeRabbit
New Features
Bug Fixes