mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
test(integration): basic translation cases for the azure route (#44672)
* test(integration): azure-route basic translation cases on messages, chat completions and responses Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(integration): use the three-line form for the azure chat LIT-9235 skip Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: kerry <kerry@berri.ai> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
9062fd3931
commit
4314f3ce0c
8 changed files with 2419 additions and 1 deletions
|
|
@ -105,6 +105,36 @@ model_list:
|
|||
model: openai/responses/gpt-6.1-sol
|
||||
api_base: http://127.0.0.1:8191
|
||||
api_key: synthetic-openai-key
|
||||
- model_name: azure/gpt-5.4
|
||||
litellm_params:
|
||||
model: azure/gpt-5.4
|
||||
api_base: http://127.0.0.1:8191
|
||||
api_key: synthetic-azure-key
|
||||
api_version: "2025-04-01-preview"
|
||||
- model_name: azure/gpt-5.6-sol
|
||||
litellm_params:
|
||||
model: azure/gpt-5.6-sol
|
||||
api_base: http://127.0.0.1:8191
|
||||
api_key: synthetic-azure-key
|
||||
api_version: "2025-04-01-preview"
|
||||
- model_name: azure/gpt-5.6-luna
|
||||
litellm_params:
|
||||
model: azure/gpt-5.6-luna
|
||||
api_base: http://127.0.0.1:8191
|
||||
api_key: synthetic-azure-key
|
||||
api_version: "2025-04-01-preview"
|
||||
- model_name: azure/gpt-6-luna
|
||||
litellm_params:
|
||||
model: azure/gpt-6-luna
|
||||
api_base: http://127.0.0.1:8191
|
||||
api_key: synthetic-azure-key
|
||||
api_version: "2025-04-01-preview"
|
||||
- model_name: azure/gpt-6.1-sol
|
||||
litellm_params:
|
||||
model: azure/gpt-6.1-sol
|
||||
api_base: http://127.0.0.1:8191
|
||||
api_key: synthetic-azure-key
|
||||
api_version: "2025-04-01-preview"
|
||||
general_settings:
|
||||
master_key: os.environ/LITELLM_MASTER_KEY
|
||||
database_url: os.environ/DATABASE_URL
|
||||
|
|
|
|||
768
tests/integration/translation/chat_completions/bases/azure.py
Normal file
768
tests/integration/translation/chat_completions/bases/azure.py
Normal file
|
|
@ -0,0 +1,768 @@
|
|||
from typing import Final
|
||||
|
||||
from integration.translation.case import TranslationTestCase
|
||||
|
||||
GPT_5_4_TEST_CASE: Final = TranslationTestCase(
|
||||
scenario="basic",
|
||||
litellm_endpoint="/v1/chat/completions",
|
||||
litellm_request={
|
||||
"model": "azure/gpt-5.4",
|
||||
"max_tokens": 64,
|
||||
"messages": [
|
||||
{"role": "system", "content": "You are a terse assistant."},
|
||||
{"role": "user", "content": "Say hello."},
|
||||
],
|
||||
"cache": {"no-cache": True},
|
||||
},
|
||||
expected_provider_endpoint="/openai/deployments/gpt-5.4/chat/completions?api-version=2025-04-01-preview",
|
||||
expected_provider_headers={
|
||||
"content-type": "application/json",
|
||||
"api-key": "synthetic-azure-key",
|
||||
"authorization": "Bearer synthetic-azure-key",
|
||||
},
|
||||
expected_provider_request={
|
||||
"messages": [
|
||||
{"role": "system", "content": "You are a terse assistant."},
|
||||
{"role": "user", "content": "Say hello."},
|
||||
],
|
||||
"model": "gpt-5.4",
|
||||
"max_completion_tokens": 64,
|
||||
"stream": False,
|
||||
},
|
||||
mock_provider_response={
|
||||
"choices": [
|
||||
{
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"protected_material_code": {"detected": False, "filtered": False},
|
||||
"protected_material_text": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
"finish_reason": "stop",
|
||||
"index": 0,
|
||||
"logprobs": None,
|
||||
"message": {"annotations": [], "content": "Hello.", "refusal": None, "role": "assistant"},
|
||||
}
|
||||
],
|
||||
"created": 1791231844,
|
||||
"id": "chatcmpl-EVjW8mtOvQmVYDtEuv7KNgydJESBC",
|
||||
"model": "gpt-5.4-2026-03-05",
|
||||
"object": "chat.completion",
|
||||
"prompt_filter_results": [
|
||||
{
|
||||
"prompt_index": 0,
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"jailbreak": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"routing": {"serving_pipereplica": "d20260919103649-bf00bd58-default-r2-dp0-default"},
|
||||
"service_tier": "default",
|
||||
"system_fingerprint": None,
|
||||
"usage": {
|
||||
"completion_tokens": 5,
|
||||
"completion_tokens_details": {
|
||||
"accepted_prediction_tokens": 0,
|
||||
"audio_tokens": 0,
|
||||
"reasoning_tokens": 0,
|
||||
"rejected_prediction_tokens": 0,
|
||||
},
|
||||
"latency_checkpoint": {
|
||||
"engine_tbt_ms": 6,
|
||||
"engine_ttft_ms": 134,
|
||||
"engine_ttlt_ms": 168,
|
||||
"pre_inference_ms": 74,
|
||||
"service_tbt_ms": 6,
|
||||
"service_ttft_ms": 564,
|
||||
"service_ttlt_ms": 592,
|
||||
"user_visible_ttft_ms": 490,
|
||||
},
|
||||
"prompt_tokens": 19,
|
||||
"prompt_tokens_details": {"audio_tokens": 0, "cached_tokens": 0},
|
||||
"total_tokens": 24,
|
||||
},
|
||||
},
|
||||
expected_litellm_response={
|
||||
"id": "chatcmpl-EVjW8mtOvQmVYDtEuv7KNgydJESBC",
|
||||
"created": 1791231844,
|
||||
"model": "azure/gpt-5.4",
|
||||
"object": "chat.completion",
|
||||
"choices": [
|
||||
{
|
||||
"finish_reason": "stop",
|
||||
"index": 0,
|
||||
"message": {"content": "Hello.", "role": "assistant", "annotations": [], "refusal": None},
|
||||
"provider_specific_fields": {
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"protected_material_code": {"detected": False, "filtered": False},
|
||||
"protected_material_text": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
}
|
||||
},
|
||||
"logprobs": None,
|
||||
}
|
||||
],
|
||||
"usage": {
|
||||
"completion_tokens": 5,
|
||||
"prompt_tokens": 19,
|
||||
"total_tokens": 24,
|
||||
"completion_tokens_details": {
|
||||
"accepted_prediction_tokens": 0,
|
||||
"audio_tokens": 0,
|
||||
"reasoning_tokens": 0,
|
||||
"rejected_prediction_tokens": 0,
|
||||
},
|
||||
"prompt_tokens_details": {"audio_tokens": 0, "cached_tokens": 0},
|
||||
"latency_checkpoint": {
|
||||
"engine_tbt_ms": 6,
|
||||
"engine_ttft_ms": 134,
|
||||
"engine_ttlt_ms": 168,
|
||||
"pre_inference_ms": 74,
|
||||
"service_tbt_ms": 6,
|
||||
"service_ttft_ms": 564,
|
||||
"service_ttlt_ms": 592,
|
||||
"user_visible_ttft_ms": 490,
|
||||
},
|
||||
},
|
||||
"service_tier": "default",
|
||||
"prompt_filter_results": [
|
||||
{
|
||||
"prompt_index": 0,
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"jailbreak": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"routing": {"serving_pipereplica": "d20260919103649-bf00bd58-default-r2-dp0-default"},
|
||||
"system_fingerprint": None,
|
||||
},
|
||||
)
|
||||
|
||||
GPT_5_6_SOL_TEST_CASE: Final = TranslationTestCase(
|
||||
scenario="basic",
|
||||
litellm_endpoint="/v1/chat/completions",
|
||||
litellm_request={
|
||||
"model": "azure/gpt-5.6-sol",
|
||||
"max_tokens": 64,
|
||||
"messages": [
|
||||
{"role": "system", "content": "You are a terse assistant."},
|
||||
{"role": "user", "content": "Say hello."},
|
||||
],
|
||||
"cache": {"no-cache": True},
|
||||
},
|
||||
expected_provider_endpoint="/openai/deployments/gpt-5.6-sol/chat/completions?api-version=2025-04-01-preview",
|
||||
expected_provider_headers={
|
||||
"content-type": "application/json",
|
||||
"api-key": "synthetic-azure-key",
|
||||
"authorization": "Bearer synthetic-azure-key",
|
||||
},
|
||||
expected_provider_request={
|
||||
"messages": [
|
||||
{"role": "system", "content": "You are a terse assistant."},
|
||||
{"role": "user", "content": "Say hello."},
|
||||
],
|
||||
"model": "gpt-5.6-sol",
|
||||
"max_completion_tokens": 64,
|
||||
"stream": False,
|
||||
},
|
||||
mock_provider_response={
|
||||
"choices": [
|
||||
{
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"protected_material_code": {"detected": False, "filtered": False},
|
||||
"protected_material_text": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
"finish_reason": "stop",
|
||||
"index": 0,
|
||||
"logprobs": None,
|
||||
"message": {"annotations": [], "content": "Hello.", "refusal": None, "role": "assistant"},
|
||||
}
|
||||
],
|
||||
"created": 1791231846,
|
||||
"id": "chatcmpl-EVjWAtsNezzFIBBSE6qy0TnpRv0Ll",
|
||||
"model": "gpt-5.6-sol-2026-07-09",
|
||||
"object": "chat.completion",
|
||||
"prompt_filter_results": [
|
||||
{
|
||||
"prompt_index": 0,
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"jailbreak": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"routing": {"serving_pipereplica": "d20260930154032-380c3f99-prefill-r9-dp0-prefill"},
|
||||
"service_tier": "default",
|
||||
"system_fingerprint": None,
|
||||
"usage": {
|
||||
"completion_tokens": 5,
|
||||
"completion_tokens_details": {
|
||||
"accepted_prediction_tokens": 0,
|
||||
"audio_tokens": 0,
|
||||
"reasoning_tokens": 0,
|
||||
"rejected_prediction_tokens": 0,
|
||||
},
|
||||
"latency_checkpoint": {
|
||||
"engine_tbt_ms": 7,
|
||||
"engine_ttft_ms": 228,
|
||||
"engine_ttlt_ms": 269,
|
||||
"pre_inference_ms": 78,
|
||||
"service_tbt_ms": 8,
|
||||
"service_ttft_ms": 348,
|
||||
"service_ttlt_ms": 387,
|
||||
"user_visible_ttft_ms": 270,
|
||||
},
|
||||
"prompt_tokens": 19,
|
||||
"prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
|
||||
"total_tokens": 24,
|
||||
},
|
||||
},
|
||||
expected_litellm_response={
|
||||
"id": "chatcmpl-EVjWAtsNezzFIBBSE6qy0TnpRv0Ll",
|
||||
"created": 1791231846,
|
||||
"model": "azure/gpt-5.6-sol",
|
||||
"object": "chat.completion",
|
||||
"choices": [
|
||||
{
|
||||
"finish_reason": "stop",
|
||||
"index": 0,
|
||||
"message": {"content": "Hello.", "role": "assistant", "annotations": [], "refusal": None},
|
||||
"provider_specific_fields": {
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"protected_material_code": {"detected": False, "filtered": False},
|
||||
"protected_material_text": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
}
|
||||
},
|
||||
"logprobs": None,
|
||||
}
|
||||
],
|
||||
"usage": {
|
||||
"completion_tokens": 5,
|
||||
"prompt_tokens": 19,
|
||||
"total_tokens": 24,
|
||||
"completion_tokens_details": {
|
||||
"accepted_prediction_tokens": 0,
|
||||
"audio_tokens": 0,
|
||||
"reasoning_tokens": 0,
|
||||
"rejected_prediction_tokens": 0,
|
||||
},
|
||||
"prompt_tokens_details": {
|
||||
"audio_tokens": 0,
|
||||
"cached_tokens": 0,
|
||||
"cache_write_tokens": 0,
|
||||
"cache_creation_tokens": 0,
|
||||
},
|
||||
"latency_checkpoint": {
|
||||
"engine_tbt_ms": 7,
|
||||
"engine_ttft_ms": 228,
|
||||
"engine_ttlt_ms": 269,
|
||||
"pre_inference_ms": 78,
|
||||
"service_tbt_ms": 8,
|
||||
"service_ttft_ms": 348,
|
||||
"service_ttlt_ms": 387,
|
||||
"user_visible_ttft_ms": 270,
|
||||
},
|
||||
},
|
||||
"service_tier": "default",
|
||||
"prompt_filter_results": [
|
||||
{
|
||||
"prompt_index": 0,
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"jailbreak": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"routing": {"serving_pipereplica": "d20260930154032-380c3f99-prefill-r9-dp0-prefill"},
|
||||
"system_fingerprint": None,
|
||||
},
|
||||
)
|
||||
|
||||
GPT_5_6_LUNA_TEST_CASE: Final = TranslationTestCase(
|
||||
scenario="basic",
|
||||
litellm_endpoint="/v1/chat/completions",
|
||||
litellm_request={
|
||||
"model": "azure/gpt-5.6-luna",
|
||||
"max_tokens": 64,
|
||||
"messages": [
|
||||
{"role": "system", "content": "You are a terse assistant."},
|
||||
{"role": "user", "content": "Say hello."},
|
||||
],
|
||||
"cache": {"no-cache": True},
|
||||
},
|
||||
expected_provider_endpoint="/openai/deployments/gpt-5.6-luna/chat/completions?api-version=2025-04-01-preview",
|
||||
expected_provider_headers={
|
||||
"content-type": "application/json",
|
||||
"api-key": "synthetic-azure-key",
|
||||
"authorization": "Bearer synthetic-azure-key",
|
||||
},
|
||||
expected_provider_request={
|
||||
"messages": [
|
||||
{"role": "system", "content": "You are a terse assistant."},
|
||||
{"role": "user", "content": "Say hello."},
|
||||
],
|
||||
"model": "gpt-5.6-luna",
|
||||
"max_completion_tokens": 64,
|
||||
"stream": False,
|
||||
},
|
||||
mock_provider_response={
|
||||
"choices": [
|
||||
{
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"protected_material_code": {"detected": False, "filtered": False},
|
||||
"protected_material_text": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
"finish_reason": "stop",
|
||||
"index": 0,
|
||||
"logprobs": None,
|
||||
"message": {"annotations": [], "content": "Hello!", "refusal": None, "role": "assistant"},
|
||||
}
|
||||
],
|
||||
"created": 1791231848,
|
||||
"id": "chatcmpl-EVjWC8K4D1wYOwETMUzs0oFLnsvKg",
|
||||
"model": "gpt-5.6-luna-2026-07-09",
|
||||
"object": "chat.completion",
|
||||
"prompt_filter_results": [
|
||||
{
|
||||
"prompt_index": 0,
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"jailbreak": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"routing": {"serving_pipereplica": "d20260925052750-47dc37a0-prefill-r7-dp0-prefill"},
|
||||
"service_tier": "default",
|
||||
"system_fingerprint": None,
|
||||
"usage": {
|
||||
"completion_tokens": 5,
|
||||
"completion_tokens_details": {
|
||||
"accepted_prediction_tokens": 0,
|
||||
"audio_tokens": 0,
|
||||
"reasoning_tokens": 0,
|
||||
"rejected_prediction_tokens": 0,
|
||||
},
|
||||
"latency_checkpoint": {
|
||||
"engine_tbt_ms": 12,
|
||||
"engine_ttft_ms": 58,
|
||||
"engine_ttlt_ms": 130,
|
||||
"pre_inference_ms": 70,
|
||||
"service_tbt_ms": 13,
|
||||
"service_ttft_ms": 224,
|
||||
"service_ttlt_ms": 290,
|
||||
"user_visible_ttft_ms": 154,
|
||||
},
|
||||
"prompt_tokens": 19,
|
||||
"prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
|
||||
"total_tokens": 24,
|
||||
},
|
||||
},
|
||||
expected_litellm_response={
|
||||
"id": "chatcmpl-EVjWC8K4D1wYOwETMUzs0oFLnsvKg",
|
||||
"created": 1791231848,
|
||||
"model": "azure/gpt-5.6-luna",
|
||||
"object": "chat.completion",
|
||||
"choices": [
|
||||
{
|
||||
"finish_reason": "stop",
|
||||
"index": 0,
|
||||
"message": {"content": "Hello!", "role": "assistant", "annotations": [], "refusal": None},
|
||||
"provider_specific_fields": {
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"protected_material_code": {"detected": False, "filtered": False},
|
||||
"protected_material_text": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
}
|
||||
},
|
||||
"logprobs": None,
|
||||
}
|
||||
],
|
||||
"usage": {
|
||||
"completion_tokens": 5,
|
||||
"prompt_tokens": 19,
|
||||
"total_tokens": 24,
|
||||
"completion_tokens_details": {
|
||||
"accepted_prediction_tokens": 0,
|
||||
"audio_tokens": 0,
|
||||
"reasoning_tokens": 0,
|
||||
"rejected_prediction_tokens": 0,
|
||||
},
|
||||
"prompt_tokens_details": {
|
||||
"audio_tokens": 0,
|
||||
"cached_tokens": 0,
|
||||
"cache_write_tokens": 0,
|
||||
"cache_creation_tokens": 0,
|
||||
},
|
||||
"latency_checkpoint": {
|
||||
"engine_tbt_ms": 12,
|
||||
"engine_ttft_ms": 58,
|
||||
"engine_ttlt_ms": 130,
|
||||
"pre_inference_ms": 70,
|
||||
"service_tbt_ms": 13,
|
||||
"service_ttft_ms": 224,
|
||||
"service_ttlt_ms": 290,
|
||||
"user_visible_ttft_ms": 154,
|
||||
},
|
||||
},
|
||||
"service_tier": "default",
|
||||
"prompt_filter_results": [
|
||||
{
|
||||
"prompt_index": 0,
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"jailbreak": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"routing": {"serving_pipereplica": "d20260925052750-47dc37a0-prefill-r7-dp0-prefill"},
|
||||
"system_fingerprint": None,
|
||||
},
|
||||
)
|
||||
|
||||
GPT_6_LUNA_TEST_CASE: Final = TranslationTestCase(
|
||||
scenario="basic",
|
||||
litellm_endpoint="/v1/chat/completions",
|
||||
litellm_request={
|
||||
"model": "azure/gpt-6-luna",
|
||||
"max_tokens": 64,
|
||||
"messages": [
|
||||
{"role": "system", "content": "You are a terse assistant."},
|
||||
{"role": "user", "content": "Say hello."},
|
||||
],
|
||||
"cache": {"no-cache": True},
|
||||
},
|
||||
expected_provider_endpoint="/openai/deployments/gpt-6-luna/chat/completions?api-version=2025-04-01-preview",
|
||||
expected_provider_headers={
|
||||
"content-type": "application/json",
|
||||
"api-key": "synthetic-azure-key",
|
||||
"authorization": "Bearer synthetic-azure-key",
|
||||
},
|
||||
expected_provider_request={
|
||||
"messages": [
|
||||
{"role": "system", "content": "You are a terse assistant."},
|
||||
{"role": "user", "content": "Say hello."},
|
||||
],
|
||||
"model": "gpt-6-luna",
|
||||
"max_completion_tokens": 64,
|
||||
"stream": False,
|
||||
},
|
||||
mock_provider_response={
|
||||
"choices": [
|
||||
{
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"protected_material_code": {"detected": False, "filtered": False},
|
||||
"protected_material_text": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
"finish_reason": "stop",
|
||||
"index": 0,
|
||||
"logprobs": None,
|
||||
"message": {"annotations": [], "content": "Hello!", "refusal": None, "role": "assistant"},
|
||||
}
|
||||
],
|
||||
"created": 1791231849,
|
||||
"id": "chatcmpl-EVjWDVYMA8Y26Lw8Jk3617Q3kWSUS",
|
||||
"model": "gpt-6-luna-2026-09-22",
|
||||
"object": "chat.completion",
|
||||
"prompt_filter_results": [
|
||||
{
|
||||
"prompt_index": 0,
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"jailbreak": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"routing": {"serving_pipereplica": "d20260930053954-f91e8c7b-prefill-r7-dp0-prefill"},
|
||||
"service_tier": "default",
|
||||
"system_fingerprint": None,
|
||||
"usage": {
|
||||
"completion_tokens": 5,
|
||||
"completion_tokens_details": {
|
||||
"accepted_prediction_tokens": 0,
|
||||
"audio_tokens": 0,
|
||||
"reasoning_tokens": 0,
|
||||
"rejected_prediction_tokens": 0,
|
||||
},
|
||||
"latency_checkpoint": {
|
||||
"engine_tbt_ms": 2,
|
||||
"engine_ttft_ms": 65,
|
||||
"engine_ttlt_ms": 80,
|
||||
"pre_inference_ms": 83,
|
||||
"service_tbt_ms": 5,
|
||||
"service_ttft_ms": 282,
|
||||
"service_ttlt_ms": 306,
|
||||
"user_visible_ttft_ms": 199,
|
||||
},
|
||||
"prompt_tokens": 19,
|
||||
"prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
|
||||
"total_tokens": 24,
|
||||
},
|
||||
},
|
||||
expected_litellm_response={
|
||||
"id": "chatcmpl-EVjWDVYMA8Y26Lw8Jk3617Q3kWSUS",
|
||||
"created": 1791231849,
|
||||
"model": "azure/gpt-6-luna",
|
||||
"object": "chat.completion",
|
||||
"choices": [
|
||||
{
|
||||
"finish_reason": "stop",
|
||||
"index": 0,
|
||||
"message": {"content": "Hello!", "role": "assistant", "annotations": [], "refusal": None},
|
||||
"provider_specific_fields": {
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"protected_material_code": {"detected": False, "filtered": False},
|
||||
"protected_material_text": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
}
|
||||
},
|
||||
"logprobs": None,
|
||||
}
|
||||
],
|
||||
"usage": {
|
||||
"completion_tokens": 5,
|
||||
"prompt_tokens": 19,
|
||||
"total_tokens": 24,
|
||||
"completion_tokens_details": {
|
||||
"accepted_prediction_tokens": 0,
|
||||
"audio_tokens": 0,
|
||||
"reasoning_tokens": 0,
|
||||
"rejected_prediction_tokens": 0,
|
||||
},
|
||||
"prompt_tokens_details": {
|
||||
"audio_tokens": 0,
|
||||
"cached_tokens": 0,
|
||||
"cache_write_tokens": 0,
|
||||
"cache_creation_tokens": 0,
|
||||
},
|
||||
"latency_checkpoint": {
|
||||
"engine_tbt_ms": 2,
|
||||
"engine_ttft_ms": 65,
|
||||
"engine_ttlt_ms": 80,
|
||||
"pre_inference_ms": 83,
|
||||
"service_tbt_ms": 5,
|
||||
"service_ttft_ms": 282,
|
||||
"service_ttlt_ms": 306,
|
||||
"user_visible_ttft_ms": 199,
|
||||
},
|
||||
},
|
||||
"service_tier": "default",
|
||||
"prompt_filter_results": [
|
||||
{
|
||||
"prompt_index": 0,
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"jailbreak": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"routing": {"serving_pipereplica": "d20260930053954-f91e8c7b-prefill-r7-dp0-prefill"},
|
||||
"system_fingerprint": None,
|
||||
},
|
||||
)
|
||||
|
||||
GPT_6_1_SOL_TEST_CASE: Final = TranslationTestCase(
|
||||
scenario="basic",
|
||||
litellm_endpoint="/v1/chat/completions",
|
||||
litellm_request={
|
||||
"model": "azure/gpt-6.1-sol",
|
||||
"max_tokens": 64,
|
||||
"messages": [
|
||||
{"role": "system", "content": "You are a terse assistant."},
|
||||
{"role": "user", "content": "Say hello."},
|
||||
],
|
||||
"cache": {"no-cache": True},
|
||||
},
|
||||
expected_provider_endpoint="/openai/deployments/gpt-6.1-sol/chat/completions?api-version=2025-04-01-preview",
|
||||
expected_provider_headers={
|
||||
"content-type": "application/json",
|
||||
"api-key": "synthetic-azure-key",
|
||||
"authorization": "Bearer synthetic-azure-key",
|
||||
},
|
||||
expected_provider_request={
|
||||
"messages": [
|
||||
{"role": "system", "content": "You are a terse assistant."},
|
||||
{"role": "user", "content": "Say hello."},
|
||||
],
|
||||
"model": "gpt-6.1-sol",
|
||||
"max_completion_tokens": 64,
|
||||
"stream": False,
|
||||
},
|
||||
mock_provider_response={
|
||||
"choices": [
|
||||
{
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"protected_material_code": {"detected": False, "filtered": False},
|
||||
"protected_material_text": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
"finish_reason": "stop",
|
||||
"index": 0,
|
||||
"logprobs": None,
|
||||
"message": {"annotations": [], "content": "Hello!", "refusal": None, "role": "assistant"},
|
||||
}
|
||||
],
|
||||
"created": 1791231851,
|
||||
"id": "chatcmpl-EVjWFBfdrUdRu3rbi6eAXbuO4zfNm",
|
||||
"model": "gpt-6.1-sol-2026-09-29",
|
||||
"object": "chat.completion",
|
||||
"prompt_filter_results": [
|
||||
{
|
||||
"prompt_index": 0,
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"jailbreak": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"routing": {"serving_pipereplica": "d20260929014647-f3a90410-prefill-r11-dp0-prefill"},
|
||||
"service_tier": "default",
|
||||
"system_fingerprint": None,
|
||||
"usage": {
|
||||
"completion_tokens": 5,
|
||||
"completion_tokens_details": {
|
||||
"accepted_prediction_tokens": 0,
|
||||
"audio_tokens": 0,
|
||||
"reasoning_tokens": 0,
|
||||
"rejected_prediction_tokens": 0,
|
||||
},
|
||||
"latency_checkpoint": {
|
||||
"engine_tbt_ms": 8,
|
||||
"engine_ttft_ms": 440,
|
||||
"engine_ttlt_ms": 491,
|
||||
"pre_inference_ms": 70,
|
||||
"service_tbt_ms": 9,
|
||||
"service_ttft_ms": 773,
|
||||
"service_ttlt_ms": 819,
|
||||
"user_visible_ttft_ms": 703,
|
||||
},
|
||||
"prompt_tokens": 19,
|
||||
"prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
|
||||
"total_tokens": 24,
|
||||
},
|
||||
},
|
||||
expected_litellm_response={
|
||||
"id": "chatcmpl-EVjWFBfdrUdRu3rbi6eAXbuO4zfNm",
|
||||
"created": 1791231851,
|
||||
"model": "azure/gpt-6.1-sol",
|
||||
"object": "chat.completion",
|
||||
"choices": [
|
||||
{
|
||||
"finish_reason": "stop",
|
||||
"index": 0,
|
||||
"message": {"content": "Hello!", "role": "assistant", "annotations": [], "refusal": None},
|
||||
"provider_specific_fields": {
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"protected_material_code": {"detected": False, "filtered": False},
|
||||
"protected_material_text": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
}
|
||||
},
|
||||
"logprobs": None,
|
||||
}
|
||||
],
|
||||
"usage": {
|
||||
"completion_tokens": 5,
|
||||
"prompt_tokens": 19,
|
||||
"total_tokens": 24,
|
||||
"completion_tokens_details": {
|
||||
"accepted_prediction_tokens": 0,
|
||||
"audio_tokens": 0,
|
||||
"reasoning_tokens": 0,
|
||||
"rejected_prediction_tokens": 0,
|
||||
},
|
||||
"prompt_tokens_details": {
|
||||
"audio_tokens": 0,
|
||||
"cached_tokens": 0,
|
||||
"cache_write_tokens": 0,
|
||||
"cache_creation_tokens": 0,
|
||||
},
|
||||
"latency_checkpoint": {
|
||||
"engine_tbt_ms": 8,
|
||||
"engine_ttft_ms": 440,
|
||||
"engine_ttlt_ms": 491,
|
||||
"pre_inference_ms": 70,
|
||||
"service_tbt_ms": 9,
|
||||
"service_ttft_ms": 773,
|
||||
"service_ttlt_ms": 819,
|
||||
"user_visible_ttft_ms": 703,
|
||||
},
|
||||
},
|
||||
"service_tier": "default",
|
||||
"prompt_filter_results": [
|
||||
{
|
||||
"prompt_index": 0,
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"jailbreak": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"routing": {"serving_pipereplica": "d20260929014647-f3a90410-prefill-r11-dp0-prefill"},
|
||||
"system_fingerprint": None,
|
||||
},
|
||||
)
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
import pytest
|
||||
from integration._support.client import Gateway
|
||||
from integration._support.provider import SharedProvider
|
||||
from integration.translation.case import TranslationTestCase
|
||||
from integration.translation.chat_completions.bases.azure import (
|
||||
GPT_5_4_TEST_CASE,
|
||||
GPT_5_6_LUNA_TEST_CASE,
|
||||
GPT_5_6_SOL_TEST_CASE,
|
||||
GPT_6_1_SOL_TEST_CASE,
|
||||
GPT_6_LUNA_TEST_CASE,
|
||||
)
|
||||
from integration.translation.runner import run
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"case",
|
||||
[
|
||||
GPT_5_4_TEST_CASE,
|
||||
GPT_5_6_SOL_TEST_CASE,
|
||||
GPT_5_6_LUNA_TEST_CASE,
|
||||
GPT_6_LUNA_TEST_CASE,
|
||||
GPT_6_1_SOL_TEST_CASE,
|
||||
],
|
||||
ids=lambda case: case.id,
|
||||
)
|
||||
def test_chat_completions_basic_azure(case: TranslationTestCase, gateway: Gateway, provider: SharedProvider) -> None:
|
||||
pytest.skip(
|
||||
"BUG: LIT-9235 chat completions moves message.refusal into provider_specific_fields and drops null system_fingerprint and logprobs"
|
||||
)
|
||||
run(case, gateway, provider)
|
||||
483
tests/integration/translation/messages/bases/azure.py
Normal file
483
tests/integration/translation/messages/bases/azure.py
Normal file
|
|
@ -0,0 +1,483 @@
|
|||
from typing import Final
|
||||
|
||||
from integration.translation.case import TranslationTestCase
|
||||
|
||||
GPT_5_4_TEST_CASE: Final = TranslationTestCase(
|
||||
scenario="basic",
|
||||
litellm_endpoint="/v1/messages",
|
||||
litellm_request={
|
||||
"model": "azure/gpt-5.4",
|
||||
"max_tokens": 64,
|
||||
"system": "You are a terse assistant.",
|
||||
"messages": [{"role": "user", "content": "Say hello."}],
|
||||
"cache": {"no-cache": True},
|
||||
},
|
||||
expected_provider_endpoint="/openai/deployments/gpt-5.4/chat/completions?api-version=2025-04-01-preview",
|
||||
expected_provider_headers={
|
||||
"content-type": "application/json",
|
||||
"api-key": "synthetic-azure-key",
|
||||
"authorization": "Bearer synthetic-azure-key",
|
||||
},
|
||||
expected_provider_request={
|
||||
"messages": [
|
||||
{"role": "system", "content": "You are a terse assistant."},
|
||||
{"role": "user", "content": "Say hello."},
|
||||
],
|
||||
"model": "gpt-5.4",
|
||||
"max_completion_tokens": 64,
|
||||
},
|
||||
mock_provider_response={
|
||||
"choices": [
|
||||
{
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"protected_material_code": {"detected": False, "filtered": False},
|
||||
"protected_material_text": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
"finish_reason": "stop",
|
||||
"index": 0,
|
||||
"logprobs": None,
|
||||
"message": {"annotations": [], "content": "Hello.", "refusal": None, "role": "assistant"},
|
||||
}
|
||||
],
|
||||
"created": 1791231864,
|
||||
"id": "chatcmpl-EVjWSpHSltjjRtiCWAwJpzcB7dyOQ",
|
||||
"model": "gpt-5.4-2026-03-05",
|
||||
"object": "chat.completion",
|
||||
"prompt_filter_results": [
|
||||
{
|
||||
"prompt_index": 0,
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"jailbreak": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"routing": {"serving_pipereplica": "d20260919103649-bf00bd58-default-r2-dp0-default"},
|
||||
"service_tier": "default",
|
||||
"system_fingerprint": None,
|
||||
"usage": {
|
||||
"completion_tokens": 5,
|
||||
"completion_tokens_details": {
|
||||
"accepted_prediction_tokens": 0,
|
||||
"audio_tokens": 0,
|
||||
"reasoning_tokens": 0,
|
||||
"rejected_prediction_tokens": 0,
|
||||
},
|
||||
"latency_checkpoint": {
|
||||
"engine_tbt_ms": 11,
|
||||
"engine_ttft_ms": 84,
|
||||
"engine_ttlt_ms": 152,
|
||||
"pre_inference_ms": 63,
|
||||
"service_tbt_ms": 12,
|
||||
"service_ttft_ms": 516,
|
||||
"service_ttlt_ms": 578,
|
||||
"user_visible_ttft_ms": 453,
|
||||
},
|
||||
"prompt_tokens": 19,
|
||||
"prompt_tokens_details": {"audio_tokens": 0, "cached_tokens": 0},
|
||||
"total_tokens": 24,
|
||||
},
|
||||
},
|
||||
expected_litellm_response={
|
||||
"id": "chatcmpl-EVjWSpHSltjjRtiCWAwJpzcB7dyOQ",
|
||||
"type": "message",
|
||||
"role": "assistant",
|
||||
"model": "azure/gpt-5.4",
|
||||
"stop_sequence": None,
|
||||
"usage": {"input_tokens": 19, "output_tokens": 5},
|
||||
"content": [{"type": "text", "text": "Hello."}],
|
||||
"stop_reason": "end_turn",
|
||||
"stop_details": None,
|
||||
},
|
||||
)
|
||||
|
||||
GPT_5_6_SOL_TEST_CASE: Final = TranslationTestCase(
|
||||
scenario="basic",
|
||||
litellm_endpoint="/v1/messages",
|
||||
litellm_request={
|
||||
"model": "azure/gpt-5.6-sol",
|
||||
"max_tokens": 64,
|
||||
"system": "You are a terse assistant.",
|
||||
"messages": [{"role": "user", "content": "Say hello."}],
|
||||
"cache": {"no-cache": True},
|
||||
},
|
||||
expected_provider_endpoint="/openai/deployments/gpt-5.6-sol/chat/completions?api-version=2025-04-01-preview",
|
||||
expected_provider_headers={
|
||||
"content-type": "application/json",
|
||||
"api-key": "synthetic-azure-key",
|
||||
"authorization": "Bearer synthetic-azure-key",
|
||||
},
|
||||
expected_provider_request={
|
||||
"messages": [
|
||||
{"role": "system", "content": "You are a terse assistant."},
|
||||
{"role": "user", "content": "Say hello."},
|
||||
],
|
||||
"model": "gpt-5.6-sol",
|
||||
"max_completion_tokens": 64,
|
||||
},
|
||||
mock_provider_response={
|
||||
"choices": [
|
||||
{
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"protected_material_code": {"detected": False, "filtered": False},
|
||||
"protected_material_text": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
"finish_reason": "stop",
|
||||
"index": 0,
|
||||
"logprobs": None,
|
||||
"message": {"annotations": [], "content": "Hello.", "refusal": None, "role": "assistant"},
|
||||
}
|
||||
],
|
||||
"created": 1791231865,
|
||||
"id": "chatcmpl-EVjWTALQyI0QnRBpbPzjE9NvDPIJG",
|
||||
"model": "gpt-5.6-sol-2026-07-09",
|
||||
"object": "chat.completion",
|
||||
"prompt_filter_results": [
|
||||
{
|
||||
"prompt_index": 0,
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"jailbreak": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"routing": {"serving_pipereplica": "d20260930154032-380c3f99-prefill-r9-dp0-prefill"},
|
||||
"service_tier": "default",
|
||||
"system_fingerprint": None,
|
||||
"usage": {
|
||||
"completion_tokens": 5,
|
||||
"completion_tokens_details": {
|
||||
"accepted_prediction_tokens": 0,
|
||||
"audio_tokens": 0,
|
||||
"reasoning_tokens": 0,
|
||||
"rejected_prediction_tokens": 0,
|
||||
},
|
||||
"latency_checkpoint": {
|
||||
"engine_tbt_ms": 7,
|
||||
"engine_ttft_ms": 144,
|
||||
"engine_ttlt_ms": 186,
|
||||
"pre_inference_ms": 66,
|
||||
"service_tbt_ms": 4,
|
||||
"service_ttft_ms": 267,
|
||||
"service_ttlt_ms": 286,
|
||||
"user_visible_ttft_ms": 201,
|
||||
},
|
||||
"prompt_tokens": 19,
|
||||
"prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
|
||||
"total_tokens": 24,
|
||||
},
|
||||
},
|
||||
expected_litellm_response={
|
||||
"id": "chatcmpl-EVjWTALQyI0QnRBpbPzjE9NvDPIJG",
|
||||
"type": "message",
|
||||
"role": "assistant",
|
||||
"model": "azure/gpt-5.6-sol",
|
||||
"stop_sequence": None,
|
||||
"usage": {"input_tokens": 19, "output_tokens": 5},
|
||||
"content": [{"type": "text", "text": "Hello."}],
|
||||
"stop_reason": "end_turn",
|
||||
"stop_details": None,
|
||||
},
|
||||
)
|
||||
|
||||
GPT_5_6_LUNA_TEST_CASE: Final = TranslationTestCase(
|
||||
scenario="basic",
|
||||
litellm_endpoint="/v1/messages",
|
||||
litellm_request={
|
||||
"model": "azure/gpt-5.6-luna",
|
||||
"max_tokens": 64,
|
||||
"system": "You are a terse assistant.",
|
||||
"messages": [{"role": "user", "content": "Say hello."}],
|
||||
"cache": {"no-cache": True},
|
||||
},
|
||||
expected_provider_endpoint="/openai/deployments/gpt-5.6-luna/chat/completions?api-version=2025-04-01-preview",
|
||||
expected_provider_headers={
|
||||
"content-type": "application/json",
|
||||
"api-key": "synthetic-azure-key",
|
||||
"authorization": "Bearer synthetic-azure-key",
|
||||
},
|
||||
expected_provider_request={
|
||||
"messages": [
|
||||
{"role": "system", "content": "You are a terse assistant."},
|
||||
{"role": "user", "content": "Say hello."},
|
||||
],
|
||||
"model": "gpt-5.6-luna",
|
||||
"max_completion_tokens": 64,
|
||||
},
|
||||
mock_provider_response={
|
||||
"choices": [
|
||||
{
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"protected_material_code": {"detected": False, "filtered": False},
|
||||
"protected_material_text": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
"finish_reason": "stop",
|
||||
"index": 0,
|
||||
"logprobs": None,
|
||||
"message": {"annotations": [], "content": "Hello!", "refusal": None, "role": "assistant"},
|
||||
}
|
||||
],
|
||||
"created": 1791231867,
|
||||
"id": "chatcmpl-EVjWVHRXX2btCuzlg1wSnpqkpZFQZ",
|
||||
"model": "gpt-5.6-luna-2026-07-09",
|
||||
"object": "chat.completion",
|
||||
"prompt_filter_results": [
|
||||
{
|
||||
"prompt_index": 0,
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"jailbreak": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"routing": {"serving_pipereplica": "d20260925052750-47dc37a0-prefill-r12-dp0-prefill"},
|
||||
"service_tier": "default",
|
||||
"system_fingerprint": None,
|
||||
"usage": {
|
||||
"completion_tokens": 5,
|
||||
"completion_tokens_details": {
|
||||
"accepted_prediction_tokens": 0,
|
||||
"audio_tokens": 0,
|
||||
"reasoning_tokens": 0,
|
||||
"rejected_prediction_tokens": 0,
|
||||
},
|
||||
"latency_checkpoint": {
|
||||
"engine_tbt_ms": 12,
|
||||
"engine_ttft_ms": 64,
|
||||
"engine_ttlt_ms": 138,
|
||||
"pre_inference_ms": 88,
|
||||
"service_tbt_ms": 14,
|
||||
"service_ttft_ms": 248,
|
||||
"service_ttlt_ms": 317,
|
||||
"user_visible_ttft_ms": 159,
|
||||
},
|
||||
"prompt_tokens": 19,
|
||||
"prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
|
||||
"total_tokens": 24,
|
||||
},
|
||||
},
|
||||
expected_litellm_response={
|
||||
"id": "chatcmpl-EVjWVHRXX2btCuzlg1wSnpqkpZFQZ",
|
||||
"type": "message",
|
||||
"role": "assistant",
|
||||
"model": "azure/gpt-5.6-luna",
|
||||
"stop_sequence": None,
|
||||
"usage": {"input_tokens": 19, "output_tokens": 5},
|
||||
"content": [{"type": "text", "text": "Hello!"}],
|
||||
"stop_reason": "end_turn",
|
||||
"stop_details": None,
|
||||
},
|
||||
)
|
||||
|
||||
GPT_6_LUNA_TEST_CASE: Final = TranslationTestCase(
|
||||
scenario="basic",
|
||||
litellm_endpoint="/v1/messages",
|
||||
litellm_request={
|
||||
"model": "azure/gpt-6-luna",
|
||||
"max_tokens": 64,
|
||||
"system": "You are a terse assistant.",
|
||||
"messages": [{"role": "user", "content": "Say hello."}],
|
||||
"cache": {"no-cache": True},
|
||||
},
|
||||
expected_provider_endpoint="/openai/deployments/gpt-6-luna/chat/completions?api-version=2025-04-01-preview",
|
||||
expected_provider_headers={
|
||||
"content-type": "application/json",
|
||||
"api-key": "synthetic-azure-key",
|
||||
"authorization": "Bearer synthetic-azure-key",
|
||||
},
|
||||
expected_provider_request={
|
||||
"messages": [
|
||||
{"role": "system", "content": "You are a terse assistant."},
|
||||
{"role": "user", "content": "Say hello."},
|
||||
],
|
||||
"model": "gpt-6-luna",
|
||||
"max_completion_tokens": 64,
|
||||
},
|
||||
mock_provider_response={
|
||||
"choices": [
|
||||
{
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"protected_material_code": {"detected": False, "filtered": False},
|
||||
"protected_material_text": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
"finish_reason": "stop",
|
||||
"index": 0,
|
||||
"logprobs": None,
|
||||
"message": {"annotations": [], "content": "Hello!", "refusal": None, "role": "assistant"},
|
||||
}
|
||||
],
|
||||
"created": 1791231868,
|
||||
"id": "chatcmpl-EVjWWeBeTmIBg80iLiSeFNeYYY20z",
|
||||
"model": "gpt-6-luna-2026-09-22",
|
||||
"object": "chat.completion",
|
||||
"prompt_filter_results": [
|
||||
{
|
||||
"prompt_index": 0,
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"jailbreak": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"routing": {"serving_pipereplica": "d20260930053954-f91e8c7b-prefill-r6-dp0-prefill"},
|
||||
"service_tier": "default",
|
||||
"system_fingerprint": None,
|
||||
"usage": {
|
||||
"completion_tokens": 5,
|
||||
"completion_tokens_details": {
|
||||
"accepted_prediction_tokens": 0,
|
||||
"audio_tokens": 0,
|
||||
"reasoning_tokens": 0,
|
||||
"rejected_prediction_tokens": 0,
|
||||
},
|
||||
"latency_checkpoint": {
|
||||
"engine_tbt_ms": 3,
|
||||
"engine_ttft_ms": 63,
|
||||
"engine_ttlt_ms": 79,
|
||||
"pre_inference_ms": 81,
|
||||
"service_tbt_ms": 4,
|
||||
"service_ttft_ms": 280,
|
||||
"service_ttlt_ms": 301,
|
||||
"user_visible_ttft_ms": 199,
|
||||
},
|
||||
"prompt_tokens": 19,
|
||||
"prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
|
||||
"total_tokens": 24,
|
||||
},
|
||||
},
|
||||
expected_litellm_response={
|
||||
"id": "chatcmpl-EVjWWeBeTmIBg80iLiSeFNeYYY20z",
|
||||
"type": "message",
|
||||
"role": "assistant",
|
||||
"model": "azure/gpt-6-luna",
|
||||
"stop_sequence": None,
|
||||
"usage": {"input_tokens": 19, "output_tokens": 5},
|
||||
"content": [{"type": "text", "text": "Hello!"}],
|
||||
"stop_reason": "end_turn",
|
||||
"stop_details": None,
|
||||
},
|
||||
)
|
||||
|
||||
GPT_6_1_SOL_TEST_CASE: Final = TranslationTestCase(
|
||||
scenario="basic",
|
||||
litellm_endpoint="/v1/messages",
|
||||
litellm_request={
|
||||
"model": "azure/gpt-6.1-sol",
|
||||
"max_tokens": 64,
|
||||
"system": "You are a terse assistant.",
|
||||
"messages": [{"role": "user", "content": "Say hello."}],
|
||||
"cache": {"no-cache": True},
|
||||
},
|
||||
expected_provider_endpoint="/openai/deployments/gpt-6.1-sol/chat/completions?api-version=2025-04-01-preview",
|
||||
expected_provider_headers={
|
||||
"content-type": "application/json",
|
||||
"api-key": "synthetic-azure-key",
|
||||
"authorization": "Bearer synthetic-azure-key",
|
||||
},
|
||||
expected_provider_request={
|
||||
"messages": [
|
||||
{"role": "system", "content": "You are a terse assistant."},
|
||||
{"role": "user", "content": "Say hello."},
|
||||
],
|
||||
"model": "gpt-6.1-sol",
|
||||
"max_completion_tokens": 64,
|
||||
},
|
||||
mock_provider_response={
|
||||
"choices": [
|
||||
{
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"protected_material_code": {"detected": False, "filtered": False},
|
||||
"protected_material_text": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
"finish_reason": "stop",
|
||||
"index": 0,
|
||||
"logprobs": None,
|
||||
"message": {"annotations": [], "content": "Hello!", "refusal": None, "role": "assistant"},
|
||||
}
|
||||
],
|
||||
"created": 1791231869,
|
||||
"id": "chatcmpl-EVjWXoW5I8J7jZD6gsZ3ONxzOqZ27",
|
||||
"model": "gpt-6.1-sol-2026-09-29",
|
||||
"object": "chat.completion",
|
||||
"prompt_filter_results": [
|
||||
{
|
||||
"prompt_index": 0,
|
||||
"content_filter_results": {
|
||||
"hate": {"filtered": False, "severity": "safe"},
|
||||
"jailbreak": {"detected": False, "filtered": False},
|
||||
"self_harm": {"filtered": False, "severity": "safe"},
|
||||
"sexual": {"filtered": False, "severity": "safe"},
|
||||
"violence": {"filtered": False, "severity": "safe"},
|
||||
},
|
||||
}
|
||||
],
|
||||
"routing": {"serving_pipereplica": "d20260929014647-f3a90410-prefill-r11-dp0-prefill"},
|
||||
"service_tier": "default",
|
||||
"system_fingerprint": None,
|
||||
"usage": {
|
||||
"completion_tokens": 5,
|
||||
"completion_tokens_details": {
|
||||
"accepted_prediction_tokens": 0,
|
||||
"audio_tokens": 0,
|
||||
"reasoning_tokens": 0,
|
||||
"rejected_prediction_tokens": 0,
|
||||
},
|
||||
"latency_checkpoint": {
|
||||
"engine_tbt_ms": 9,
|
||||
"engine_ttft_ms": 477,
|
||||
"engine_ttlt_ms": 530,
|
||||
"pre_inference_ms": 44,
|
||||
"service_tbt_ms": 8,
|
||||
"service_ttft_ms": 795,
|
||||
"service_ttlt_ms": 833,
|
||||
"user_visible_ttft_ms": 750,
|
||||
},
|
||||
"prompt_tokens": 19,
|
||||
"prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
|
||||
"total_tokens": 24,
|
||||
},
|
||||
},
|
||||
expected_litellm_response={
|
||||
"id": "chatcmpl-EVjWXoW5I8J7jZD6gsZ3ONxzOqZ27",
|
||||
"type": "message",
|
||||
"role": "assistant",
|
||||
"model": "azure/gpt-6.1-sol",
|
||||
"stop_sequence": None,
|
||||
"usage": {"input_tokens": 19, "output_tokens": 5},
|
||||
"content": [{"type": "text", "text": "Hello!"}],
|
||||
"stop_reason": "end_turn",
|
||||
"stop_details": None,
|
||||
},
|
||||
)
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
import pytest
|
||||
from integration._support.client import Gateway
|
||||
from integration._support.provider import SharedProvider
|
||||
from integration.translation.case import TranslationTestCase
|
||||
from integration.translation.messages.bases.azure import (
|
||||
GPT_5_4_TEST_CASE,
|
||||
GPT_5_6_LUNA_TEST_CASE,
|
||||
GPT_5_6_SOL_TEST_CASE,
|
||||
GPT_6_1_SOL_TEST_CASE,
|
||||
GPT_6_LUNA_TEST_CASE,
|
||||
)
|
||||
from integration.translation.runner import run
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"case",
|
||||
[
|
||||
GPT_5_4_TEST_CASE,
|
||||
GPT_5_6_SOL_TEST_CASE,
|
||||
GPT_5_6_LUNA_TEST_CASE,
|
||||
GPT_6_LUNA_TEST_CASE,
|
||||
GPT_6_1_SOL_TEST_CASE,
|
||||
],
|
||||
ids=lambda case: case.id,
|
||||
)
|
||||
def test_messages_basic_azure(case: TranslationTestCase, gateway: Gateway, provider: SharedProvider) -> None:
|
||||
run(case, gateway, provider)
|
||||
1049
tests/integration/translation/responses/bases/azure.py
Normal file
1049
tests/integration/translation/responses/bases/azure.py
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,27 @@
|
|||
import pytest
|
||||
from integration._support.client import Gateway
|
||||
from integration._support.provider import SharedProvider
|
||||
from integration.translation.case import TranslationTestCase
|
||||
from integration.translation.responses.bases.azure import (
|
||||
GPT_5_4_TEST_CASE,
|
||||
GPT_5_6_LUNA_TEST_CASE,
|
||||
GPT_5_6_SOL_TEST_CASE,
|
||||
GPT_6_1_SOL_TEST_CASE,
|
||||
GPT_6_LUNA_TEST_CASE,
|
||||
)
|
||||
from integration.translation.runner import run
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"case",
|
||||
[
|
||||
GPT_5_4_TEST_CASE,
|
||||
GPT_5_6_SOL_TEST_CASE,
|
||||
GPT_5_6_LUNA_TEST_CASE,
|
||||
GPT_6_LUNA_TEST_CASE,
|
||||
GPT_6_1_SOL_TEST_CASE,
|
||||
],
|
||||
ids=lambda case: case.id,
|
||||
)
|
||||
def test_responses_basic_azure(case: TranslationTestCase, gateway: Gateway, provider: SharedProvider) -> None:
|
||||
run(case, gateway, provider)
|
||||
|
|
@ -15,7 +15,11 @@ def run(case: TranslationTestCase, gateway: Gateway, provider: SharedProvider) -
|
|||
received: Final = provider.received()
|
||||
assert [(request.method, request.target) for request in received] == [("POST", case.expected_provider_endpoint)]
|
||||
sent: Final = received[0]
|
||||
assert {name: value for name, value in sent.headers.items() if name not in TRANSPORT_HEADERS} == dict(case.expected_provider_headers)
|
||||
assert {
|
||||
name: value
|
||||
for name, value in sent.headers.items()
|
||||
if name not in TRANSPORT_HEADERS and not name.startswith("x-stainless-")
|
||||
} == dict(case.expected_provider_headers)
|
||||
assert json.loads(sent.body) == case.expected_provider_request
|
||||
assert response.status_code == case.expected_litellm_status_code, response.text
|
||||
assert response.json() == case.expected_litellm_response
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue