litellm/tests/llm_translation
Javier de la Torre df232a71f1 feat(snowflake): add function calling support for Snowflake Cortex REST API
Add support for function calling (tools) with Snowflake Cortex models that support it (e.g., Claude 3.5 Sonnet).

Changes:
- Add 'tools' and 'tool_choice' to supported OpenAI parameters
- Implement request transformation: OpenAI function format → Snowflake tool_spec format
- Implement response transformation: Snowflake content_list with tool_use → OpenAI tool_calls
- Add tool_choice transformation: OpenAI nested format → Snowflake array format

Request transformation:
- Transform tools from nested {"type": "function", "function": {...}} to Snowflake's {"tool_spec": {"type": "generic", "name": "...", "input_schema": {...}}}
- Transform tool_choice from {"type": "function", "function": {"name": "..."}} to {"type": "tool", "name": ["..."]}

Response transformation:
- Parse Snowflake's content_list array containing tool_use objects
- Extract tool calls with tool_use_id, name, and input
- Convert to OpenAI's tool_calls format with proper JSON serialization

Testing:
- Add 7 unit tests covering request/response transformations
- Add integration test for Responses API with tool calling
- All tests passing

Fixes issue #15218

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-05 13:08:33 +02:00
..
test_llm_response_utils
base_audio_transcription_unit_tests.py fix: use fastuuid helper (#14903) 2025-09-25 15:47:01 -07:00
base_embedding_unit_tests.py
base_llm_unit_tests.py fix: use fastuuid helper (#14903) 2025-09-25 15:47:01 -07:00
base_rerank_unit_tests.py [Feat] Add Nvidia NIM Rerank Support (#15152) 2025-10-02 18:58:52 -07:00
conftest.py [Perf] Improvements for Async Success Handler (Logging Callbacks) - Approx +130 RPS (#13905) 2025-08-23 13:13:23 -07:00
dog.wav
duck.png
gettysburg.wav
guinea.png
log.xt
Readme.md
test_aiohttp_openai.py
test_anthropic_completion.py [Feat] Add new anthropic web fetch tool support (#14951) 2025-09-26 11:04:11 -07:00
test_aws_base_llm.py Add support for AWS assume_role with a session token 2025-08-23 22:37:21 -07:00
test_azure_ai.py test_completion_azure 2025-09-27 22:44:46 -07:00
test_azure_o_series.py
test_azure_openai.py test fix 2025-09-27 12:40:34 -07:00
test_bedrock_agents.py test: skip test with invalid arn 2025-09-09 20:35:44 -07:00
test_bedrock_completion.py Added vertex_ai/qwen models and azure/gpt-5-codex (#14844) 2025-09-24 10:40:00 -07:00
test_bedrock_dynamic_auth_params_unit_tests.py Add comprehensive tests for AWS external ID support 2025-09-15 19:56:31 +02:00
test_bedrock_embedding.py test bedrock embedding tests marengo 2025-10-04 11:27:29 -07:00
test_bedrock_govcloud.py
test_bedrock_gpt_oss.py test_completion_cost 2025-09-27 22:43:51 -07:00
test_bedrock_invoke_tests.py
test_bedrock_llama.py
test_bedrock_nova_json.py
test_clarifai_completion.py
test_cloudflare.py
test_cohere.py fix: test_cohere_request_body_with_allowed_params 2025-09-18 10:56:45 -07:00
test_convert_dict_to_image.py
test_databricks.py
test_deepgram.py
test_deepseek_completion.py
test_elevenlabs.py
test_fireworks_ai_translation.py [LLM Translation] Fix Realtime API endpoint for no intent (#13476) 2025-08-14 16:24:14 -07:00
test_gemini.py test_gemini_url_context 2025-10-04 12:23:43 -07:00
test_gpt4o_audio.py
test_groq.py fix contributor PR linting failing (#14710) 2025-09-18 20:03:27 -07:00
test_huggingface_chat_completion.py
test_hyperbolic.py
test_infinity.py
test_jina_ai.py
test_lambda_ai.py [Performance] Use O(1) Set lookups for model routing (#13879) 2025-08-21 22:56:46 -07:00
test_litellm_proxy_provider.py [Bug Fix] image_edit() function returns APIConnectionError with litellm_proxy - Support for both image edits and image generations (#13735) 2025-08-18 18:26:32 -07:00
test_mistral_api.py test: reduce mistral direct tests b/c of rate limit errors 2025-08-23 11:15:03 -07:00
test_morph.py
test_nvidia_nim.py [Feat] Add Nvidia NIM Rerank Support (#15152) 2025-10-02 18:58:52 -07:00
test_openai_o1.py
test_openai_realtime.py [LLM Translation] Fix Realtime API endpoint for no intent (#13476) 2025-08-14 16:24:14 -07:00
test_openai.py test: update test 2025-09-09 20:18:03 -07:00
test_openrouter.py feat(openrouter.py): add image generation via google on openrouter support 2025-09-01 18:39:41 -07:00
test_optional_params.py fix: resolve invalid model name error for Gemini Imagen models (#13851) 2025-08-27 04:17:35 +02:00
test_perplexity_reasoning.py
test_prompt_caching.py
test_prompt_factory.py fix: ensure Gemini calls include a user message (fixes #9733) 2025-08-29 20:41:58 +03:00
test_rerank.py test_rerank_custom_callbacks 2025-09-20 16:27:58 -07:00
test_router_llm_translation_tests.py
test_snowflake.py feat(snowflake): add function calling support for Snowflake Cortex REST API 2025-10-05 13:08:33 +02:00
test_text_completion_unit_tests.py
test_text_completion.py
test_together_ai.py
test_triton.py
test_unit_test_bedrock_invoke.py
test_v0.py
test_voyage_ai.py Add support for voyage-context-3 embedding model 2025-08-22 00:15:12 +05:30
test_watsonx.py
test_xai.py [Bug]: grok-4 does not support frequency_penalty, litellm should drop this param for grok-4 (#14078) 2025-08-29 17:31:48 -07:00

Unit tests for individual LLM providers.

Name of the test file is the name of the LLM provider - e.g. test_openai.py is for OpenAI.