The Crosshatch provider for the Vercel AI SDK contains language model support for the Crosshatch API.
Currently supports the following Crosshatch providers and models:
- Anthropic
- claude-3.5-sonnet
- claude-3-haiku
- claude-3-sonnet
- OpenAI
- gpt-4o
- gpt-4o mini
Models and providers can be added by request at support@crosshatch.io
The Crosshatch provider is available in the @crosshatch/ai-provider
module. You can install it with
npm i @crosshatch/ai-provider
You can import the default provider instance crosshatch
from @crosshatch/ai-provider
:
import { crosshatch } from '@crosshatch/ai-provider';
import { crosshatch } from '@crosshatch/ai-provider';
import { generateText } from 'ai';
const { text } = await generateText({
model: crosshatch.languageModel("gpt-4o", {
token: "YOUR-TOKEN-HERE",
replace: {
"{{userInfo}}": {
select: ["originalTimestamp", "entity_vibe"],
from: "personalTimeline",
where: [{"field": "event", "op": "=", "value": "purchased"}],
orderBy: [{"field": "originalTimestamp", "dir": "desc"}],
limit: 5
}
}
}),
prompt: 'What kind of mood is this user in? Heres some info: {{userInfo}}',
});
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: {
"{{userInfo}}": {
select: ["originalTimestamp", "entity_vibe"],
from: "personalTimeline",
where: [{"field": "event", "op": "=", "value": "purchased"}],
orderBy: [{"field": "originalTimestamp", "dir": "desc"}],
limit: 5
}
}
}),
prompt: 'What kind of mood is this user in? Heres some info: {{userInfo}}',
});
Please check out our main documentation for more information.