AI
Layeron AI binds Cloudflare Workers AI as AI on the product worker.
Use ai.llm to set a default model, then call it with run or the shorter prompt helper.
import { ai } from "@layeron/modules"
const assistant = ai.llm({ name: "assistant", model: "@cf/meta/llama-3.1-8b-instruct",})
const reply = await assistant.prompt("Write a short haiku about Cloudflare.")Pass extra Workers AI options through run when you need them:
const result = await assistant.run({ prompt: "Summarize this paragraph.", options: { temperature: 0.2, max_tokens: 128, },})