@leuria/client
v0.2.0
Published
Browser SDK for Leuria: connect a page to the visitor's own AI and give it the page's tools.
Readme
@leuria/client
Browser SDK for Leuria. Write each AI feature once. Each request is served by the visitor's own AI (through the Leuria engine), the browser's built-in model, or your server, whichever this visitor has. Tools run in the page.
import { createAI, leuria, promptAPI, server } from "@leuria/client"
const ai = createAI({ providers: [leuria({ app: "My shop" }), promptAPI(), server({ url: "/api/ai" })] })
const answer = await ai.chat({ prompt: "Which mug is cheapest?", tools: [searchProducts] }).text()
const order = await ai.chat({ prompt: freeText, schema: orderSchema }).object()
const convo = ai.conversation({ system, tools }) // multi-turn, keeps history
exposeTools([searchProducts]) // the same tools for the browser's own agents (WebMCP)Visitors run the engine with npx @leuria/cli. Docs: docs/sdk.md. Apache-2.0.
