-
Notifications
You must be signed in to change notification settings - Fork 10
update web search implementation to use Brave API and add a query step to improve web search #134
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
blefo
commented
Jul 23, 2025
- Changed dependency from duckduckgo-search (deprecated) to ddgs
- Updated web search functions to query Brave instead of DuckDuckGo, including modifications to the search logic and response handling.
- Added a step to generate a concise search query using the LLM before performing the web search, improving the relevance of search results.
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.
Pull Request Overview
This pull request updates the web search implementation to use the Brave API instead of DuckDuckGo, migrates to the ddgs library, and adds an LLM-based query generation step to improve search relevance.
- Changed dependency from
duckduckgo-searchtoddgslibrary - Updated web search to use Brave API backend instead of DuckDuckGo
- Added query generation step using LLM to create concise search queries before performing web searches
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Updated dependency from duckduckgo-search to ddgs |
| nilai_api/handlers/web_search.py | Core changes to use Brave API, added LLM query generation, and updated function signatures |
| nilai_api/routers/private.py | Updated client initialization and function calls to support new web search interface |
| tests/unit/nilai_api/test_web_search.py | Updated test mocks and function calls to match new signatures |
| tests/unit/nilai_api/routers/test_private.py | Fixed OpenAI client mocking for async operations |
| tests/e2e/test_openai.py | Increased retry count for web search tests |
Comments suppressed due to low confidence (2)
nilai-api/src/nilai_api/handlers/web_search.py:87
- The parameter
clientshould have a type annotation for better code clarity and type safety.
) -> str:
nilai-api/src/nilai_api/handlers/web_search.py:107
- The parameter
clientshould have a type annotation for better code clarity and type safety.
) -> EnhancedMessages:
Enhance web result fetching utilizing the Brave browser; Introduce a step to rephrase web search queries from the user's initial prompt.
8260d65 to
60af94d
Compare
b3a9235 to
9e0d3cf
Compare
jcabrero
left a comment
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.
👍
f2459f4 to
bdb9f5c
Compare
bdb9f5c to
acc0b1d
Compare