mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-16 06:27:58 +00:00
update tests slightly, other fixes
This commit is contained in:
parent
0b02af792d
commit
e9f8458770
5 changed files with 24 additions and 32 deletions
|
@ -30,7 +30,6 @@ runs:
|
||||||
- name: Run Integration Tests
|
- name: Run Integration Tests
|
||||||
env:
|
env:
|
||||||
LLAMA_STACK_CLIENT_TIMEOUT: "300"
|
LLAMA_STACK_CLIENT_TIMEOUT: "300"
|
||||||
LLAMA_STACK_TEST_RECORDING_DIR: "tests/integration/recordings"
|
|
||||||
LLAMA_STACK_TEST_INFERENCE_MODE: ${{ inputs.inference-mode }}
|
LLAMA_STACK_TEST_INFERENCE_MODE: ${{ inputs.inference-mode }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
@ -51,6 +50,7 @@ runs:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${{ inputs.run-vision-tests }}" == "true" ]; then
|
if [ "${{ inputs.run-vision-tests }}" == "true" ]; then
|
||||||
|
export LLAMA_STACK_TEST_RECORDING_DIR="tests/integration/recordings/vision"
|
||||||
if uv run pytest -s -v tests/integration/inference/test_vision_inference.py --stack-config=${stack_config} \
|
if uv run pytest -s -v tests/integration/inference/test_vision_inference.py --stack-config=${stack_config} \
|
||||||
-k "not( ${EXCLUDE_TESTS} )" \
|
-k "not( ${EXCLUDE_TESTS} )" \
|
||||||
--vision-model=ollama/llama3.2-vision:11b \
|
--vision-model=ollama/llama3.2-vision:11b \
|
||||||
|
@ -66,6 +66,8 @@ runs:
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Run non-vision tests
|
||||||
|
export LLAMA_STACK_TEST_RECORDING_DIR="tests/integration/recordings"
|
||||||
TEST_TYPES='${{ inputs.test-types }}'
|
TEST_TYPES='${{ inputs.test-types }}'
|
||||||
echo "Test types to run: $TEST_TYPES"
|
echo "Test types to run: $TEST_TYPES"
|
||||||
|
|
||||||
|
|
5
.github/workflows/integration-tests.yml
vendored
5
.github/workflows/integration-tests.yml
vendored
|
@ -128,11 +128,10 @@ jobs:
|
||||||
|
|
||||||
- name: Commit and push recordings
|
- name: Commit and push recordings
|
||||||
run: |
|
run: |
|
||||||
if ! git diff --quiet tests/integration/recordings/; then
|
if ! git status --porcelain tests/integration/recordings/ | grep -q .; then
|
||||||
echo "Committing recordings"
|
echo "New recordings detected, committing and pushing"
|
||||||
git add tests/integration/recordings/
|
git add tests/integration/recordings/
|
||||||
git commit -m "Update recordings"
|
git commit -m "Update recordings"
|
||||||
echo "Pushing all recording commits to PR"
|
|
||||||
git push origin HEAD:${{ github.head_ref }}
|
git push origin HEAD:${{ github.head_ref }}
|
||||||
else
|
else
|
||||||
echo "No recording changes"
|
echo "No recording changes"
|
||||||
|
|
14
.github/workflows/integration-vision-tests.yml
vendored
14
.github/workflows/integration-vision-tests.yml
vendored
|
@ -25,7 +25,14 @@ on:
|
||||||
default: false
|
default: false
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ contains(github.event.pull_request.labels.*.name, 're-record-tests') && 'rerecord' || 'replay' }}
|
group: >-
|
||||||
|
${{ github.workflow }}-${{ github.ref }}-${{
|
||||||
|
(github.event.action == 'opened' ||
|
||||||
|
github.event.action == 'synchronize' ||
|
||||||
|
(github.event.action == 'labeled' && contains(github.event.pull_request.labels.*.name, 're-record-tests'))) &&
|
||||||
|
(contains(github.event.pull_request.labels.*.name, 're-record-tests') && 'rerecord' || 'replay') ||
|
||||||
|
'no-run'
|
||||||
|
}}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -100,11 +107,10 @@ jobs:
|
||||||
|
|
||||||
- name: Commit and push recordings
|
- name: Commit and push recordings
|
||||||
run: |
|
run: |
|
||||||
if ! git diff --quiet tests/integration/recordings/; then
|
if ! git status --porcelain tests/integration/recordings/ | grep -q .; then
|
||||||
echo "Committing recordings"
|
echo "New recordings detected, committing and pushing"
|
||||||
git add tests/integration/recordings/
|
git add tests/integration/recordings/
|
||||||
git commit -m "Update recordings"
|
git commit -m "Update recordings"
|
||||||
echo "Pushing all recording commits to PR"
|
|
||||||
git push origin HEAD:${{ github.head_ref }}
|
git push origin HEAD:${{ github.head_ref }}
|
||||||
else
|
else
|
||||||
echo "No recording changes"
|
echo "No recording changes"
|
||||||
|
|
|
@ -25,12 +25,6 @@ def base64_image_data(image_path):
|
||||||
return base64.b64encode(image_path.read_bytes()).decode("utf-8")
|
return base64.b64encode(image_path.read_bytes()).decode("utf-8")
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def base64_image_url(base64_image_data, image_path):
|
|
||||||
# suffix includes the ., so we remove it
|
|
||||||
return f"data:image/{image_path.suffix[1:]};base64,{base64_image_data}"
|
|
||||||
|
|
||||||
|
|
||||||
def test_image_chat_completion_non_streaming(client_with_models, vision_model_id):
|
def test_image_chat_completion_non_streaming(client_with_models, vision_model_id):
|
||||||
message = {
|
message = {
|
||||||
"role": "user",
|
"role": "user",
|
||||||
|
@ -78,7 +72,9 @@ def multi_image_data():
|
||||||
def test_image_chat_completion_multiple_images(client_with_models, vision_model_id, multi_image_data, stream):
|
def test_image_chat_completion_multiple_images(client_with_models, vision_model_id, multi_image_data, stream):
|
||||||
supported_models = ["llama-4", "gpt-4o", "llama4"]
|
supported_models = ["llama-4", "gpt-4o", "llama4"]
|
||||||
if not any(model in vision_model_id.lower() for model in supported_models):
|
if not any(model in vision_model_id.lower() for model in supported_models):
|
||||||
pytest.skip(f"Skip for non-supported model: {vision_model_id}")
|
pytest.skip(
|
||||||
|
f"Skip since multi-image tests are only supported for {supported_models}, not for {vision_model_id}"
|
||||||
|
)
|
||||||
|
|
||||||
messages = [
|
messages = [
|
||||||
{
|
{
|
||||||
|
@ -183,24 +179,13 @@ def test_image_chat_completion_streaming(client_with_models, vision_model_id):
|
||||||
assert any(expected in streamed_content for expected in {"dog", "puppy", "pup"})
|
assert any(expected in streamed_content for expected in {"dog", "puppy", "pup"})
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("type_", ["url", "data"])
|
def test_image_chat_completion_base64(client_with_models, vision_model_id, base64_image_data):
|
||||||
def test_image_chat_completion_base64(client_with_models, vision_model_id, base64_image_data, base64_image_url, type_):
|
|
||||||
image_spec = {
|
image_spec = {
|
||||||
"url": {
|
"type": "image",
|
||||||
"type": "image",
|
"image": {
|
||||||
"image": {
|
"data": base64_image_data,
|
||||||
"url": {
|
|
||||||
"uri": base64_image_url,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
"data": {
|
}
|
||||||
"type": "image",
|
|
||||||
"image": {
|
|
||||||
"data": base64_image_data,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}[type_]
|
|
||||||
|
|
||||||
message = {
|
message = {
|
||||||
"role": "user",
|
"role": "user",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue