Function createLangSmithProviderOptions

Wraps LangSmith config in a way that matches AI SDK provider types.

import { createLangSmithProviderOptions } from "langsmith/experimental/vercel";
import * as ai from "ai";

const lsConfig = createLangSmithProviderOptions<typeof ai.generateText>({
// Will have appropriate typing
processInputs: (inputs) => {
const { messages } = inputs;
return {
messages: messages?.map((message) => ({
...message,
content: "REDACTED",
})),
prompt: "REDACTED",
};
},
});

Note: AI SDK expects only JSON values in an object for provider options, but LangSmith's config may contain non-JSON values. These are not passed to the underlying AI SDK model, so it is safe to cast the typing here.