Guillermo Rauch Profile picture
Jun 27 3 tweets 2 min read Read on X
Chrome is adding `window​.ai` — a Gemini Nano AI model right inside your browser.

It already works with the AI SDK:

ai-sdk-chrome-ai.vercel.app
I believe this will truly transform frontend applications.

The use-cases are endless: smart auto-completion, error correction and validation, natural language filtering, auto-filling forms, UI suggestions, first-pass summarization and search…

But what we're getting now is:

• Faster AI – the model is tiny and runs on-device, at the speed of keystrokes.

• Optimistic AI – just like `useOptimistic` is a React hook to commit a local state change beating the server roundtrip and provider a better UX, I believe we'll see "multi-tiered AI", where the On-device AI does the first pass, and the Cloud AI enhances it further.

• Cost-efficient AI – many usecases will be altogether served by the local AI end-to-end. And if the device doesn't support it, @vercel AI SDK helps you share code, execute it in the cloud, and just swap out the `provider` to use a fast cloud model like @groqinc
This is how simple the resulting API is.
h/t @jeasonstudio for implementing `chrome-ai`Lines of code in a text editor.  import { streamText } from "ai"; import { chromeai } from "chrome-ai"; const { textStream } = await streamText({   model: chromeai(),   prompt: "what is a large language model?", });

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Guillermo Rauch

Guillermo Rauch Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @rauchg

May 12
A new kind of phishing attack showed up in my DMs.

A hacked government account DMs you that your account is in violation of X policies.

Here's an analysis of the attack 🧵 A Twitter profile page showing the profile picture and details of Amélie Oudéa-Castéra, the Minister of Sports and the Olympic and Paralympic Games.  Amélie Oudéa-Castéra @AOC1978 Ministre des Sports et des Jeux Olympiques et Paralympiques Joined July 2012 · 52.7K Followers Not followed by anyone you're following  X | Security Notification Dear X User,  This notification is to inform you that your account does not comply with our current policies. Activities or content that do not align with our company's policies may result in an inconsistent user experience with our services.  The reason ...
Notably, if you check out the account, it's not just verified, it's government verified. A fireworks display over a harbor with a large sailing ship.  This account is verified because it is a government or multilateral organization account. Verified since May 2022.
Let's take a look at the referenced hostname `twitter[.]support` – could this possibly be legit?

First red flag: it's served by @cloudflare, which and do not use. x.com
x.com
A terminal window displaying network connection information.  Connected to 2606:4700:3037::6815:29b5:443 from 2001:5a8:6ad:2000:d893:29a7:91b3:b225:63794  HTTP/2 200 date: Sun, 12 May 2024 17:00:18 GMT content-type: text/html; charset=UTF-8 vary: Accept-Encoding cf-cache-status: DYNAMIC report-to: {"endpoints":[{"url":"https://\/\/a.nel.cloudflare.com\/report\/v4?s=VwDofB3aMnCX2BXUx0S7%2Bi28nqxwvayXQznUwf0m5Ms3Ss7QcSc85y%2BaVKimoSznUdfq6iEVQ8oaVjSRMR8mZgqB%2FYBz2Bzcl1EIWg2dR%2B272vgQbDMkq1Ny1C5jROef1CpHrArkM1osF'gnWvJXmSSM%3D"}
Read 9 tweets
Mar 7
My favorite @nextjs apps I’ve written to learn the framework.

1️⃣ Next AI News:

My acid test here was: “are we delivering on ‘dynamic at the speed of static’”? next-ai-news.vercel.app
Its search, which is always SSR’d on a per-keystroke basis thanks to RSC, is a good demonstration.
2️⃣ Emoji TODO:

This one set out to prove two things:
✓ React now has PHP-like levels of code simplicity
✓ A mutation that re-renders the page from the server is fast enough

emoji-todo.vercel.app
Read 7 tweets
Feb 11
Next.js and React have never been easier, and they've also never been harder 🧵

Here's the universal 'minimum viable app', a TODO list, implemented with the latest features in 45LOC A TODO list implemented with RSC and Server Actions
Below is the live deployment. The most striking thing is that, as it's been discussed, React is now server-first.

Fetching and mutating data, compared to the old React, is now completely straightforward (as in PHP).
emoji-todo.vercel.app
If I had to teach how to re-create this basic app with "the old React", I'd have to teach:

◆ How to add API servers or RPC routes
◆ `useEffect` and `useState`
◆ External packages and more concepts
◆ Perf would suffer

And therein lies the problem.
Read 6 tweets
Dec 27, 2023
Fascinating talk, highly recommended.

The attackers used the hash of a WebGL rendered triangle for device fingerprinting 😲
Device fingerprinting with JS and WebGL
TrueType is "surprisingly turing-complete"[1] per @gwern who also pointed out the security implications[2]

[1]
[2] gwern.net/turing-complet…
gwern.net/turing-complet…
TrueType VM
@gwern The undocumented instruction 0x8f is still undocumented[1], and there are no mentions of the `ADJUST` opcode anywhere.

Closest I could find is this interpreter calling it `UNKNOWN`[2] 😲

[1]
[2] developer.apple.com/fonts/TrueType…
github.com/servo/libfreet…
0x8F instruction
Read 8 tweets
Nov 12, 2023
I upgraded to use partial-prerendering.

The speed is absolutely nuts. I see as low as 15ms TTFB from my home Wi-Fi in SF. The final result streams from us-east, where the core pokemon database is.

Speed *and* code simplification. Let's dive in 🧵 how-is-this-not-illegal.vercel.app
This demo is named "how is this not illegal" after Dan Abramov's reaction to Server Components bringing a PHP-like simplicity to React.

I turned on the `ppr` flag and I was able to simplify things further:
◆ No more `runtime` junk
◆ No more `dynamic`

github.com/rauchg/how-is-…
Image
Notice I added `headers()` specifically such that every single request gets fresh (random) Pokémon.

This simulates user personalization, like rendering a logged-in profile pic, cart, recommendations.

So… why is the TTFB so fast? Because the edge serves the shell of the page. The shell containing the skeleton for the page
Read 8 tweets
Apr 28, 2023
I re-designed rauchg.com with App Router
Migration highlights 🧵
◆ 100 PSI perf *out of the box*
◆ Using AI to migrate
◆ React Server Components are unreal (ft. <Tweet>)
◆ Generating Dynamic OG
◆ Reaching Dark Mode nirvana
◆ Integrating Rust-powered MDX (+ RSC) My new blog, redesigned and...
1️⃣ To start: is it really a framework if it's not blazing fast?
(or "why not an MPA?")
◆ 100 PSI (mobile!) with no work
◆ Yet page got *more complex* (realtime views)
◆ Yet I get:
◇ blazing page transitions
◇ state (e.g.: mutated view count)
◇ persistent layout (nav) 100 performance score, out ...
2️⃣ As part of this work, I converted
◆ `.jsx` → `.mdx` for all posts
◆ `<style jsx>` to Tailwind 🐐

CoPilot & ChatGPT saved a tremendous amount of time. I captured some examples:
sharegpt.com/c/zMhaUj2
sharegpt.com/c/vPEYSTh
shareg.pt/beYcWji

But! [cont]
Read 16 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(