From 975612482bbe6351f4359af1176b52329da495ac Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Wed, 20 May 2026 16:10:47 -0700 Subject: [PATCH] docs: add comprehensive docstring to _should_allow_input_examples function - Add detailed documentation explaining the function's purpose - Include parameter descriptions with types - Add return value documentation - Include usage examples for clarity - Explain which providers support input examples and why --- litellm/main.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/litellm/main.py b/litellm/main.py index b5364f8ba17..f1a1889d5cd 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -1018,6 +1018,31 @@ def responses_api_bridge_check( def _should_allow_input_examples( custom_llm_provider: Optional[str], model: str ) -> bool: + """ + Determine whether a given model supports input examples in API calls. + + This function checks if the specified LLM provider and model combination + supports the `input_examples` parameter, which is used for in-context learning + with Claude models. Input examples are currently only supported by Anthropic's + native Claude models and Claude models accessed through cloud providers like + Azure AI, AWS Bedrock, and Google Vertex AI. + + Args: + custom_llm_provider: The LLM provider name (e.g., "anthropic", "azure_ai", + "bedrock", "vertex_ai"). Can be None. + model: The model identifier string (e.g., "claude-3-opus"). + + Returns: + bool: True if the model supports input examples, False otherwise. + + Examples: + >>> _should_allow_input_examples("anthropic", "claude-3-opus") + True + >>> _should_allow_input_examples("azure_ai", "claude-3-sonnet") + True + >>> _should_allow_input_examples("openai", "gpt-4") + False + """ if custom_llm_provider == "anthropic": return True if (