[PR #1718] docs: Update customer_support_small_model example to use non-deprecated methods and add type annotations #1676

Open
opened 2026-02-15 20:16:29 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langgraphjs/pull/1718
Author: @jet-isnt-haha
Created: 10/2/2025
Status: 🔄 Open

Base: mainHead: docs/update-customer-support-example


📝 Commits (1)

  • ee8ee41 docs: Update customer_support_small_model example to use non-deprecated methods

📊 Changes

1 file changed (+3 additions, -3 deletions)

View changed files

📝 examples/chatbots/customer_support_small_model.ipynb (+3 -3)

📄 Description

Description

Updated the customer_support_small_model.ipynb example to use non-deprecated API methods and improve TypeScript type safety.

Changes

1. Replace deprecated _getType() method

  • Before: if (trimmedHistory.at(-1)._getType() === "ai")
  • After: if (trimmedHistory[trimmedHistory.length - 1].getType() === "ai")
  • The _getType() method signature is deprecated and should be replaced with getType()
  • Also replaced .at(-1) with [trimmedHistory.length - 1] to fix TypeScript "possibly undefined" error (ts(2532))

2. Add missing type annotation

  • Location: addConditionalEdges callback in billing_support node
  • Added: async (state: typeof StateAnnotation.State) => type annotation
  • Ensures consistency with other conditional edge definitions in the example

Type of Change

  • Documentation update
  • Bug fix (non-breaking change which fixes TypeScript errors)

Testing

  • Verified code changes compile without TypeScript errors
  • Confirmed deprecated method warnings are resolved

Motivation

This PR addresses two issues in the example notebook:

  1. API Deprecation: The _getType() method is deprecated and should be replaced with the public getType() API
  2. TypeScript Safety: Adding explicit type annotations and using safer array access patterns improves type safety and prevents potential runtime errors

🔄 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/langgraphjs/pull/1718 **Author:** [@jet-isnt-haha](https://github.com/jet-isnt-haha) **Created:** 10/2/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `docs/update-customer-support-example` --- ### 📝 Commits (1) - [`ee8ee41`](https://github.com/langchain-ai/langgraphjs/commit/ee8ee418aed7ff31385ee212c2af3a5846590285) docs: Update customer_support_small_model example to use non-deprecated methods ### 📊 Changes **1 file changed** (+3 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `examples/chatbots/customer_support_small_model.ipynb` (+3 -3) </details> ### 📄 Description ## Description Updated the `customer_support_small_model.ipynb` example to use non-deprecated API methods and improve TypeScript type safety. ## Changes ### 1. Replace deprecated `_getType()` method - **Before**: `if (trimmedHistory.at(-1)._getType() === "ai")` - **After**: `if (trimmedHistory[trimmedHistory.length - 1].getType() === "ai")` - The `_getType()` method signature is deprecated and should be replaced with `getType()` - Also replaced `.at(-1)` with `[trimmedHistory.length - 1]` to fix TypeScript "possibly undefined" error (ts(2532)) ### 2. Add missing type annotation - **Location**: `addConditionalEdges` callback in `billing_support` node - **Added**: `async (state: typeof StateAnnotation.State) =>` type annotation - Ensures consistency with other conditional edge definitions in the example ## Type of Change - [x] Documentation update - [x] Bug fix (non-breaking change which fixes TypeScript errors) ## Testing - Verified code changes compile without TypeScript errors - Confirmed deprecated method warnings are resolved ## Motivation This PR addresses two issues in the example notebook: 1. **API Deprecation**: The `_getType()` method is deprecated and should be replaced with the public `getType()` API 2. **TypeScript Safety**: Adding explicit type annotations and using safer array access patterns improves type safety and prevents potential runtime errors --- <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-02-15 20:16:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#1676