Skip to content

Commit ece9e31

Browse files
authored
openai[patch]: VCR some tests (#31524)
1 parent 5187817 commit ece9e31

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed
Binary file not shown.
Binary file not shown.

libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def test_stream_reasoning_summary() -> None:
381381
assert isinstance(response_2, AIMessage)
382382

383383

384-
# TODO: VCR some of these
384+
@pytest.mark.vcr
385385
def test_code_interpreter() -> None:
386386
llm = ChatOpenAI(model="o4-mini", use_responses_api=True)
387387
llm_with_tools = llm.bind_tools(
@@ -420,8 +420,8 @@ def test_code_interpreter() -> None:
420420
_ = llm_with_tools.invoke([input_message, full, next_message])
421421

422422

423+
@pytest.mark.vcr
423424
def test_mcp_builtin() -> None:
424-
pytest.skip() # TODO: set up VCR
425425
llm = ChatOpenAI(model="o4-mini", use_responses_api=True)
426426

427427
llm_with_tools = llm.bind_tools(
@@ -434,10 +434,14 @@ def test_mcp_builtin() -> None:
434434
}
435435
]
436436
)
437-
response = llm_with_tools.invoke(
438-
"What transport protocols does the 2025-03-26 version of the MCP spec "
439-
"(modelcontextprotocol/modelcontextprotocol) support?"
440-
)
437+
input_message = {
438+
"role": "user",
439+
"content": (
440+
"What transport protocols does the 2025-03-26 version of the MCP spec "
441+
"support?"
442+
),
443+
}
444+
response = llm_with_tools.invoke([input_message])
441445

442446
approval_message = HumanMessage(
443447
[
@@ -453,6 +457,10 @@ def test_mcp_builtin() -> None:
453457
_ = llm_with_tools.invoke(
454458
[approval_message], previous_response_id=response.response_metadata["id"]
455459
)
460+
# Zero-data retention (e.g., as below) requires change in output format.
461+
# _ = llm_with_tools.invoke(
462+
# [input_message, response, approval_message]
463+
# )
456464

457465

458466
@pytest.mark.vcr()

0 commit comments

Comments
 (0)