Detection of programming language

91 views
Skip to first unread message

Raymond Camden

unread,
Aug 12, 2025, 5:48:02 PMAug 12
to Chrome Built-in AI Early Preview Program Discussions
I'm working on a demo using Chrome AI to detect the language of a code sample. My initial experiments on Gemini (AI Studio) worked perfectly. In Chrome, it fails very badly, and not in a "this is a smaller model, etc etc" way, but like, surely I'm doing something wrong. ;) 


Even small tests like: console.log('hello world') will return odd results like <pad>. I've tried short Python, PHP, and JS scripts, and can't ever get a decent result. I also tried, and you can see this in the code pen, wrapping the input with markdown triple backticks to signify that code is the input, but it didn't seem to help.

Is this just something the model won't be good at, or did I indeed make a simple mistake someplace?

Die4Ever2005

unread,
Aug 12, 2025, 10:16:55 PMAug 12
to Chrome Built-in AI Early Preview Program Discussions, Raymond Camden
"odd results like <pad>"

Pretty sure this was just a bad version of Chrome Canary, I saw stuff like this too but it's gone now after a couple updates. You might also need to go to chrome://components/ and check for update on "Optimization Guide On Device Model" (you might need to refresh the page for this to show up)

Die4Ever2005

unread,
Aug 12, 2025, 10:17:23 PMAug 12
to Chrome Built-in AI Early Preview Program Discussions, Die4Ever2005, Raymond Camden
Your demo works for me btw, it said Javascript

Raymond Camden

unread,
Aug 13, 2025, 9:07:27 AMAug 13
to Die4Ever2005, Chrome Built-in AI Early Preview Program Discussions
Canary updated this morning and now it works perfectly. :) 

On Tue, Aug 12, 2025 at 9:17 PM Die4Ever2005 <die4ev...@gmail.com> wrote:
Your demo works for me btw, it said Javascript



--
===========================================================================
Raymond Camden

Email : raymon...@gmail.com
Blog : www.raymondcamden.com
Twitter: raymondcamden

Thomas Steiner

unread,
Aug 14, 2025, 1:08:11 PMAug 14
to Raymond Camden, Die4Ever2005, Chrome Built-in AI Early Preview Program Discussions
Yes, whenever you see something like `<pad>`, the model is borked. Please let us know via a bug qith an example in the future (we're likely already aware, but just in case). 

Thanks!

Thomas Steiner, PhD—Developer Relations Engineer (blog.tomayac.comtoot.cafe/@tomayac)

Google Spain, S.L.U.
Torre Picasso, Pl. Pablo Ruiz Picasso, 1, Tetuán, 28020 Madrid, Spain

CIF: B63272603
Inscrita en el Registro Mercantil de Madrid, sección 8, Hoja M­-435397 Tomo 24227 Folio 25

----- BEGIN PGP SIGNATURE -----
Version: GnuPG v2.4.8 (GNU/Linux)

iFy0uwAntT0bE3xtRa5AfeCheCkthAtTh3reSabiGbl0ck
0fjumBl3DCharaCTersAttH3b0ttom.xKcd.cOm/1181.
----- END PGP SIGNATURE -----

--
You received this message because you are subscribed to the Google Groups "Chrome Built-in AI Early Preview Program Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chrome-ai-dev-previe...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chrome-ai-dev-preview-discuss/CAK2avF8%3DfJMKEkZdzQwecoQJhrENENiJimL4%2B%3DjgZ%2BfU0ByLFA%40mail.gmail.com.

Dan Brickley

unread,
Aug 14, 2025, 3:01:23 PMAug 14
to Thomas Steiner, Raymond Camden, Die4Ever2005, Chrome Built-in AI Early Preview Program Discussions
Is this predictable enough for the model framework to test itself on first use?

Thomas Steiner

unread,
Aug 14, 2025, 10:00:27 PMAug 14
to dan...@gmail.com, Thomas Steiner, Raymond Camden, Die4Ever2005, Chrome Built-in AI Early Preview Program Discussions
Not an expert, but in my personal experience it's not always happening for all inputs when the model is broken. For example, in the past, I hit the issue only after the session had reached a given length.l, which makes me believe it's not possible for the model to autodetect its correctness. 

Thomas Steiner, PhD—Developer Relations Engineer (blog.tomayac.comtoot.cafe/@tomayac)

Google Spain, S.L.U.
Torre Picasso, Pl. Pablo Ruiz Picasso, 1, Tetuán, 28020 Madrid, Spain

CIF: B63272603
Inscrita en el Registro Mercantil de Madrid, sección 8, Hoja M­-435397 Tomo 24227 Folio 25

----- BEGIN PGP SIGNATURE -----
Version: GnuPG v2.4.8 (GNU/Linux)

iFy0uwAntT0bE3xtRa5AfeCheCkthAtTh3reSabiGbl0ck
0fjumBl3DCharaCTersAttH3b0ttom.xKcd.cOm/1181.
----- END PGP SIGNATURE -----

Yallaling Goudar

unread,
Aug 15, 2025, 4:48:30 PMAug 15
to Thomas Steiner, Chrome Built-in AI Early Preview Program Discussions
Hi Built in AI EPP members,
I'm excited to announce the release of AI Components – a comprehensive TypeScript React component library that makes it incredibly easy to integrate Chrome's experimental AI APIs into your applications!

🎯 What is AI Components?

A production-ready React component library that provides plug-and-play AI components using Chrome's built-in AI capabilities. Think of it like Material-UI, but specifically designed for AI interactions.

📦 Package: @yallaling/ai-ui-components
🔗 NPM: https://www.npmjs.com/package/@yallaling/ai-ui-components
📚 Documentation: https://yallaling.github.io/ai-ui-components/
🔧 GitHub: https://github.com/yallaling/ai-ui-components

✨ Key Features

🧠 AI-Powered Components

  • AISummarizer – Text summarization with multiple formats (TL;DR, key points, headlines)

  • AITranslator – Multi-language translation with 10+ supported languages

  • AIRewriter – Content improvement with tone and style control

  • AILanguageDetector – Automatic language detection with confidence scoring

  • AIWriter – AI-assisted content creation

  • AIChat – Complete chat interface for AI conversations

  • AIPrompt – Smart prompt input with validation

🛠 Developer Experience

  • TypeScript First – Full type safety and IntelliSense support

  • Tree Shakeable – Import only what you need

  • Storybook Integration – Interactive component playground

  • Modern Build – ESM/CJS support with Rollup

  • Testing Ready – Jest + React Testing Library setup

  • CI/CD Ready – GitHub Actions workflow included

🎨 User Experience

  • Responsive Design – Works on all screen sizes

  • Accessibility – WCAG compliant with ARIA labels

  • Copy & Download – One-click copy to clipboard and file downloads

  • Resizable Components – Drag to resize for optimal layout

  • Streaming Support – Real-time AI responses

🚀 Quick Start

Installation

bash
npm install @yallaling/ai-ui-components

Basic Usage

tsx
import { AISummarizer, AITranslator, Toaster } from '@yallaling/ai-ui-components'; function App() { return ( <div> <AISummarizer type=\"key-points\" format=\"markdown\" allowCopy={true} allowDownload={true} placeholder=\"Enter text to summarize...\" /> <AITranslator sourceLanguage=\"en\" targetLanguage=\"es\" streaming={true} showControls={true} /> </div> ); }

⚠️ Important Requirements

Chrome 138+ Required – This library uses Chrome's experimental AI APIs, so users need:

  • Chrome 138 or later

  • Enable AI flags at chrome://flags/

  • Currently Chrome-exclusive (other browsers not supported)

🎯 Use Cases

For Developers

  • Rapid Prototyping – Get AI features running in minutes

  • Learning Chrome AI – Real examples with proper TypeScript types

  • Production Apps – Battle-tested components with error handling

For Applications

  • Content Management – Summarization and rewriting tools

  • International Apps – Built-in translation capabilities

  • Educational Platforms – Language detection and AI assistance

  • Documentation Sites – Auto-summarization of content

  • Creative Tools – AI-powered writing assistance

🔗 Links & Resources

💬 Feedback & Support

I'd love to hear your thoughts! Whether you're building AI applications, exploring Chrome's AI capabilities, or just curious about the technology:

Try it out and let me know what you build with it!

Best regards,
Yallaling Goudar


Raymond Camden

unread,
Aug 15, 2025, 4:52:11 PMAug 15
to Yallaling Goudar, Chrome Built-in AI Early Preview Program Discussions
I'll be "That Person" (sorry ;) and ask - why React components when vanilla web components would have been usable _anywhere_?

Yallaling Goudar

unread,
Aug 15, 2025, 4:57:15 PMAug 15
to Raymond Camden, Chrome Built-in AI Early Preview Program Discussions
Hi Raymond,

I will look into this. I was using it in react projects. So built it initially.

Thanks and Regards 
Yallaling 
Reply all
Reply to author
Forward
0 new messages