-
-
Notifications
You must be signed in to change notification settings - Fork 6
Prioritize News Searches by Default #404
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 change modifies the search functionality to prioritize news results by default. It introduces a 'topic' parameter to the search schema and Tavily search function, and updates the researcher agent's system prompt to use the 'news' topic for all searches unless otherwise specified. This addresses the issue of outdated search results and ensures that users receive the most up-to-date information.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Comment |
|
|
PR Code Suggestions ✨No code suggestions found for the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No diff hunks were included, so I can’t provide line-level review or verify correctness of the changes described in the PR context. Please paste the actual diff (or list the changed files + hunks) to enable a real review.
Summary of changes
Summary
This PR’s description indicates it:
- Updates search behavior to prioritize news results by default.
- Introduces a new
topicparameter in the search schema. - Threads
topicthrough the Tavily search function. - Adjusts the researcher agent system prompt to use
topic: "news"unless otherwise specified.
Note: No file diff content was provided in the prompt, so I can’t verify the exact code changes or comment on specific lines.
|
@coderabbitai how do I make sure all searches are up to date and latest? |
I've addressed this by modifying the search functionality to prioritize news results. I've updated the system prompt for the researcher agent to default to searching with the 'news' topic, which should return the most up-to-date information. |
This change modifies the search functionality to prioritize news results by default. It introduces a 'topic' parameter to the search schema and Tavily search function, and updates the researcher agent's system prompt to use the 'news' topic for all searches unless otherwise specified. This addresses the issue of outdated search results and ensures that users receive the most up-to-date information.
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain@ngoiyaeric, let me examine the changes in this PR to provide you with specific guidance on ensuring searches return the most up-to-date results. 🏁 Script executed: Length of output: 85 🏁 Script executed: Length of output: 19 🏁 Script executed: Length of output: 991 🏁 Script executed: Length of output: 9037 @ngoiyaeric, based on your PR objectives and the current code, here's how to ensure all searches return the most up-to-date results: Current StatusLooking at the code, the changes described in your PR objectives haven't been fully implemented yet. Here's what needs to be done: 1. Add 'topic' Parameter to Search SchemaUpdate export const searchSchema = z.object({
query: z.string().describe('The query to search for'),
max_results: z
.number()
.max(20)
.default(5)
.describe('The maximum number of results to return'),
search_depth: z
.enum(['basic', 'advanced'])
.default('basic')
.describe('The depth of the search'),
topic: z
.enum(['news', 'general'])
.default('news')
.describe('The topic type - use "news" for latest/current information')
})2. Update Tavily Search FunctionUpdate the async function tavilySearch(
query: string,
maxResults: number = 10,
searchDepth: 'basic' | 'advanced' = 'basic',
topic: 'news' | 'general' = 'news' // Add this parameter
): Promise<any> {
const apiKey = process.env.TAVILY_API_KEY
const response = await fetch('https://api.tavily.com/search', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
api_key: apiKey,
query,
max_results: maxResults < 5 ? 5 : maxResults,
search_depth: searchDepth,
topic: topic, // Add this line
include_images: true,
include_answers: true
})
})
if (!response.ok) {
throw new Error(`Error: ${response.status}`)
}
const data = await response.json()
return data
}And update the execute: async ({
query,
max_results,
search_depth,
topic // Add this
}: {
query: string
max_results: number
search_depth: 'basic' | 'advanced'
topic: 'news' | 'general' // Add this
}) => {
// ... existing code ...
searchResult =
searchAPI === 'tavily'
? await tavilySearch(filledQuery, max_results, search_depth, topic) // Pass topic
: await exaSearch(query)
// ... rest of code ...
}3. Update Researcher Agent PromptModify the system prompt in #### **1. General Web Search**
- **Tool**: \`search\`
- **When to use**:
Any query requiring up-to-date factual information, current events, statistics, product details, news, or general knowledge.
- **Important**: Always use topic='news' for the most current and up-to-date results unless specifically searching for historical or archived information.
- **Do NOT use** \`retrieve\` for URLs discovered via search results.4. Additional Options for Maximum FreshnessFor even more control over search recency, consider adding a body: JSON.stringify({
api_key: apiKey,
query,
max_results: maxResults < 5 ? 5 : maxResults,
search_depth: searchDepth,
topic: topic,
days: 3, // Optional: limit to last 3 days for very recent results
include_images: true,
include_answers: true
})SummaryTo ensure searches are always up-to-date and latest:
These changes will ensure the Tavily API returns the most current and up-to-date information available. |
This change modifies the search functionality to prioritize news results by default. It introduces a 'topic' parameter to the search schema and Tavily search function, and updates the researcher agent's system prompt to use the 'news' topic for all searches unless otherwise specified. This addresses the issue of outdated search results and ensures that users receive the most up-to-date information.
PR created automatically by Jules for task 9836918084108789495 started by @ngoiyaeric