Skip to content

Conversation

@christian-bromann
Copy link
Member

This PR adds support for OpenAI's web search tool, enabling models to search the web for up-to-date information before generating responses.

Usage

import { ChatOpenAI, tools } from "@langchain/openai";

const model = new ChatOpenAI({ model: "gpt-4o" });

// Basic usage
const response = await model.invoke("What are today's top news stories?", {
  tools: [tools.webSearch()],
});

// With options
const response = await model.invoke("Local weather forecast", {
  tools: [tools.webSearch({
    userLocation: {
      type: "approximate",
      country: "US",
      city: "San Francisco",
    },
    filters: { allowedDomains: ["weather.gov"] },
  })],
});

@changeset-bot
Copy link

changeset-bot bot commented Dec 4, 2025

🦋 Changeset detected

Latest commit: 4b11ab5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@langchain/openai Minor
@langchain/classic Patch
@langchain/community Patch
@langchain/deepseek Patch
@langchain/xai Patch

Not sure what this means? Click here to learn what changesets are.

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

@christian-bromann christian-bromann force-pushed the cb/anthropic-mcp-toolset branch 2 times, most recently from 0dba245 to 2be74c8 Compare December 8, 2025 23:19
@christian-bromann christian-bromann force-pushed the cb/openai-websearch-tools branch from 6b2cf1c to 79c52aa Compare December 8, 2025 23:21
@christian-bromann christian-bromann merged commit 4b11ab5 into cb/anthropic-mcp-toolset Dec 9, 2025
27 of 28 checks passed
@christian-bromann christian-bromann deleted the cb/openai-websearch-tools branch December 9, 2025 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants