Skip to content

feat: Deep Research Multilingual#7405

Merged
Subash-Mohan merged 1 commit intomainfrom
dr-multilingual
Jan 14, 2026
Merged

feat: Deep Research Multilingual#7405
Subash-Mohan merged 1 commit intomainfrom
dr-multilingual

Conversation

@yuhongsun96
Copy link
Copy Markdown
Contributor

@yuhongsun96 yuhongsun96 commented Jan 14, 2026

Description

Tune it for queries not in English

How Has This Been Tested?

Works for sure

Additional Options

  • [Optional] Override Linear Check

Summary by cubic

Enable multilingual Deep Research so clarifications, plans, tasks, and reports respond in the user's language. Adds query validation and loop safeguards for more reliable runs.

  • New Features

    • Orchestration prompts instruct all steps to respond in the user’s language; research tasks are authored in that language; reports are written in the task language.
  • Bug Fixes

    • Normalize web search queries (trim, drop empty) and return a clear error when none are valid.
    • Prevent potential infinite loops by incrementing cycle counters after tool failures; limit tool call logging to debug-only paths.

Written for commit b9a1b43. Summary will update on new commits.

@yuhongsun96 yuhongsun96 requested a review from a team as a code owner January 14, 2026 04:47
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Jan 14, 2026

Greptile Summary

Added multilingual support to the deep research feature by instructing the LLM to respond in the user's language at each stage of the research workflow.

  • Added "Respond in the user's language" instructions to orchestration layer prompts for clarifications, research plans, research tasks, and final report generation
  • Added language matching instructions to research agent prompts to generate reports in the same language as the input task
  • Improved web search tool robustness by normalizing queries (stripping whitespace and rejecting empty queries)
  • Fixed infinite loop vulnerability by incrementing cycle counters after tool call failures in the research agent
  • Minor indentation fix for debug logging

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • Changes are well-targeted prompt engineering additions for multilingual support with solid defensive improvements (query normalization, infinite loop prevention). All changes are additive and non-breaking.
  • No files require special attention

Important Files Changed

Filename Overview
backend/onyx/prompts/deep_research/orchestration_layer.py Added multilingual support instructions to prompts for clarification, planning, research tasks, and report generation
backend/onyx/prompts/deep_research/research_agent.py Added language matching instructions to research agent prompts to generate reports in the same language as the input task
backend/onyx/tools/tool_implementations/web_search/web_search_tool.py Added query normalization to strip whitespace and reject empty queries, improving robustness for multilingual input

Sequence Diagram

sequenceDiagram
    participant User
    participant Orchestrator
    participant ResearchAgent
    participant WebSearch
    participant LLM

    User->>Orchestrator: Submit query (any language)
    Orchestrator->>LLM: Generate clarification questions
    Note over LLM: "Respond in the user's language"
    LLM-->>User: Questions in user's language
    
    User->>Orchestrator: Provide answers
    Orchestrator->>LLM: Generate research plan
    Note over LLM: "Respond in the user's language"
    LLM-->>Orchestrator: Research plan steps (user's language)
    
    loop For each research step
        Orchestrator->>LLM: Create research task
        Note over LLM: "Research task should be in user's language"
        LLM->>ResearchAgent: Research task (user's language)
        
        ResearchAgent->>WebSearch: Execute web searches
        Note over WebSearch: Normalize queries, strip whitespace
        WebSearch-->>ResearchAgent: Search results
        
        ResearchAgent->>LLM: Generate report from results
        Note over LLM: "Write report in same language as task"
        LLM-->>ResearchAgent: Report (user's language)
        ResearchAgent-->>Orchestrator: Research findings
    end
    
    Orchestrator->>LLM: Generate final report
    Note over LLM: "Respond in the user's language"
    LLM-->>User: Final report (user's language)
Loading

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

Copy link
Copy Markdown
Contributor

@Subash-Mohan Subash-Mohan left a comment

Choose a reason for hiding this comment

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

lgtm!

@Subash-Mohan Subash-Mohan added this pull request to the merge queue Jan 14, 2026
Merged via the queue into main with commit e98dea1 Jan 14, 2026
76 checks passed
@Subash-Mohan Subash-Mohan deleted the dr-multilingual branch January 14, 2026 05:16
rohoswagger pushed a commit that referenced this pull request Jan 19, 2026
jessicasingh7 pushed a commit that referenced this pull request Jan 21, 2026
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