Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

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

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.
@vercel
Copy link

vercel bot commented Jan 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
qcx Ready Ready Preview, Comment Jan 11, 2026 8:50am

@google-labs-jules
Copy link
Contributor Author

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 8, 2026

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.


Comment @coderabbitai help to get the list of available commands and usage tips.

@CLAassistant
Copy link

CLAassistant commented Jan 8, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ ngoiyaeric
❌ google-labs-jules[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

@ngoiyaeric ngoiyaeric marked this pull request as ready for review January 10, 2026 14:20
@charliecreates charliecreates bot requested a review from CharlieHelps January 10, 2026 14:20
@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Jan 10, 2026

PR Code Suggestions ✨

No code suggestions found for the PR.

Copy link

@charliecreates charliecreates bot left a 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 topic parameter in the search schema.
  • Threads topic through 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.

@ngoiyaeric
Copy link
Collaborator

@coderabbitai how do I make sure all searches are up to date and latest?

@google-labs-jules
Copy link
Contributor Author

@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.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 11, 2026

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:

#!/bin/bash

# Get the list of files changed in this PR
git diff --name-only origin/main...HEAD

echo "---"

# Show the actual changes in this PR
git diff origin/main...HEAD

Length of output: 85


🏁 Script executed:

#!/bin/bash

# Get PR diff using GitHub CLI
gh pr diff 404

echo "---FILES_CHANGED---"

# Get list of files changed in the PR
gh pr view 404 --json files --jq '.files[].path'

Length of output: 19


🏁 Script executed:

#!/bin/bash

# Search for files related to Tavily search
echo "=== Files mentioning Tavily ==="
rg -l "tavily" -i

echo -e "\n=== Files mentioning researcher ==="
rg -l "researcher" -i

echo -e "\n=== Files mentioning search schema or topic ==="
rg -l "search.*schema|topic.*search" -i

echo -e "\n=== Check current branch ==="
git branch

echo -e "\n=== List Python files in src or app directories ==="
fd -e py -e ts -e js . 2>/dev/null | head -20

Length of output: 991


🏁 Script executed:

#!/bin/bash

echo "=== Search Schema ==="
cat lib/schema/search.tsx

echo -e "\n=== Tavily Search Tool ==="
cat lib/agents/tools/search.tsx

echo -e "\n=== Researcher Agent ==="
cat lib/agents/researcher.tsx

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 Status

Looking 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 Schema

Update lib/schema/search.tsx:

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 Function

Update the tavilySearch function in lib/agents/tools/search.tsx:

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 function to pass the topic parameter:

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 Prompt

Modify the system prompt in lib/agents/researcher.tsx to emphasize using news topic:

#### **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 Freshness

For even more control over search recency, consider adding a days parameter to limit results to recent timeframes:

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
})

Summary

To ensure searches are always up-to-date and latest:

  1. ✅ Use topic: 'news' by default (prioritizes recent content)
  2. ✅ Use search_depth: 'advanced' when comprehensive recent information is needed
  3. ✅ Optionally add days parameter to limit results to specific timeframe (e.g., last 3, 7, or 30 days)
  4. ✅ Update the researcher agent prompt to emphasize recency in search queries

These changes will ensure the Tavily API returns the most current and up-to-date information available.

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.

3 participants