Back to Runanywhere Sdks

@runanywhere/web-llamacpp

sdk/runanywhere-web/packages/llamacpp/README.md

0.20.121.2 KB
Original Source

@runanywhere/web-llamacpp

Llama.cpp WASM backend for the RunAnywhere Web SDK — LLM, GGUF embeddings, VLM, LoRA, tools, and structured output in the browser.


Installation

bash
npm install @runanywhere/[email protected] @runanywhere/[email protected]

See the Web SDK README for bundler configuration and cross-origin isolation headers.


Usage

typescript
import { RunAnywhere, SDKEnvironment } from '@runanywhere/web';
import { LlamaCPP } from '@runanywhere/web-llamacpp';

await RunAnywhere.initialize({
  environment: SDKEnvironment.SDK_ENVIRONMENT_DEVELOPMENT,
});
await LlamaCPP.register({ acceleration: 'auto' });
await RunAnywhere.completeServicesInitialization();

const stream = await RunAnywhere.generateStream({
  prompt: 'Write a haiku about local AI.',
  maxTokens: 64,
});
for await (const token of stream.stream) {
  renderToken(token);
}

See the Web SDK README for model lifecycle and Vite setup.


Support


License

RunAnywhere License. See LICENSE.