mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 18:00:36 +00:00
update
This commit is contained in:
parent
8d63cb405d
commit
33c7bd6c09
4 changed files with 112 additions and 6 deletions
24
tests/unit/server/test_runtime_error_sanitizer.py
Normal file
24
tests/unit/server/test_runtime_error_sanitizer.py
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the terms described in the LICENSE file in
|
||||
# the root directory of this source tree.
|
||||
|
||||
from llama_stack.core.server.runtime_error_sanitizer import sanitize_runtime_error
|
||||
|
||||
|
||||
def test_model_not_found_is_sanitized():
|
||||
err = RuntimeError("OpenAI response failed: Model 'claude-sonnet-4-5-20250929' not found.")
|
||||
|
||||
sanitized = sanitize_runtime_error(err)
|
||||
|
||||
assert sanitized.code == "MODEL_NOT_FOUND"
|
||||
assert sanitized.message == "Requested model 'claude-sonnet-4-5-20250929' is unavailable."
|
||||
|
||||
|
||||
def test_unmapped_runtime_error_defaults_to_internal_error():
|
||||
err = RuntimeError("Unexpected failure in obscure subsystem")
|
||||
|
||||
sanitized = sanitize_runtime_error(err)
|
||||
|
||||
assert sanitized is None
|
||||
Loading…
Add table
Add a link
Reference in a new issue