Skip to content

Upgrades langchain package to latest versions.#41

Open
Balki-OriginTrail wants to merge 2 commits intomainfrom
fix-upgrade_langchain_packages
Open

Upgrades langchain package to latest versions.#41
Balki-OriginTrail wants to merge 2 commits intomainfrom
fix-upgrade_langchain_packages

Conversation

@Balki-OriginTrail
Copy link

Cursor also always runs linting which is why we have so many changed files....-.-

…s linting which is why we have so many changed files....-.-
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This PR is mostly formatting and documentation churn, but it also includes a major LangChain dependency migration and a chat content parsing change. There is a blocker in the chat renderer path: an unsafe cast can pass object-shaped image payloads as string URIs and break image rendering at runtime. Maintainability in the touched parsing logic is slightly worsened because type assertions are used instead of explicit normalization/guards. Aside from that, the rest of the code diffs are largely cosmetic.

for (const c of toContents(m.content)) {
if (c.type === "image_url") {
images.push({ uri: c.image_url });
images.push({ uri: c.image_url as string });
Copy link

Choose a reason for hiding this comment

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

🔴 Bug: c.image_url as string can pass an object payload through as uri at runtime (e.g. { url: ... }), which breaks image rendering. Normalize explicitly (typeof c.image_url === 'string' ? c.image_url : c.image_url?.url) and only push when a string URL exists; same unsafe-cast pattern appears at line 663 for c.text.

"@langchain/mistralai": "^0.2.1",
"@langchain/openai": "^0.6.3",
"@langchain/xai": "^0.1.0",
"@langchain/anthropic": "^1.3.22",
Copy link

Choose a reason for hiding this comment

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

🟡 Issue: This upgrades LangChain packages across major versions, but the PR does not add regression coverage for the changed content-shape handling in chat parsing. Add tests for both string/object image_url blocks and non-string/missing text fields so migration regressions are caught.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This PR is largely formatting and documentation churn, plus a significant LangChain dependency upgrade in apps/agent. I found one blocker in the chat rendering path: image content parsing now drops one valid image_url shape, which can remove images from messages. Maintainability in the touched chat parsing area is slightly worsened because it now diverges from existing message-content handling logic for the same content type.


for (const c of toContents(m.content)) {
if (c.type === "image_url") {
if (c.type === "image_url" && typeof c.image_url === "string") {
Copy link

Choose a reason for hiding this comment

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

🔴 Bug: This now only handles image_url when it is a string, but LangChain message blocks can also provide image_url as an object ({ url: ... }), so those images are silently dropped. Normalize both shapes (e.g. string or c.image_url?.url) before pushing to images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant