diff --git a/langchain/package.json b/langchain/package.json index 7fa98d21ce8c..641cb9980e49 100644 --- a/langchain/package.json +++ b/langchain/package.json @@ -941,8 +941,7 @@ "js-tiktoken": "^1.0.12", "js-yaml": "^4.1.0", "jsonpointer": "^5.0.1", - "langchainhub": "~0.0.8", - "langsmith": "~0.1.30", + "langsmith": "~0.1.40", "ml-distance": "^4.0.0", "openapi-types": "^12.1.3", "p-retry": "4", diff --git a/langchain/src/hub.ts b/langchain/src/hub.ts index ac2f958b08a6..53abe8e8c1fc 100644 --- a/langchain/src/hub.ts +++ b/langchain/src/hub.ts @@ -1,4 +1,4 @@ -import { Client, ClientConfiguration, HubPushOptions } from "langchainhub"; +import { Client } from "langsmith"; import { Runnable } from "@langchain/core/runnables"; import { load } from "./load/index.js"; @@ -13,10 +13,30 @@ import { load } from "./load/index.js"; export async function push( repoFullName: string, runnable: Runnable, - options?: HubPushOptions & ClientConfiguration + options?: { + apiKey?: string; + apiUrl?: string; + parentCommitHash?: string; + /** @deprecated Use isPublic instead. */ + newRepoIsPublic?: boolean; + isPublic?: boolean; + /** @deprecated Use description instead. */ + newRepoDescription?: string; + description?: string; + readme?: string; + tags?: string[]; + } ) { const client = new Client(options); - return client.push(repoFullName, JSON.stringify(runnable), options); + const payloadOptions = { + object: runnable, + parentCommitHash: options?.parentCommitHash, + isPublic: options?.isPublic ?? options?.newRepoIsPublic, + description: options?.description ?? options?.newRepoDescription, + readme: options?.readme, + tags: options?.tags, + }; + return client.pushPrompt(repoFullName, payloadOptions); } /** @@ -27,9 +47,11 @@ export async function push( */ export async function pull( ownerRepoCommit: string, - options?: ClientConfiguration + options?: { apiKey?: string; apiUrl?: string; includeModel?: boolean } ) { const client = new Client(options); - const result = await client.pull(ownerRepoCommit); + const result = await client._pullPrompt(ownerRepoCommit, { + includeModel: options?.includeModel, + }); return load(result); } diff --git a/yarn.lock b/yarn.lock index f2c95da3ec90..905737d53470 100644 --- a/yarn.lock +++ b/yarn.lock @@ -31545,8 +31545,7 @@ __metadata: js-yaml: ^4.1.0 jsdom: ^22.1.0 jsonpointer: ^5.0.1 - langchainhub: ~0.0.8 - langsmith: ~0.1.30 + langsmith: ~0.1.40 mammoth: ^1.5.1 ml-distance: ^4.0.0 mongodb: ^5.2.0 @@ -31809,6 +31808,31 @@ __metadata: languageName: node linkType: hard +"langsmith@npm:~0.1.40": + version: 0.1.40 + resolution: "langsmith@npm:0.1.40" + dependencies: + "@types/uuid": ^9.0.1 + commander: ^10.0.1 + p-queue: ^6.6.2 + p-retry: 4 + semver: ^7.6.3 + uuid: ^9.0.0 + peerDependencies: + "@langchain/core": "*" + langchain: "*" + openai: "*" + peerDependenciesMeta: + "@langchain/core": + optional: true + langchain: + optional: true + openai: + optional: true + checksum: 8c5bcf5137e93a9a17203fbe21d6a61f45c98fccafc2040d56e9cc15a4ee432456d986adf0e590d8c436b72d18143053ce6e65f021115f1596dd4519ec2805d7 + languageName: node + linkType: hard + "language-subtag-registry@npm:^0.3.20, language-subtag-registry@npm:~0.3.2": version: 0.3.22 resolution: "language-subtag-registry@npm:0.3.22"