diff --git a/src/oss/python/integrations/chat/openai.mdx b/src/oss/python/integrations/chat/openai.mdx index d7f77b6b7..930dc7b99 100644 --- a/src/oss/python/integrations/chat/openai.mdx +++ b/src/oss/python/integrations/chat/openai.mdx @@ -431,26 +431,26 @@ response.content_blocks ``` ```output -[{'type': 'web_search_call', - 'id': 'ws_68af6ac605848195b7ce59c3293b59100cd6678a2b812fed', - 'query': 'positive news stories today', - 'action': {'query': 'positive news stories today', 'type': 'search'}, - 'status': 'completed'}, - {'type': 'web_search_result', - 'id': 'ws_68af6ac605848195b7ce59c3293b59100cd6678a2b812fed'}, +[{'type': 'server_tool_call', + 'name': 'web_search', + 'args': {'query': 'positive news stories today', 'type': 'search'}, + 'id': 'ws_68cd6f8d72e4819591dab080f4b0c340080067ad5ea8144a'}, + {'type': 'server_tool_result', + 'tool_call_id': 'ws_68cd6f8d72e4819591dab080f4b0c340080067ad5ea8144a', + 'status': 'success'}, {'type': 'text', 'text': 'Here are some positive news stories from today...', - 'annotations': [{'end_index': 587, - 'start_index': 484, - 'title': 'Positive News Highlights | AI, PFAS Breakthroughs & More — August 2025 — Podego', + 'annotations': [{'end_index': 410, + 'start_index': 337, + 'title': 'Positive News | Real Stories. Real Positive Impact', 'type': 'citation', - 'url': 'https://www.podego.com/insights/august-2025-good-news-ai-pfas-stories?utm_source=openai'}, - {'end_index': 3335, - 'start_index': 3155, - 'title': '7 stories of optimism this week (19.08.25-25.08.25) - Conservation Optimism', + 'url': 'https://www.positivenews.press/?utm_source=openai'}, + {'end_index': 969, + 'start_index': 798, + 'title': "From Green Innovation to Community Triumphs: Uplifting US Stories Lighting Up September 2025 | That's Great News", 'type': 'citation', - 'url': 'https://conservationoptimism.org/7-stories-of-optimism-this-week-19-08-25-25-08-25/?utm_source=openai'}], - 'id': 'msg_68af6ac75aa881958de4d8758b251c860cd6678a2b812fed'}] + 'url': 'https://info.thatsgreatnews.com/from-green-innovation-to-community-triumphs-uplifting-us-stories-lighting-up-september-2025/?utm_source=openai'}, + 'id': 'msg_68cd6f8e8d448195a807b89f483a1277080067ad5ea8144a'}] ``` @@ -516,7 +516,10 @@ To trigger a file search, pass a [file search tool](https://platform.openai.com/ ```python from langchain_openai import ChatOpenAI -llm = ChatOpenAI(model="gpt-4.1-mini") +llm = ChatOpenAI( + model="gpt-4.1-mini", + include=["file_search_call.results"], # optionally include search results +) openai_vector_store_ids = [ "vs_...", # your IDs here @@ -539,16 +542,11 @@ Deep Research by OpenAI is... As with [web search](#web-search), the response will include content blocks with citations: ```python -for block in response.content_blocks: - if block["type"] == "non_standard": - print(block["value"].get("type")) - else: - print(block["type"]) +[block["type"] for block in response.content_blocks] ``` ```output -file_search_call -text +['server_tool_call', 'server_tool_result', 'text'] ``` ```python @@ -569,14 +567,14 @@ text_block["annotations"][:2] It will also include information from the built-in tool invocations: ```python -response.content[0] +response.content_blocks[0] ``` ```output -{'id': 'fs_685d9e7d48408191b9e34ad359069ede019138cfaaf3cea8', - 'queries': ['deep research by OpenAI'], - 'status': 'completed', - 'type': 'file_search_call'} +{'type': 'server_tool_call', + 'name': 'file_search', + 'id': 'fs_68cd704c191c81959281b3b2ec6b139908f8f7fb31b1123c', + 'args': {'queries': ['deep research by OpenAI']}} ``` ### Computer use @@ -748,7 +746,10 @@ Example use: ```python from langchain_openai import ChatOpenAI -llm = ChatOpenAI(model="gpt-4.1-mini") +llm = ChatOpenAI( + model="gpt-4.1-mini", + include=["code_interpreter_call.outputs"], # optionally include outputs +) llm_with_tools = llm.bind_tools( [