Skip to content

Commit 9b2ded5

Browse files
committed
Update test for provider-layer max_tokens normalization
After the oracle#148 refactor, OpenAIProvider.normalize_params remaps max_tokens to max_completion_tokens at request-prep time. The agent layer now stays model-agnostic and passes max_tokens through unchanged, so the test now asserts that behavior instead of the old agents/common.py remap.
1 parent fcdd716 commit 9b2ded5

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

libs/oci/tests/unit_tests/agents/test_deep_research.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,14 @@ def test_custom_model_id(self) -> None:
531531
call_kwargs = mock_llm_class.call_args.kwargs
532532
assert call_kwargs["model_id"] == "google.gemini-2.5-flash"
533533

534-
def test_openai_models_use_max_completion_tokens(self) -> None:
535-
"""Test OpenAI-compatible models map max_tokens to max_completion_tokens."""
534+
def test_openai_models_pass_max_tokens_through(self) -> None:
535+
"""OpenAI-compatible models receive ``max_tokens`` from the agent layer.
536+
537+
The ``max_tokens -> max_completion_tokens`` remap happens at
538+
request-prep time in ``OpenAIProvider.normalize_params`` (see
539+
``chat_models/providers/generic.py``), keeping the agent layer
540+
model-agnostic.
541+
"""
536542
from langchain_oci.agents.deep_research.agent import create_deep_research_agent
537543

538544
with patch.dict("os.environ", {"OCI_COMPARTMENT_ID": "test"}):
@@ -547,8 +553,8 @@ def test_openai_models_use_max_completion_tokens(self) -> None:
547553
)
548554

549555
call_kwargs = mock_llm_class.call_args.kwargs
550-
assert call_kwargs["model_kwargs"]["max_completion_tokens"] == 1024
551-
assert "max_tokens" not in call_kwargs["model_kwargs"]
556+
assert call_kwargs["model_kwargs"]["max_tokens"] == 1024
557+
assert "max_completion_tokens" not in call_kwargs["model_kwargs"]
552558

553559
def test_tools_passed_to_create_deep_agent(self) -> None:
554560
"""Test that tools are passed to create_deep_agent."""

0 commit comments

Comments
 (0)