Skip to content

Conversation

jet-isnt-haha
Copy link

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

Copy link

changeset-bot bot commented Oct 2, 2025

⚠️ No Changeset found

Latest commit: ee8ee41

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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