11import type { BaseLanguageModel } from "@langchain/core/language_models/base" ;
22import type { Runnable } from "@langchain/core/runnables" ;
33
4- import type { Client , ClientConfig } from "langsmith" ;
4+ import { Client } from "langsmith" ;
55import type { PromptCommit } from "langsmith/schemas" ;
66
77/**
@@ -25,7 +25,6 @@ export async function basePush(
2525 tags ?: string [ ] ;
2626 }
2727) : Promise < string > {
28- const Client = await loadLangSmith ( ) ;
2928 const client = new Client ( options ) ;
3029 const payloadOptions = {
3130 object : runnable ,
@@ -42,7 +41,6 @@ export async function basePull(
4241 ownerRepoCommit : string ,
4342 options ?: { apiKey ?: string ; apiUrl ?: string ; includeModel ?: boolean }
4443) : Promise < PromptCommit > {
45- const Client = await loadLangSmith ( ) ;
4644 const client = new Client ( options ) ;
4745
4846 const promptObject = await client . pullPromptCommit ( ownerRepoCommit , {
@@ -188,20 +186,3 @@ export function bindOutputSchema<T extends Runnable>(loadedSequence: T) {
188186 }
189187 return loadedSequence ;
190188}
191-
192- /**
193- * Dynamically load the LangSmith client.
194- * @returns The LangSmith client.
195- */
196- async function loadLangSmith ( ) : Promise < new ( config ?: ClientConfig ) => Client > {
197- try {
198- const { Client } = await import ( "langsmith" ) ;
199- return Client ;
200- } catch ( error ) {
201- // eslint-disable-next-line no-instanceof/no-instanceof
202- const errorMessage = error instanceof Error ? error . message : String ( error ) ;
203- throw new Error (
204- `Error loading "langsmith" package, install it via \`npm install langsmith\` before you use this function.\nError: ${ errorMessage } `
205- ) ;
206- }
207- }
0 commit comments