feat(core): add web_search in OpenAI tools list (#32738)

This commit is contained in:
Shahroz Ahmad
2025-09-02 18:57:25 -03:00
committed by GitHub
parent b999f356e8
commit 4828a85ab0
4 changed files with 9 additions and 7 deletions

View File

@@ -515,6 +515,7 @@ _WellKnownOpenAITools = (
"mcp",
"image_generation",
"web_search_preview",
"web_search",
)

View File

@@ -123,6 +123,7 @@ global_ssl_context = ssl.create_default_context(cafile=certifi.where())
WellKnownTools = (
"file_search",
"web_search_preview",
"web_search",
"computer_use_preview",
"code_interpreter",
"mcp",
@@ -2374,7 +2375,7 @@ class ChatOpenAI(BaseChatOpenAI): # type: ignore[override]
llm = ChatOpenAI(model="gpt-4.1-mini", output_version="responses/v1")
tool = {"type": "web_search_preview"}
tool = {"type": "web_search"}
llm_with_tools = llm.bind_tools([tool])
response = llm_with_tools.invoke(

View File

@@ -8,7 +8,7 @@ license = { text = "MIT" }
requires-python = ">=3.9"
dependencies = [
"langchain-core<1.0.0,>=0.3.74",
"openai<2.0.0,>=1.99.9",
"openai<2.0.0,>=1.104.2",
"tiktoken<1,>=0.7",
]
name = "langchain-openai"

View File

@@ -1,5 +1,5 @@
version = 1
revision = 3
revision = 2
requires-python = ">=3.9"
resolution-markers = [
"python_full_version >= '3.13' and platform_python_implementation == 'PyPy'",
@@ -588,7 +588,7 @@ typing = [
[package.metadata]
requires-dist = [
{ name = "langchain-core", editable = "../../core" },
{ name = "openai", specifier = ">=1.99.9,<2.0.0" },
{ name = "openai", specifier = ">=1.104.2,<2.0.0" },
{ name = "tiktoken", specifier = ">=0.7,<1" },
]
@@ -1001,7 +1001,7 @@ wheels = [
[[package]]
name = "openai"
version = "1.101.0"
version = "1.104.2"
source = { registry = "https://pypi.org/simple" }
dependencies = [
{ name = "anyio" },
@@ -1013,9 +1013,9 @@ dependencies = [
{ name = "tqdm" },
{ name = "typing-extensions" },
]
sdist = { url = "https://files.pythonhosted.org/packages/00/7c/eaf06b62281f5ca4f774c4cff066e6ddfd6a027e0ac791be16acec3a95e3/openai-1.101.0.tar.gz", hash = "sha256:29f56df2236069686e64aca0e13c24a4ec310545afb25ef7da2ab1a18523f22d", size = 518415, upload-time = "2025-08-21T21:11:01.645Z" }
sdist = { url = "https://files.pythonhosted.org/packages/94/dc/965b3528ed0435b717acca45e2541d94bd827c0520ce172366323c9edcab/openai-1.104.2.tar.gz", hash = "sha256:9b582ead9dd208753f89dae8e36b6548c6ada076e87ba3db36630e29239661ab", size = 557160, upload-time = "2025-09-02T21:42:31.054Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/c8/a6/0e39baa335bbd1c66c7e0a41dbbec10c5a15ab95c1344e7f7beb28eee65a/openai-1.101.0-py3-none-any.whl", hash = "sha256:6539a446cce154f8d9fb42757acdfd3ed9357ab0d34fcac11096c461da87133b", size = 810772, upload-time = "2025-08-21T21:10:59.215Z" },
{ url = "https://files.pythonhosted.org/packages/46/9c/d0b56971e5584aea338bb00d3ca96a7f6694dff77006581b21cd773497ce/openai-1.104.2-py3-none-any.whl", hash = "sha256:0148951da12ea651f890ef38f8adef75b78c053dba37ea2bdba857c8945860d4", size = 928160, upload-time = "2025-09-02T21:42:28.678Z" },
]
[[package]]