Skip to content

Latest commit

 

History

History
57 lines (40 loc) · 1.44 KB

File metadata and controls

57 lines (40 loc) · 1.44 KB

Flower Intelligence

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

Install

To install via NPM, run:

pnpm i @flwr/flwr

Alternatively, 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>

Hello, Flower Intelligence!

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();

Demo

You can also quickly try out the library with the examples/hello-world-ts example (which is a minimal TypeScript project):

pnpm demo

You can also use pnpm demo:js to run the equivalent JavaScript project example (examples/simple-ts-project).