Created
August 29, 2025 03:22
-
-
Save thangman22/ae50cfd3443f3e2b824a54e0ff97b693 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Check availability first | |
| const availability = await LanguageModel.availability({ | |
| }) | |
| // Create session with monitoring | |
| const session = await LanguageModel.create({ | |
| temperature: 0.7, | |
| monitor(m) { | |
| m.addEventListener('downloadprogress', (e) => { | |
| console.log(`Downloaded ${e.loaded * 100}%`) | |
| }) | |
| } | |
| }) | |
| // Use regular API for complete response | |
| const result = await session.prompt(prompt) | |
| // Clean up when done | |
| session.destroy() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment