Skip to content

Conversation

christian-bromann
Copy link
Member

Small update on code example in JS for OpenAI custom tools.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the JavaScript code examples for OpenAI custom tools integration by updating imports, function signatures, and API usage to match current LangChain patterns.

Key changes:

  • Updated imports from deprecated @langchain/classic to langchain
  • Modified agent creation and invocation patterns to use current API
  • Fixed custom tool function signatures and grammar format specifications

const codeTool = customTool(
async (input) => {
async () => {
// ... Add code to execute the input
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

The custom tool function signature has been changed to remove the input parameter, but the comment on line 299 still references using the input. Either the parameter should be restored or the comment should be updated to match the new signature.

Suggested change
// ... Add code to execute the input
// ... Add code to execute

Copilot uses AI. Check for mistakes.


const doMath = customTool(
async (input) => {
async () => {
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

Similar to the first example, this custom tool function removes the input parameter but the comment on line 346 mentions parsing and executing the input. The function signature and comment are inconsistent.

Suggested change
async () => {
async (input) => {

Copilot uses AI. Check for mistakes.

@github-actions
Copy link
Contributor

Preview ID generated: preview-cbopen-1760532529-d100313

@lnhsingh lnhsingh merged commit 1df8583 into main Oct 22, 2025
11 checks passed
@lnhsingh lnhsingh deleted the cb/openai-custom-tools branch October 22, 2025 19:34
mdrxy pushed a commit to anjaliratnam-msft/docs that referenced this pull request Oct 22, 2025
…#908)

Small update on code example in JS for OpenAI custom tools.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript langchain For docs changes to LangChain oss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants