Optional
options: Partial<RunTreeConfig>LangSmith options.
Use wrapAISDK
from langsmith/experimental/vercel
instead.
Wrap a Vercel AI SDK model, enabling automatic LangSmith tracing.
After wrapping a model, you can use it with the Vercel AI SDK Core
methods as normal.
import { anthropic } from "@ai-sdk/anthropic";
import { streamText } from "ai";
import { wrapAISDKModel } from "langsmith/wrappers/vercel";
const anthropicModel = anthropic("claude-3-haiku-20240307");
const modelWithTracing = wrapAISDKModel(anthropicModel);
const { textStream } = await streamText({
model: modelWithTracing,
prompt: "Write a vegetarian lasagna recipe for 4 people.",
});
for await (const chunk of textStream) {
console.log(chunk);
}
An AI SDK model instance.