Skip to content

feat: add integration test for max_output_tokens - #4825

Merged
mattf merged 2 commits into
ogx-ai:mainfrom
gyliu513:arg
Feb 10, 2026
Merged

mattf merged 2 commits into
ogx-ai:mainfrom
gyliu513:arg

Conversation

@gyliu513

@gyliu513 gyliu513 commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Related to #4817

Test Plan

(llama-stack) gualiu@gualiu-mac llama-stack % uv run ./scripts/integration-tests.sh \
      --stack-config server:ci-tests \
      --inference-mode record-if-missing \
      --setup gpt \
      --suite responses \
      --pattern 'TestOpenAIResponses'
=== Llama Stack Integration Test Runner ===
Stack Config: server:ci-tests
Setup: gpt
Inference Mode: record-if-missing
Test Suite: responses
Test Subdirs:
Test Pattern: TestOpenAIResponses

Checking llama packages
llama-stack                              0.2.2.dev1723+g3ec57a7f6 /Users/gualiu/go/src/github.com/llamastack/llama-stack
llama-stack-api                          0.2.2.dev1723+g3ec57a7f6 /Users/gualiu/go/src/github.com/llamastack/llama-stack/src/llama_stack_api
llama-stack-client                       0.4.4
ollama                                   0.6.1
=== Applying Setup Environment Variables ===
Setting SQLITE_STORE_DIR: /var/folders/fp/4p_qynps32sg30hs3m3bs5pc0000gn/T/tmp.v9JzrvrTB9
Setting stack config type: server
Setting MCP host: localhost (library/server mode)
Setting up environment variables:
export LLAMA_STACK_TEST_TEXT_MODEL='openai/gpt-4o'
export LLAMA_STACK_TEST_EMBEDDING_MODEL='openai/text-embedding-3-small'
export LLAMA_STACK_TEST_EMBEDDING_DIMENSION='1536'

Will use port: 8321
=== Starting Llama Stack Server ===
Waiting for Llama Stack Server to start on port 8321...
✅ Llama Stack Server started successfully

=== Running Integration Tests ===
Test subdirs to run:
+ STACK_CONFIG_ARG=
+ [[ -n server:ci-tests ]]
+ STACK_CONFIG_ARG=--stack-config=server:ci-tests
+ [[ false == \f\a\l\s\e ]]
+ pytest -s -v tests/integration/ --stack-config=server:ci-tests --inference-mode=record-if-missing -k 'not( builtin_tool or safety_with_image or code_interpreter or test_rag ) and TestOpenAIResponses' --setup=gpt --suite=responses --color=yes --embedding-model=sentence-transformers/nomic-ai/nomic-embed-text-v1.5 --color=yes --capture=tee-sys
=================================================================================================== test session starts ====================================================================================================
platform darwin -- Python 3.12.7, pytest-8.4.2, pluggy-1.6.0 -- /Users/gualiu/go/src/github.com/llamastack/llama-stack/.venv/bin/python3
cachedir: .pytest_cache
metadata: {'Python': '3.12.7', 'Platform': 'macOS-26.2-arm64-arm-64bit', 'Packages': {'pytest': '8.4.2', 'pluggy': '1.6.0'}, 'Plugins': {'anyio': '4.9.0', 'html': '4.1.1', 'socket': '0.7.0', 'asyncio': '1.1.0', 'json-report': '1.5.0', 'timeout': '2.4.0', 'metadata': '3.1.1', 'cov': '6.2.1', 'nbval': '0.11.0'}}
rootdir: /Users/gualiu/go/src/github.com/llamastack/llama-stack
configfile: pyproject.toml
plugins: anyio-4.9.0, html-4.1.1, socket-0.7.0, asyncio-1.1.0, json-report-1.5.0, timeout-2.4.0, metadata-3.1.1, cov-6.2.1, nbval-0.11.0
asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
collected 97 items / 94 deselected / 3 selected

tests/integration/responses/test_openai_response.py::TestOpenAIResponses::test_openai_response_with_max_output_tokens[txt=openai/gpt-4o]
instantiating llama_stack_client
Port 8321 is already in use, assuming server is already running...
llama_stack_client instantiated in 0.025s
PASSED                                                                      [ 33%]
tests/integration/responses/test_openai_response.py::TestOpenAIResponses::test_openai_response_with_small_max_output_tokens[txt=openai/gpt-4o] PASSED                                                                [ 66%]
tests/integration/responses/test_openai_response.py::TestOpenAIResponses::test_openai_response_max_output_tokens_below_minimum[txt=openai/gpt-4o] PASSED                                                             [100%]

=================================================================================================== slowest 10 durations ===================================================================================================
0.14s call     tests/integration/responses/test_openai_response.py::TestOpenAIResponses::test_openai_response_with_max_output_tokens[txt=openai/gpt-4o]
0.03s setup    tests/integration/responses/test_openai_response.py::TestOpenAIResponses::test_openai_response_with_max_output_tokens[txt=openai/gpt-4o]
0.02s call     tests/integration/responses/test_openai_response.py::TestOpenAIResponses::test_openai_response_with_small_max_output_tokens[txt=openai/gpt-4o]

(6 durations < 0.005s hidden.  Use -vv to show these durations.)
======================================================================================= 3 passed, 94 deselected, 2 warnings in 0.28s =======================================================================================
+ exit_code=0
+ set +x
✅ All tests completed successfully

=== Integration Tests Complete ===
Stopping Llama Stack Server...
Killing Llama Stack Server processes: 50190
50190
Llama Stack Server stopped

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Feb 3, 2026
@gyliu513

gyliu513 commented Feb 3, 2026

Copy link
Copy Markdown
Contributor Author

@mattf I was trying to add a integration test with openai client now, can you help check if this is the right direction? Thanks

Comment on lines +111 to +130
input=request.input,
model=request.model,
prompt=request.prompt,
instructions=request.instructions,
previous_response_id=request.previous_response_id,
conversation=request.conversation,
store=request.store,
stream=request.stream,
temperature=request.temperature,
text=request.text,
tool_choice=request.tool_choice,
tools=request.tools,
include=request.include,
max_infer_iters=request.max_infer_iters,
guardrails=request.guardrails,
parallel_tool_calls=request.parallel_tool_calls,
max_tool_calls=request.max_tool_calls,
max_output_tokens=request.max_output_tokens,
reasoning=request.reasoning,
metadata=request.metadata,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can make sure when you are adding a new parameter here, do not need to consider the order of the parameters.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this makes sense, I have been hitting this too

@mattf mattf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is worth including just for the param naming!

imho, tests like this could be done w/ the openresponses cli.

@gyliu513

gyliu513 commented Feb 6, 2026

Copy link
Copy Markdown
Contributor Author

imho, tests like this could be done w/ the openresponses cli.

@mattf can you elaborate more on this? I did not see openresponses cli from https://github.com/openresponses

@mattf

mattf commented Feb 6, 2026

Copy link
Copy Markdown
Collaborator

imho, tests like this could be done w/ the openresponses cli.

can you elaborate more on this? I did not see openresponses cli from https://github.com/openresponses

https://github.com/openresponses/openresponses?tab=readme-ov-file#cli

@gyliu513

gyliu513 commented Feb 6, 2026

Copy link
Copy Markdown
Contributor Author

@mattf +1 with you for the compliance integration test, I think after all response API finished, we can add a new integration file named as test_openresponses_compliance.py and this will call openresponse cli to do compliance test. With that, I think for #4817, we do not need to introduce OpenAI Client for Responses API Integration Test, comments?

@mattf

mattf commented Feb 7, 2026

Copy link
Copy Markdown
Collaborator

@mattf +1 with you for the compliance integration test, I think after all response API finished, we can add a new integration file named as test_openresponses_compliance.py and this will call openresponse cli to do compliance test. With that, I think for #4817, we do not need to introduce OpenAI Client for Responses API Integration Test, comments?

no need to wait. the test can be informative and non-gating.

@mattf
mattf merged commit 5eff27a into ogx-ai:main Feb 10, 2026
47 checks passed
@gyliu513
gyliu513 deleted the arg branch February 10, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants