-
Notifications
You must be signed in to change notification settings - Fork 48.8k
[mcp] Prompt improvements for smarter tool composition #33108
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
Merged
Conversation
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
Our runtime results are still bogus, but so far this tweak let's the llm use the tools a little more intelligently. example: --- ```js import React from 'react'; function App() { const [count, setCount] = React.useState(0); const [data, setData] = React.useState([]); React.useEffect(() => { const processData = () => { console.log("Processing data..."); const newData = []; for (let i = 0; i < 1000000000; i++) { newData.push({ id: i, value: Math.random() * count }); } return newData; }; const processedData = processData(); setData(processedData); }, [count]); return ( <div> <p>Count: {count}</p> <p>Data Length: {data.length}</p> <ul> {data.slice(0, 5).map((item) => ( <li key={item.id}>Item {item.id}: {item.value.toFixed(2)}</li> ))} </ul> </div> ); }; ``` why is this component slow? use the react tools to figure this out. > I'll analyze why this component is slow using the React tools. Let's first evaluate the performance of the original code. > [review-react-runtime ...] > > The performance measurement tool timed out, which is a strong indication of just how severe the performance issue is in this component. Let's now try to compile the code to see if React Compiler can identify any issues: > [compile...] > > Now I understand the issue. Let's analyze why this component > is extremely slow: > Main Performance Issues: > > Massive Data Processing: The component is trying to create an array with a billion (1,000,000,000) objects in the processData function. This is an enormous amount of data that will: > > Consume massive amounts of memory > Take an extremely long time to process > Likely crash the browser > > > Unnecessary Recalculation: The effect depends on [count], meaning every time the count changes, it will reprocess this enormous dataset. > Inefficient Data Handling: Even though only 5 items are displayed, the component processes a billion items. > > Let's fix these issues: > [compile...] > > Now let's check if our modified code performs better: > [review-react-runtime...] > > Excellent! The performance has dramatically improved. Now let's check the React documentation to make sure we're following the best practices: > [query-react-dev-docs...] (hit the maximum length conversation limit because i'm on a free plan)
github-actions bot
pushed a commit
that referenced
this pull request
May 2, 2025
Our runtime results are still bogus, but so far this tweak let's the llm use the tools a little more intelligently. example: --- ```js import React from 'react'; function App() { const [count, setCount] = React.useState(0); const [data, setData] = React.useState([]); React.useEffect(() => { const processData = () => { console.log("Processing data..."); const newData = []; for (let i = 0; i < 1000000000; i++) { newData.push({ id: i, value: Math.random() * count }); } return newData; }; const processedData = processData(); setData(processedData); }, [count]); return ( <div> <p>Count: {count}</p> <p>Data Length: {data.length}</p> <ul> {data.slice(0, 5).map((item) => ( <li key={item.id}>Item {item.id}: {item.value.toFixed(2)}</li> ))} </ul> </div> ); }; ``` why is this component slow? use the react tools to figure this out. > I'll analyze why this component is slow using the React tools. Let's first evaluate the performance of the original code. > [review-react-runtime ...] > > The performance measurement tool timed out, which is a strong indication of just how severe the performance issue is in this component. Let's now try to compile the code to see if React Compiler can identify any issues: > [compile...] > > Now I understand the issue. Let's analyze why this component > is extremely slow: > Main Performance Issues: > > Massive Data Processing: The component is trying to create an array with a billion (1,000,000,000) objects in the processData function. This is an enormous amount of data that will: > > Consume massive amounts of memory > Take an extremely long time to process > Likely crash the browser > > > Unnecessary Recalculation: The effect depends on [count], meaning every time the count changes, it will reprocess this enormous dataset. > Inefficient Data Handling: Even though only 5 items are displayed, the component processes a billion items. > > Let's fix these issues: > [compile...] > > Now let's check if our modified code performs better: > [review-react-runtime...] > > Excellent! The performance has dramatically improved. Now let's check the React documentation to make sure we're following the best practices: > [query-react-dev-docs...] (hit the maximum length conversation limit because i'm on a free plan) DiffTrain build for [26ecc98](26ecc98)
jorge-cab
pushed a commit
that referenced
this pull request
May 2, 2025
Our runtime results are still bogus, but so far this tweak let's the llm use the tools a little more intelligently. example: --- ```js import React from 'react'; function App() { const [count, setCount] = React.useState(0); const [data, setData] = React.useState([]); React.useEffect(() => { const processData = () => { console.log("Processing data..."); const newData = []; for (let i = 0; i < 1000000000; i++) { newData.push({ id: i, value: Math.random() * count }); } return newData; }; const processedData = processData(); setData(processedData); }, [count]); return ( <div> <p>Count: {count}</p> <p>Data Length: {data.length}</p> <ul> {data.slice(0, 5).map((item) => ( <li key={item.id}>Item {item.id}: {item.value.toFixed(2)}</li> ))} </ul> </div> ); }; ``` why is this component slow? use the react tools to figure this out. > I'll analyze why this component is slow using the React tools. Let's first evaluate the performance of the original code. > [review-react-runtime ...] > > The performance measurement tool timed out, which is a strong indication of just how severe the performance issue is in this component. Let's now try to compile the code to see if React Compiler can identify any issues: > [compile...] > > Now I understand the issue. Let's analyze why this component > is extremely slow: > Main Performance Issues: > > Massive Data Processing: The component is trying to create an array with a billion (1,000,000,000) objects in the processData function. This is an enormous amount of data that will: > > Consume massive amounts of memory > Take an extremely long time to process > Likely crash the browser > > > Unnecessary Recalculation: The effect depends on [count], meaning every time the count changes, it will reprocess this enormous dataset. > Inefficient Data Handling: Even though only 5 items are displayed, the component processes a billion items. > > Let's fix these issues: > [compile...] > > Now let's check if our modified code performs better: > [review-react-runtime...] > > Excellent! The performance has dramatically improved. Now let's check the React documentation to make sure we're following the best practices: > [query-react-dev-docs...] (hit the maximum length conversation limit because i'm on a free plan)
This was referenced May 5, 2025
This was referenced May 12, 2025
This was referenced May 19, 2025
16 tasks
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.
Our runtime results are still bogus, but so far this tweak let's the llm use the tools a little more intelligently.
example:
why is this component slow? use the react tools to figure this out.
[review-react-runtime ...]
[compile...]
[compile...]
[review-react-runtime...]
[query-react-dev-docs...]
(hit the maximum length conversation limit because i'm on a free plan)