Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dependency_range_tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ services:
working_dir: /app
volumes:
- ../libs/langchain:/langchain
- ../libs/langchain-core:/libs/langchain-core
- ../libs/langchain-textsplitters:/libs/langchain-textsplitters
- ../libs/providers/langchain-openai:/libs/langchain-openai
- ../libs/providers/langchain-anthropic:/libs/langchain-anthropic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ const workspaceDependencies = [

for (const [depName, depVersion] of workspaceDependencies) {
/**
* for the peer dependency @langchain/core, we want to make sure to install max version
* defined above
* for the peer dependency @langchain/core, we will link to the workspace dependency
*/
if (depName === "@langchain/core") {
delete currentPackageJson.devDependencies[depName];
currentPackageJson.devDependencies[depName] = `file:/libs/langchain-core`;
continue;
}

Expand Down
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is just invalidating the point of dep tests. Fine to either disable for this pass, but I think the fix for the latest tests is to allow for pre-release versions if thats what's in dependencies (since we're just pnpm add @langchain/core'ing within the script)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, ideally we need to be able to push dev releases from branches and then adjust the peer dep in langchain.

Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,21 @@ if (
const minVersion = semver.minVersion(
currentPackageJson.peerDependencies["@langchain/core"]
).version;
currentPackageJson.peerDependencies = {
...currentPackageJson.peerDependencies,
"@langchain/core": minVersion,
};

// Check if the minimum version matches the workspace version
const corePackageJsonPath = "/libs/langchain-core/package.json";
const corePackageJson = JSON.parse(fs.readFileSync(corePackageJsonPath));

if (corePackageJson.version === minVersion) {
currentPackageJson.pnpm.overrides[
"@langchain/core"
] = `file:/libs/langchain-core`;
} else {
currentPackageJson.peerDependencies = {
...currentPackageJson.peerDependencies,
"@langchain/core": minVersion,
};
}
}

/**
Expand Down
11 changes: 8 additions & 3 deletions examples/src/createAgent/middleware/promptCaching.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { createAgent, HumanMessage, AIMessage } from "langchain";
import { anthropicPromptCachingMiddleware } from "langchain";
import {
createAgent,
HumanMessage,
AIMessage,
type AgentMiddleware,
} from "langchain";
import { promptCachingMiddleware } from "@langchain/anthropic";

// Example usage
const agent = createAgent({
model: "anthropic:claude-sonnet-4-20250514",
tools: [],
middleware: [anthropicPromptCachingMiddleware({ ttl: "5m" })] as const,
middleware: [promptCachingMiddleware({ ttl: "5m" }) as AgentMiddleware],
});

// Usage example with a long chat history for testing caching
Expand Down
4 changes: 2 additions & 2 deletions libs/langchain-classic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"lunary": "^0.8.8",
"mariadb": "^3.4.0",
"mem0ai": "^2.1.8",
"mongodb": "^6.17.0",
"mongodb": "^6.20.0",
"openai": "^5.1.0",
"peggy": "^3.0.2",
"pg": "^8.16.3",
Expand Down Expand Up @@ -1230,4 +1230,4 @@
},
"./package.json": "./package.json"
}
}
}
4 changes: 2 additions & 2 deletions libs/langchain-community/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
"mammoth": "^1.6.0",
"mariadb": "^3.4.0",
"mem0ai": "^2.1.8",
"mongodb": "^6.17.0",
"mongodb": "^6.20.0",
"mysql2": "^3.9.8",
"neo4j-driver": "^5.17.0",
"node-llama-cpp": "3.1.1",
Expand Down Expand Up @@ -3435,4 +3435,4 @@
"files": [
"dist/"
]
}
}
13 changes: 12 additions & 1 deletion libs/langchain-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,17 @@
},
"input": "./src/memory.ts"
},
"./middleware": {
"require": {
"types": "./dist/middleware/index.d.cts",
"default": "./dist/middleware/index.cjs"
},
"import": {
"types": "./dist/middleware/index.d.ts",
"default": "./dist/middleware/index.js"
},
"input": "./src/middleware/index.ts"
},
"./messages": {
"require": {
"types": "./dist/messages/index.d.cts",
Expand Down Expand Up @@ -720,4 +731,4 @@
"files": [
"dist/"
]
}
}
1 change: 1 addition & 0 deletions libs/langchain-core/src/load/import_map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export * as language_models__chat_models from "../language_models/chat_models.js
export * as language_models__llms from "../language_models/llms.js";
export * as load__serializable from "../load/serializable.js";
export * as memory from "../memory.js";
export * as middleware from "../middleware/index.js";
export * as messages from "../messages/index.js";
export * as messages__tool from "../messages/tool.js";
export * as output_parsers from "../output_parsers/index.js";
Expand Down
Loading
Loading