https://cloud.google.com/vertex-ai/generative-ai/docs/sample...
You can also take a look at Webllm library. https://github.com/mlc-ai/web-llm
In the future, google will probably load Gemini nano into chrome, right now it's in beta - https://developer.chrome.com/docs/ai/built-in
https://cloud.google.com/vertex-ai/generative-ai/docs/sample...