Skip to content

Commit f839aec

Browse files
authored
Merge branch 'main' into jira-codex
2 parents 8b29985 + 0087cdc commit f839aec

18 files changed

+2567
-6
lines changed

authors.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ MW-OAI:
275275
dwigg-openai:
276276
name: "Danny Wigg"
277277
website: "https://www.linkedin.com/in/dannywigg/"
278-
avatar: "https://media.licdn.com/dms/image/v2/C4D03AQEjMSl0pMR_qw/profile-displayphoto-shrink_800_800/profile-displayphoto-shrink_800_800/0/1587647134114?e=1743033600&v=beta&t=XmULCSmk6V6YFmlyBggxj5uJeoYYuaYUKgcByKlS0K0"
278+
avatar: "https://avatars.githubusercontent.com/u/4661060?v=4"
279279

280280
msingh-openai:
281281
name: "Mandeep Singh"
@@ -375,4 +375,9 @@ lupie:
375375
alexl-oai:
376376
name: "Alex Lowden"
377377
website: "https://www.linkedin.com/in/alex-lowden01/"
378-
avatar: "https://avatars.githubusercontent.com/u/215167546"
378+
avatar: "https://avatars.githubusercontent.com/u/215167546"
379+
380+
glojain:
381+
name: "Glory Jain"
382+
website: "https://www.linkedin.com/in/gloryjain/"
383+
avatar: "https://media.licdn.com/dms/image/v2/C4E03AQH72n6Sm5q69Q/profile-displayphoto-shrink_400_400/profile-displayphoto-shrink_400_400/0/1557995338725?e=1756339200&v=beta&t=FGTXiCZwTZvqHCY-wd8It15EDf11Rex1oLlBKRGHNtY"

examples/Context_summarization_with_realtime_api.ipynb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,14 @@
333333
" return resp.choices[0].message.content.strip()"
334334
]
335335
},
336+
{
337+
"cell_type": "markdown",
338+
"metadata": {},
339+
"source": [
340+
"Important implementation detail:\n",
341+
"- The summary is appended as a SYSTEM message rather than an ASSISTANT message. Testing revealed that, during extended conversations, using ASSISTANT messages for summaries can cause the model to mistakenly switch from audio responses to text responses. By using SYSTEM messages for summaries (which can also include additional custom instructions), we clearly signal to the model that these are context-setting instructions, preventing it from incorrectly adopting the modality of the ongoing user-assistant interaction."
342+
]
343+
},
336344
{
337345
"cell_type": "code",
338346
"execution_count": 11,
@@ -367,8 +375,8 @@
367375
" \"item\": {\n",
368376
" \"id\": summary_id,\n",
369377
" \"type\": \"message\",\n",
370-
" \"role\": \"assistant\",\n",
371-
" \"content\": [{\"type\": \"text\", \"text\": summary_text}],\n",
378+
" \"role\": \"system\",\n",
379+
" \"content\": [{\"type\": \"input_text\", \"text\": summary_text}],\n",
372380
" },\n",
373381
" }))\n",
374382
"\n",

examples/Prompt_migration_guide.ipynb

Lines changed: 891 additions & 0 deletions
Large diffs are not rendered by default.

examples/Speech_transcription_methods.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
"\n",
1414
"By the end you will be able to select and use the appropriate transcription method for your use use cases.\n",
1515
"\n",
16-
"*Note: For simplicity and ease of use, this notebook uses WAV audio files. Real-time microphone streaming (e.g., from web apps or microphones) is not utilized.*"
16+
"*Note:*\n",
17+
"- *This notebook uses WAV audio files for simplicity. It does **not** demonstrate real-time microphone streaming (such as from a web app or direct mic input).*\n",
18+
"- *This notebook uses WebSockets to connect to the Realtime API. Alternatively, you can use WebRTC, see the [OpenAI docs](https://platform.openai.com/docs/guides/realtime#connect-with-webrtc) for details.*"
1719
]
1820
},
1921
{
121 KB
Loading
305 KB
Loading
91 KB
Loading
326 KB
Loading
85.1 KB
Loading
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# MCP for Deep Research
2+
3+
This is a minimal example of a Deep Research style MCP server for searching and fetching files from the OpenAI file storage service.
4+
5+
For a reference of _how_ to call this service from the Responses API, with Deep Research see [this cookbook](https://cookbook.openai.com/examples/deep_research_api/introduction_to_deep_research_api). To see how to call the MCP server with the Agents SDK, checkout [this cookbook](https://cookbook.openai.com/examples/deep_research_api/how_to_use_deep_research_API_agents)!
6+
7+
The Deep Research agent relies specifically on Search and Fetch tools. Search should look through your object store for a set of specfic, top-k IDs. Fetch, is a tool that takes objectIds as arguments and pulls back the relevant resources.
8+
9+
## Set up & run
10+
11+
Store your internal file(s) in [OpenAI Vector Storage](https://platform.openai.com/storage/vector_stores/)
12+
13+
Python setup:
14+
15+
```shell
16+
python3 -m venv env
17+
source env/bin/activate
18+
pip install -r requirements.txt
19+
```
20+
21+
Run the server:
22+
23+
```shell
24+
python main.py
25+
```
26+
27+
The server will start on `http://0.0.0.0:8000/sse/` using SSE transport. If you want to reach the server from the public internet, there are a variety of ways to do that including with ngrok:
28+
29+
```shell
30+
brew install ngrok
31+
ngrok config add-authtoken <your_token>
32+
ngrok http 8000
33+
```
34+
35+
You should now be able to reach your local server from your client.
36+
37+
## Files
38+
39+
- `main.py`: [Main server code](https://github.com/openai/openai-cookbook/blob/main/examples/deep_research_api/how_to_build_a_deep_research_mcp_server/main.py)
40+
41+
## Example Flow diagram for MCP Server
42+
43+
![../../../images/mcp_dr.png](../../../images/mcp_dr.png)
44+
45+
## Example request
46+
47+
```python
48+
# system_message includes reference to internal file lookups for MCP.
49+
system_message = """
50+
You are a professional researcher preparing a structured, data-driven report on behalf of a global health economics team. Your task is to analyze the health question the user poses.
51+
52+
Do:
53+
- Focus on data-rich insights: include specific figures, trends, statistics, and measurable outcomes (e.g., reduction in hospitalization costs, market size, pricing trends, payer adoption).
54+
- When appropriate, summarize data in a way that could be turned into charts or tables, and call this out in the response (e.g., "this would work well as a bar chart comparing per-patient costs across regions").
55+
- Prioritize reliable, up-to-date sources: peer-reviewed research, health organizations (e.g., WHO, CDC), regulatory agencies, or pharmaceutical earnings reports.
56+
- Include an internal file lookup tool to retrieve information from our own internal data sources. If you've already retrieved a file, do not call fetch again for that same file. Prioritize inclusion of that data.
57+
- Include inline citations and return all source metadata.
58+
59+
Be analytical, avoid generalities, and ensure that each section supports data-backed reasoning that could inform healthcare policy or financial modeling.
60+
"""
61+
62+
user_query = "Research the economic impact of semaglutide on global healthcare systems."
63+
64+
response = client.responses.create(
65+
model="o3-deep-research-2025-06-26",
66+
input=[
67+
{
68+
"role": "developer",
69+
"content": [
70+
{
71+
"type": "input_text",
72+
"text": system_message,
73+
}
74+
]
75+
},
76+
{
77+
"role": "user",
78+
"content": [
79+
{
80+
"type": "input_text",
81+
"text": user_query,
82+
}
83+
]
84+
}
85+
],
86+
reasoning={
87+
"summary": "auto"
88+
},
89+
tools=[
90+
{
91+
"type": "web_search_preview"
92+
},
93+
{ # ADD MCP TOOL SUPPORT
94+
"type": "mcp",
95+
"server_label": "internal_file_lookup",
96+
"server_url": "http://0.0.0.0:8000/sse/", # Update to the location of *your* MCP server
97+
"require_approval": "never"
98+
}
99+
]
100+
)

0 commit comments

Comments
 (0)