The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
[stripe] gemini 3 thought signatures in tool call id (#16895)
colinlin-stripef9d8eeaf8e38
diff --git a/docs/my-website/docs/providers/gemini.md b/docs/my-website/docs/providers/gemini.mdindex fd20e907d3b..e04225e1f85 100644--- a/docs/my-website/docs/providers/gemini.md+++ b/docs/my-website/docs/providers/gemini.md@@ -1308,6 +1308,8 @@ curl --location 'http://localhost:4000/v1/chat/completions' \5. **Format**: Thought signatures are stored in `provider_specific_fields.thought_signature` of tool calls in the response, and are automatically included when you append the assistant message to your conversation history.+6. **Chat Completions Clients**: With chat completions clients where you cannot control whether or not the previous assistant message is included as-is (ex langchain's ChatOpenAI), LiteLLM also preserves the thought signature by appending it to the tool call id (`call_123__thought__<thought-signature>`) and extracting it back out before sending the outbound request to Gemini.+## JSON Mode<Tabs>diff --git a/litellm/litellm_core_utils/prompt_templates/factory.py b/litellm/litellm_core_utils/prompt_templates/factory.pyindex 202ae5beae2..0f4a159975a 100644--- a/litellm/litellm_core_utils/prompt_templates/factory.py+++ b/litellm/litellm_core_utils/prompt_templates/factory.py@@ -58,6 +58,10 @@ def prompt_injection_detection_default_pt():BAD_MESSAGE_ERROR_STR = "Invalid Message "+# Separator used to embed Gemini thought signatures in tool call IDs+# See: https://ai.google.dev/gemini-api/docs/thought-signatures+THOUGHT_SIGNATURE_SEPARATOR = "__thought__"+# used to interweave user messages, to ensure user/assistant alternatingDEFAULT_USER_CONTINUE_MESSAGE = {"role": "user",@@ -1162,9 +1166,34 @@ def _gemini_tool_call_invoke_helper(return function_call-def _get_thought_signature_from_tool(tool: dict, model: Optional[str] = None) -> Optional[str]:+def _encode_tool_call_id_with_signature(+ tool_call_id: str, thought_signature: Optional[str]+) -> str:+ """+ Embed thought signature into tool call ID for OpenAI client compatibility.++ Args:+ tool_call_id: The tool call ID (e.g., "call_abc123...")+ thought_signature: Base64-encoded signature from Gemini response++ Returns:+ Tool call ID with embedded signature if present, otherwise original ID+ Format: call_<uuid>__thought__<base64_signature>++ See: https://ai.google.dev/gemini-api/docs/thought-signatures+ """+ if thought_signature:+ return f"{tool_call_id}{THOUGHT_SIGNATURE_SEPARATOR}{thought_signature}"+ return tool_call_id+++def _get_thought_signature_from_tool(+ tool: dict, model: Optional[str] = None+) -> Optional[str]:"""Extract thought signature from tool call's provider_specific_fields.-++ If not provided try to extract thought signature from tool call id+Checks both tool.provider_specific_fields and tool.function.provider_specific_fields.If no signature is found and model is gemini-3, returns a dummy signature."""@@ -1174,7 +1203,7 @@ def _get_thought_signature_from_tool(tool: dict, model: Optional[str] = None) ->signature = provider_fields.get("thought_signature")if signature:return signature-+# Then check function's provider_specific_fieldsfunction = tool.get("function")if function:@@ -1184,23 +1213,34 @@ def _get_thought_signature_from_tool(tool: dict, model: Optional[str] = None) ->signature = func_provider_fields.get("thought_signature")if signature:return signature- elif hasattr(function, "provider_specific_fields") and function.provider_specific_fields:+ elif (+ hasattr(function, "provider_specific_fields")+ and function.provider_specific_fields+ ):if isinstance(function.provider_specific_fields, dict):signature = function.provider_specific_fields.get("thought_signature")if signature:return signature-+ # Check if thought signature is embedded in tool call ID+ tool_call_id = tool.get("id")+ if tool_call_id and THOUGHT_SIGNATURE_SEPARATOR in tool_call_id:+ parts = tool_call_id.split(THOUGHT_SIGNATURE_SEPARATOR, 1)+ if len(parts) == 2:+ _, signature = parts+ return signature# If no signature found and model is gemini-3, return dummy signature- from litellm.llms.vertex_ai.gemini.vertex_and_google_ai_studio_gemini import VertexGeminiConfig+ from litellm.llms.vertex_ai.gemini.vertex_and_google_ai_studio_gemini import (+ VertexGeminiConfig,+ )+if model and VertexGeminiConfig._is_gemini_3_or_newer(model):return _get_dummy_thought_signature()-return Nonedef _get_dummy_thought_signature() -> str:"""Generate a dummy thought signature for models that require it.-+This is used when transferring conversation history from older models(like gemini-2.5-flash) to gemini-3, which requires thought_signaturefor strict validation.@@ -1258,23 +1298,25 @@ def convert_to_gemini_tool_call_invoke(_parts_list: List[VertexPartType] = []tool_calls = message.get("tool_calls", None)function_call = message.get("function_call", None)-+if tool_calls is not None:for idx, tool in enumerate(tool_calls):if "function" in tool:- gemini_function_call: Optional[VertexFunctionCall] = (- _gemini_tool_call_invoke_helper(- function_call_params=tool["function"]- )+ gemini_function_call: Optional[+ VertexFunctionCall+ ] = _gemini_tool_call_invoke_helper(+ function_call_params=tool["function"])if gemini_function_call is not None:part_dict: VertexPartType = {"function_call": gemini_function_call}- thought_signature = _get_thought_signature_from_tool(dict(tool), model=model)+ thought_signature = _get_thought_signature_from_tool(+ dict(tool), model=model+ )if thought_signature:part_dict["thoughtSignature"] = thought_signature-+_parts_list.append(part_dict)else: # don't silently drop params. Make it clear to user what's happening.raise Exception(@@ -1290,21 +1332,32 @@ def convert_to_gemini_tool_call_invoke(part_dict_function: VertexPartType = {"function_call": gemini_function_call}-+# Extract thought signature from function_call's provider_specific_fieldsthought_signature = None- provider_fields = function_call.get("provider_specific_fields") if isinstance(function_call, dict) else {}+ provider_fields = (+ function_call.get("provider_specific_fields")+ if isinstance(function_call, dict)+ else {}+ )if isinstance(provider_fields, dict):thought_signature = provider_fields.get("thought_signature")-+# If no signature found and model is gemini-3, use dummy signature- from litellm.llms.vertex_ai.gemini.vertex_and_google_ai_studio_gemini import VertexGeminiConfig- if not thought_signature and model and VertexGeminiConfig._is_gemini_3_or_newer(model):+ from litellm.llms.vertex_ai.gemini.vertex_and_google_ai_studio_gemini import (+ VertexGeminiConfig,+ )++ if (+ not thought_signature+ and model+ and VertexGeminiConfig._is_gemini_3_or_newer(model)+ ):thought_signature = _get_dummy_thought_signature()-+if thought_signature:part_dict_function["thoughtSignature"] = thought_signature-+_parts_list.append(part_dict_function)else: # don't silently drop params. Make it clear to user what's happening.raise Exception(@@ -1807,9 +1860,9 @@ def anthropic_messages_pt( # noqa: PLR0915)if "cache_control" in _content_element:- _anthropic_content_element["cache_control"] = (- _content_element["cache_control"]- )+ _anthropic_content_element[+ "cache_control"+ ] = _content_element["cache_control"]user_content.append(_anthropic_content_element)elif m.get("type", "") == "text":m = cast(ChatCompletionTextObject, m)@@ -1847,9 +1900,9 @@ def anthropic_messages_pt( # noqa: PLR0915)if "cache_control" in _content_element:- _anthropic_content_text_element["cache_control"] = (- _content_element["cache_control"]- )+ _anthropic_content_text_element[+ "cache_control"+ ] = _content_element["cache_control"]user_content.append(_anthropic_content_text_element)@@ -2615,17 +2668,19 @@ class BedrockImageProcessor:"""Handles both sync and async image processing for Bedrock conversations."""@staticmethod- def _post_call_image_processing(response: httpx.Response, image_url: str = "") -> Tuple[str, str]:+ def _post_call_image_processing(+ response: httpx.Response, image_url: str = ""+ ) -> Tuple[str, str]:# Check the response's content type to ensure it is an imagecontent_type = response.headers.get("content-type")-+# Use helper function to infer content type with fallback logiccontent_type = infer_content_type_from_url_and_content(url=image_url,content=response.content,current_content_type=content_type,)-+content_type = _parse_content_type(content_type)# Convert the image content to base64 bytes@@ -2644,7 +2699,9 @@ class BedrockImageProcessor:response = await client.get(image_url, follow_redirects=True)response.raise_for_status() # Raise an exception for HTTP errors- return BedrockImageProcessor._post_call_image_processing(response, image_url)+ return BedrockImageProcessor._post_call_image_processing(+ response, image_url+ )except Exception as e:raise e@@ -2657,7 +2714,9 @@ class BedrockImageProcessor:response = client.get(image_url, follow_redirects=True)response.raise_for_status() # Raise an exception for HTTP errors- return BedrockImageProcessor._post_call_image_processing(response, image_url)+ return BedrockImageProcessor._post_call_image_processing(+ response, image_url+ )except Exception as e:raise e@@ -3926,7 +3985,9 @@ def _bedrock_converse_messages_pt( # noqa: PLR0915)elif element["type"] == "text":# AWS Bedrock doesn't allow empty or whitespace-only text content, so use placeholder for empty strings- text_content = element["text"] if element["text"].strip() else "."+ text_content = (+ element["text"] if element["text"].strip() else "."+ )assistants_part = BedrockContentBlock(text=text_content)assistants_parts.append(assistants_part)elif element["type"] == "image_url":diff --git a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.pyindex d49d86f8ca4..f1f0a67b9a1 100644--- a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py+++ b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py@@ -81,6 +81,9 @@ from litellm.types.utils import (TopLogprob,Usage,)+from litellm.litellm_core_utils.prompt_templates.factory import (+ _encode_tool_call_id_with_signature,+)from litellm.utils import (CustomStreamWrapper,ModelResponse,@@ -1192,7 +1195,13 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):"function": _function_chunk,"index": cumulative_tool_call_idx,}+ # Embed thought signature in ID for OpenAI client compatibilityif thought_signature:+ _tool_response_chunk[+ "id"+ ] = _encode_tool_call_id_with_signature(+ _tool_response_chunk["id"], thought_signature+ )_tool_response_chunk["provider_specific_fields"] = { # type: ignore"thought_signature": thought_signature}@@ -1702,7 +1711,10 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):# Convert thinking_blocks to reasoning_content for streaming# This ensures reasoning_content is available in streaming responses- if isinstance(model_response, ModelResponseStream) and reasoning_content is None:+ if (+ isinstance(model_response, ModelResponseStream)+ and reasoning_content is None+ ):reasoning_content_parts = []for block in thinking_blocks:thinking_text = block.get("thinking")diff --git a/tests/test_litellm/llms/vertex_ai/gemini/test_thought_signature_in_tool_call_id.py b/tests/test_litellm/llms/vertex_ai/gemini/test_thought_signature_in_tool_call_id.pynew file mode 100644index 00000000000..68c0f3bdbfc--- /dev/null+++ b/tests/test_litellm/llms/vertex_ai/gemini/test_thought_signature_in_tool_call_id.py@@ -0,0 +1,264 @@+"""+Tests for embedding thought signatures in tool call IDs for OpenAI client compatibility.++When using OpenAI clients (instead of LiteLLM SDK), provider_specific_fields are not preserved.+This test suite validates that thought signatures can be embedded in tool call IDs and extracted+when converting back to Gemini format.+"""++import pytest+from litellm.llms.vertex_ai.gemini.vertex_and_google_ai_studio_gemini import (+ VertexGeminiConfig,+)+from litellm.litellm_core_utils.prompt_templates.factory import (+ THOUGHT_SIGNATURE_SEPARATOR,+ convert_to_gemini_tool_call_invoke,+ _encode_tool_call_id_with_signature,+ _get_thought_signature_from_tool,+)+from litellm.types.llms.vertex_ai import HttpxPartType+++def test_encode_decode_tool_call_id_with_signature():+ """Test that thought signatures can be encoded in and decoded from tool call IDs"""+ base_id = "call_abc123"+ test_signature = "Co4CAdHtim/rWgXbz2Ghp4tShzLeMASrPw6JJyYIC3cbVyZnKzU3uv8/wVzyS2sKRPL2m8QQHHXbNQhEEz500G7n/4ZMmksdTtfQcJMoT76S1DGwhnAiLwTgWCNXs3lEb4M19EVYoWFxhrH5Lr9YMIquoU9U4paydGwvZyIyigamIg4B6WnxrRsf0KZV12gJed0DZuKczvOFtHz3zUnmZRlOiTzd5gBVyQM+5jv1VI8m4WUKd6cN/5a5ZvaA0ggiO6kdVhlpIVs7GczSEVJD8KH4u02X7VSnb7CvykqDntZzV0y8rZFBEFGKrChmeHlWXP4D1IB3F9KQyhuLgWImMzg4BajKVxxMU737JGnNISy5"++ # Test encoding+ encoded_id = _encode_tool_call_id_with_signature(base_id, test_signature)+ assert THOUGHT_SIGNATURE_SEPARATOR in encoded_id+ assert encoded_id.startswith(base_id)++ # Test decoding using factory function with realistic tool call structure+ tool = {+ "id": encoded_id,+ "type": "function",+ "function": {+ "name": "get_current_temperature",+ "arguments": '{"location": "Paris"}',+ },+ }++ extracted_signature = _get_thought_signature_from_tool(tool)+ assert extracted_signature == test_signature++ # Verify base ID is preserved+ decoded_base_id = encoded_id.split(THOUGHT_SIGNATURE_SEPARATOR)[0]+ assert decoded_base_id == base_id+++def test_encode_tool_call_id_without_signature():+ """Test that IDs without signatures are returned unchanged"""+ base_id = "call_abc123def456"++ # Encode without signature+ encoded_id = _encode_tool_call_id_with_signature(base_id, None)+ assert encoded_id == base_id+ assert THOUGHT_SIGNATURE_SEPARATOR not in encoded_id++ # Decode ID without signature using factory function+ tool_obj = {"id": base_id, "type": "function"}+ decoded_signature = _get_thought_signature_from_tool(tool_obj)+ assert decoded_signature is None+++def test_tool_call_id_includes_signature_in_response():+ """Test that tool call IDs in responses include embedded thought signatures"""+ test_signature = "Co4CAdHtim/rWgXbz2Ghp4tShzLeMASrPw6JJyYIC3cbVyZnKzU3uv8/wVzyS2sKRPL2m8QQHHXbNQhEEz500G7n/4ZMmksdTtfQcJMoT76S1DGwhnAiLwTgWCNXs3lEb4M19EVYoWFxhrH5Lr9YMIquoU9U4paydGwvZyIyigamIg4B6WnxrRsf0KZV12gJed0DZuKczvOFtHz3zUnmZRlOiTzd5gBVyQM+5jv1VI8m4WUKd6cN/5a5ZvaA0ggiO6kdVhlpIVs7GczSEVJD8KH4u02X7VSnb7CvykqDntZzV0y8rZFBEFGKrChmeHlWXP4D1IB3F9KQyhuLgWImMzg4BajKVxxMU737JGnNISy5"++ parts_with_signature = [+ HttpxPartType(+ functionCall={+ "name": "get_current_temperature",+ "args": {"location": "Paris"},+ },+ thoughtSignature=test_signature,+ )+ ]++ function, tools, _ = VertexGeminiConfig._transform_parts(+ parts=parts_with_signature,+ cumulative_tool_call_idx=0,+ is_function_call=False,+ )++ # Verify tool call ID includes thought signature+ assert tools is not None+ assert len(tools) == 1+ tool_call_id = tools[0]["id"]+ assert THOUGHT_SIGNATURE_SEPARATOR in tool_call_id++ # Verify we can decode it using the factory function+ tool_obj = {"id": tool_call_id, "type": "function"}+ decoded_sig = _get_thought_signature_from_tool(tool_obj)+ assert decoded_sig == test_signature+++def test_get_thought_signature_backward_compatibility():+ """Test that provider_specific_fields still works (backward compatibility)"""+ test_signature = "Co4CAdHtim/rWgXbz2Ghp4tShzLeMASrPw6JJyYIC3cbVyZnKzU3uv8/wVzyS2sKRPL2m8QQHHXbNQhEEz500G7n/4ZMmksdTtfQcJMoT76S1DGwhnAiLwTgWCNXs3lEb4M19EVYoWFxhrH5Lr9YMIquoU9U4paydGwvZyIyigamIg4B6WnxrRsf0KZV12gJed0DZuKczvOFtHz3zUnmZRlOiTzd5gBVyQM+5jv1VI8m4WUKd6cN/5a5ZvaA0ggiO6kdVhlpIVs7GczSEVJD8KH4u02X7VSnb7CvykqDntZzV0y8rZFBEFGKrChmeHlWXP4D1IB3F9KQyhuLgWImMzg4BajKVxxMU737JGnNISy5"++ # Test with provider_specific_fields (LiteLLM SDK scenario)+ tool = {+ "id": "call_abc123",+ "type": "function",+ "function": {+ "name": "get_current_temperature",+ "arguments": '{"location": "Paris"}',+ },+ "provider_specific_fields": {"thought_signature": test_signature},+ }++ extracted_signature = _get_thought_signature_from_tool(tool)+ assert extracted_signature == test_signature+++def test_get_thought_signature_prioritizes_provider_fields():+ """Test that provider_specific_fields takes priority over tool call ID"""+ signature_in_fields = "signature_from_fields"+ signature_in_id = "signature_from_id"++ encoded_id = _encode_tool_call_id_with_signature("call_abc123", signature_in_id)++ tool = {+ "id": encoded_id,+ "type": "function",+ "function": {+ "name": "get_current_temperature",+ "arguments": '{"location": "Paris"}',+ },+ "provider_specific_fields": {"thought_signature": signature_in_fields},+ }++ extracted_signature = _get_thought_signature_from_tool(tool)+ # Should prioritize provider_specific_fields+ assert extracted_signature == signature_in_fields+++def test_convert_to_gemini_with_embedded_signature():+ """Test that convert_to_gemini_tool_call_invoke extracts signatures from tool call IDs"""+ test_signature = "Co4CAdHtim/rWgXbz2Ghp4tShzLeMASrPw6JJyYIC3cbVyZnKzU3uv8/wVzyS2sKRPL2m8QQHHXbNQhEEz500G7n/4ZMmksdTtfQcJMoT76S1DGwhnAiLwTgWCNXs3lEb4M19EVYoWFxhrH5Lr9YMIquoU9U4paydGwvZyIyigamIg4B6WnxrRsf0KZV12gJed0DZuKczvOFtHz3zUnmZRlOiTzd5gBVyQM+5jv1VI8m4WUKd6cN/5a5ZvaA0ggiO6kdVhlpIVs7GczSEVJD8KH4u02X7VSnb7CvykqDntZzV0y8rZFBEFGKrChmeHlWXP4D1IB3F9KQyhuLgWImMzg4BajKVxxMU737JGnNISy5"++ # Create tool call ID with embedded signature (as OpenAI client would send)+ base_id = "call_abc123"+ encoded_id = _encode_tool_call_id_with_signature(base_id, test_signature)++ # Assistant message as sent by OpenAI client (no provider_specific_fields)+ assistant_message = {+ "role": "assistant",+ "content": None,+ "tool_calls": [+ {+ "id": encoded_id, # ID has signature embedded+ "type": "function",+ "function": {+ "name": "get_current_temperature",+ "arguments": '{"location": "Paris"}',+ },+ }+ ],+ }++ gemini_parts = convert_to_gemini_tool_call_invoke(assistant_message)++ # Verify thought signature is extracted and sent to Gemini+ assert len(gemini_parts) == 1+ assert "function_call" in gemini_parts[0]+ assert "thoughtSignature" in gemini_parts[0]+ assert gemini_parts[0]["thoughtSignature"] == test_signature+++def test_openai_client_e2e_flow():+ """+ End-to-end test simulating OpenAI client usage:+ 1. LiteLLM receives response from Gemini with thought signature+ 2. LiteLLM embeds signature in tool call ID+ 3. OpenAI client sends message back with same tool call ID+ 4. LiteLLM extracts signature from ID and sends to Gemini+ """+ test_signature = "Co4CAdHtim/rWgXbz2Ghp4tShzLeMASrPw6JJyYIC3cbVyZnKzU3uv8/wVzyS2sKRPL2m8QQHHXbNQhEEz500G7n/4ZMmksdTtfQcJMoT76S1DGwhnAiLwTgWCNXs3lEb4M19EVYoWFxhrH5Lr9YMIquoU9U4paydGwvZyIyigamIg4B6WnxrRsf0KZV12gJed0DZuKczvOFtHz3zUnmZRlOiTzd5gBVyQM+5jv1VI8m4WUKd6cN/5a5ZvaA0ggiO6kdVhlpIVs7GczSEVJD8KH4u02X7VSnb7CvykqDntZzV0y8rZFBEFGKrChmeHlWXP4D1IB3F9KQyhuLgWImMzg4BajKVxxMU737JGnNISy5"++ # Step 1: Gemini returns function call with thought signature+ gemini_parts = [+ HttpxPartType(+ functionCall={+ "name": "get_current_temperature",+ "args": {"location": "Paris"},+ },+ thoughtSignature=test_signature,+ )+ ]++ # Step 2: LiteLLM transforms to OpenAI format with embedded signature+ function, tools, _ = VertexGeminiConfig._transform_parts(+ parts=gemini_parts,+ cumulative_tool_call_idx=0,+ is_function_call=False,+ )++ assert tools is not None+ assert len(tools) == 1+ tool_call_id = tools[0]["id"]+ assert THOUGHT_SIGNATURE_SEPARATOR in tool_call_id++ # Step 3: OpenAI client sends back assistant message (preserves tool_call_id)+ openai_assistant_message = {+ "role": "assistant",+ "content": "",+ "tool_calls": [+ {+ "id": tool_call_id, # Preserved from response+ "type": "function",+ "function": {+ "name": "get_current_temperature",+ "arguments": '{"location": "Paris"}',+ },+ }+ ],+ }++ # Step 4: LiteLLM converts back to Gemini format, extracting signature+ gemini_parts_converted = convert_to_gemini_tool_call_invoke(+ openai_assistant_message+ )++ # Verify signature is preserved through the round trip+ assert len(gemini_parts_converted) == 1+ assert "thoughtSignature" in gemini_parts_converted[0]+ assert gemini_parts_converted[0]["thoughtSignature"] == test_signature+++def test_parallel_tool_calls_with_signatures():+ """Test that parallel tool calls preserve signatures correctly"""+ signature1 = "signature_for_first_call"+ # Only first call has signature (Gemini behavior for parallel calls)++ gemini_parts = [+ HttpxPartType(+ functionCall={"name": "get_temperature", "args": {"location": "Paris"}},+ thoughtSignature=signature1,+ ),+ HttpxPartType(+ functionCall={"name": "get_temperature", "args": {"location": "London"}},+ # No signature for second parallel call+ ),+ ]++ function, tools, _ = VertexGeminiConfig._transform_parts(+ parts=gemini_parts,+ cumulative_tool_call_idx=0,+ is_function_call=False,+ )++ assert tools is not None+ assert len(tools) == 2++ # First tool call has signature in ID+ assert THOUGHT_SIGNATURE_SEPARATOR in tools[0]["id"]+ sig1 = _get_thought_signature_from_tool({"id": tools[0]["id"], "type": "function"})+ assert sig1 == signature1++ # Second tool call has no signature in ID+ assert THOUGHT_SIGNATURE_SEPARATOR not in tools[1]["id"]+ sig2 = _get_thought_signature_from_tool({"id": tools[1]["id"], "type": "function"})+ assert sig2 is None