Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

APIs

SDK

We provide a Custom Provider for the Vercel AI SDK to make it easier to integrate Crosshatch into your web application.

Typescript SDK

import { crosshatch } from "@crosshatch/ai-provider"; import { link } from "@crosshatch/link"; import { generateText } from "ai"; const { getToken } = await link({ clientId: "YOUR-CLIENT-ID" }); const { text } = await generateText({ model: crosshatch.languageModel("gpt-4o", { token: getToken(), replace: { last_5_buys: { select: ["originalTimestamp", "object_style"], from: "personalTimeline", where: [{ field: "event", op: "=", value: "purchased" }], orderBy: [{ field: "originalTimestamp", dir: "desc" }], limit: 5, }, }, }), prompt: "What should the user buy next? They last purchased these 5 things {last_5_buys}", });

See the Vercel AI SDK documentation for more information on how to use the SDK.

On this page