Skip to content

Using the WebBrowser tool with watsonx chat model throws an error #10040

@peterzaccha

Description

@peterzaccha

Checked other resources

  • This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
  • I added a very descriptive title to this issue.
  • I searched the LangChain.js documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain.js rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

Using the following code

export function getLangChainModel(model: string) {
  return new ChatWatsonx({
    version: "2024-03-14",
    serviceUrl: WATSONX_BASE_URL,
    projectId: WATSONX_PROJECT_ID,
    watsonxAIAuthType: "iam",
    watsonxAIApikey: WATSONX_API_KEY,
    model,
  });
}
export function getLangChainEmbeddingsModel(model: string) {
  return new WatsonxEmbeddings({
    version: "2024-03-14",
    serviceUrl: WATSONX_BASE_URL,
    projectId: WATSONX_PROJECT_ID,
    watsonxAIAuthType: "iam",
    watsonxAIApikey: WATSONX_API_KEY,
    model,
    truncateInputTokens: 512,
  });
}

const browser = new WebBrowser({
  model: getLangChainModel(DEFAULT_MODEL_ID),
  embeddings: getLangChainEmbeddingsModel(EMBEDDING_MODEL),
});

await this.browser.invoke(input)

Error Message and Stack Trace (if applicable)

Error: Unexpected properties: handlers, inheritableHandlers, inheritableTags, inheritableMetadata, name, _parentRunId. Expected only: headers, signal, tool_choice, promptIndex, ls_structured_output_format, watsonxCallbacks, writer, interrupt, spaceId, projectId, tools, toolChoiceOption, frequencyPenalty, logitBias, logprobs, topLogprobs, maxTokens, maxCompletionTokens, n, presencePenalty, responseFormat, seed, stop, temperature, topP, timeLimit, model, reasoningEffort, includeReasoning.

Description

The problem is when the tool invokes the watsonx chat models it sends extra properties in the options handlers, inheritableHandlers, inheritableTags, inheritableMetadata, name, _parentRunId which makes the validation fail.

System Info

@langchain/community: 1.1.15
node: v20.19.2
platform: mac

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions