LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangSmith
  • Client
  • Run Trees
  • Traceable
  • Evaluation
  • Schemas
  • Langchain
  • Jest
  • Vitest
  • Wrappers
  • Anonymizer
  • Traceable
  • Jestlike
  • Vercel
  • Anthropic
  • Sandbox
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangSmith
ClientRun TreesTraceableEvaluationSchemasLangchainJestVitestWrappersAnonymizerTraceableJestlikeVercelAnthropicSandbox
Language
Theme
JavaScriptlangsmithexperimentalvercelcreateLangSmithProviderOptions
Function●Since v0.4

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.

Copy
createLangSmithProviderOptions<T extends (
  args: any[]) => any>(lsConfig: WrapAISDKConfig<T>
): Record<string, JSONValue>

Used in Docs

  • Trace Vercel AI SDK applications (JS/TS only)

Parameters

NameTypeDescription
lsConfigWrapAISDKConfig<T>
View source on GitHub