mirror of
https://github.com/BerriAI/litellm.git
synced 2026-12-04 01:48:57 +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>
223 lines
14 KiB
Python
223 lines
14 KiB
Python
from typing import Final
|
||
|
||
from integration.translation.case import TranslationTestCase
|
||
from integration.translation.messages.templates import MESSAGES_BRIDGE_RESPONSE, MESSAGES_REQUEST
|
||
from integration.translation.templates.openai import OPENAI_RESPONSES_REQUEST_FROM_MESSAGES, OPENAI_RESPONSES_RESPONSE
|
||
|
||
GPT_5_6_SOL_TEST_CASE: Final = TranslationTestCase(
|
||
scenario="basic",
|
||
litellm_endpoint="/v1/messages",
|
||
litellm_request={
|
||
"model": "openai/responses/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="/responses",
|
||
expected_provider_headers={"authorization": "Bearer synthetic-openai-key", "content-type": "application/json"},
|
||
expected_provider_request={
|
||
"model": "gpt-5.6-sol",
|
||
"input": [{"type": "message", "role": "user", "content": [{"type": "input_text", "text": "Say hello."}]}],
|
||
"include": ["reasoning.encrypted_content"],
|
||
"instructions": "You are a terse assistant.",
|
||
"max_output_tokens": 64,
|
||
},
|
||
mock_provider_response={
|
||
"id": "resp_0879800c1455ba3d006ac3f0427c4c87d0a632b130c8c464ea",
|
||
"object": "response",
|
||
"created_at": 1791225922,
|
||
"status": "completed",
|
||
"access_programs": {"cyber": "daybreak_blue"},
|
||
"background": False,
|
||
"billing": {"payer": "developer"},
|
||
"completed_at": 1791225923,
|
||
"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_0879800c1455ba3d006ac3f0430f2087d0bcdc00a8eba6a1ce",
|
||
"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": "resp_bGl0ZWxsbTpjdXN0b21fbGxtX3Byb3ZpZGVyOm9wZW5haTttb2RlbF9pZDo1ZDQ1NmY1ODlhMDIwNzI4N2M0YzU2NmRhN2NkN2ViNjJlMzZmNGUwMTYxOTE4M2VhMzhiMzdlZGZhNDdlM2EwO3Jlc3BvbnNlX2lkOnJlc3BfMDg3OTgwMGMxNDU1YmEzZDAwNmFjM2YwNDI3YzRjODdkMGE2MzJiMTMwYzhjNDY0ZWE=",
|
||
"type": "message",
|
||
"role": "assistant",
|
||
"model": "openai/responses/gpt-5.6-sol",
|
||
"stop_sequence": None,
|
||
"usage": {"input_tokens": 19, "output_tokens": 6},
|
||
"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={**MESSAGES_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_FROM_MESSAGES, "model": "gpt-6.1-sol"},
|
||
mock_provider_response={
|
||
**OPENAI_RESPONSES_RESPONSE,
|
||
"model": "gpt-6.1-sol",
|
||
"id": "resp_0af67cb78bead2c6006ad023a7273487d0b1768b77f6956b73",
|
||
"created_at": 1792025511,
|
||
"completed_at": 1792025514,
|
||
"instructions": (
|
||
"You help maintain a synthetic Python project. Read the relevant files before suggesting a fix. "
|
||
"Explain which file you need next, then call a read-only tool. Never change files. Use the "
|
||
"messages client for this project review. Consider zero, negative and non-integer quantities "
|
||
"before choosing the next file to inspect."
|
||
),
|
||
"output": [
|
||
{
|
||
"id": "rs_0af67cb78bead2c6006ad023a85d5c87d0810de0f56bf80208",
|
||
"type": "reasoning",
|
||
"content": [],
|
||
"encrypted_content": "gAAAAABq0COqmCc2HPj-8NSt1bzfstH4-YXiTtNvZLyVMciprSqFmNbPXwcPXWrps8lsryqoAY5MuRQ_pO9yNIsCVBRlHXitSdObtJRB5Ld7TGQnbUekIsl2TNIFPsnnc8PYSdVrJlcG3FZmykyeSVHbl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WGandVEze8K7p4wQr3gSL5zlepjWHeYPZjiXCnGY=",
|
||
"summary": [],
|
||
},
|
||
{
|
||
"id": "msg_0af67cb78bead2c6006ad023a9b1e487d09ad5bb0d5cc96bde",
|
||
"type": "message",
|
||
"status": "completed",
|
||
"content": [
|
||
{
|
||
"type": "output_text",
|
||
"annotations": [],
|
||
"logprobs": [],
|
||
"text": "I’ll read `shop/validation.py` first to check how it handles zero, "
|
||
"negative, and non-integer quantities.",
|
||
}
|
||
],
|
||
"phase": "commentary",
|
||
"role": "assistant",
|
||
},
|
||
{
|
||
"id": "fc_0af67cb78bead2c6006ad023aa22c487d0b76512608a221ae3",
|
||
"type": "function_call",
|
||
"status": "completed",
|
||
"arguments": '{"path":"shop/validation.py","start_line":1,"end_line":200}',
|
||
"call_id": "call_H6dablHqZFScV63Y29mQXJvf",
|
||
"name": "read_file",
|
||
},
|
||
],
|
||
"tools": [
|
||
{
|
||
"type": "function",
|
||
"description": "Search source and test files for a literal term.",
|
||
"name": "search_files",
|
||
"output_schema": None,
|
||
"parameters": {
|
||
"type": "object",
|
||
"properties": {
|
||
"query": {"type": "string"},
|
||
"paths": {"type": "array", "items": {"type": "string"}},
|
||
},
|
||
"required": ["query", "paths"],
|
||
"additionalProperties": False,
|
||
},
|
||
"strict": False,
|
||
},
|
||
{
|
||
"type": "function",
|
||
"description": "Read a range of lines from a project file.",
|
||
"name": "read_file",
|
||
"output_schema": None,
|
||
"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": False,
|
||
},
|
||
],
|
||
"usage": {
|
||
"input_tokens": 309,
|
||
"input_tokens_details": {"cache_write_tokens": 0, "cached_tokens": 0},
|
||
"output_tokens": 140,
|
||
"output_tokens_details": {"reasoning_tokens": 75},
|
||
"total_tokens": 449,
|
||
},
|
||
},
|
||
expected_litellm_response={
|
||
**MESSAGES_BRIDGE_RESPONSE,
|
||
"id": "resp_bGl0ZWxsbTpjdXN0b21fbGxtX3Byb3ZpZGVyOm9wZW5haTttb2RlbF9pZDo3ZGE3NDY3Njc3N2IyZjVkYmQ3MDI1MTI1ZjEzMDdlYWQ0MjM3YTgzN2QxZTJmZDhkY2FkNjhlODM4ODU1Zjg2O3Jlc3BvbnNlX2lkOnJlc3BfMGFmNjdjYjc4YmVhZDJjNjAwNmFkMDIzYTcyNzM0ODdkMGIxNzY4Yjc3ZjY5NTZiNzM=",
|
||
"model": "openai/responses/gpt-6.1-sol",
|
||
"usage": {"input_tokens": 309, "output_tokens": 140},
|
||
"content": [
|
||
{
|
||
"type": "redacted_thinking",
|
||
"data": "litellm_encrypted_reasoning:gAAAAABq0COqmCc2HPj-8NSt1bzfstH4-YXiTtNvZLyVMciprSqFmNbPXwcPXWrps8lsryqoAY5MuRQ_pO9yNIsCVBRlHXitSdObtJRB5Ld7TGQnbUekIsl2TNIFPsnnc8PYSdVrJlcG3FZmykyeSVHblM5F9SaPzHFzOfvCdYQtN52yt2lPhjYailjRidMwkl4KDGQ1BlcR3U29KKxo0020AqMMvsAht5kx5aAFaKfaIum5jctQrjgL8Y99h6sV3gc3LwI0W6ZR2IIqs6e6ADrVIGdVmSpn2GZTHmz6vUFaROU2-UTbVL7QrCy0BUg5CEqjnZ563lqsEYuWOxTVK0RXCPonWwmhfSllKffjLxtGuaq4dtl6v3lGIt-BW3-gJ1WqhtfTDV5VWTAliJhx09kgGhXz7VuxQRQMBSy--M9nBhdNJ1KfkbC0YDUcq5LT_cKh-KZU_-jNWCSQa7hvNJP-aCQ85oL-av-9fT5Wb5ovLUzELiBDooQLH8SalXQgFo-GX_wvSF-IH7byXwCka0F9fyIW6FjmRkirX8h_WF7pLDJeZDO5_8BWbxGOxDI6hEURHW9HLGG-e8S_lp1cVc7i37r-3KNqOwVlnlxEn2hj9TmDvTxRk4yv71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uKHkeiFdZs6EMytIwz6lPGKLhYii6HW0Oe0KU_WQrIVNdXMcs5EWZGqMIdEhf09ZpO3ONcWIYswjgng6W8WMqwplHyHMcjnhzaVbIhs6rsVgTwGJawtbmD5q6aYnJCRq4zI68wzKOe7d6av8jwMGZS-dd8cdHj_XyShws1cWLhLJCaGW_vHKA0i-D1WTDeKSev31IQKCXBSRMB5URPkHu6dNDm1UyDiLGlJBx6iuKTizGeGhb4o2SQ1y1ISKyQRhKuNih0XgY40hn4x-6Scqu6_thPey-4F32BeTnbzNLGQ0wXE--dcIVRbAZMEB7wn7V4mRczG4gTG9ZnqarfZnHMPVUTZ0AxxZ2d_ifef1wQv9aRyKNRVLiBxvSqJtu7NnDMZT_U8mXCc_OIREi9wn-6esDbmxYYeBpNPR6Oq0fbsBbr--A_nVUz99MAAvkSnLhV3zdAHmMgjqNJNCmr2kPtGyle-GqdBx0LYQh4mtc5FdqLZUz9dz6gv_ERua952na3S1UnJr__8zVwofLEPGjiC5_g1nQuVCRE3QVSufMmw4gQL5kdUSuZGEm3RN__6DwAIS_X-E-aBv3utOMs92JWGandVEze8K7p4wQr3gSL5zlepjWHeYPZjiXCnGY=",
|
||
},
|
||
{
|
||
"type": "text",
|
||
"text": "I’ll read `shop/validation.py` first to check how it handles zero, "
|
||
"negative, and non-integer quantities.",
|
||
},
|
||
{
|
||
"type": "tool_use",
|
||
"id": "call_H6dablHqZFScV63Y29mQXJvf",
|
||
"name": "read_file",
|
||
"input": {"path": "shop/validation.py", "start_line": 1, "end_line": 200},
|
||
},
|
||
],
|
||
},
|
||
)
|