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
JavaScriptlangsmithwrapperswrapSDK
Function●Since v0.1

wrapSDK

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.

Copy
wrapSDK<T extends object>(sdk: T, options: Partial<RunTreeConfig  __type>): T

Parameters

NameTypeDescription
sdk*T

An arbitrary SDK instance.

optionsPartial<RunTreeConfig & __type>

LangSmith options.

View source on GitHub