mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-09 04:50:37 +00:00
openai[patch]: VCR some tests (#31524)
This commit is contained in:
parent
5187817006
commit
ece9e31a7a
Binary file not shown.
BIN
libs/partners/openai/tests/cassettes/test_mcp_builtin.yaml.gz
Normal file
BIN
libs/partners/openai/tests/cassettes/test_mcp_builtin.yaml.gz
Normal file
Binary file not shown.
@ -381,7 +381,7 @@ def test_stream_reasoning_summary() -> None:
|
|||||||
assert isinstance(response_2, AIMessage)
|
assert isinstance(response_2, AIMessage)
|
||||||
|
|
||||||
|
|
||||||
# TODO: VCR some of these
|
@pytest.mark.vcr
|
||||||
def test_code_interpreter() -> None:
|
def test_code_interpreter() -> None:
|
||||||
llm = ChatOpenAI(model="o4-mini", use_responses_api=True)
|
llm = ChatOpenAI(model="o4-mini", use_responses_api=True)
|
||||||
llm_with_tools = llm.bind_tools(
|
llm_with_tools = llm.bind_tools(
|
||||||
@ -420,8 +420,8 @@ def test_code_interpreter() -> None:
|
|||||||
_ = llm_with_tools.invoke([input_message, full, next_message])
|
_ = llm_with_tools.invoke([input_message, full, next_message])
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.vcr
|
||||||
def test_mcp_builtin() -> None:
|
def test_mcp_builtin() -> None:
|
||||||
pytest.skip() # TODO: set up VCR
|
|
||||||
llm = ChatOpenAI(model="o4-mini", use_responses_api=True)
|
llm = ChatOpenAI(model="o4-mini", use_responses_api=True)
|
||||||
|
|
||||||
llm_with_tools = llm.bind_tools(
|
llm_with_tools = llm.bind_tools(
|
||||||
@ -434,10 +434,14 @@ def test_mcp_builtin() -> None:
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
response = llm_with_tools.invoke(
|
input_message = {
|
||||||
"What transport protocols does the 2025-03-26 version of the MCP spec "
|
"role": "user",
|
||||||
"(modelcontextprotocol/modelcontextprotocol) support?"
|
"content": (
|
||||||
)
|
"What transport protocols does the 2025-03-26 version of the MCP spec "
|
||||||
|
"support?"
|
||||||
|
),
|
||||||
|
}
|
||||||
|
response = llm_with_tools.invoke([input_message])
|
||||||
|
|
||||||
approval_message = HumanMessage(
|
approval_message = HumanMessage(
|
||||||
[
|
[
|
||||||
@ -453,6 +457,10 @@ def test_mcp_builtin() -> None:
|
|||||||
_ = llm_with_tools.invoke(
|
_ = llm_with_tools.invoke(
|
||||||
[approval_message], previous_response_id=response.response_metadata["id"]
|
[approval_message], previous_response_id=response.response_metadata["id"]
|
||||||
)
|
)
|
||||||
|
# Zero-data retention (e.g., as below) requires change in output format.
|
||||||
|
# _ = llm_with_tools.invoke(
|
||||||
|
# [input_message, response, approval_message]
|
||||||
|
# )
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.vcr()
|
@pytest.mark.vcr()
|
||||||
|
Loading…
Reference in New Issue
Block a user