Skip to content

Commit 23729de

Browse files
authored
fix readme (#526)
Fix couple of errors on readme
1 parent d0a9431 commit 23729de

1 file changed

Lines changed: 36 additions & 14 deletions

File tree

sdk_v2/js/README.md

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ The Foundry Local JS SDK provides a JavaScript/TypeScript interface for running
1717
## Installation
1818

1919
```bash
20-
npm install @prathikrao/foundry-local-sdk
20+
npm install foundry-local-sdk
2121
```
2222

2323
## WinML: Automatic Hardware Acceleration (Windows)
2424

2525
On Windows, install with the `--winml` flag to enable automatic execution provider management. The SDK will automatically discover, download, and register hardware-specific execution providers (e.g., Qualcomm QNN for NPU acceleration) via the Windows App Runtime — no manual driver or EP setup required.
2626

2727
```bash
28-
npm install @prathikrao/foundry-local-sdk --winml
28+
npm install foundry-local-sdk --winml
2929
```
3030

3131
When WinML is enabled:
@@ -37,28 +37,50 @@ When WinML is enabled:
3737
## Quick Start
3838

3939
```typescript
40-
import { FoundryLocalManager } from '@prathikrao/foundry-local-sdk';
40+
import { FoundryLocalManager } from 'foundry-local-sdk';
4141

42-
// Initialize the SDK
4342
const manager = FoundryLocalManager.create({
44-
appName: 'MyApp',
43+
appName: 'foundry_local_samples',
4544
logLevel: 'info'
4645
});
4746

48-
// Get a model from the catalog
49-
const model = await manager.catalog.getModel('phi-3-mini');
47+
// Get the model object
48+
const modelAlias = 'qwen2.5-0.5b';
49+
const model = await manager.catalog.getModel(modelAlias);
5050

51-
// Load the model into memory
51+
// Download the model
52+
console.log(`\nDownloading model ${modelAlias}...`);
53+
await model.download((progress) => {
54+
process.stdout.write(`\rDownloading... ${progress.toFixed(2)}%`);
55+
});
56+
57+
// Load the model
5258
await model.load();
5359

54-
// Run a chat completion
60+
// Create chat client
5561
const chatClient = model.createChatClient();
56-
const response = await chatClient.completeChat([
57-
{ role: 'user', content: 'Hello, how are you?' }
62+
63+
// Example chat completion
64+
console.log('\nTesting chat completion...');
65+
const completion = await chatClient.completeChat([
66+
{ role: 'user', content: 'Why is the sky blue?' }
5867
]);
59-
console.log(response.choices[0].message.content);
68+
console.log(completion.choices[0]?.message?.content);
69+
70+
// Example streaming completion
71+
console.log('\nTesting streaming completion...');
72+
await chatClient.completeStreamingChat(
73+
[{ role: 'user', content: 'Write a short poem about programming.' }],
74+
(chunk) => {
75+
const content = chunk.choices?.[0]?.message?.content;
76+
if (content) {
77+
process.stdout.write(content);
78+
}
79+
}
80+
);
81+
console.log('\n');
6082

61-
// Clean up
83+
// Unload the model
6284
await model.unload();
6385
```
6486

@@ -89,7 +111,7 @@ const loaded = await catalog.getLoadedModels();
89111
Each `Model` can have multiple variants (different quantizations or formats). The SDK automatically selects the best available variant, preferring cached versions.
90112

91113
```typescript
92-
const model = await catalog.getModel('phi-3-mini');
114+
const model = await catalog.getModel('qwen2.5-0.5b');
93115

94116
// Download if not cached (with optional progress tracking)
95117
if (!model.isCached) {

0 commit comments

Comments
 (0)