Skip to content

core[patch]: Update ai.ts #5099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 15, 2024
Merged

core[patch]: Update ai.ts #5099

merged 2 commits into from
Apr 15, 2024

Conversation

dwcarr
Copy link
Contributor

@dwcarr dwcarr commented Apr 14, 2024

In langchain-core/src/messages/ai.ts

The code currently only checks for undefined on rawToolCalls. However, the provider (deep-infra in this case) can return toolCalls=null, which passed the conditional but will then produce an error when rawToolCalls.length is accessed.

Changed the conditional to !(rawToolCalls == null) to address the issue, and verified that this fixed the issue.

Note that rawToolCalls == null is true if rawToolCalls is null OR undefined, thus handling both cases.

The code currently only checks for undefined on rawToolCalls.  However, the provider can return toolCalls=null, which passed the conditional but will then produce an error when rawToolCalls.length is accessed.
Copy link

vercel bot commented Apr 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 15, 2024 9:38pm
langchainjs-docs ✅ Ready (Inspect) Visit Preview Apr 15, 2024 9:38pm

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. auto:bug Related to a bug, vulnerability, unexpected error with an existing feature labels Apr 14, 2024
@jacoblee93 jacoblee93 changed the title Update ai.ts core[patch]: Update ai.ts Apr 15, 2024
@jacoblee93
Copy link
Collaborator

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature lgtm PRs that are ready to be merged as-is size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants