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
[Websearch] update #427
[Websearch] update #427
Conversation
c050b95
to
2f0b2fa
Compare
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.
Overall this is clearly much better! I tried it with Serper and it worked great. I also think we should switch to serper for prod tbh.
I like the sources UI, plus it's much faster and more accurate. I left a few minor comments but really nothing blocking, just notes for the future.
Minor nit is that the update collapse menu is getting pretty big and I feel like some updates could be combined/removed imo.
I think it makes sense to keep the ones that contain extra info (like which query is used, which webpages are visited) but the other ones could be dropped/merged into fewer updates imo.
For the transformers.js integration, I would also recommend the following:
|
@xenova based on this codebase, do you have suggestion for the path? And I guess I should put that path in gitignore? |
These can also be HTTP(s) links, so we could host them on the hub if needed. Alternatively, if you wish to serve these locally, they can be copied from |
@xenova in this PR, tfjs is running on server-side, not frontend. Therefore, is |
I guess it depends if you want to modify the default configuration at all (e.g., updating the path to the WASM files). It also depends how much extra configuration you want users to face. However, as you say, it's running server-side, so it doesn't actually use the WASM files - it uses their onnxruntime-node backend. TLDR: Probably not necessary! Check these options just in case you want some custom behaviour. |
* Fix reuqest body * update webSearchQueryPromptTemplate * update generate google query parser * Add today's date to google search query creator * crawl top stories if exts; remove answer_box & knowledgeGraph * Create paragraph chunks from top articles * flattened paragprah chunks * update status texts * add gradio client * call gradio app for RAG * Web scrape only "p, li, span" els * add MAX_N_CHUNKS * gradio result typing * parse only <p> elements * rm dev change * update typing WebSearch * buld RAG prompt * Rm dev change * change websearch context msg from user to assisntat type * use hosted gradio app * fix lint * prompt engineering * more prompt engineering * MAX_N_PAGES_SCRAPE = 10 * better error msg * more prompt engineering * revert websearch prompt to previous * rm `top_stories` from websearch as the results are not good * Stop using gradio client, use regular fetch * chore * Rm websearchsummary references as it is no longer used * update readme * Apply suggestions from code review Co-authored-by: Julien Chaumond <julien@huggingface.co> * Use tfjs to do embeddings in server node * fix websearch component disapperar after finishing generation * Show sources of closest embeddings used in RAG * fix prompting and also add current date * add comment * comment for search query * sources * hide www * using hostname direclty * Show successful web pages instead of failed ones * rm noisy messages * google query generation using previous messaages as context * handle falcon generation * bring back Browsing webpage msg --------- Co-authored-by: Julien Chaumond <julien@huggingface.co> Co-authored-by: Victor Mustar <victor.mustar@gmail.com>
* Bump mongodb from 5.3.0 to 5.8.0 Bumps [mongodb](https://github.com/mongodb/node-mongodb-native) from 5.3.0 to 5.8.0. - [Release notes](https://github.com/mongodb/node-mongodb-native/releases) - [Changelog](https://github.com/mongodb/node-mongodb-native/blob/v5.8.0/HISTORY.md) - [Commits](mongodb/node-mongodb-native@v5.3.0...v5.8.0) --- updated-dependencies: - dependency-name: mongodb dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * Store IP in messageEvents * IP based rate limit * Revert "IP based rate limit" This reverts commit 87c6937. * ip rate limit * move rate limit event to top * Add rate limiting to websearch and title summary (#433) * [Websearch] update (#427) * Fix reuqest body * update webSearchQueryPromptTemplate * update generate google query parser * Add today's date to google search query creator * crawl top stories if exts; remove answer_box & knowledgeGraph * Create paragraph chunks from top articles * flattened paragprah chunks * update status texts * add gradio client * call gradio app for RAG * Web scrape only "p, li, span" els * add MAX_N_CHUNKS * gradio result typing * parse only <p> elements * rm dev change * update typing WebSearch * buld RAG prompt * Rm dev change * change websearch context msg from user to assisntat type * use hosted gradio app * fix lint * prompt engineering * more prompt engineering * MAX_N_PAGES_SCRAPE = 10 * better error msg * more prompt engineering * revert websearch prompt to previous * rm `top_stories` from websearch as the results are not good * Stop using gradio client, use regular fetch * chore * Rm websearchsummary references as it is no longer used * update readme * Apply suggestions from code review Co-authored-by: Julien Chaumond <julien@huggingface.co> * Use tfjs to do embeddings in server node * fix websearch component disapperar after finishing generation * Show sources of closest embeddings used in RAG * fix prompting and also add current date * add comment * comment for search query * sources * hide www * using hostname direclty * Show successful web pages instead of failed ones * rm noisy messages * google query generation using previous messaages as context * handle falcon generation * bring back Browsing webpage msg --------- Co-authored-by: Julien Chaumond <julien@huggingface.co> Co-authored-by: Victor Mustar <victor.mustar@gmail.com> * bump to 0.6.0 (#434) * Update README.md (#435) * Update README.md * add description of websearch on readme * Apply suggestions from code review Co-authored-by: Victor Muštar <victor.mustar@gmail.com> * Update README.md --------- Co-authored-by: Mishig Davaadorj <dmishig@gmail.com> Co-authored-by: Mishig <mishig.davaadorj@coloradocollege.edu> * Mobile: fix model selection (#448) * adjustments and mobile modal * use dvh unit * margin * fix lint on main * Add latex support with marked-katex-extension (#450) * Add latex support with marked-katex-extension * Add renderer * Fix marked default option problem * Fix linting error * Fix lock error --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nathan Sarrazin <sarrazin.nathan@gmail.com> Co-authored-by: Mishig <mishig.davaadorj@coloradocollege.edu> Co-authored-by: Julien Chaumond <julien@huggingface.co> Co-authored-by: Victor Mustar <victor.mustar@gmail.com> Co-authored-by: Mishig Davaadorj <dmishig@gmail.com> Co-authored-by: Blanchon <julien@blanchon.cc>
“ through something hacky like selenium, Google won't like it (and they'll miss ad revenue).“ I'm trying not to implode with cringe and laughter fighting to make sense of such a ridiculous naivety and ill-logic. Google owns searching the internet? We must not do anything Google doesn't like. Their feelings could get huwwrrrrt. We are not responsible for the eggs Google's business has restricted its success to. We are not responsible for prioritizing the Google-gets-a-check-for any web searchy things any creature partakes in. Cuz, duh, pay Google. I mean just like, they did a thing so pay up humanity! 🤦🏻♂️ |
@pixelpandacreative I believe this is the thread you are referring to? Your questions will be answered there :) |
Just curious, how does web search for this really work? I went through langchain's web search tutorial and according to it, the web search api usually returns html and we have to manually filter it by relevant tags (span, p, etc) to get the exact text information. And of course, this doesn't really seem to be applicable to every website. So how does huggingchat or perplexity manage to extract the necesarry information from any web page? |
the overall process is described in https://github.com/huggingface/chat-ui?tab=readme-ov-file#web-search you can see the code for the details: https://github.com/huggingface/chat-ui/tree/main/src/lib/server/websearch |
TLDR: update websearch demo
Specifically, there are 2 parts:
Testing locally
meta-llama/Llama-2-70b-chat-hf
as your modelRunnpm ci
since there is a new dependency to gradio clientDetailed description
My question is: {{USER QUESTION}}. Based on the conversation history, give me an appropriate query to answer my question for google search. You should not say more than query. You should not say any words except the query. For the context, today is {{CURRENT DATE}}
. Adding{{CURRENT DATE}}
has been very useful in asking questions such as:what happened yesterday?
, which becomesnews September 3, 2023
(overall, the query is same as used https://huggingface.co/spaces/chansung/llama2-with-gradio-chat except current date is added)top storeis
andorganic results
only (discardknowledge graph
andanswer box
)<p>
paragraph elements (this seems to remove a lot of "noise" and actually get "useful" text information from websites)a. use intfloat/e5-large-v2 for embeddings here
b. use hnswlib for finding releavant text chunks here
c. and use gradio js client here (docs here)
Video cast
Screen.Recording.2023-09-04.at.14.57.42.mov
Notes
I'd say it is working quite well.
However, right now, I'm looking for a potential bug that results in generating a completely unrelated text. When I ask: what happened yesterday, it answered once: Why AWS is a good cloud provider. Looking for a bug whether it is in the prompt, frontend, or server.(Update: 5bfab64 fixed the error)Examples
Open the examples:
Next steps