mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
fix and extra int test (#3037)
This commit is contained in:
@@ -183,7 +183,7 @@ class OpenAIBaseChatClient(OpenAIBase, BaseChatClient):
|
|||||||
translations = {
|
translations = {
|
||||||
"model_id": "model",
|
"model_id": "model",
|
||||||
"allow_multiple_tool_calls": "parallel_tool_calls",
|
"allow_multiple_tool_calls": "parallel_tool_calls",
|
||||||
"max_tokens": "max_output_tokens",
|
"max_tokens": "max_completion_tokens",
|
||||||
}
|
}
|
||||||
for old_key, new_key in translations.items():
|
for old_key, new_key in translations.items():
|
||||||
if old_key in run_options and old_key != new_key:
|
if old_key in run_options and old_key != new_key:
|
||||||
|
|||||||
@@ -236,6 +236,36 @@ async def test_openai_chat_completion_response() -> None:
|
|||||||
assert "scientists" in response.text
|
assert "scientists" in response.text
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.flaky
|
||||||
|
@skip_if_openai_integration_tests_disabled
|
||||||
|
async def test_openai_chat_completion_response_params() -> None:
|
||||||
|
"""Test OpenAI chat completion responses."""
|
||||||
|
openai_chat_client = OpenAIChatClient()
|
||||||
|
|
||||||
|
assert isinstance(openai_chat_client, ChatClientProtocol)
|
||||||
|
|
||||||
|
messages: list[ChatMessage] = []
|
||||||
|
messages.append(
|
||||||
|
ChatMessage(
|
||||||
|
role="user",
|
||||||
|
text="Emily and David, two passionate scientists, met during a research expedition to Antarctica. "
|
||||||
|
"Bonded by their love for the natural world and shared curiosity, they uncovered a "
|
||||||
|
"groundbreaking phenomenon in glaciology that could potentially reshape our understanding "
|
||||||
|
"of climate change.",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
messages.append(ChatMessage(role="user", text="who are Emily and David?"))
|
||||||
|
|
||||||
|
# Test that the client can be used to get a response
|
||||||
|
response = await openai_chat_client.get_response(
|
||||||
|
messages=messages, chat_options=ChatOptions(max_tokens=150, temperature=0.7, top_p=0.9)
|
||||||
|
)
|
||||||
|
|
||||||
|
assert response is not None
|
||||||
|
assert isinstance(response, ChatResponse)
|
||||||
|
assert "scientists" in response.text
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.flaky
|
@pytest.mark.flaky
|
||||||
@skip_if_openai_integration_tests_disabled
|
@skip_if_openai_integration_tests_disabled
|
||||||
async def test_openai_chat_completion_response_tools() -> None:
|
async def test_openai_chat_completion_response_tools() -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user