Skip to content

Commit deea844

Browse files
fix and extra int test (#3037)
1 parent 577ad4b commit deea844

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

python/packages/core/agent_framework/openai/_chat_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def _prepare_options(self, messages: MutableSequence[ChatMessage], chat_options:
183183
translations = {
184184
"model_id": "model",
185185
"allow_multiple_tool_calls": "parallel_tool_calls",
186-
"max_tokens": "max_output_tokens",
186+
"max_tokens": "max_completion_tokens",
187187
}
188188
for old_key, new_key in translations.items():
189189
if old_key in run_options and old_key != new_key:

python/packages/core/tests/openai/test_openai_chat_client.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,36 @@ async def test_openai_chat_completion_response() -> None:
236236
assert "scientists" in response.text
237237

238238

239+
@pytest.mark.flaky
240+
@skip_if_openai_integration_tests_disabled
241+
async def test_openai_chat_completion_response_params() -> None:
242+
"""Test OpenAI chat completion responses."""
243+
openai_chat_client = OpenAIChatClient()
244+
245+
assert isinstance(openai_chat_client, ChatClientProtocol)
246+
247+
messages: list[ChatMessage] = []
248+
messages.append(
249+
ChatMessage(
250+
role="user",
251+
text="Emily and David, two passionate scientists, met during a research expedition to Antarctica. "
252+
"Bonded by their love for the natural world and shared curiosity, they uncovered a "
253+
"groundbreaking phenomenon in glaciology that could potentially reshape our understanding "
254+
"of climate change.",
255+
)
256+
)
257+
messages.append(ChatMessage(role="user", text="who are Emily and David?"))
258+
259+
# Test that the client can be used to get a response
260+
response = await openai_chat_client.get_response(
261+
messages=messages, chat_options=ChatOptions(max_tokens=150, temperature=0.7, top_p=0.9)
262+
)
263+
264+
assert response is not None
265+
assert isinstance(response, ChatResponse)
266+
assert "scientists" in response.text
267+
268+
239269
@pytest.mark.flaky
240270
@skip_if_openai_integration_tests_disabled
241271
async def test_openai_chat_completion_response_tools() -> None:

0 commit comments

Comments
 (0)