Skip to content

chore: exa prompt fix#7274

Merged
yuhongsun96 merged 1 commit intomainfrom
exa-fix
Jan 7, 2026
Merged

chore: exa prompt fix#7274
yuhongsun96 merged 1 commit intomainfrom
exa-fix

Conversation

@yuhongsun96
Copy link
Copy Markdown
Contributor

@yuhongsun96 yuhongsun96 commented Jan 7, 2026

Description

Exa fails to search in format site:whatever for sites like reddit, just turning it off with prompt change hopefully.

How Has This Been Tested?

Checked locally

Additional Options

  • [Optional] Override Linear Check

Summary by cubic

Disable "site:" usage in web search prompts when using Exa to prevent failed queries (e.g., reddit), and add a provider capability flag to control this behavior. This reduces search errors and makes queries more reliable.

  • Bug Fixes

    • Conditionally add “Do not use the site: operator” guidance to the system prompt when the provider doesn’t support it (Exa).
  • Refactors

    • Added supports_site_filter capability to WebSearchProvider (defaults to True).
    • Exa client reports supports_site_filter = False; surfaced via WebSearchTool.
    • Updated WEB_SEARCH_GUIDANCE to accept optional site_colon_disabled messaging.

Written for commit 7041a47. Summary will update on new commits.

@yuhongsun96 yuhongsun96 requested a review from a team as a code owner January 7, 2026 22:29
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai 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 issues found across 5 files

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Jan 7, 2026

Greptile Summary

This PR fixes an issue where Exa web search fails when using the site: operator (e.g., site:reddit.com) by dynamically adjusting the LLM prompt to discourage its use when Exa is the active provider.

The implementation adds a supports_site_filter property pattern:

  • Base WebSearchProvider class defaults to True (most providers support it)
  • ExaClient overrides to return False
  • WebSearchTool exposes this property from its underlying provider
  • Prompt building logic checks this property and conditionally adds "Do not use the 'site:' operator" guidance when False

The solution is clean, extensible, and follows the existing architecture patterns. The string formatting approach with {site_colon_disabled} placeholder allows the guidance to be seamlessly included or omitted without breaking prompt structure.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are well-contained, follow existing patterns, use proper abstraction through properties, and maintain backward compatibility. The implementation is clean with no logical errors, security issues, or breaking changes. All modifications are additive (new property, conditional formatting) without altering existing behavior for other providers.
  • No files require special attention

Important Files Changed

Filename Overview
backend/onyx/tools/tool_implementations/web_search/clients/exa_client.py Overrode supports_site_filter to return False for Exa provider
backend/onyx/prompts/tool_prompts.py Added format placeholder and new constant WEB_SEARCH_SITE_DISABLED_GUIDANCE to conditionally include site operator warning
backend/onyx/chat/prompt_utils.py Updated prompt building to conditionally format web search guidance based on provider's site filter support

Sequence Diagram

sequenceDiagram
    participant User
    participant PromptBuilder as build_system_prompt
    participant WebSearchTool
    participant ExaClient
    participant LLM

    User->>PromptBuilder: Request system prompt with tools
    PromptBuilder->>WebSearchTool: Check has_web_search
    PromptBuilder->>WebSearchTool: supports_site_filter?
    WebSearchTool->>ExaClient: supports_site_filter
    ExaClient-->>WebSearchTool: False
    WebSearchTool-->>PromptBuilder: False
    PromptBuilder->>PromptBuilder: Set site_disabled_guidance = WEB_SEARCH_SITE_DISABLED_GUIDANCE
    PromptBuilder->>PromptBuilder: Format WEB_SEARCH_GUIDANCE with site_disabled_guidance
    PromptBuilder-->>User: System prompt with "Do not use site: operator"
    User->>LLM: Send prompt
    LLM->>LLM: Follow guidance, avoid site: operator
    LLM-->>User: Search results without site: filter issues
Loading

Copy link
Copy Markdown
Contributor

@jessicasingh7 jessicasingh7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm thank you!

@yuhongsun96 yuhongsun96 added this pull request to the merge queue Jan 7, 2026
Merged via the queue into main with commit 439707c Jan 7, 2026
75 checks passed
@yuhongsun96 yuhongsun96 deleted the exa-fix branch January 7, 2026 23:41
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