mirror of
https://github.com/BerriAI/litellm.git
synced 2026-12-02 01:28:38 +00:00
* test(integration): add rich anthropic claude haiku 5.5, opus 5.5 and fable 5.1 translation cases Capture-backed basic cases on /v1/chat/completions, /v1/messages and /v1/responses for claude-haiku-5-5, claude-opus-5-5 and claude-fable-5-1, reusing the shared client templates and ANTHROPIC_MESSAGES_REQUEST/RESPONSE with model-specific id, content and usage overrides. The minimal Opus 5.5 hello cases are replaced by the rich conversation. Sonnet 5.5 and legacy models are unchanged * test(translation): rich OpenAI captures for gpt-6.1-sol, gpt-6-luna, gpt-6-astra and gpt-5.6-terra Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(translation): rich Azure gpt-6.1-sol, gpt-6-luna, gpt-6-astra and gpt-5.6-terra cases * test(translation): rich azure_ai Claude cases for haiku-5-5 and fable-5-1 Bind the shared chat_completions, messages and responses client templates and the anthropic provider templates to azure_ai/claude-haiku-5-5 and azure_ai/claude-fable-5-1 from real Azure AI Foundry captures, keeping the Azure dialect exact (/anthropic/v1/messages, x-api-key plus api-key on chat_completions and responses, system as a text block list on /v1/messages). Add prompt_cache_hit variants for both models from the second call inside the cache window. The two deployments need rows in tests/integration/proxy_config.yaml Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(translation): rich Gemini bases for gemini-3.8-flash, gemini-3.1-pro-preview and gemini-4-argon Add the shared generateContent provider templates in templates/gemini.py from real captures and bind the three target models on chat completions, messages and responses with explicit per-model response overrides. gemini-4-argon is registered in the three basic lists. gemini-3.5-flash is unchanged * test(translation): enrich vertex_ai claude and gemini cases from live captures Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(integration): rich Bedrock converse, invoke and mantle translation cases from real captures * test(integration): register the rich translation deployments and follow the rich Gemini 3.8 Flash cases Add the synthetic deployments the rich provider cases bind (anthropic, openai, azure, azure_ai, gemini, vertex_ai, bedrock converse, invoke and mantle) to tests/integration/proxy_config.yaml, all pointed at the fake provider on 127.0.0.1:8191 with synthetic keys. The Gemini omitted-temperature contract now takes its expected generationConfig and reply text from the rich GEMINI_3_8_FLASH_TEST_CASE literals instead of the retired minimal hello cases * test(translation): reuse bridged and native response templates --------- Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: kerry <kerry@berri.ai>
300 lines
13 KiB
Python
300 lines
13 KiB
Python
from typing import Final
|
||
from unittest.mock import ANY
|
||
|
||
from integration.translation.case import TranslationTestCase
|
||
from integration.translation.responses.templates import RESPONSES_NATIVE_RESPONSE, RESPONSES_REQUEST
|
||
from integration.translation.templates.openai import OPENAI_RESPONSES_REQUEST, OPENAI_RESPONSES_RESPONSE
|
||
|
||
GPT_5_6_SOL_TEST_CASE: Final = TranslationTestCase(
|
||
scenario="basic",
|
||
litellm_endpoint="/v1/responses",
|
||
litellm_request={
|
||
"model": "openai/responses/gpt-5.6-sol",
|
||
"max_output_tokens": 64,
|
||
"instructions": "You are a terse assistant.",
|
||
"input": "Say hello.",
|
||
"cache": {"no-cache": True},
|
||
},
|
||
expected_provider_endpoint="/responses",
|
||
expected_provider_headers={"authorization": "Bearer synthetic-openai-key", "content-type": "application/json"},
|
||
expected_provider_request={
|
||
"model": "gpt-5.6-sol",
|
||
"input": "Say hello.",
|
||
"instructions": "You are a terse assistant.",
|
||
"max_output_tokens": 64,
|
||
},
|
||
mock_provider_response={
|
||
"id": "resp_0691e5d81d357aec006ac3f045381487d0904424fd18d4adfb",
|
||
"object": "response",
|
||
"created_at": 1791225925,
|
||
"status": "completed",
|
||
"access_programs": {"cyber": "daybreak_blue"},
|
||
"background": False,
|
||
"billing": {"payer": "developer"},
|
||
"completed_at": 1791225926,
|
||
"error": None,
|
||
"frequency_penalty": 0.0,
|
||
"incomplete_details": None,
|
||
"instructions": "You are a terse assistant.",
|
||
"max_output_tokens": 64,
|
||
"max_tool_calls": None,
|
||
"model": "gpt-5.6-sol",
|
||
"moderation": None,
|
||
"output": [
|
||
{
|
||
"id": "msg_0691e5d81d357aec006ac3f04611ac87d081b8e4e32967101d",
|
||
"type": "message",
|
||
"status": "completed",
|
||
"content": [{"type": "output_text", "annotations": [], "logprobs": [], "text": "Hello."}],
|
||
"phase": "final_answer",
|
||
"role": "assistant",
|
||
}
|
||
],
|
||
"parallel_tool_calls": True,
|
||
"presence_penalty": 0.0,
|
||
"previous_response_id": None,
|
||
"prompt_cache_key": None,
|
||
"prompt_cache_retention": "24h",
|
||
"reasoning": {"context": "all_turns", "effort": "medium", "mode": "standard", "summary": None},
|
||
"safety_identifier": None,
|
||
"service_tier": "default",
|
||
"store": True,
|
||
"temperature": 1.0,
|
||
"text": {"format": {"type": "text"}, "verbosity": "medium"},
|
||
"tool_choice": "auto",
|
||
"tool_usage": {
|
||
"image_gen": {
|
||
"input_tokens": 0,
|
||
"input_tokens_details": {"image_tokens": 0, "text_tokens": 0},
|
||
"output_tokens": 0,
|
||
"output_tokens_details": {"image_tokens": 0, "text_tokens": 0},
|
||
"total_tokens": 0,
|
||
},
|
||
"web_search": {"num_requests": 0},
|
||
},
|
||
"tools": [],
|
||
"top_logprobs": 0,
|
||
"top_p": 0.98,
|
||
"truncation": "disabled",
|
||
"usage": {
|
||
"input_tokens": 19,
|
||
"input_tokens_details": {"cache_write_tokens": 0, "cached_tokens": 0},
|
||
"output_tokens": 6,
|
||
"output_tokens_details": {"reasoning_tokens": 0},
|
||
"total_tokens": 25,
|
||
},
|
||
"user": None,
|
||
"metadata": {},
|
||
},
|
||
expected_litellm_response={
|
||
"id": ANY,
|
||
"created_at": 1791225925,
|
||
"error": None,
|
||
"incomplete_details": None,
|
||
"instructions": "You are a terse assistant.",
|
||
"metadata": {},
|
||
"model": "openai/responses/gpt-5.6-sol",
|
||
"object": "response",
|
||
"output": [
|
||
{
|
||
"id": "msg_0691e5d81d357aec006ac3f04611ac87d081b8e4e32967101d",
|
||
"content": [{"annotations": [], "text": "Hello.", "type": "output_text", "logprobs": []}],
|
||
"role": "assistant",
|
||
"status": "completed",
|
||
"type": "message",
|
||
"phase": "final_answer",
|
||
}
|
||
],
|
||
"parallel_tool_calls": True,
|
||
"temperature": 1.0,
|
||
"tool_choice": "auto",
|
||
"tools": [],
|
||
"top_p": 0.98,
|
||
"max_output_tokens": 64,
|
||
"previous_response_id": None,
|
||
"reasoning": {"context": "all_turns", "effort": "medium", "mode": "standard", "summary": None},
|
||
"status": "completed",
|
||
"text": {"format": {"type": "text"}, "verbosity": "medium"},
|
||
"truncation": "disabled",
|
||
"usage": {
|
||
"input_tokens": 19,
|
||
"input_tokens_details": {
|
||
"audio_tokens": None,
|
||
"cached_tokens": 0,
|
||
"cached_tokens_details": None,
|
||
"image_tokens": None,
|
||
"text_tokens": None,
|
||
"video_tokens": None,
|
||
"cache_write_tokens": 0,
|
||
},
|
||
"output_tokens": 6,
|
||
"output_tokens_details": {"audio_tokens": None, "reasoning_tokens": 0, "text_tokens": None},
|
||
"total_tokens": 25,
|
||
"cost": None,
|
||
},
|
||
"user": None,
|
||
"store": True,
|
||
"access_programs": {"cyber": "daybreak_blue"},
|
||
"background": False,
|
||
"billing": {"payer": "developer"},
|
||
"completed_at": 1791225926,
|
||
"frequency_penalty": 0.0,
|
||
"max_tool_calls": None,
|
||
"moderation": None,
|
||
"presence_penalty": 0.0,
|
||
"prompt_cache_key": None,
|
||
"prompt_cache_retention": "24h",
|
||
"safety_identifier": None,
|
||
"service_tier": "default",
|
||
"tool_usage": {
|
||
"image_gen": {
|
||
"input_tokens": 0,
|
||
"input_tokens_details": {"image_tokens": 0, "text_tokens": 0},
|
||
"output_tokens": 0,
|
||
"output_tokens_details": {"image_tokens": 0, "text_tokens": 0},
|
||
"total_tokens": 0,
|
||
},
|
||
"web_search": {"num_requests": 0},
|
||
},
|
||
"top_logprobs": 0,
|
||
},
|
||
)
|
||
|
||
GPT_6_1_SOL_TEST_CASE: Final = TranslationTestCase(
|
||
scenario="basic",
|
||
litellm_endpoint="/v1/responses",
|
||
litellm_request={**RESPONSES_REQUEST, "model": "openai/responses/gpt-6.1-sol"},
|
||
expected_provider_endpoint="/responses",
|
||
expected_provider_headers={
|
||
"content-type": "application/json",
|
||
"authorization": "Bearer synthetic-openai-key",
|
||
},
|
||
expected_provider_request={**OPENAI_RESPONSES_REQUEST, "model": "gpt-6.1-sol"},
|
||
mock_provider_response={
|
||
**OPENAI_RESPONSES_RESPONSE,
|
||
"model": "gpt-6.1-sol",
|
||
},
|
||
expected_litellm_response={
|
||
**RESPONSES_NATIVE_RESPONSE,
|
||
"id": ANY,
|
||
"created_at": 1792025514,
|
||
"model": "openai/responses/gpt-6.1-sol",
|
||
"output": [
|
||
{
|
||
"id": "rs_0207c20ae125feee006ad023abed4087d09d32a32ad2d3182c",
|
||
"summary": [],
|
||
"type": "reasoning",
|
||
"content": [],
|
||
"encrypted_content": "gAAAAABq0COvx3R_lOOaYJijiIokUKBq9tt_p3mhoPHnm4KR0Pj_t0wf1sP7WEDHfYSzylhHilYoKjU4guIz-TAqBV6HNUpIx5ggp3aukKEW6zks2ERT3a40sCFFdUdKHk6py5trFuwYn6lHLwifwDkd7rI7MKIP7C7pZSHnXh8cmfk0t96p4nBplQ93C4m917Kyx6PqvWSxPP78h5s_RMEdhkWRU20xMhminpIBNArOkPYT4xsmBEuONlndM5-DHG7ZeLk2yMZw8b_hxk2LZ4mC66b5RHfJKVKfw4egn4K8tkr8mQSR4bnjpY56DsIRj4fjSH5GpoDZyolFFBh1BNkGMoVsicye_4gZn0eELuOWxCw7lVVsMpIzTLw8CHJkCo_8vKtNCFSZcKjOPKDDfX1bsFJ7LMonmqijHPV_kZi_YXjVNNJBhJLiGjYrVUFZzjS0OKQx-RnZf5luO3UM2Ff3Ilvx1eQtuWlsvJjPBRwObzk5zlPEdYwoh5OjUREbgGb4H71Q7A9YYjUIms2h5e13Z5s8X0onRVr9SUcSbbMA0FXWn6QGQ5qgiQV56xec7xk62SrxKBXeILgBttBf68YfLAbdINCPL89G5Z1X2toQLlFM7e0jKYUOvSmpW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GKKMKSryH3BqP6X7d0kdUcAx-nd5yudVbePQyc-UC7EbISj5QXY8g6cTOy-IkwpBe68DvfcNGIhuaH6UscqrewXQjKZFJC_BJSl-ICOfMw-FCTumzCDXPqTeLBPHf1g5kd5lBd6HLPUldHtJfD48V12KCRtaoksZ4g2NibuClnmZRpnDMPDUr7r_D8-RfoLEiJeh8SbOSnLvMPVAJIB95F73B-UX5u0e0aWeyfG5QjBq-kB7vVGsRiMyHEVQW810xo2qULVIyVO03s7rAWwTxFY-EHmKkaAIbKU2b-qAasytni7f1Aq61OSIYqSCRdFhpUX6HpnQeCFC_s6_Q9P3CFx120ZaTB_HPeRJO6dhVSJ3nL3PiNi8sCnhRiNIXkJfm9l1TxRS8ok9s1NY8oi4Y98J4Ay52EkX6f9F9FtWHNu4GX_Z50jDNnVTVqQo3L3slpwxECsTAEU-0MsmIa-1RqJ00VqBLKtIDVbbnQ==",
|
||
},
|
||
{
|
||
"id": "msg_0207c20ae125feee006ad023ade23487d093e272f84cb35723",
|
||
"content": [
|
||
{
|
||
"annotations": [],
|
||
"text": "I’ll read `shop/validation.py` first to check how it handles "
|
||
"zero, negative, and non-integer quantities.",
|
||
"type": "output_text",
|
||
"logprobs": [],
|
||
}
|
||
],
|
||
"role": "assistant",
|
||
"status": "completed",
|
||
"type": "message",
|
||
"phase": "commentary",
|
||
},
|
||
{
|
||
"arguments": '{"path":"shop/validation.py","start_line":1,"end_line":200}',
|
||
"call_id": "call_S4WtfrQwa6ZLEUZf1BVtA8ON",
|
||
"name": "read_file",
|
||
"type": "function_call",
|
||
"id": "fc_0207c20ae125feee006ad023ae893c87d08068561e36e665ad",
|
||
"namespace": None,
|
||
"status": "completed",
|
||
},
|
||
],
|
||
"parallel_tool_calls": True,
|
||
"temperature": 1.0,
|
||
"tools": [
|
||
{
|
||
"name": "search_files",
|
||
"parameters": {
|
||
"type": "object",
|
||
"properties": {
|
||
"query": {"type": "string"},
|
||
"paths": {"type": "array", "items": {"type": "string"}},
|
||
},
|
||
"required": ["query", "paths"],
|
||
"additionalProperties": False,
|
||
},
|
||
"strict": True,
|
||
"type": "function",
|
||
"defer_loading": None,
|
||
"description": "Search source and test files for a literal term.",
|
||
"output_schema": None,
|
||
},
|
||
{
|
||
"name": "read_file",
|
||
"parameters": {
|
||
"type": "object",
|
||
"properties": {
|
||
"path": {"type": "string"},
|
||
"start_line": {"type": "integer", "minimum": 1},
|
||
"end_line": {"type": "integer", "minimum": 1},
|
||
},
|
||
"required": ["path", "start_line", "end_line"],
|
||
"additionalProperties": False,
|
||
},
|
||
"strict": True,
|
||
"type": "function",
|
||
"defer_loading": None,
|
||
"description": "Read a range of lines from a project file.",
|
||
"output_schema": None,
|
||
},
|
||
],
|
||
"top_p": 0.98,
|
||
"reasoning": {"context": "all_turns", "effort": "high", "mode": "standard", "summary": None},
|
||
"text": {"format": {"type": "text"}, "verbosity": "medium"},
|
||
"truncation": "disabled",
|
||
"usage": {
|
||
"input_tokens": 309,
|
||
"input_tokens_details": {
|
||
"audio_tokens": None,
|
||
"cached_tokens": 0,
|
||
"cached_tokens_details": None,
|
||
"image_tokens": None,
|
||
"text_tokens": None,
|
||
"video_tokens": None,
|
||
"cache_write_tokens": 0,
|
||
},
|
||
"output_tokens": 118,
|
||
"output_tokens_details": {"audio_tokens": None, "reasoning_tokens": 53, "text_tokens": None},
|
||
"total_tokens": 427,
|
||
"cost": None,
|
||
},
|
||
"store": True,
|
||
"access_programs": None,
|
||
"background": False,
|
||
"billing": {"payer": "developer"},
|
||
"completed_at": 1792025519,
|
||
"frequency_penalty": 0.0,
|
||
"max_tool_calls": None,
|
||
"moderation": None,
|
||
"presence_penalty": 0.0,
|
||
"prompt_cache_key": None,
|
||
"prompt_cache_retention": "24h",
|
||
"safety_identifier": None,
|
||
"service_tier": "default",
|
||
"tool_usage": {
|
||
"image_gen": {
|
||
"input_tokens": 0,
|
||
"input_tokens_details": {"image_tokens": 0, "text_tokens": 0},
|
||
"output_tokens": 0,
|
||
"output_tokens_details": {"image_tokens": 0, "text_tokens": 0},
|
||
"total_tokens": 0,
|
||
},
|
||
"web_search": {"num_requests": 0},
|
||
},
|
||
"top_logprobs": 0,
|
||
},
|
||
)
|