Notice: The Weights & Biases domain will change on September 30. This includes all websites and services that use a W&B domain. No action is needed today.
Integrate third-party libraries with the Weave TypeScript SDK
This guide describes how to integrate third-party libraries (for example, OpenAI) with the Weave TypeScript SDK. It’s intended for TypeScript developers who want Weave to automatically trace calls to supported libraries in their application.Weave supports automatic instrumentation, which streamlines setup and reduces the need for manual configuration.
What changed?
As of PR #4554, Weave automatically patches supported libraries such as OpenAI when it loads. You no longer need to manually wrap them:
weave.wrapOpenAI(newOpenAI());
Weave handles this automatically in most cases. However, edge cases may occur.
Use Weave integrations with your TypeScript project
The following sections describe how to identify which module system your project uses and then configure that project so Weave can automatically instrument supported third-party libraries. TypeScript projects can use either the CommonJS or ESM module system, and the required setup differs slightly between the two.
If you’re unsure which type of project you have
If you run a TypeScript file directly with a tool such as:
npx tsx test.ts
your environment may determine the module system implicitly. For consistent behavior, explicitly define package.json and tsconfig.json files.To determine whether a project uses CommonJS or ESM, check the type field in package.json:
"type": "module"
If type is "module", the project uses ESM.
If the type field is missing or set to "commonjs", the project defaults to using CommonJS.
Set up a CommonJS project
For CommonJS projects, automatic instrumentation works without additional configuration.To configure your project for CommonJS:
Create or update your package.json:
{ "type": "commonjs"}
Create a tsconfig.json with CommonJS-compatible settings:
These settings configure TypeScript to compile for CommonJS:
module: "CommonJS". Compiles modules to CommonJS format (require or module.exports).
For details on this compiler option, see TypeScript - Module.
target: "es2022" (recommended). Emits modern JavaScript compatible with recent Node.js versions.
For details on this compiler option, see TypeScript - Target.
rootDir: ".". Treats the directory that contains tsconfig.json as the root of your input files. TypeScript uses this with outDir to mirror your source folder layout in the output.
For details on this compiler option, see TypeScript - Root Dir.
outDir: "dist". Writes emitted JavaScript and other compiler outputs into the dist folder.
For details on this compiler option, see TypeScript - Out Dir.
Install Weave and any other required libraries:
npm install weave
Compile your TypeScript file.For an example file test.ts:
npx tsc
This compiles the file to dist/test.js.
Run the compiled file with Node.js:
node dist/test.js
Your CommonJS project is now configured so that Weave automatically instruments supported libraries when your code runs. Because CommonJS uses the Node.js require module loader, Weave can automatically instrument supported libraries without the --import flag used in ESM projects.
Set up an ESM project
To use Weave with an ESM TypeScript project, configure your project for Node.js ESM, compile your code, and start Node.js with the --import flag so Weave can register its instrumentation before other modules load.To configure your project for ESM:
Create or update your package.json:
{ "type": "module"}
Create a tsconfig.json with Node-compatible ESM settings:
These settings configure TypeScript to compile for modern Node.js ESM:
module: "nodenext". Compiles modules using Node.js ESM semantics.
For details on this compiler option, see TypeScript - Module.
moduleResolution: "nodenext". Ensures module resolution follows Node.js ESM rules.
For details on this compiler option, see TypeScript - Module Resolution.
target: "es2022" (recommended). Emits modern JavaScript compatible with recent Node.js versions.
For details on this compiler option, see TypeScript - Target.
rootDir: ".". Treats the directory that contains tsconfig.json as the root of your input files. TypeScript uses this with outDir to mirror your source folder layout in the output.
For details on this compiler option, see TypeScript - Root Dir.
outDir: "dist". Writes emitted JavaScript and other compiler outputs into the dist folder.
For details on this compiler option, see TypeScript - Out Dir.
Install Weave and any other required libraries:
npm install weave
Compile your TypeScript file.For an example file test.ts:
npx tsc
This compiles the file to dist/test.js.
Run the compiled file with Node.js and preload the Weave instrumentation:
node --import=weave/instrument dist/test.js
The --import flag ensures that the weave/instrument module loads before other modules, so Weave can automatically instrument supported libraries and integrations.Weave must be installed locally in the project you run.Your ESM project is now configured so that Weave preloads its instrumentation before other modules and automatically traces calls to supported libraries.
Advanced usage and troubleshooting
The following sections cover edge cases and workarounds for when the TypeScript SDK’s automatic patching doesn’t work as expected. For example, ESM-only environments, bundler setups such as Next.js, or constrained runtime environments may cause issues. If you see missing traces or integration issues, start here.
Use NODE_OPTIONS (only for ESM)
Use NODE_OPTIONS with caution, because it affects all Node.js processes in the environment and may introduce side effects.
If you use an ESM project and can’t pass CLI flags (for example, due to constraints in CLI tools or frameworks), set the NODE_OPTIONS environment variable:
export NODE_OPTIONS="--import=weave/instrument"
Bundler compatibility
Some frameworks and bundlers, such as Next.js, may bundle third-party libraries in ways that prevent Node.js from patching them at runtime.If this describes your setup, try the following steps:
Mark LLM libraries as external in your bundler configuration. This prevents the bundler from bundling them, so Weave can patch them correctly at runtime.The following example shows how to mark the openai package as external in a next.config.js configuration, which prevents the bundler from bundling it. The module loads at runtime, so Weave can automatically patch and track it. Use this setup when you work with frameworks such as Next.js to enable auto-instrumentation.
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"Weights \u0026 Biases Documentation","colors":{"primary":"#FCBC32","light":"#FCBC32","dark":"#FCBC32"},"logo":{"light":"https://mintcdn.com/wb-21fd5541/C7PMWo9Jl9GZ2Zki/icons/Endorsed_primary_blackwhite.svg?fit=max\u0026auto=format\u0026n=C7PMWo9Jl9GZ2Zki\u0026q=85\u0026s=a9d999235518399090dd8ddd0a9e1e4a","dark":"https://mintcdn.com/wb-21fd5541/C7PMWo9Jl9GZ2Zki/icons/Endorsed_primary_goldwhite.svg?fit=max\u0026auto=format\u0026n=C7PMWo9Jl9GZ2Zki\u0026q=85\u0026s=f4eaf37e934c12e5fd3e806fe2984c2e","href":"https://docs.wandb.ai/"},"favicon":"https://mintcdn.com/wb-21fd5541/HesivM0BUKMK8VeH/favicon.png?fit=max\u0026auto=format\u0026n=HesivM0BUKMK8VeH\u0026q=85\u0026s=0c96f60ed4edd2ece5e942ecde3c11fa","background":{"decoration":"gradient"},"navbar":{"links":[{"href":"https://app.wandb.ai/login?_gl=1*8ninq0*_ga*MTE3ODEwNDkyLjE3MzQwMjk0NjA.*_ga_JH1SJHJQXJ*MTczNDA2Mzc4OS4yLjEuMTczNDA2MzkxMC42MC4wLjA.*_ga_GMYDGNGKDT*MTczNDA2Mzc4OS4zLjEuMTczNDA2Mzg2Ny4wLjAuMA..*_gcl_au*MTc0Mjk3ODgzMi4xNzM0MDI5NDYw","label":"Log in"}],"primary":{"type":"button","label":"Sign Up","href":"https://app.wandb.ai/login?signup=true\u0026_gl=1*y15ckv*_ga*MTE3ODEwNDkyLjE3MzQwMjk0NjA.*_ga_JH1SJHJQXJ*MTczNDA2Mzc4OS4yLjEuMTczNDA2Mzk3MC42MC4wLjA.*_ga_GMYDGNGKDT*MTczNDA2Mzc4OS4zLjEuMTczNDA2Mzg2Ny4wLjAuMA..*_gcl_au*MTc0Mjk3ODgzMi4xNzM0MDI5NDYw"}},"footer":{"socials":{"discord":"https://discord.com/invite/RgB8CPk2ce","github":"https://github.com/wandb/docs","linkedin":"https://www.linkedin.com/company/wandb","x":"https://x.com/weights_biases?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor","youtube":"https://www.youtube.com/c/WeightsBiases"}},"seo":{"metatags":{"canonical":"https://docs.wandb.ai"},"indexing":"all"},"fonts":{"heading":{"family":"Source Serif 4","weight":400},"body":{"family":"Source Sans 3","weight":400}},"styling":{"eyebrows":"breadcrumbs","latex":true},"integrations":{"ga4":{"measurementId":"G-5JYCHZZP7K"},"gtm":{"tagId":"GTM-5BL5RTH"}},"banner":{"content":"**Notice:** The Weights \u0026 Biases domain [will change on September 30](https://wandb.ai/site/domain-update-faqs/). This includes all websites and services that use a W\u0026B domain. No action is needed today.","dismissible":true,"type":"warning"},"contextual":{"options":[{"title":"Install W\u0026B MCP","description":"Set up the W\u0026B MCP server in Claude Code, Codex, VS Code and or other LLM agents.","icon":"plug","href":"/platform/mcp-server"},{"title":"Install W\u0026B MCP in Cursor","description":"Automatically install W\u0026B MCP server to Cursor. Requires a W\u0026B API key.","icon":"plug","href":"cursor://anysphere.cursor-deeplink/mcp/install?name=wandb\u0026config=eyJ0cmFuc3BvcnQiOiJodHRwIiwidXJsIjoiaHR0cHM6Ly9tY3Aud2l0aHdhbmRiLmNvbS9tY3AiLCJoZWFkZXJzIjp7IkF1dGhvcml6YXRpb24iOiJCZWFyZXIgWU9VUl9XQU5EQl9BUElfS0VZIiwiQWNjZXB0IjoiYXBwbGljYXRpb24vanNvbiwgdGV4dC9ldmVudC1zdHJlYW0ifX0="},"chatgpt","claude","copy","view"],"display":"header"},"navigation":{"languages":[{"language":"en","href":""},{"language":"fr","href":"fr"},{"language":"ja","href":"ja"},{"language":"ko","href":"ko"}]}},"deployment":{"deploymentMetadataValue":{"subdomain":"wb-21fd5541","hasAudioNarration":false,"actualSubdomain":"wb-21fd5541","customDomains":["docs.wandb.ai"],"gitSource":{"type":"github","owner":"wandb","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"feedback":{"thumbs":true,"edits":true,"issues":true,"agentFeedback":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6abd16e4f7750a5210d47e77","clientVersion":"0.0.4271","searchFilterCounts":[{"language":"en","tag":"Products","count":420},{"language":"fr","tag":"Produits","count":420},{"language":"ja","tag":"プロダクト","count":420},{"language":"ko","tag":"제품","count":420},{"language":"en","tag":"Reference","count":397},{"language":"fr","tag":"Référence","count":397},{"language":"ja","tag":"リファレンス","count":397},{"language":"ko","tag":"레퍼런스","count":397},{"language":"en","tag":"W\u0026B Weave","count":356},{"language":"fr","tag":"W\u0026B Weave","count":356},{"language":"ja","tag":"W\u0026B Weave","count":356},{"language":"ko","tag":"W\u0026B Weave","count":356},{"language":"en","tag":"W\u0026B Models","count":333},{"language":"fr","tag":"W\u0026B Models","count":333},{"language":"ja","tag":"W\u0026B Models","count":333},{"language":"ko","tag":"W\u0026B Models","count":333},{"language":"en","tag":"Guides","count":259},{"language":"fr","tag":"Guides","count":259},{"language":"ja","tag":"ガイド","count":259},{"language":"ko","tag":"가이드","count":259},{"language":"en","tag":"Service API","count":113},{"language":"fr","tag":"API de service","count":113},{"language":"ja","tag":"サービス API","count":113},{"language":"ko","tag":"서비스 API","count":113},{"language":"en","tag":"Python","count":92},{"language":"fr","tag":"Python","count":92},{"language":"ja","tag":"Python","count":92},{"language":"ko","tag":"Python","count":92},{"language":"en","tag":"TypeScript SDK","count":88},{"language":"fr","tag":"SDK TypeScript","count":88},{"language":"ja","tag":"TypeScript SDK","count":88},{"language":"ko","tag":"TypeScript SDK","count":88},{"language":"en","tag":"Trace functions with Ops and Calls","count":64},{"language":"fr","tag":"Tracer des fonctions avec des Ops et des Calls","count":64},{"language":"ja","tag":"Ops と Calls を使用して関数をトレースする","count":64},{"language":"ko","tag":"Ops와 Calls로 함수 트레이스하기","count":64},{"language":"en","tag":"Docs Home","count":62},{"language":"fr","tag":"Accueil de la documentation","count":62},{"language":"ja","tag":"ドキュメント ホーム","count":62},{"language":"ko","tag":"문서 홈","count":62}],"searchSettings":{"maxResults":25}},"assistantConfig":{"enableAskAiButton":true,"enableAskAiSearchBar":false,"deflection":{"enabled":true,"email":"support@wandb.com"}},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":true,"toggles":[{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":true},"customCss":[{"filePath":"css/styles.css","content":":root{--background-light:251 250 248;--background-dark:26 29 36;--primary-foreground:217 13% 19%;--page-texture:url(\"/css/assets/light-dots.png\")}:root{--color-page-bg:#FBFAF8;--color-card-hover:#FFFFFF;--color-stroke:#DFE0E2;--color-sidebar-bg:#F9F7F3;--color-sidebar-hover:#F5EDE1;--color-card-rest:#FBFAF8;--color-card-active:#FFFFFF;--color-icon:#D4870D;--color-button:#FCBC32;--color-button-fg:#2B3038;--color-text-primary:#2B3038;--color-text-secondary:#4B535C}.dark{--color-page-bg:#1A1D24;--color-card-hover:#363C44;--color-stroke:#2B3038;--color-sidebar-bg:#20242B;--color-sidebar-hover:#2B3038;--color-card-rest:#1A1D24;--color-card-active:#2B3038;--color-icon:#D4870D;--color-button:#FCBC32;--color-text-primary:#E8E8E9;--color-text-secondary:#C5C7CC;--page-texture:url(\"/css/assets/dark-dots.png\")}:root{--font-serif:\"Source Serif 4\",\"Times New Roman\",serif;--font-sans:\"Source Sans 3\",Calibri,sans-serif;--font-weight-regular:400;--font-weight-medium:500;--font-weight-bold:650;--font-size-xs:0.75rem;--font-size-sm:0.9375rem;--font-size-md:1rem;--font-size-xm:1.125rem;--font-size-lg:1.5rem;--font-size-xl:2.5rem}body{font-family:var(--font-sans)}h1,h2,h3,h4,h5,h6{font-family:var(--font-serif);font-weight:var(--font-weight-medium)!important;color:var(--color-text-primary)!important}h1{font-size:var(--font-size-xl)}b,strong{font-weight:var(--font-weight-bold)!important;font-synthesis-weight:auto}.prose :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2.5rem}h2:is([id^=january-2],[id^=february-2],[id^=march-2],[id^=april-2],[id^=may-2],[id^=june-2],[id^=july-2],[id^=august-2],[id^=september-2],[id^=october-2],[id^=november-2],[id^=december-2]){margin-top:3rem}.banner-body,.banner-body *,.banner-title{color:#e8e8e9!important}body,html{background-color:var(--color-page-bg)!important;background-image:var(--page-texture)!important;background-repeat:no-repeat!important;background-size:500px auto!important;background-position:calc(100% + 375px) 200px!important;background-attachment:fixed!important}main{background-color:transparent!important}#background-color{background-color:transparent!important}span[style*=radial-gradient]{background:0 0!important}img.nav-logo{height:62px!important;min-height:62px!important;max-height:62px!important;width:233px!important;min-width:233px!important;max-width:233px!important;flex-shrink:0!important;flex-grow:0!important}a:has(>img.nav-logo){flex-shrink:0;min-width:233px}a.nav-tabs-item.font-medium:not([data-active=true]),button.nav-tabs-item:not(.text-primary)>div:first-child{color:var(--color-text-secondary)}button.nav-tabs-item.text-primary>div:first-child svg,button.nav-tabs-item:hover>div:first-child svg{color:var(--color-text-primary)!important}.nav-tabs-item{font-size:var(--font-size-md)}[data-active=true].hover\\:text-primary:hover,[data-active=true].text-primary{color:var(--color-text-primary);text-shadow:none;font-weight:var(--font-weight-bold)}button.nav-tabs-item.text-primary,button.nav-tabs-item.text-primary>div:first-child{color:var(--color-text-primary)!important;font-weight:var(--font-weight-bold)!important}.nav-tabs-item .bg-primary{background-color:var(--color-text-primary);height:2px}.nav-dropdown-item:has(.text-primary){background-color:var(--color-sidebar-hover)}.nav-dropdown-item .text-primary{color:var(--color-text-primary);font-weight:var(--font-weight-medium)}.nav-dropdown-item.group:hover .group-hover\\:text-primary{color:var(--color-text-primary)}#assistant-entry,#assistant-entry span,#localization-select-trigger,#localization-select-trigger span,#search-bar-entry,#search-bar-entry>div>div,#topbar-cta-button a,#topbar-cta-button a span,.topbar-right-container nav,.topbar-right-container nav a{font-size:var(--font-size-sm)}#topbar-cta-button a,#topbar-cta-button a span,#topbar-cta-button a svg{color:var(--color-button-fg)}#assistant-entry{background-color:var(--color-button)!important}#assistant-entry:hover{background-color:var(--color-button)!important;opacity:.9}#assistant-entry,#assistant-entry span,#assistant-entry svg{color:var(--color-button-fg)!important}#banner,#banner *{color:var(--color-button-fg)!important}button[aria-label=\"Dismiss banner\"] svg{stroke:var(--color-button-fg)!important}#sidebar,#sidebar-content{background-color:var(--color-sidebar-bg)}.sidebar-group-header,.sidebar-group-header>h5{font-family:var(--font-sans)!important;font-size:var(--font-size-md);font-weight:var(--font-weight-medium)!important}.sidebar-group a,.sidebar-group button{font-family:var(--font-sans);font-size:var(--font-size-sm);font-weight:var(--font-weight-medium)}#sidebar-content a.text-primary{color:var(--color-text-primary);background-color:var(--color-sidebar-hover);text-shadow:none}.nav-tag-pill-text{color:var(--color-text-secondary)}#sidebar-content .sidebar-group a .justify-end{flex:none}.toc-item[data-active=true]>a,.toc-item[data-active=true]>a:hover{color:var(--color-text-primary);border-color:var(--color-text-primary)}.colab-link,.github-source-link,.try-product-link{display:flex;align-items:center;justify-content:center;gap:12px;padding:8px 14px;border:1px solid color-mix(in srgb,var(--color-stroke) 70%,transparent);border-radius:12px;font-size:var(--font-size-md);font-weight:var(--font-weight-regular);font-family:var(--font-sans);color:var(--color-text-secondary);background-color:color-mix(in srgb,var(--color-card-hover) 50%,transparent);text-decoration:none;line-height:24px;white-space:nowrap;cursor:pointer;transition:all .2s ease;margin-bottom:1.5rem;width:fit-content;min-width:fit-content}.colab-link:hover,.github-source-link:hover,.try-product-link:hover{background-color:color-mix(in srgb,var(--color-card-hover) 80%,transparent);border-color:var(--color-stroke)}.dark .colab-link,.dark .github-source-link,.dark .try-product-link{color:var(--color-text-primary)}.source-link{float:right;display:inline-block;padding:2px 8px;border:1px solid color-mix(in srgb,var(--color-stroke) 70%,transparent);border-radius:6px;font-size:var(--font-size-xs);font-weight:var(--font-weight-medium);color:var(--color-text-secondary);background-color:color-mix(in srgb,var(--color-card-hover) 50%,transparent);text-decoration:none;transition:all .15s ease}.source-link:hover{background-color:color-mix(in srgb,var(--color-card-hover) 80%,transparent);border-color:var(--color-stroke);text-decoration:none}.dark .source-link{color:var(--color-text-primary)}button[type=submit].bg-primary.mint-text-white{color:var(--color-button-fg)!important}button[type=submit].bg-primary.mint-text-white [fill=white]{fill:currentColor!important}button[type=submit].bg-primary.mint-text-white [stroke=white]{stroke:currentColor!important}button[type=submit].bg-primary.mint-text-white svg{color:var(--color-button-fg)!important}div:has(>div>textarea.chat-assistant-input):not(#chat-assistant-sheet *){box-shadow:0 8px 24px #00000026}div:has(>.chat-assistant-floating-input){overflow:visible!important}textarea.chat-assistant-input{min-height:2.5rem!important;max-height:2.5rem!important}button.chat-assistant-send-button{background-color:var(--color-button)!important}button.chat-assistant-send-button svg{color:var(--color-button-fg)!important}.product-card{background-color:var(--color-card-rest);border:1px solid var(--color-stroke)}.product-card:hover{background-color:var(--color-card-active)}.product-card-title{font-size:var(--font-size-lg);font-weight:var(--font-weight-medium)!important;margin-top:0}.home-h3,.product-card-subtitle{font-family:var(--font-sans)!important;font-size:var(--font-size-xm);font-weight:var(--font-weight-regular);color:var(--color-text-primary)}.product-card-body{font-family:var(--font-sans);font-size:var(--font-size-sm);font-weight:var(--font-weight-regular);color:var(--color-text-secondary)}.card.block{background-color:var(--color-card-rest)!important;border-color:var(--color-stroke)!important}.card.block:hover{background-color:var(--color-card-active)!important;border-color:var(--color-stroke)!important}.card.block h1,.card.block h2,.card.block h3,.card.block h4,.card.block h5,.card.block h6{font-family:var(--font-sans);font-weight:var(--font-weight-bold)!important}#pagination>a{background-color:var(--color-card-rest);border-color:var(--color-stroke)}#pagination>a:hover{background-color:var(--color-card-active);border-color:var(--color-stroke)}[data-component-part=update-label]{color:var(--color-text-secondary)}[data-badge=true][data-color=orange]{--color-bg:color-mix(in srgb, var(--color-button) 20%, transparent);--color-text:var(--color-icon);--color-bg-disabled:color-mix(in srgb, var(--color-button) 8%, transparent);--color-text-disabled:color-mix(in srgb, var(--color-icon) 50%, transparent)}[data-badge=true] a,[data-badge=true] a:hover{text-decoration:none!important;border-bottom:0!important}.dark [data-badge=true][data-color=orange]{--color-text:var(--color-button);--color-text-disabled:color-mix(in srgb, var(--color-button) 50%, transparent)}"}]}
{"page":{"pagePath":"weave/guides/integrations/js","slug":"/weave/guides/integrations/js","pageMetadata":{"title":"TypeScript SDK: third-party integration guide","description":"Integrate third-party libraries with the Weave TypeScript SDK","href":"/weave/guides/integrations/js"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Integrate third-party libraries with the Weave TypeScript SDK\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,br:`br`,code:`code`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Popup,PopupContent,PopupTrigger,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Popup)_missingMdxReference(`Popup`,true);if(!PopupContent)_missingMdxReference(`PopupContent`,true);if(!PopupTrigger)_missingMdxReference(`PopupTrigger`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`This guide describes how to integrate third-party libraries (for example, OpenAI) with the Weave TypeScript SDK. It’s intended for TypeScript developers who want Weave to automatically trace calls to supported libraries in their application.`}),`\n`,_jsx(_components.p,{children:`Weave supports automatic instrumentation, which streamlines setup and reduces the need for manual configuration.`}),`\n`,_jsxs(Warning,{children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`What changed?`}),`\nAs of `,_jsx(_components.a,{href:`https://github.com/wandb/weave/pull/4554`,children:`PR #4554`}),`, Weave automatically patches supported libraries such as OpenAI when it loads. You no longer need to manually wrap them:`]}),_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`1`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus twoslash lsp`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`weave`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`wrapOpenAI`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` `}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`OpenAI`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`());`})]}),`\n`]})})}),_jsxs(_components.p,{children:[`Weave handles this automatically in most cases. However, `,_jsx(_components.a,{href:`#advanced-usage`,children:`edge cases`}),` may occur.`]})]}),`\n`,_jsx(Heading,{level:`2`,id:`use-weave-integrations-with-your-typescript-project`,children:`Use Weave integrations with your TypeScript project`}),`\n`,_jsx(_components.p,{children:`The following sections describe how to identify which module system your project uses and then configure that project so Weave can automatically instrument supported third-party libraries. TypeScript projects can use either the CommonJS or ESM module system, and the required setup differs slightly between the two.`}),`\n`,_jsx(Heading,{level:`3`,id:`if-you’re-unsure-which-type-of-project-you-have`,children:`If you’re unsure which type of project you have`}),`\n`,_jsx(_components.p,{children:`If you run a TypeScript file directly with a tool such as:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`npx`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` tsx`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` test.ts`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`your environment may determine the module system implicitly. For consistent behavior, explicitly define `,_jsx(_components.code,{children:`package.json`}),` and `,_jsx(_components.code,{children:`tsconfig.json`}),` files.`]}),`\n`,_jsxs(_components.p,{children:[`To determine whether a project uses CommonJS or ESM, check the `,_jsx(_components.code,{children:`type`}),` field in `,_jsx(_components.code,{children:`package.json`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"module\"`})]}),`\n`]})})}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`If `,_jsx(_components.code,{children:`type`}),` is `,_jsx(_components.code,{children:`\"module\"`}),`, the project uses ESM.`]}),`\n`,_jsxs(_components.li,{children:[`If the `,_jsx(_components.code,{children:`type`}),` field is missing or set to `,_jsx(_components.code,{children:`\"commonjs\"`}),`, the project defaults to using CommonJS.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`set-up-a-commonjs-project`,children:`Set up a CommonJS project`}),`\n`,_jsx(_components.p,{children:`For CommonJS projects, automatic instrumentation works without additional configuration.`}),`\n`,_jsx(_components.p,{children:`To configure your project for CommonJS:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Create or update your `,_jsx(_components.code,{children:`package.json`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"commonjs\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Create a `,_jsx(_components.code,{children:`tsconfig.json`}),` with CommonJS-compatible settings:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"compilerOptions\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"module\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"CommonJS\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"target\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"es2022\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"rootDir\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\".\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"outDir\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"dist\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`These settings configure TypeScript to compile for CommonJS:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`module: \"CommonJS\"`}),`. Compiles modules to CommonJS format (`,_jsx(_components.code,{children:`require`}),` or `,_jsx(_components.code,{children:`module.exports`}),`).\nFor details on this compiler option, see `,_jsx(_components.a,{href:`https://www.typescriptlang.org/tsconfig/#module`,children:`TypeScript - Module`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`target: \"es2022\"`}),` (recommended). Emits modern JavaScript compatible with recent Node.js versions.\nFor details on this compiler option, see `,_jsx(_components.a,{href:`https://www.typescriptlang.org/tsconfig/#target`,children:`TypeScript - Target`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`rootDir: \".\"`}),`. Treats the directory that contains `,_jsx(_components.code,{children:`tsconfig.json`}),` as the root of your input files. TypeScript uses this with `,_jsx(_components.code,{children:`outDir`}),` to mirror your source folder layout in the output.\nFor details on this compiler option, see `,_jsx(_components.a,{href:`https://www.typescriptlang.org/tsconfig/#rootDir`,children:`TypeScript - Root Dir`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`outDir: \"dist\"`}),`. Writes emitted JavaScript and other compiler outputs into the `,_jsx(_components.code,{children:`dist`}),` folder.\nFor details on this compiler option, see `,_jsx(_components.a,{href:`https://www.typescriptlang.org/tsconfig/#outDir`,children:`TypeScript - Out Dir`}),`.`]}),`\n`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Install Weave and any other required libraries:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`npm`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` weave`})]}),`\n`]})})}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Compile your TypeScript file.`}),`\n`,_jsxs(_components.p,{children:[`For an example file `,_jsx(_components.code,{children:`test.ts`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`npx`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` tsc`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`This compiles the file to `,_jsx(_components.code,{children:`dist/test.js`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Run the compiled file with Node.js:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`node`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` dist/test.js`})]}),`\n`]})})}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Your CommonJS project is now configured so that Weave automatically instruments supported libraries when your code runs. Because CommonJS uses the Node.js `,_jsx(_components.code,{children:`require`}),` module loader, Weave can automatically instrument supported libraries without the `,_jsx(_components.code,{children:`--import`}),` flag used in ESM projects.`]}),`\n`,_jsx(Heading,{level:`3`,id:`set-up-an-esm-project`,children:`Set up an ESM project`}),`\n`,_jsxs(_components.p,{children:[`To use Weave with an ESM TypeScript project, configure your project for Node.js ESM, compile your code, and start Node.js with the `,_jsx(_components.code,{children:`--import`}),` flag so Weave can register its instrumentation before other modules load.`]}),`\n`,_jsx(_components.p,{children:`To configure your project for ESM:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Create or update your `,_jsx(_components.code,{children:`package.json`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"module\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Create a `,_jsx(_components.code,{children:`tsconfig.json`}),` with Node-compatible ESM settings:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`9`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"compilerOptions\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"module\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"nodenext\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"moduleResolution\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"nodenext\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"target\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"es2022\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"rootDir\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\".\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"outDir\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"dist\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`These settings configure TypeScript to compile for modern Node.js ESM:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`module: \"nodenext\"`}),`. Compiles modules using Node.js ESM semantics.`,_jsx(_components.br,{}),`\n`,`For details on this compiler option, see `,_jsx(_components.a,{href:`https://www.typescriptlang.org/tsconfig/#module`,children:`TypeScript - Module`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`moduleResolution: \"nodenext\"`}),`. Ensures module resolution follows Node.js ESM rules.`,_jsx(_components.br,{}),`\n`,`For details on this compiler option, see `,_jsx(_components.a,{href:`https://www.typescriptlang.org/tsconfig/#moduleResolution`,children:`TypeScript - Module Resolution`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`target: \"es2022\"`}),` (recommended). Emits modern JavaScript compatible with recent Node.js versions.`,_jsx(_components.br,{}),`\n`,`For details on this compiler option, see `,_jsx(_components.a,{href:`https://www.typescriptlang.org/tsconfig/#target`,children:`TypeScript - Target`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`rootDir: \".\"`}),`. Treats the directory that contains `,_jsx(_components.code,{children:`tsconfig.json`}),` as the root of your input files. TypeScript uses this with `,_jsx(_components.code,{children:`outDir`}),` to mirror your source folder layout in the output.`,_jsx(_components.br,{}),`\n`,`For details on this compiler option, see `,_jsx(_components.a,{href:`https://www.typescriptlang.org/tsconfig/#rootDir`,children:`TypeScript - Root Dir`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`outDir: \"dist\"`}),`. Writes emitted JavaScript and other compiler outputs into the `,_jsx(_components.code,{children:`dist`}),` folder.`,_jsx(_components.br,{}),`\n`,`For details on this compiler option, see `,_jsx(_components.a,{href:`https://www.typescriptlang.org/tsconfig/#outDir`,children:`TypeScript - Out Dir`}),`.`]}),`\n`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Install Weave and any other required libraries:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`npm`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` install`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` weave`})]}),`\n`]})})}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Compile your TypeScript file.`}),`\n`,_jsxs(_components.p,{children:[`For an example file `,_jsx(_components.code,{children:`test.ts`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`npx`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` tsc`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`This compiles the file to `,_jsx(_components.code,{children:`dist/test.js`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Run the compiled file with Node.js and preload the Weave instrumentation:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`node`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --import=weave/instrument`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` dist/test.js`})]}),`\n`]})})}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`--import`}),` flag ensures that the `,_jsx(_components.code,{children:`weave/instrument`}),` module loads before other modules, so Weave can automatically instrument supported libraries and integrations.`]}),`\n`,_jsx(_components.p,{children:`Weave must be installed locally in the project you run.`}),`\n`,_jsx(_components.p,{children:`Your ESM project is now configured so that Weave preloads its instrumentation before other modules and automatically traces calls to supported libraries.`}),`\n`,_jsx(Heading,{level:`2`,id:`advanced-usage-and-troubleshooting`,children:`Advanced usage and troubleshooting`}),`\n`,_jsx(_components.p,{children:`The following sections cover edge cases and workarounds for when the TypeScript SDK’s automatic patching doesn’t work as expected. For example, ESM-only environments, bundler setups such as Next.js, or constrained runtime environments may cause issues. If you see missing traces or integration issues, start here.`}),`\n`,_jsxs(Heading,{level:`3`,id:`use-node_options-only-for-esm`,children:[`Use `,_jsx(_components.code,{children:`NODE_OPTIONS`}),` (only for ESM)`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Use `,_jsx(_components.code,{children:`NODE_OPTIONS`}),` with caution, because it affects all Node.js processes in the environment and may introduce side effects.`]})}),`\n`,_jsxs(_components.p,{children:[`If you use an ESM project and can’t pass CLI flags (for example, due to constraints in CLI tools or frameworks), set the `,_jsx(_components.code,{children:`NODE_OPTIONS`}),` environment variable:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`export`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` NODE_OPTIONS`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"--import=weave/instrument\"`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`bundler-compatibility`,children:`Bundler compatibility`}),`\n`,_jsx(_components.p,{children:`Some frameworks and bundlers, such as Next.js, may bundle third-party libraries in ways that prevent Node.js from patching them at runtime.`}),`\n`,_jsx(_components.p,{children:`If this describes your setup, try the following steps:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Mark LLM libraries as external in your bundler configuration. This prevents the bundler from bundling them, so Weave can patch them correctly at runtime.`}),`\n`,_jsxs(_components.p,{children:[`The following example shows how to mark the `,_jsx(_components.code,{children:`openai`}),` package as external in a `,_jsx(_components.code,{children:`next.config.js`}),` configuration, which prevents the bundler from bundling it. The module loads at runtime, so Weave can automatically patch and track it. Use this setup when you work with frameworks such as Next.js to enable auto-instrumentation.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#C8C8C8`},children:`externals`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'openai'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'commonjs openai'`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`If patching still fails, fall back to `,_jsx(_components.a,{href:`#manual-patching-fallback-option`,children:`manual instrumentation`}),`.`]}),`\n`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`manual-patching-fallback-option`,children:`Manual patching (fallback option)`}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`Manual patching is the legacy approach. Use it only when auto-patching doesn’t work.`})}),`\n`,_jsx(_components.p,{children:`Sometimes, you may still need to use manual instrumentation:`}),`\n`,_jsx(CodeBlock,{filename:``,lines:`true`,numberOfLines:`2`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus twoslash lsp`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:_jsxs(Popup,{className:`twoslash-hover`,children:[_jsx(PopupContent,{className:`twoslash-popup-container`,children:_jsx(_components.span,{className:`mint-twoslash-popover-pre`,children:_jsxs(_components.code,{className:`twoslash-popup-code shiki`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` wrapOpenAI`})]})})}),_jsx(PopupTrigger,{children:`wrapOpenAI`})]})}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`from`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'weave'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:_jsxs(Popup,{className:`twoslash-hover`,children:[_jsx(PopupContent,{className:`twoslash-popup-container`,children:_jsx(_components.span,{className:`mint-twoslash-popover-pre`,children:_jsxs(_components.code,{className:`twoslash-popup-code shiki`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` client`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` any`})]})})}),_jsx(PopupTrigger,{children:`client`})]})}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` `}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:_jsxs(Popup,{className:`twoslash-hover`,children:[_jsx(PopupContent,{className:`twoslash-popup-container`,children:_jsx(_components.span,{className:`mint-twoslash-popover-pre`,children:_jsxs(_components.code,{className:`twoslash-popup-code shiki`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` wrapOpenAI`})]})})}),_jsx(PopupTrigger,{children:`wrapOpenAI`})]})}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` `}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`OpenAI`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`());`})]}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"TypeScript SDK: third-party integration guide","description":"Integrate third-party libraries with the Weave TypeScript SDK","href":"/weave/guides/integrations/js"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Use Weave integrations with your TypeScript project","slug":"use-weave-integrations-with-your-typescript-project","depth":2,"children":[{"title":"If you’re unsure which type of project you have","slug":"if-you’re-unsure-which-type-of-project-you-have","depth":3,"children":[]},{"title":"Set up a CommonJS project","slug":"set-up-a-commonjs-project","depth":3,"children":[]},{"title":"Set up an ESM project","slug":"set-up-an-esm-project","depth":3,"children":[]}]},{"title":"Advanced usage and troubleshooting","slug":"advanced-usage-and-troubleshooting","depth":2,"children":[{"title":"Use NODE_OPTIONS (only for ESM)","slug":"use-node_options-only-for-esm","depth":3,"children":[]},{"title":"Bundler compatibility","slug":"bundler-compatibility","depth":3,"children":[]},{"title":"Manual patching (fallback option)","slug":"manual-patching-fallback-option","depth":3,"children":[]}]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/wb-21fd5541/62b2917cd8d8869b/analytics.js","/_mintlify/custom/wb-21fd5541/1d706ba09a39aeb0/local-links-same-tab.js","/_mintlify/custom/wb-21fd5541/b496d1b047524c5a/dropdown-tabs-navigate.js","/_mintlify/custom/wb-21fd5541/ca910ce06377c00d/code-group-language-persist.js","/_mintlify/custom/wb-21fd5541/6e7fd8bf6d924ed7/kapa-widget.js"],"subdomain":"wb-21fd5541","siteName":"Weights \u0026 Biases Documentation","title":"TypeScript SDK: third-party integration guide - Weights \u0026 Biases Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{"en":{"href":"/weave/guides/integrations/js","matchLevel":0},"fr":{"href":"/fr/weave/guides/integrations/js","matchLevel":1},"ja":{"href":"/ja/weave/guides/integrations/js","matchLevel":1},"ko":{"href":"/ko/weave/guides/integrations/js","matchLevel":1}}},"lastModified":"2026-06-15T14:15:23.086Z","originalFileLocation":"weave/guides/integrations/js.mdx","locale":"en"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Integrate third-party libraries with the Weave TypeScript SDK\">\u003cmeta data-mint-head name=\"application-name\" content=\"Weights \u0026amp; Biases Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/wb-21fd5541/5Z9xPfvPzDMWig23/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/wb-21fd5541/5Z9xPfvPzDMWig23/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/wb-21fd5541/5Z9xPfvPzDMWig23/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/wb-21fd5541/5Z9xPfvPzDMWig23/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/wb-21fd5541/5Z9xPfvPzDMWig23/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/wb-21fd5541/5Z9xPfvPzDMWig23/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/wb-21fd5541/5Z9xPfvPzDMWig23/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/wb-21fd5541/5Z9xPfvPzDMWig23/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/wb-21fd5541/5Z9xPfvPzDMWig23/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"TypeScript SDK: third-party integration guide - Weights \u0026amp; Biases Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Integrate third-party libraries with the Weave TypeScript SDK\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Weights \u0026amp; Biases Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.wandb.ai/weave/guides/integrations/js\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://wb-21fd5541.mintlify.site/_mintlify/api/og/v2?division=Integrate+with+your+LLM+provider+and+frameworks\u0026amp;title=TypeScript+SDK%3A+third-party+integration+guide\u0026amp;description=Integrate+third-party+libraries+with+the+Weave+TypeScript+SDK\u0026amp;theme=b2b0182ac5551ece3d862622\u0026amp;signature=19238a8fba90ce0709e122497906c27f5e281db99bd7fe74c2cce63af3b7a4d5\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"TypeScript SDK: third-party integration guide - Weights \u0026amp; Biases Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Integrate third-party libraries with the Weave TypeScript SDK\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://wb-21fd5541.mintlify.site/_mintlify/api/og/v2?division=Integrate+with+your+LLM+provider+and+frameworks\u0026amp;title=TypeScript+SDK%3A+third-party+integration+guide\u0026amp;description=Integrate+third-party+libraries+with+the+Weave+TypeScript+SDK\u0026amp;theme=b2b0182ac5551ece3d862622\u0026amp;signature=19238a8fba90ce0709e122497906c27f5e281db99bd7fe74c2cce63af3b7a4d5\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/wb-21fd5541/5Z9xPfvPzDMWig23/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Weights \u0026amp; Biases Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#FCBC32\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.wandb.ai/weave/guides/integrations/js\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/weave/guides/integrations/js.md\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"en\" href=\"https://docs.wandb.ai/weave/guides/integrations/js\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"fr\" href=\"https://docs.wandb.ai/fr/weave/guides/integrations/js\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"ja\" href=\"https://docs.wandb.ai/ja/weave/guides/integrations/js\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"ko\" href=\"https://docs.wandb.ai/ko/weave/guides/integrations/js\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"x-default\" href=\"https://docs.wandb.ai/weave/guides/integrations/js\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.wandb.ai/#organization\",\"name\":\"Weights \u0026 Biases Documentation\",\"url\":\"https://docs.wandb.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/wb-21fd5541/C7PMWo9Jl9GZ2Zki/icons/Endorsed_primary_blackwhite.svg?fit=max\u0026auto=format\u0026n=C7PMWo9Jl9GZ2Zki\u0026q=85\u0026s=a9d999235518399090dd8ddd0a9e1e4a\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.wandb.ai#website\",\"name\":\"Weights \u0026 Biases Documentation\",\"url\":\"https://docs.wandb.ai\",\"publisher\":{\"@id\":\"https://docs.wandb.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.wandb.ai/weave/guides/integrations/js#webpage\",\"url\":\"https://docs.wandb.ai/weave/guides/integrations/js\",\"name\":\"TypeScript SDK: third-party integration guide\",\"description\":\"Integrate third-party libraries with the Weave TypeScript SDK\",\"dateModified\":\"2026-06-15T14:15:23.086Z\",\"isPartOf\":{\"@id\":\"https://docs.wandb.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.wandb.ai/weave/guides/integrations/js#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.wandb.ai/weave/guides/integrations/js#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Guides\",\"item\":\"https://docs.wandb.ai/weave/concepts/what-is-weave\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Trace functions with Ops and Calls\",\"item\":\"https://docs.wandb.ai/weave/guides/integrations\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Integrate with your LLM provider and frameworks\",\"item\":\"https://docs.wandb.ai/weave/guides/integrations\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"TypeScript SDK: third-party integration guide\",\"item\":\"https://docs.wandb.ai/weave/guides/integrations/js\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.wandb.ai/weave/guides/integrations/js#article\",\"headline\":\"TypeScript SDK: third-party integration guide\",\"name\":\"TypeScript SDK: third-party integration guide\",\"description\":\"Integrate third-party libraries with the Weave TypeScript SDK\",\"url\":\"https://docs.wandb.ai/weave/guides/integrations/js\",\"mainEntityOfPage\":{\"@id\":\"https://docs.wandb.ai/weave/guides/integrations/js#webpage\"},\"dateModified\":\"2026-06-15T14:15:23.086Z\",\"publisher\":{\"@id\":\"https://docs.wandb.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.wandb.ai#website\"}}]}\u003c/script>","agentPointerHref":"/weave/guides/integrations/js.md","siteName":"Weights \u0026 Biases Documentation","nav":{"global":null,"languages":[{"language":"en","tabs":[{"tab":"Products","menu":[{"item":"Docs Home","pages":[{"title":"Docs Home","href":""}]},{"item":"W\u0026B Models","pages":[{"title":"W\u0026B Models","href":"/models"}]},{"item":"W\u0026B Weave","pages":[{"title":"W\u0026B Weave","mode":"wide","href":"/weave"},{"group":"Get Started","pages":[{"title":"Choose an agent integration","href":"/weave/agent-integration-quickstart"},{"title":"Quickstart: Set up custom agent observability","href":"/weave/custom-agents-quickstart"},{"title":"Evaluate your AI agent with Weave","href":"/weave/agent-evals"},{"title":"Send OpenTelemetry spans to the Agents view","href":"/weave/guides/tracking/trace-agents-otel"},{"title":"Quickstart: Instrument and trace functions","mode":"wide","href":"/weave/quickstart"}]},{"group":"Guides","pages":[{"title":"What is Weave?","href":"/weave/concepts/what-is-weave"},{"group":"Trace your agents","pages":[{"group":"Integrate Weave with agents","pages":[{"title":"Google ADK","href":"/weave/guides/integrations/agents/google-adk"},{"title":"OpenAI Agents SDK","href":"/weave/guides/integrations/agents/openai-agents-sdk"},{"title":"Claude Agent SDK","href":"/weave/guides/integrations/agents/claude-agents-sdk"},{"title":"Claude Code plugin","href":"/weave/guides/integrations/agents/claude-code-harness"},{"title":"Codex plugin","href":"/weave/guides/integrations/agents/codex-harness"},{"title":"OpenClaw plugin","href":"/weave/guides/integrations/agents/openclaw-harness"},{"title":"Pi extension","href":"/weave/guides/integrations/agents/pi-dev-harness"}]},{"title":"Trace your agents","href":"/weave/guides/tracking/trace-agents"},{"title":"Send OpenTelemetry spans to the Agents view","href":"/weave/guides/tracking/trace-agents-otel"},{"title":"View agent activity","href":"/weave/guides/tracking/view-agent-activity"},{"title":"Monitor your agents with signals","href":"/weave/guides/tracking/view-agent-signals"},{"title":"Create a custom signal","href":"/weave/guides/tracking/create-custom-signal"},{"title":"Score agent turns with a remote scorer","href":"/weave/guides/tracking/remote-scorer-signals"},{"title":"Set attributes and events on agent spans","href":"/weave/guides/tracking/trace-agents-attributes"},{"title":"Batch logging for your agent","href":"/weave/guides/tracking/trace-agents-batch"},{"title":"Trace sub-agents","href":"/weave/guides/tracking/trace-sub-agents"},{"title":"Reference media in your own bucket (BYOB) using agent spans","sidebarTitle":"Reference media in your own bucket","href":"/weave/guides/tracking/agents-byob-references"}]},{"group":"Trace functions with Ops and Calls","pages":[{"group":"Integrate with your LLM provider and frameworks","pages":[{"title":"Integrations overview","href":"/weave/guides/integrations"},{"title":"Control automatic LLM call tracking","description":"Control how W\u0026B Weave automatically records calls to OpenAI, Anthropic, and other LLM libraries","href":"/weave/guides/integrations/autopatching"},{"title":"TypeScript SDK: third-party integration guide","href":"/weave/guides/integrations/js"},{"group":"LLM Providers","pages":[{"title":"Serverless Inference","description":"Use Serverless Inference with Weave to trace and monitor open source foundation model calls through the OpenAI-compatible API.","href":"/weave/guides/integrations/inference"},{"title":"Bedrock","href":"/weave/guides/integrations/bedrock"},{"title":"Anthropic","href":"/weave/guides/integrations/anthropic"},{"title":"Cerebras","href":"/weave/guides/integrations/cerebras"},{"title":"Cohere","href":"/weave/guides/integrations/cohere"},{"title":"Google","href":"/weave/guides/integrations/google"},{"title":"Groq","href":"/weave/guides/integrations/groq"},{"title":"Hugging Face Hub","href":"/weave/guides/integrations/huggingface"},{"title":"LiteLLM","href":"/weave/guides/integrations/litellm"},{"title":"Microsoft Azure","href":"/weave/guides/integrations/azure"},{"title":"MistralAI","href":"/weave/guides/integrations/mistral"},{"title":"Neon AI Gateway","href":"/weave/guides/integrations/neon"},{"title":"NVIDIA NIM","href":"/weave/guides/integrations/nvidia_nim"},{"title":"OpenAI","href":"/weave/guides/integrations/openai"},{"title":"OpenRouter","href":"/weave/guides/integrations/openrouter"},{"title":"Together AI","href":"/weave/guides/integrations/together_ai"}]},{"group":"Frameworks","pages":[{"title":"OpenAI Realtime API","href":"/weave/guides/integrations/openai-realtime-audio"},{"title":"Bedrock Agents","href":"/weave/guides/integrations/bedrock_agents"},{"title":"LangChain","href":"/weave/guides/integrations/langchain"},{"title":"LlamaIndex","href":"/weave/guides/integrations/llamaindex"},{"title":"DSPy","href":"/weave/guides/integrations/dspy"},{"title":"Instructor","href":"/weave/guides/integrations/instructor"},{"title":"CrewAI","href":"/weave/guides/integrations/crewai"},{"title":"Smolagents","href":"/weave/guides/integrations/smolagents"},{"title":"PydanticAI","href":"/weave/guides/integrations/pydantic_ai"},{"title":"Vercel AI SDK","href":"/weave/guides/integrations/vercel_ai_sdk"},{"title":"Haystack","href":"/weave/guides/integrations/haystack"},{"title":"Agno","href":"/weave/guides/integrations/agno"},{"title":"Koog","href":"/weave/guides/integrations/koog"},{"title":"AutoGen","href":"/weave/guides/integrations/autogen"},{"title":"Verdict","href":"/weave/guides/integrations/verdict"},{"title":"Verifiers","href":"/weave/guides/integrations/verifiers"},{"title":"VERL","href":"/weave/guides/integrations/verl"}]},{"group":"Protocols","pages":[{"title":"Model Context Protocol (MCP) and Weave","href":"/weave/guides/integrations/mcp"},{"title":"Send OpenTelemetry Traces to Weave","href":"/weave/guides/tracking/otel"}]},{"title":"Local Models","href":"/weave/guides/integrations/local_models"}]},{"group":"Tracing basics","pages":[{"title":"Quickstart: Instrument and trace functions","mode":"wide","href":"/weave/quickstart"},{"title":"Understand Ops, Calls, and Traces","href":"/weave/guides/tracking/tracing"},{"title":"Trace your code","href":"/weave/guides/tracking/create-call"},{"title":"Navigate the Weave Trace view","href":"/weave/guides/tracking/trace-tree"},{"title":"Compare traces and other logged information","href":"/weave/guides/tools/comparison"},{"title":"Query and export Calls","href":"/weave/guides/tracking/querying-calls"}]},{"group":"Advanced Ops","pages":[{"title":"Trace generator functions","href":"/weave/guides/tracking/trace-generator-func"},{"title":"Trace nested functions","href":"/weave/tutorial-tracing_2"},{"title":"Trace threads","href":"/weave/guides/tracking/threads"},{"title":"Customize Ops","href":"/weave/guides/tracking/ops"},{"title":"Define and log attributes","href":"/weave/guides/tools/attributes"},{"title":"Log media","href":"/weave/guides/core-types/media"},{"title":"Reference media in your own bucket (BYOB) using Weave Op","sidebarTitle":"Reference media in your own bucket","href":"/weave/guides/tracking/byob-references"},{"title":"View and customize trace display","href":"/weave/guides/tracking/view-call"},{"title":"Disable tracing","href":"/weave/guides/tracking/trace-disable"},{"title":"Write-ahead log","href":"/weave/guides/tracking/write-ahead-log"}]},{"group":"Work with Calls","pages":[{"title":"Update and delete Calls","href":"/weave/guides/tracking/update-call"},{"title":"Call schema reference","href":"/weave/guides/tracking/call-schema-reference"},{"title":"Get a handle to the Call object during execution","href":"/weave/guides/tracking/get-call-object"},{"title":"Set Call display name","href":"/weave/guides/tracking/set-call-display"}]},{"title":"Track costs","href":"/weave/guides/tracking/costs"},{"title":"Create and manage saved views","href":"/weave/guides/tools/saved-views"},{"title":"Use trace plots","href":"/weave/guides/tracking/trace-plots"},{"title":"Link a W\u0026B run to trace function calls","href":"/weave/guides/tracking/trace-to-run"},{"title":"Use Weave with W\u0026B training runs","href":"/weave/guides/tools/weave-in-workspaces"}]},{"group":"Evaluate your agents and functions","pages":[{"title":"Evaluations overview","href":"/weave/guides/core-types/evaluations"},{"title":"Build an evaluation","href":"/weave/tutorial-eval"},{"title":"Evaluate RAG applications","href":"/weave/tutorial-rag"},{"title":"Collect and track datasets","href":"/weave/guides/core-types/datasets"},{"title":"Scoring overview","href":"/weave/guides/evaluation/scorers"},{"title":"Use builtin scorers","href":"/weave/guides/evaluation/builtin_scorers"},{"title":"Evaluate using local scorers","href":"/weave/guides/evaluation/weave_local_scorers"},{"title":"Log evaluation data from your code","href":"/weave/guides/evaluation/evaluation_logger"},{"title":"Export evaluation data","href":"/weave/guides/evaluation/export_eval"},{"title":"Compare evaluations","href":"/weave/guides/evaluation/compare_evals"},{"title":"Compare and rank models","href":"/weave/guides/core-types/leaderboards"},{"title":"Map columns in datasets","href":"/weave/guides/tools/column-mapping"},{"title":"Create dynamic Leaderboards in Evaluations","href":"/weave/guides/evaluation/dynamic_leaderboards"}]},{"group":"Experiment with prompts and models","pages":[{"title":"Use the Playground to experiment with prompts","href":"/weave/guides/tools/playground"},{"title":"Compare model performance using the Evaluation Playground","href":"/weave/guides/tools/evaluation_playground"},{"title":"Add custom runtimes","href":"/weave/guides/tools/custom-runtimes"},{"title":"Learn Weave with Serverless Inference","href":"/weave/quickstart-inference"}]},{"group":"Version your work","pages":[{"title":"Tutorial: App versioning","href":"/weave/tutorial-weave_models"},{"title":"Track application versions with models","href":"/weave/guides/core-types/models"},{"title":"Create prompt objects","href":"/weave/guides/core-types/prompts"},{"title":"Store and track versions of prompts","href":"/weave/guides/core-types/prompts-version"},{"title":"Track and version objects","href":"/weave/guides/tracking/objects"}]},{"group":"Monitor and collect feedback","pages":[{"group":"Annotate","pages":[{"title":"Set up annotation queues","href":"/weave/guides/tracking/annotation-queues"},{"title":"Review items in an annotation queue","href":"/weave/guides/tracking/annotation-review"},{"title":"Collect feedback and use annotations","href":"/weave/guides/tracking/feedback"}]},{"title":"Redact PII from traces","href":"/weave/guides/tracking/redact-pii"},{"title":"Monitor using built-in signals","href":"/weave/guides/evaluation/monitors"},{"title":"Set up custom monitors","href":"/weave/guides/evaluation/custom-monitors"},{"title":"Score Calls with remote scorers","href":"/weave/guides/evaluation/remote-scorers"},{"title":"Set up automations","href":"/weave/guides/evaluation/automations"},{"title":"Set up guardrails","href":"/weave/guides/evaluation/guardrails"}]},{"group":"Deploy and scale","pages":[{"title":"Deployment options and security features","href":"/weave/guides/platform"},{"title":"Set up a self-managed W\u0026B Weave instance","href":"/weave/guides/platform/weave-self-managed"},{"title":"Configure ingest sampling for Weave Self-Managed","href":"/weave/guides/platform/ingest-sampling"},{"title":"Server response caching","href":"/weave/guides/platform/server-caching"}]},{"title":"Manage Weave projects","href":"/weave/guides/platform/weave-projects"},{"title":"Configure Weave environment variables","href":"/weave/guides/core-types/env-vars"}]},{"group":"Cookbooks","pages":[{"title":"Overview","mode":"wide","href":"/weave/cookbooks"},{"group":"Weave fundamentals","pages":[{"title":"Introduction to Traces","href":"/weave/cookbooks/Intro_to_Weave_Hello_Trace"},{"title":"Introduction to Evaluations","href":"/weave/cookbooks/Intro_to_Weave_Hello_Eval"}]},{"group":"Evaluations \u0026 Datasets","pages":[{"title":"Leaderboard Quickstart","href":"/weave/cookbooks/leaderboard_quickstart"},{"title":"HuggingFace Dataset Evaluations","href":"/weave/cookbooks/hf_dataset_evals"},{"title":"Import from CSV","href":"/weave/cookbooks/import_from_csv"}]},{"group":"Models \u0026 Prompts","pages":[{"title":"Use Weave with W\u0026B Models","href":"/weave/cookbooks/Models_and_Weave_Integration_Demo"},{"title":"Chain Of Density","href":"/weave/cookbooks/chain_of_density"},{"title":"DSPy Prompt Optimization","href":"/weave/cookbooks/dspy_prompt_optimization"},{"title":"Not Diamond custom routing","href":"/weave/cookbooks/notdiamond_custom_routing"}]},{"group":"Advanced Topics","pages":[{"title":"Multi-agent structured output","href":"/weave/cookbooks/multi-agent-structured-output"},{"title":"Codegen","href":"/weave/cookbooks/codegen"},{"title":"Trace and Evaluate a Computer Vision Pipeline with Weave","href":"/weave/cookbooks/ocr-pipeline"},{"title":"Audio with Weave","href":"/weave/cookbooks/audio_with_weave"}]},{"group":"Production \u0026 Monitoring","pages":[{"title":"Online Monitoring","href":"/weave/cookbooks/online_monitoring"},{"title":"Feedback Prod","href":"/weave/cookbooks/feedback_prod"},{"title":"Scorers as guardrails","href":"/weave/cookbooks/scorers_as_guardrails"},{"title":"Custom Model Cost","href":"/weave/cookbooks/custom_model_cost"},{"title":"PII Data Handling","href":"/weave/cookbooks/pii"}]}]},{"group":"Reference","pages":[{"title":"Python SDK","url":"/weave/reference/python-sdk","href":"/weave/ref-link-python"},{"title":"TypeScript SDK","url":"/weave/reference/typescript-sdk","href":"/weave/ref-link-typescript"},{"title":"Service API","url":"/weave/reference/service-api","href":"/weave/ref-link-service-api"}]},{"group":"Details \u0026 Support","pages":[{"title":"Limits and expected behaviors","href":"/weave/details/limits"},{"title":"Support: Weave","url":"/support/weave","href":"/weave/details/support-weave"}]}]},{"item":"Serverless Inference","pages":[{"title":"Serverless Inference","href":"/inference"}]},{"item":"Serverless Training","pages":[{"title":"Serverless Training","href":"/serverless-training"}]},{"item":"Serverless Sandboxes","pages":[{"title":"Serverless Sandboxes","href":"/sandboxes"}]}]},{"tab":"Get Started","pages":[{"title":"Get Started","href":"/get-started"}]},{"tab":"Reference","pages":[{"title":"Reference","href":"/reference"}]},{"tab":"Release Notes","pages":[{"title":"Release Notes","href":"/release-notes"}]},{"tab":"Support","menu":[{"item":"Support Home","pages":[{"title":"Support Home","href":"/support"}]},{"item":"W\u0026B Models","pages":[{"title":"W\u0026B Models","href":"/support/models"}]},{"item":"W\u0026B Weave","pages":[{"title":"W\u0026B Weave","href":"/support/weave"}]},{"item":"Serverless Inference","pages":[{"title":"Serverless Inference","href":"/support/inference"}]}],"pages":[{"title":"Support","href":"/support"}]},{"tab":"W\u0026B Launch","hidden":true,"pages":[{"title":"W\u0026B Launch","href":"/platform/launch"}]},{"tab":"Support: W\u0026B Models","hidden":true,"pages":[{"title":"Support: W\u0026B Models","href":"/support/models"}]},{"tab":"Support: W\u0026B Weave","hidden":true,"pages":[{"title":"Support: W\u0026B Weave","href":"/support/weave"}]},{"tab":"Support: W\u0026B Inference","hidden":true,"pages":[{"title":"Support: W\u0026B Inference","href":"/support/inference"}]}]},{"language":"fr","pages":[{"title":"fr","href":"/fr/weave/guides/integrations/js"}]},{"language":"ja","pages":[{"title":"ja","href":"/ja/weave/guides/integrations/js"}]},{"language":"ko","pages":[{"title":"ko","href":"/ko/weave/guides/integrations/js"}]}]},"basePath":"","title":"TypeScript SDK: third-party integration guide - Weights \u0026 Biases Documentation","deploymentId":"dpl_Em2U4NQQ2N2DE3HPbPUJVZLnAtvc","buildId":"dpl_Em2U4NQQ2N2DE3HPbPUJVZLnAtvc","dynamics":["10e4515597"],"chunks":["BannerMarkdown-CVKwuln2.js","dist-CXMB3QQU.js","lib-DMeTj1gb.js","lib-B8HbPgcC.js","katex-Dbtb6Wk7.js","html-void-elements-mCSPHezU.js","marked.esm-CZWythHk.js"]}