Check out the full documentation here, and the project website here.
You can use npm or pnpm (or probably yarn), but this README.md shows examples using pnpm
To install via NPM, run:
pnpm i @flwr/flwrAlternatively, you can use it in vanilla JS, without any bundler, by using a CDN or static hosting. For example, using ES Modules, you can import the library with:
<script type="module">
import { FlowerIntelligence } from 'https://cdn.jsdelivr.net/npm/@flwr/flwr';
</script>import { FlowerIntelligence } from '@flwr/flwr';
const fi = FlowerIntelligence.instance;
async function main() {
const response = await fi.chat({
model: 'meta/llama3.2-1b/instruct-fp16',
messages: [
{ role: 'system', content: 'You are a helpful assistant' },
{ role: 'user', content: 'How are you?' },
],
});
if (!response.ok) {
console.error(`${response.failure.code}: ${response.failure.description}`);
} else {
console.log(response.message.content);
}
}
await main().then().catch();You can also quickly try out the library with the examples/hello-world-ts example (which is a minimal TypeScript project):
pnpm demoYou can also use pnpm demo:js to run the equivalent JavaScript project example (examples/simple-ts-project).