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
JavaScriptlangsmithwrappers
Module●Since v0.1

wrappers

Copy
import { ... } from "langsmith/wrappers";

Functions

function
wrapOpenAI→ PatchedOpenAIClient<T>
function
wrapSDK→ T
View source on GitHub

Wraps an OpenAI client's completion methods, enabling automatic LangSmith tracing. Method signatures are unchanged, with the exception that you can pass an additional and optional "langsmithExtra" field within the second parameter.

Wrap an arbitrary SDK, enabling automatic LangSmith tracing. Method signatures are unchanged.

Note that this will wrap and trace ALL SDK methods, not just LLM completion methods. If the passed SDK contains other methods, we recommend using the wrapped instance for LLM calls only.