[PR #3328] [MERGED] fix: remove python cast() usage from code examples #3383

Closed
opened 2026-06-05 18:22:55 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/docs/pull/3328
Author: @npentrel
Created: 3/26/2026
Status: Merged
Merged: 3/26/2026
Merged by: @npentrel

Base: mainHead: open-swe/b74be038-e243-f023-2335-1f9e82b0f7cf


📝 Commits (2)

  • f42b6ff Remove Python cast() usage from documentation code examples
  • fedfccd update

📊 Changes

5 files changed (+6 additions, -15 deletions)

View changed files

📝 src/code-samples/langchain/long-term-memory-write-tool-inmemory.py (+1 -2)
📝 src/code-samples/langchain/long-term-memory-write-tool-postgres.py (+1 -4)
📝 src/langsmith/custom-store.mdx (+2 -3)
📝 src/snippets/code-samples/long-term-memory-write-tool-inmemory-py.mdx (+1 -2)
📝 src/snippets/code-samples/long-term-memory-write-tool-postgres-py.mdx (+1 -4)

📄 Description

Description

Removes all cast(type, ...) usage from Python code examples in the docs. Using cast is a code smell that suggests incorrect/incomplete types in OSS. Two patterns were fixed: cast(Embeddings, init_embeddings(...)) was simplified since init_embeddings already returns Embeddings in v1, and cast("dict[str, Any]", user_info) was replaced with dict(user_info) since TypedDict is already a dict at runtime.

Resolves DOC-913

Test Plan

  • Verify custom-store page renders correctly in preview deployment
  • Verify long-term memory code samples render correctly in preview deployment

Opened collaboratively by Naomi Pentrel and open-swe.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/docs/pull/3328 **Author:** [@npentrel](https://github.com/npentrel) **Created:** 3/26/2026 **Status:** ✅ Merged **Merged:** 3/26/2026 **Merged by:** [@npentrel](https://github.com/npentrel) **Base:** `main` ← **Head:** `open-swe/b74be038-e243-f023-2335-1f9e82b0f7cf` --- ### 📝 Commits (2) - [`f42b6ff`](https://github.com/langchain-ai/docs/commit/f42b6ff19a99e2f7a8a8bf6019e472a136de29ba) Remove Python cast() usage from documentation code examples - [`fedfccd`](https://github.com/langchain-ai/docs/commit/fedfccda2aec7cead457b38e1dd2a0617548f8f4) update ### 📊 Changes **5 files changed** (+6 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `src/code-samples/langchain/long-term-memory-write-tool-inmemory.py` (+1 -2) 📝 `src/code-samples/langchain/long-term-memory-write-tool-postgres.py` (+1 -4) 📝 `src/langsmith/custom-store.mdx` (+2 -3) 📝 `src/snippets/code-samples/long-term-memory-write-tool-inmemory-py.mdx` (+1 -2) 📝 `src/snippets/code-samples/long-term-memory-write-tool-postgres-py.mdx` (+1 -4) </details> ### 📄 Description ## Description Removes all `cast(type, ...)` usage from Python code examples in the docs. Using `cast` is a code smell that suggests incorrect/incomplete types in OSS. Two patterns were fixed: `cast(Embeddings, init_embeddings(...))` was simplified since `init_embeddings` already returns `Embeddings` in v1, and `cast("dict[str, Any]", user_info)` was replaced with `dict(user_info)` since `TypedDict` is already a dict at runtime. Resolves DOC-913 ## Test Plan - [ ] Verify custom-store page renders correctly in preview deployment - [ ] Verify long-term memory code samples render correctly in preview deployment _Opened collaboratively by Naomi Pentrel and open-swe._ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-05 18:22:55 -04:00
yindo closed this issue 2026-06-05 18:22:55 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#3383