diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/access_group.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/access_group.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dce847d631b9b994b171d18bf577ed748331a769 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/access_group.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/adapter.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/adapter.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..689e75ae9a45fe48824bb078157f8dbf77e5cc3a Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/adapter.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/agents.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/agents.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..184c9476682a2acedf52beb5c0f4244a29b22f18 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/agents.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/caching.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/caching.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0f33ed0e87c2b9a9a6bb896f5433b340d995d1b4 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/caching.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/completion.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/completion.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..672b600ef013f6a6f649e8ed365a81aaced47b38 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/completion.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/compression.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/compression.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5f31749eb7672d55839813264a4d5e7fc743e8f8 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/compression.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/embedding.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/embedding.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6bdfe6e651b11ee07aad800c9441d11dbef2443f Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/embedding.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/files.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/files.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..434cb954d394a63d5bfd4305f5a0513446df10d1 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/files.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/fine_tuning.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/fine_tuning.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4dc93eb0d5ac65eca24945f102643cd1a2cad875 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/fine_tuning.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/guardrails.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/guardrails.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0701ee55c552dd0f93bcc4ee6364de53cedfa284 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/guardrails.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/mcp.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/mcp.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5244c37ec3f7019495b756b6396a533aacf695a3 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/mcp.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/memory_management.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/memory_management.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..05ce0232ebdda682c969563227ce09ae22abd669 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/memory_management.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/policy_engine.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/policy_engine.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c6d85eec113ef50e9e17cd93e1e65f5c468b2a37 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/policy_engine.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/rag.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/rag.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..39e80bf0d45c8cd7ee6adcc94ac52eb5a2a31c5b Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/rag.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/realtime.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/realtime.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3b64c172fd7ab61948287492dc5bf4487f4fb6c0 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/realtime.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/rerank.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/rerank.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f57aefffd22454a992f6feceec0105c2c9021709 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/rerank.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/router.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/router.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..96c2b7e5973b19659934fa6b43156e71214d234e Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/router.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/scheduler.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/scheduler.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b200ead3aa52feae3386e3b798b2fc5edd527ae1 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/scheduler.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/search.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/search.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a2a3a50d697c6a5f6e0a8af2f003564bba9950ec Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/search.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/services.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/services.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2b5630872f5a8512af01eb4e0ab4cf7773912863 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/services.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/tag_management.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/tag_management.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3753a79c1301a69cfd5c3b895d70455e8e66d88c Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/tag_management.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/tool_management.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/tool_management.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fe9fec8bbf73e15e58cd18728fb85ae54d950153 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/tool_management.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/utils.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/utils.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..01cba50d9f28a6d01fb3420767d344b5ce7c69ec Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/utils.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/vector_store_files.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/vector_store_files.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..600b125c0fd2dc408c783ab536eb3b302527c825 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/vector_store_files.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/vector_stores.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/vector_stores.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1755b17e5dc282a5579a2384ebab9ea75f22b652 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/vector_stores.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/__init__.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..9f74df91e288001824a19e4816641b86f3326907 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/__init__.py @@ -0,0 +1,13 @@ +from .main import ( + ContentListUnion, + ContentListUnionDict, + GenerateContentConfigOrDict, + GenerateContentResponse, +) + +__all__ = [ + "ContentListUnion", + "ContentListUnionDict", + "GenerateContentConfigOrDict", + "GenerateContentResponse", +] diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/__pycache__/__init__.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a05b28ba22eed415f795501df3f2cf275e43da4a Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/__pycache__/__init__.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/__pycache__/main.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/__pycache__/main.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..80dc45460c3b8794892423abe9fff86e110f0841 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/__pycache__/main.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/main.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/main.py new file mode 100644 index 0000000000000000000000000000000000000000..b2e1fb3d46b09c39a0ce234800a2b99d3ce8706c --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/main.py @@ -0,0 +1,59 @@ +# Import types from the Google GenAI SDK +from typing import TYPE_CHECKING, Any, Dict, List, Optional, TypeAlias + +from pydantic import BaseModel +from typing_extensions import TypedDict + +from litellm.types.llms.openai import BaseLiteLLMOpenAIResponseObject + +# During static type-checking we can rely on the real google-genai types. +if TYPE_CHECKING: + from google.genai import types as _genai_types # type: ignore + + ContentListUnion = _genai_types.ContentListUnion + ContentListUnionDict = _genai_types.ContentListUnionDict + GenerateContentConfigOrDict = _genai_types.GenerateContentConfigOrDict + GoogleGenAIGenerateContentResponse = _genai_types.GenerateContentResponse + GenerateContentContentListUnionDict = _genai_types.ContentListUnionDict + GenerateContentConfigDict = _genai_types.GenerateContentConfigDict + GenerateContentRequestParametersDict = _genai_types._GenerateContentParametersDict + ToolConfigDict = _genai_types.ToolConfigDict + + class GenerateContentRequestDict(GenerateContentRequestParametersDict): # type: ignore[misc, valid-type] + generationConfig: Optional[Any] + tools: Optional[ToolConfigDict] # type: ignore[assignment, valid-type] + + class GenerateContentResponse(GoogleGenAIGenerateContentResponse, BaseLiteLLMOpenAIResponseObject): # type: ignore[misc, valid-type] + _hidden_params: dict = {} + pass + +else: + # Fallback types when google.genai is not available + ContentListUnion = Any + ContentListUnionDict = Dict[str, Any] + GenerateContentConfigOrDict = Dict[str, Any] + GoogleGenAIGenerateContentResponse = Dict[str, Any] + GenerateContentContentListUnionDict = Dict[str, Any] + + # Create a proper fallback class that can be instantiated + class GenerateContentConfigDict(dict): # type: ignore[misc] + def __init__(self, **kwargs): # type: ignore + super().__init__(**kwargs) + + class GenerateContentRequestParametersDict(dict): # type: ignore[misc] + def __init__(self, **kwargs): # type: ignore + super().__init__(**kwargs) + + ToolConfigDict = Dict[str, Any] + + class GenerateContentRequestDict(GenerateContentRequestParametersDict): # type: ignore[misc] + def __init__(self, **kwargs): # type: ignore + # Extract specific fields + self.generationConfig = kwargs.get("generationConfig") + self.tools = kwargs.get("tools") + super().__init__(**kwargs) + + class GenerateContentResponse(BaseLiteLLMOpenAIResponseObject): # type: ignore[misc] + def __init__(self, **kwargs): # type: ignore + super().__init__(**kwargs) + self._hidden_params = kwargs.get("_hidden_params", {}) diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/litellm_core_utils/__pycache__/streaming_chunk_builder_utils.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/litellm_core_utils/__pycache__/streaming_chunk_builder_utils.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..3a575df13b67fd9859902631772a89f8a394c99d Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/litellm_core_utils/__pycache__/streaming_chunk_builder_utils.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/litellm_core_utils/streaming_chunk_builder_utils.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/litellm_core_utils/streaming_chunk_builder_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..a1f89dac5cffc676061370a349d38c7af80a1369 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/litellm_core_utils/streaming_chunk_builder_utils.py @@ -0,0 +1,16 @@ +from typing import TYPE_CHECKING, Optional + +from typing_extensions import TypedDict + +from ..utils import CompletionTokensDetails, PromptTokensDetailsWrapper, ServerToolUse + + +class UsagePerChunk(TypedDict): + prompt_tokens: int + completion_tokens: int + cache_creation_input_tokens: Optional[int] + cache_read_input_tokens: Optional[int] + server_tool_use: Optional[ServerToolUse] + web_search_requests: Optional[int] + completion_tokens_details: Optional[CompletionTokensDetails] + prompt_tokens_details: Optional[PromptTokensDetailsWrapper] diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/aiml.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/aiml.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f82e9da328433cd7c060500b9086a52e8048f9e8 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/aiml.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/anthropic_tool_search.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/anthropic_tool_search.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..184f7f538195bd56133b68ea7fc1f0fc1d0f0dae Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/anthropic_tool_search.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/custom_llm.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/custom_llm.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..dff6ca9dc248b88160f6994340d44607c9aea928 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/custom_llm.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/gemini.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/gemini.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1fe4ad49e911b892979410f872fabdfbc7e8f722 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/gemini.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/langgraph.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/langgraph.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..311755688b74f99ef55883ea81c309196844724b Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/langgraph.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/oci.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/oci.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..c961b0ae7e8f8369f599251f7d77843893f66734 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/oci.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/ollama.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/ollama.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..88c47dd9aefd6a0a4105cd26ecb6fb99ee9ba64c Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/ollama.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/rerank.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/rerank.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b7f499ce13fc7a0e2f7a632b7bbd858754ff96cd Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/rerank.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/stability.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/stability.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..69c6f206a2b5c9c4001ba12f7116d4a0494d4016 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/stability.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/triton.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/triton.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a2f3491882f417fd711a3a91fe6f8d164d9f60d8 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/triton.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/vertex_ai.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/vertex_ai.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ec4a9b485f76257556e46f6214becb4235a9fd77 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/vertex_ai.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/vertex_ai_text_to_speech.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/vertex_ai_text_to_speech.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6084d76ff8ced7e1ab5ef9a1f7d0178fcae62c39 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/vertex_ai_text_to_speech.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/xai.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/xai.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4547b8de5e23b47374a64444f86098733b3bf70e Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/xai.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/aiml.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/aiml.py new file mode 100644 index 0000000000000000000000000000000000000000..d5781add184213b7ab7974109f4aee81a2e6a910 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/aiml.py @@ -0,0 +1,29 @@ +from typing import Dict, Optional, Union + +from typing_extensions import TypedDict + + +class AimlImageSize(TypedDict, total=False): + """Custom image size specification for AI/ML API""" + + width: int # Must be multiple of 32, min 256, max 1440 + height: int # Must be multiple of 32, min 256, max 1440 + + +class AimlImageGenerationRequestParams(TypedDict, total=False): + """ + TypedDict for AI/ML flux image generation request parameters. + + Based on AI/ML API docs: https://api.aimlapi.com/v1/images/generations + """ + + model: str # Required: flux-pro/v1.1 + prompt: str # Required: Text prompt (max 4000 chars) + image_size: Union[ + AimlImageSize, str + ] # Custom size or predefined: square_hd, square, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9 + safety_tolerance: Optional[str] # 1-6, default 2 (1=strict, 6=permissive) + output_format: Optional[str] # jpeg or png, default jpeg + num_images: Optional[int] # 1-4, default 1 + seed: Optional[int] # Min 1, for reproducibility + enable_safety_checker: Optional[bool] # Default true diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic.py new file mode 100644 index 0000000000000000000000000000000000000000..1c4d31d21ad6ffb6bc8565e8101aad76be9bafe0 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic.py @@ -0,0 +1,689 @@ +from enum import Enum +from typing import Any, Dict, Iterable, List, Optional, Union + +from pydantic import BaseModel, ConfigDict +from typing_extensions import Literal, Required, TypedDict + +from .openai import ( + ChatCompletionCachedContent, + ChatCompletionRedactedThinkingBlock, + ChatCompletionThinkingBlock, +) + + +class AnthropicMessagesToolChoice(TypedDict, total=False): + type: Required[Literal["auto", "any", "tool", "none"]] + name: str + disable_parallel_tool_use: bool # default is false + + +AnthropicInputSchema = TypedDict( + "AnthropicInputSchema", + { + "type": Optional[str], + "properties": Optional[dict], + "additionalProperties": Optional[bool], + "required": Optional[List[str]], + "$defs": Optional[Dict], + "strict": Optional[bool], + }, + total=False, +) + + +class AnthropicOutputSchema(TypedDict, total=False): + type: Required[Literal["json_schema"]] + schema: Required[dict] + + +class AnthropicOutputConfig(TypedDict, total=False): + """Configuration for controlling Claude's output behavior.""" + + effort: Literal["high", "medium", "low"] + + +class AnthropicMessagesTool(TypedDict, total=False): + name: Required[str] + description: str + input_schema: Optional[AnthropicInputSchema] + type: Literal["custom"] + cache_control: Optional[Union[dict, ChatCompletionCachedContent]] + defer_loading: bool + allowed_callers: Optional[List[str]] + input_examples: Optional[List[Dict[str, Any]]] + + +class AnthropicComputerTool(TypedDict, total=False): + display_width_px: Required[int] + display_height_px: Required[int] + display_number: int + cache_control: Optional[Union[dict, ChatCompletionCachedContent]] + type: Required[str] + name: Required[str] + + +class AnthropicWebSearchUserLocation(TypedDict, total=False): + city: Optional[str] + country: Optional[str] + region: Optional[str] + timezone: Optional[str] + type: Required[Literal["approximate"]] + + +class AnthropicWebSearchTool(TypedDict, total=False): + name: Required[Literal["web_search"]] + type: Required[str] + cache_control: Optional[Union[dict, ChatCompletionCachedContent]] + max_uses: Optional[int] + user_location: Optional[AnthropicWebSearchUserLocation] + defer_loading: Optional[bool] + allowed_callers: Optional[List[str]] + input_examples: Optional[List[Dict[str, Any]]] + + +class AnthropicHostedTools(TypedDict, total=False): # for bash_tool and text_editor + type: Required[str] + name: Required[str] + cache_control: Optional[Union[dict, ChatCompletionCachedContent]] + defer_loading: Optional[bool] + allowed_callers: Optional[List[str]] + input_examples: Optional[List[Dict[str, Any]]] + + +class AnthropicCodeExecutionTool(TypedDict, total=False): + type: Required[str] + name: Required[Literal["code_execution"]] + cache_control: Optional[Union[dict, ChatCompletionCachedContent]] + defer_loading: Optional[bool] + allowed_callers: Optional[List[str]] + input_examples: Optional[List[Dict[str, Any]]] + + +class AnthropicMemoryTool(TypedDict, total=False): + type: Required[str] + name: Required[Literal["memory"]] + cache_control: Optional[Union[dict, ChatCompletionCachedContent]] + defer_loading: Optional[bool] + allowed_callers: Optional[List[str]] + input_examples: Optional[List[Dict[str, Any]]] + + +class AnthropicToolSearchToolRegex(TypedDict, total=False): + """Tool search tool using regex patterns for tool discovery.""" + + type: Required[Literal["tool_search_tool_regex_20251119"]] + name: Required[str] + + +class AnthropicToolSearchToolBM25(TypedDict, total=False): + """Tool search tool using BM25 algorithm for tool discovery.""" + + type: Required[Literal["tool_search_tool_bm25_20251119"]] + name: Required[str] + cache_control: Optional[Union[dict, ChatCompletionCachedContent]] + defer_loading: Optional[bool] + allowed_callers: Optional[List[str]] + input_examples: Optional[List[Dict[str, Any]]] + + +ANTHROPIC_ADVISOR_TOOL_TYPE: Literal["advisor_20260301"] = "advisor_20260301" + + +class AnthropicAdvisorTool(TypedDict, total=False): + """Advisor tool — pairs a fast executor model with a high-intelligence advisor model.""" + + type: Required[Literal["advisor_20260301"]] + name: Required[Literal["advisor"]] + model: Required[str] + max_uses: Optional[int] + caching: Optional[dict] + + +class ToolReference(TypedDict, total=False): + """Reference to a tool that should be expanded from deferred tools.""" + + type: Required[Literal["tool_reference"]] + tool_name: Required[str] + + +class DirectToolCaller(TypedDict, total=False): + """Indicates a tool was called directly by Claude.""" + + type: Required[Literal["direct"]] + + +class CodeExecutionToolCaller(TypedDict, total=False): + """Indicates a tool was called programmatically from code execution.""" + + type: Required[Literal["code_execution_20250825"]] + tool_id: Required[str] # ID of the code execution tool that made the call + + +ToolCaller = Union[DirectToolCaller, CodeExecutionToolCaller] + + +class AnthropicContainer(TypedDict, total=False): + """Container metadata for code execution.""" + + id: Required[str] + expires_at: Optional[str] # ISO 8601 timestamp + + +AllAnthropicToolsValues = Union[ + AnthropicComputerTool, + AnthropicHostedTools, + AnthropicMessagesTool, + AnthropicWebSearchTool, + AnthropicCodeExecutionTool, + AnthropicMemoryTool, + AnthropicToolSearchToolRegex, + AnthropicToolSearchToolBM25, + AnthropicAdvisorTool, +] + + +class AnthropicMcpServerToolConfiguration(TypedDict, total=False): + allowed_tools: Optional[List[str]] + + +class AnthropicMcpServerTool(TypedDict, total=False): + type: Required[Literal["url"]] + url: Required[str] + name: Required[str] + tool_configuration: AnthropicMcpServerToolConfiguration + authorization_token: str + + +class AnthropicMessagesTextParam(TypedDict, total=False): + type: Required[Literal["text"]] + text: Required[str] + cache_control: Optional[Union[dict, ChatCompletionCachedContent]] + + +class AnthropicMessagesToolUseParam(TypedDict, total=False): + type: Required[Literal["tool_use"]] + id: str + name: str + input: dict + cache_control: Optional[Union[dict, ChatCompletionCachedContent]] + caller: Optional[ToolCaller] + + +AnthropicMessagesAssistantMessageValues = Union[ + AnthropicMessagesTextParam, + AnthropicMessagesToolUseParam, + ChatCompletionThinkingBlock, + ChatCompletionRedactedThinkingBlock, +] + + +class AnthopicMessagesAssistantMessageParam(TypedDict, total=False): + content: Required[Union[str, Iterable[AnthropicMessagesAssistantMessageValues]]] + """The contents of the system message.""" + + role: Required[Literal["assistant"]] + """The role of the messages author, in this case `author`.""" + + name: str + """An optional name for the participant. + + Provides the model information to differentiate between participants of the same + role. + """ + + +class AnthropicContentParamSource(TypedDict): + type: Literal["base64"] + media_type: str + data: str + + +class AnthropicContentParamSourceUrl(TypedDict): + type: Literal["url"] + url: str + + +class AnthropicContentParamSourceFileId(TypedDict): + type: Literal["file"] + file_id: str + + +class AnthropicMessagesContainerUploadParam(TypedDict, total=False): + type: Required[Literal["container_upload"]] + file_id: str + cache_control: Optional[Union[dict, ChatCompletionCachedContent]] + + +class AnthropicMessagesImageParam(TypedDict, total=False): + type: Required[Literal["image"]] + source: Required[ + Union[ + AnthropicContentParamSource, + AnthropicContentParamSourceFileId, + AnthropicContentParamSourceUrl, + ] + ] + cache_control: Optional[Union[dict, ChatCompletionCachedContent]] + + +class CitationsObject(TypedDict): + enabled: bool + + +class AnthropicCitationPageLocation(TypedDict, total=False): + """ + Anthropic citation for page-based references. + Used when citing from documents with page numbers. + """ + + type: Literal["page_location"] + cited_text: str # The exact text being cited (not counted towards output tokens) + document_index: int # Index referencing the cited document + document_title: Optional[str] # Title of the cited document + start_page_number: int # 1-indexed starting page + end_page_number: int # Exclusive ending page + + +class AnthropicCitationCharLocation(TypedDict, total=False): + """ + Anthropic citation for character-based references. + Used when citing from text with character positions. + """ + + type: Literal["char_location"] + cited_text: str # The exact text being cited (not counted towards output tokens) + document_index: int # Index referencing the cited document + document_title: Optional[str] # Title of the cited document + start_char_index: int # Starting character index for the citation + end_char_index: int # Ending character index for the citation + + +# Union type for all citation formats +AnthropicCitation = Union[AnthropicCitationPageLocation, AnthropicCitationCharLocation] + + +class AnthropicMessagesDocumentParam(TypedDict, total=False): + type: Required[Literal["document"]] + source: Required[ + Union[ + AnthropicContentParamSource, + AnthropicContentParamSourceFileId, + AnthropicContentParamSourceUrl, + ] + ] + cache_control: Optional[Union[dict, ChatCompletionCachedContent]] + title: str + context: str + citations: Optional[CitationsObject] + + +class AnthropicMessagesToolResultContent(TypedDict, total=False): + type: Required[Literal["text"]] + text: Required[str] + cache_control: Optional[Union[dict, ChatCompletionCachedContent]] + + +class AnthropicMessagesToolResultParam(TypedDict, total=False): + type: Required[Literal["tool_result"]] + tool_use_id: Required[str] + is_error: bool + content: Union[ + str, + Iterable[ + Union[ + AnthropicMessagesToolResultContent, + AnthropicMessagesImageParam, + AnthropicMessagesDocumentParam, + ] + ], + ] + cache_control: Optional[Union[dict, ChatCompletionCachedContent]] + + +AnthropicMessagesUserMessageValues = Union[ + AnthropicMessagesTextParam, + AnthropicMessagesImageParam, + AnthropicMessagesToolResultParam, + AnthropicMessagesDocumentParam, + AnthropicMessagesContainerUploadParam, +] + + +class AnthropicMessagesUserMessageParam(TypedDict, total=False): + role: Required[Literal["user"]] + content: Required[Union[str, Iterable[AnthropicMessagesUserMessageValues]]] + + +class AnthropicMetadata(TypedDict, total=False): + user_id: str + + +class AnthropicSystemMessageContent(TypedDict, total=False): + type: str + text: str + cache_control: Optional[Union[dict, ChatCompletionCachedContent]] + + +AllAnthropicMessageValues = Union[ + AnthropicMessagesUserMessageParam, AnthopicMessagesAssistantMessageParam +] + + +class AnthropicMessagesRequestOptionalParams(TypedDict, total=False): + max_tokens: Optional[int] + metadata: Optional[Union[AnthropicMetadata, Dict]] + stop_sequences: Optional[List[str]] + stream: Optional[bool] + system: Optional[Union[str, List]] + temperature: Optional[float] + thinking: Optional[Dict] + tool_choice: Optional[Union[AnthropicMessagesToolChoice, Dict]] + tools: Optional[List[Union[AllAnthropicToolsValues, Dict]]] + top_k: Optional[int] + inference_geo: Optional[str] + top_p: Optional[float] + mcp_servers: Optional[List[AnthropicMcpServerTool]] + context_management: Optional[Dict[str, Any]] + container: Optional[ + Dict[str, Any] + ] # Container config with skills for code execution + output_format: Optional[AnthropicOutputSchema] # Structured outputs support + speed: Optional[str] # Fast mode support for Opus models + output_config: Optional[ + AnthropicOutputConfig + ] # Configuration for Claude's output behavior + cache_control: Optional[Dict[str, Any]] # Automatic prompt caching + reasoning_effort: Optional[str] + + +class AnthropicMessagesRequest(AnthropicMessagesRequestOptionalParams, total=False): + model: Required[str] + messages: Required[Union[List[AllAnthropicMessageValues], List[Dict]]] + # litellm param - used for tracking litellm proxy metadata in the request + litellm_metadata: dict + + +class ContentTextBlockDelta(TypedDict): + """ + 'delta': {'type': 'text_delta', 'text': 'Hello'} + """ + + type: str + text: str + + +class ContentCitationsBlockDelta(TypedDict): + type: Literal["citations"] + citation: dict + + +class ContentJsonBlockDelta(TypedDict): + """ + "delta": {"type": "input_json_delta","partial_json": "{\"location\": \"San Fra"}} + """ + + type: str + partial_json: str + + +class ContentThinkingBlockDelta(TypedDict): + """ + "delta": {"type": "thinking_delta", "thinking": "Let me solve this step by step:"}} + """ + + type: Literal["thinking_delta"] + thinking: str + + +class ContentThinkingSignatureBlockDelta(TypedDict): + """ + "delta": {"type": "signature_delta", "signature": "EqQBCgIYAhIM1gbcDa9GJwZA2b3hGgxBdjrkzLoky3dl1pkiMOYds..."}} + """ + + type: Literal["signature_delta"] + signature: str + + +class ContentBlockDelta(TypedDict): + type: Literal["content_block_delta"] + index: int + delta: Union[ + ContentTextBlockDelta, + ContentJsonBlockDelta, + ContentCitationsBlockDelta, + ContentThinkingBlockDelta, + ContentThinkingSignatureBlockDelta, + ] + + +class ContentBlockStop(TypedDict): + type: Literal["content_block_stop"] + index: int + + +class ToolUseBlock(TypedDict): + """ + "content_block":{"type":"tool_use","id":"toolu_01T1x1fJ34qAmk2tNTrN7Up6","name":"get_weather","input":{}} + """ + + id: str + + input: dict + + name: str + + type: Literal["tool_use"] + caller: Optional[ToolCaller] + + +class TextBlock(TypedDict): + text: str + + type: Literal["text"] + + +class ContentBlockStartToolUse(TypedDict): + type: Literal["content_block_start"] + id: str + name: str + input: dict + content_block: ToolUseBlock + + +class ContentBlockStartText(TypedDict): + type: Literal["content_block_start"] + index: int + content_block: TextBlock + + +ContentBlockContentBlockDict = Union[ + ToolUseBlock, TextBlock, ChatCompletionThinkingBlock +] + +ContentBlockStart = Union[ContentBlockStartToolUse, ContentBlockStartText] + + +class MessageDelta(TypedDict, total=False): + stop_reason: Optional[str] + + +class UsageDelta(TypedDict, total=False): + input_tokens: int + output_tokens: int + cache_creation_input_tokens: int + cache_read_input_tokens: int + + +class MessageBlockDelta(TypedDict): + """ + Anthropic + chunk = {'type': 'message_delta', 'delta': {'stop_reason': 'max_tokens', 'stop_sequence': None}, 'usage': {'output_tokens': 10}} + """ + + type: Literal["message_delta"] + delta: MessageDelta + usage: UsageDelta + + +class MessageChunk(TypedDict, total=False): + id: str + type: str + role: str + model: str + content: List + stop_reason: Optional[str] + stop_sequence: Optional[str] + usage: UsageDelta + + +class MessageStartBlock(TypedDict): + """ + Anthropic + chunk = { + "type": "message_start", + "message": { + "id": "msg_vrtx_011PqREFEMzd3REdCoUFAmdG", + "type": "message", + "role": "assistant", + "model": "claude-3-sonnet-20240229", + "content": [], + "stop_reason": null, + "stop_sequence": null, + "usage": { + "input_tokens": 270, + "output_tokens": 1 + } + } + } + """ + + type: Literal["message_start"] + message: MessageChunk + + +class AnthropicResponseContentBlockText(BaseModel): + type: Literal["text"] + text: str + + +class AnthropicResponseContentBlockToolUse(BaseModel): + type: Literal["tool_use"] + id: str + name: str + input: dict + provider_specific_fields: Optional[Dict[str, Any]] = None + + model_config = ConfigDict(extra="allow") # Allow provider_specific_fields + + +class AnthropicResponseContentBlockThinking(BaseModel): + type: Literal["thinking"] + thinking: str + signature: Optional[str] + + +class AnthropicResponseContentBlockRedactedThinking(BaseModel): + type: Literal["redacted_thinking"] + data: str + + +class AnthropicResponseUsageBlock(BaseModel): + input_tokens: int + output_tokens: int + + +AnthropicFinishReason = Literal["end_turn", "max_tokens", "stop_sequence", "tool_use"] + + +class AnthropicResponse(BaseModel): + id: str + """Unique object identifier.""" + + type: Literal["message"] + """For Messages, this is always "message".""" + + role: Literal["assistant"] + """Conversational role of the generated message. This will always be "assistant".""" + + content: List[ + Union[ + AnthropicResponseContentBlockText, + AnthropicResponseContentBlockToolUse, + AnthropicResponseContentBlockThinking, + AnthropicResponseContentBlockRedactedThinking, + ] + ] + """Content generated by the model.""" + + model: str + """The model that handled the request.""" + + stop_reason: Optional[AnthropicFinishReason] + """The reason that we stopped.""" + + stop_sequence: Optional[str] + """Which custom stop sequence was generated, if any.""" + + usage: AnthropicResponseUsageBlock + """Billing and rate-limit usage.""" + + +from .openai import ChatCompletionUsageBlock + + +class AnthropicChatCompletionUsageBlock(ChatCompletionUsageBlock, total=False): + cache_creation_input_tokens: int + cache_read_input_tokens: int + + +ANTHROPIC_API_HEADERS = { + "anthropic-version", + "anthropic-beta", +} + +ANTHROPIC_API_ONLY_HEADERS = { # fails if calling anthropic on vertex ai / bedrock + "anthropic-beta", +} + + +class AnthropicThinkingParam(TypedDict, total=False): + type: Literal["enabled", "adaptive"] + budget_tokens: int + + +class ANTHROPIC_HOSTED_TOOLS(str, Enum): + WEB_SEARCH = "web_search" + BASH = "bash" + TEXT_EDITOR = "text_editor" + CODE_EXECUTION = "code_execution" + WEB_FETCH = "web_fetch" + MEMORY = "memory" + TOOL_SEARCH_TOOL = "tool_search_tool" + + +class ANTHROPIC_BETA_HEADER_VALUES(str, Enum): + """ + Known beta header values for Anthropic. + """ + + WEB_FETCH_2025_09_10 = "web-fetch-2025-09-10" + WEB_SEARCH_2025_03_05 = "web-search-2025-03-05" + CONTEXT_MANAGEMENT_2025_06_27 = "context-management-2025-06-27" + COMPACT_2026_01_12 = "compact-2026-01-12" + STRUCTURED_OUTPUT_2025_09_25 = "structured-outputs-2025-11-13" + ADVANCED_TOOL_USE_2025_11_20 = "advanced-tool-use-2025-11-20" + FAST_MODE_2026_02_01 = "fast-mode-2026-02-01" + ADVISOR_TOOL_2026_03_01 = "advisor-tool-2026-03-01" + + +# Tool search beta header constant (for Anthropic direct API and Microsoft Foundry) +ANTHROPIC_TOOL_SEARCH_BETA_HEADER = "advanced-tool-use-2025-11-20" + +# Effort beta header constant +ANTHROPIC_EFFORT_BETA_HEADER = "effort-2025-11-24" + +# OAuth constants +ANTHROPIC_OAUTH_TOKEN_PREFIX = "sk-ant-oat" +ANTHROPIC_OAUTH_BETA_HEADER = "oauth-2025-04-20" + +ANTHROPIC_PROMPT_CACHING_SCOPE_BETA_HEADER = "prompt-caching-scope-2026-01-05" diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_messages/anthropic_request.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_messages/anthropic_request.py new file mode 100644 index 0000000000000000000000000000000000000000..4f31e9a509768a36660b725d90c84948169aac82 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_messages/anthropic_request.py @@ -0,0 +1,13 @@ +from typing import Optional + +from pydantic import BaseModel + + +class AnthropicMetadata(BaseModel): + """ + Object with allowed fields for Anthropic API metadata + + https://docs.anthropic.com/en/api/messages#body-metadata-user-id + """ + + user_id: Optional[str] = None diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_messages/anthropic_response.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_messages/anthropic_response.py new file mode 100644 index 0000000000000000000000000000000000000000..1eab1b37e06caeaca37e88b90f5a68eae290e55a --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_messages/anthropic_response.py @@ -0,0 +1,96 @@ +from typing import Any, Dict, List, Literal, Optional, Union + +from typing_extensions import TypeAlias, TypedDict + +from litellm.types.llms.anthropic import ( + AnthropicResponseContentBlockText, + AnthropicResponseContentBlockToolUse, +) + + +class AnthropicResponseTextBlock(TypedDict, total=False): + """ + Anthropic Response Text Block: https://docs.anthropic.com/en/api/messages + """ + + citations: Optional[List[Dict[str, Any]]] + text: str + type: Literal["text"] + + +class AnthropicResponseToolUseBlock(TypedDict, total=False): + """ + Anthropic Response Tool Use Block: https://docs.anthropic.com/en/api/messages + """ + + id: Optional[str] + input: Optional[str] + name: Optional[str] + type: Literal["tool_use"] + + +class AnthropicResponseThinkingBlock(TypedDict, total=False): + """ + Anthropic Response Thinking Block: https://docs.anthropic.com/en/api/messages + """ + + signature: Optional[str] + thinking: Optional[str] + type: Literal["thinking"] + + +class AnthropicResponseRedactedThinkingBlock(TypedDict, total=False): + """ + Anthropic Response Redacted Thinking Block: https://docs.anthropic.com/en/api/messages + """ + + data: Optional[str] + type: Literal["redacted_thinking"] + + +AnthropicResponseContentBlock: TypeAlias = Union[ + AnthropicResponseTextBlock, + AnthropicResponseToolUseBlock, + AnthropicResponseThinkingBlock, + AnthropicResponseRedactedThinkingBlock, +] + + +class AnthropicUsage(TypedDict, total=False): + """ + Input and output tokens used in the request + """ + + input_tokens: int + output_tokens: int + + """ + Cache Tokens Used + """ + cache_creation_input_tokens: int + cache_read_input_tokens: int + + +class AnthropicMessagesResponse(TypedDict, total=False): + """ + Anthropic Messages API Response: https://docs.anthropic.com/en/api/messages + """ + + content: Optional[ + List[ + Union[ + AnthropicResponseContentBlock, + AnthropicResponseContentBlockText, + AnthropicResponseContentBlockToolUse, + ] + ] + ] + id: str + model: Optional[str] # This represents the Model type from Anthropic + role: Optional[Literal["assistant"]] + stop_reason: Optional[ + Literal["end_turn", "max_tokens", "stop_sequence", "tool_use"] + ] + stop_sequence: Optional[str] + type: Optional[Literal["message"]] + usage: Optional[AnthropicUsage] diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_skills.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_skills.py new file mode 100644 index 0000000000000000000000000000000000000000..22257888493faecf992c39ed7ebade0240977147 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_skills.py @@ -0,0 +1,158 @@ +""" +Type definitions for Anthropic Skills API +""" + +from typing import Any, Dict, List, Literal, Optional, Union + +from pydantic import BaseModel, Field +from typing_extensions import Required, TypedDict + + +# Skills API Request Types +class CreateSkillRequest(TypedDict, total=False): + """Request parameters for creating a skill""" + + display_title: Optional[str] + """Display title for the skill (optional)""" + + files: Optional[List[Any]] + """Files to upload for the skill. All files must be in the same top-level directory and must include a SKILL.md file at the root.""" + + +class ListSkillsParams(TypedDict, total=False): + """Query parameters for listing skills""" + + limit: Optional[int] + """Number of results to return per page. Maximum value is 100. Defaults to 20.""" + + page: Optional[str] + """Pagination token for fetching a specific page of results""" + + source: Optional[str] + """Filter skills by source ('custom' or 'anthropic')""" + + +# Skills API Response Types +class Skill(BaseModel): + """Represents a skill from the Anthropic Skills API""" + + id: str + """Unique identifier for the skill""" + + created_at: str + """ISO 8601 timestamp of when the skill was created""" + + display_title: Optional[str] = None + """Display title for the skill""" + + latest_version: Optional[str] = None + """The latest version identifier for the skill""" + + source: str + """Source of the skill (custom or anthropic)""" + + type: str = "skill" + """Object type, always 'skill'""" + + updated_at: str + """ISO 8601 timestamp of when the skill was last updated""" + + +class ListSkillsResponse(BaseModel): + """Response from listing skills""" + + data: List[Skill] + """List of skills""" + + next_page: Optional[str] = None + """Pagination token for the next page""" + + has_more: bool = False + """Whether there are more skills available""" + + +class DeleteSkillResponse(BaseModel): + """Response from deleting a skill""" + + id: str + """The ID of the deleted skill""" + + type: str = "skill_deleted" + """Deleted object type, always 'skill_deleted'""" + + +# Skill Version Types +class CreateSkillVersionRequest(TypedDict, total=False): + """Request parameters for creating a skill version""" + + display_title: Optional[str] + """Display title for this version""" + + description: Optional[str] + """Description of this version""" + + instructions: Optional[str] + """Instructions for this version""" + + metadata: Optional[Dict[str, Any]] + """Additional metadata""" + + +class SkillVersion(BaseModel): + """Represents a skill version""" + + id: str + """Unique identifier for the version""" + + skill_id: str + """ID of the parent skill""" + + created_at: str + """ISO 8601 timestamp of when the version was created""" + + display_title: Optional[str] = None + """Display title for this version""" + + description: Optional[str] = None + """Description of this version""" + + instructions: Optional[str] = None + """Instructions for this version""" + + metadata: Optional[Dict[str, Any]] = None + """Additional metadata""" + + type: str = "skill.version" + """Object type""" + + +class ListSkillVersionsResponse(BaseModel): + """Response from listing skill versions""" + + object: str = "list" + """Object type, always 'list'""" + + data: List[SkillVersion] + """List of skill versions""" + + first_id: Optional[str] = None + """ID of the first version in the list""" + + last_id: Optional[str] = None + """ID of the last version in the list""" + + has_more: bool = False + """Whether there are more versions available""" + + +class DeleteSkillVersionResponse(BaseModel): + """Response from deleting a skill version""" + + id: str + """The ID of the deleted version""" + + object: str = "skill.version.deleted" + """Object type""" + + deleted: bool + """Whether the version was successfully deleted""" diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_tool_search.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_tool_search.py new file mode 100644 index 0000000000000000000000000000000000000000..7cdaec2e7cc4f3a10b89960123c3d6766d0ffaed --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_tool_search.py @@ -0,0 +1,34 @@ +""" +Tool Search Beta Header Configuration + +Reference: https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool +""" + +from typing import Dict + +from litellm.types.utils import LlmProviders + +# Tool search beta header values +TOOL_SEARCH_BETA_HEADER_ANTHROPIC = "advanced-tool-use-2025-11-20" +TOOL_SEARCH_BETA_HEADER_VERTEX = "tool-search-tool-2025-10-19" +TOOL_SEARCH_BETA_HEADER_BEDROCK = "tool-search-tool-2025-10-19" + + +# Mapping of custom_llm_provider -> tool search beta header +TOOL_SEARCH_BETA_HEADER_BY_PROVIDER: Dict[str, str] = { + LlmProviders.ANTHROPIC.value: TOOL_SEARCH_BETA_HEADER_ANTHROPIC, + LlmProviders.AZURE.value: TOOL_SEARCH_BETA_HEADER_ANTHROPIC, + LlmProviders.AZURE_AI.value: TOOL_SEARCH_BETA_HEADER_ANTHROPIC, + LlmProviders.VERTEX_AI.value: TOOL_SEARCH_BETA_HEADER_VERTEX, + LlmProviders.VERTEX_AI_BETA.value: TOOL_SEARCH_BETA_HEADER_VERTEX, + LlmProviders.BEDROCK.value: TOOL_SEARCH_BETA_HEADER_BEDROCK, +} + + +def get_tool_search_beta_header(custom_llm_provider: str) -> str: + """ + Get the tool search beta header for a given provider. + """ + return TOOL_SEARCH_BETA_HEADER_BY_PROVIDER.get( + custom_llm_provider, TOOL_SEARCH_BETA_HEADER_ANTHROPIC + ) diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/azure.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/azure.py new file mode 100644 index 0000000000000000000000000000000000000000..36c4258abd4792699f1221f18211402f84442b1a --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/azure.py @@ -0,0 +1,2 @@ +API_VERSION_YEAR_SUPPORTED_RESPONSE_FORMAT = 2024 +API_VERSION_MONTH_SUPPORTED_RESPONSE_FORMAT = 8 diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/azure_ai.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/azure_ai.py new file mode 100644 index 0000000000000000000000000000000000000000..2d597aef985fd20f9c96976403ba7bc6a0c6a5b8 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/azure_ai.py @@ -0,0 +1,17 @@ +from typing import Any, Dict, Iterable, List, Literal, Optional, Union + +from typing_extensions import Required, TypedDict + + +class ImageEmbeddingInput(TypedDict, total=False): + image: Required[str] + text: str + + +EncodingFormat = Literal["base64", "binary", "float", "int8", "ubinary", "uint8"] + + +class ImageEmbeddingRequest(TypedDict, total=False): + input: Required[List[ImageEmbeddingInput]] + dimensions: int + encoding_format: EncodingFormat diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/base.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/base.py new file mode 100644 index 0000000000000000000000000000000000000000..625d0441720e1aaabc0b5a3b8f65fe84af8a810c --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/base.py @@ -0,0 +1,77 @@ +from typing import Any, Optional, Union + +from openai._models import BaseModel as OpenAIObject +from pydantic import BaseModel, ConfigDict + + +class LiteLLMPydanticObjectBase(BaseModel): + """ + Implements default functions, all pydantic objects should have. + """ + + def json(self, **kwargs): # type: ignore + try: + return self.model_dump(**kwargs) # noqa + except Exception: + # if using pydantic v1 + return self.dict(**kwargs) + + def fields_set(self): + try: + return self.model_fields_set # noqa + except Exception: + # if using pydantic v1 + return self.__fields_set__ + + model_config = ConfigDict(protected_namespaces=()) + + +class BaseLiteLLMOpenAIResponseObject(BaseModel): + model_config = ConfigDict(extra="allow", protected_namespaces=()) + + def __getitem__(self, key): + return self.__dict__[key] + + def get(self, key, default=None): + return self.__dict__.get(key, default) + + def __contains__(self, key): + return key in self.__dict__ + + def items(self): + return self.__dict__.items() + + +class HiddenParams(OpenAIObject): + original_response: Optional[Union[str, Any]] = None + model_id: Optional[str] = None # used in Router for individual deployments + api_base: Optional[str] = None # returns api base used for making completion call + _response_ms: Optional[float] = None + response_cost: Optional[float] = None + + model_config = ConfigDict(extra="allow", protected_namespaces=()) + + def get(self, key, default=None): + # Custom .get() method to access attributes with a default value if the attribute doesn't exist + return getattr(self, key, default) + + def __getitem__(self, key): + # Allow dictionary-style access to attributes + return getattr(self, key) + + def __setitem__(self, key, value): + # Allow dictionary-style assignment of attributes + setattr(self, key, value) + + def json(self, **kwargs): # type: ignore + try: + return self.model_dump() # noqa + except Exception: + # if using pydantic v1 + return self.dict() + + def model_dump(self, **kwargs): + # Override model_dump to include private attributes + data = super().model_dump(**kwargs) + data["_response_ms"] = self._response_ms + return data diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/bedrock.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/bedrock.py new file mode 100644 index 0000000000000000000000000000000000000000..64827db13f6fd25e8d3241ffff8b093e99c6f36b --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/bedrock.py @@ -0,0 +1,1044 @@ +import json +from typing import Any, Dict, List, Literal, Optional, Union + +from typing_extensions import TYPE_CHECKING, Required, TypedDict, override + +from .openai import ChatCompletionToolCallChunk + + +class CachePointBlock(TypedDict, total=False): + type: Literal["default"] + ttl: str + + +class SystemContentBlock(TypedDict, total=False): + text: str + cachePoint: CachePointBlock + + +class SourceBlock(TypedDict): + bytes: Optional[str] # base 64 encoded string + + +BedrockImageTypes = Literal["png", "jpeg", "gif", "webp"] + + +class ImageBlock(TypedDict): + format: Union[BedrockImageTypes, str] + source: SourceBlock + + +BedrockVideoTypes = Literal[ + "mp4", "mov", "mkv", "webm", "flv", "mpeg", "mpg", "wmv", "3gp" +] + + +class VideoBlock(TypedDict): + format: Union[BedrockVideoTypes, str] + source: SourceBlock + + +BedrockDocumentTypes = Literal[ + "pdf", "csv", "doc", "docx", "xls", "xlsx", "html", "txt", "md" +] + + +class DocumentBlock(TypedDict): + format: Union[BedrockDocumentTypes, str] + source: SourceBlock + name: str + + +class ToolResultContentBlock(TypedDict, total=False): + image: ImageBlock + document: DocumentBlock + json: dict + text: str + + +class ToolResultBlock(TypedDict, total=False): + content: Required[List[ToolResultContentBlock]] + toolUseId: Required[str] + status: Literal["success", "error"] + + +class ToolUseBlock(TypedDict): + input: dict + name: str + toolUseId: str + + +class BedrockConverseReasoningTextBlock(TypedDict, total=False): + text: Required[str] + signature: str + + +class BedrockConverseReasoningContentBlock(TypedDict, total=False): + reasoningText: BedrockConverseReasoningTextBlock + redactedContent: str + + +class BedrockConverseReasoningContentBlockDelta(TypedDict, total=False): + signature: str + redactedContent: str + text: str + + +class GuardrailConverseTextBlock(TypedDict, total=False): + text: str + + +class GuardrailConverseContentBlock(TypedDict, total=False): + """Content block for selective guardrail evaluation in Bedrock Converse API""" + + text: GuardrailConverseTextBlock + + +class CitationWebLocationBlock(TypedDict, total=False): + """ + Web location block for Nova grounding citations. + Contains the URL and domain from web search results. + + Reference: https://docs.aws.amazon.com/nova/latest/userguide/grounding.html + """ + + url: str + domain: str + + +class CitationLocationBlock(TypedDict, total=False): + """ + Location block containing the web location for a citation. + """ + + web: CitationWebLocationBlock + + +class CitationReferenceBlock(TypedDict, total=False): + """ + Citation reference block containing a single citation with its location. + + Each citation contains: + - location.web.url: The URL of the source + - location.web.domain: The domain of the source + """ + + location: CitationLocationBlock + + +class CitationsContentBlock(TypedDict, total=False): + """ + Citations content block returned by Nova grounding (web search) tool. + + When Nova grounding is enabled via systemTool, the model may return + citationsContent blocks containing web search citation references. + + Reference: https://docs.aws.amazon.com/nova/latest/userguide/grounding.html + + Example response structure: + { + "citationsContent": { + "citations": [ + { + "location": { + "web": { + "url": "https://example.com/article", + "domain": "example.com" + } + } + } + ] + } + } + """ + + citations: List[CitationReferenceBlock] + + +class ContentBlock(TypedDict, total=False): + text: str + image: ImageBlock + video: VideoBlock + document: DocumentBlock + toolResult: ToolResultBlock + toolUse: ToolUseBlock + cachePoint: CachePointBlock + reasoningContent: BedrockConverseReasoningContentBlock + guardContent: GuardrailConverseContentBlock + citationsContent: CitationsContentBlock + + +class MessageBlock(TypedDict): + content: List[ContentBlock] + role: Literal["user", "assistant"] + + +class ConverseMetricsBlock(TypedDict): + latencyMs: float # time in ms + + +class ConverseResponseOutputBlock(TypedDict): + message: Optional[MessageBlock] + + +class ConverseTokenUsageBlock(TypedDict): + inputTokens: int + outputTokens: int + totalTokens: int + cacheReadInputTokenCount: int + cacheReadInputTokens: int + cacheWriteInputTokenCount: int + cacheWriteInputTokens: int + + +class ServiceTierBlock(TypedDict): + type: Literal["priority", "default", "flex"] + + +class ConverseResponseBlock(TypedDict, total=False): + additionalModelResponseFields: dict + metrics: ConverseMetricsBlock + output: Required[ConverseResponseOutputBlock] + stopReason: Required[ + str + ] # end_turn | tool_use | max_tokens | stop_sequence | content_filtered + usage: Required[ConverseTokenUsageBlock] + serviceTier: ( + ServiceTierBlock # Optional - only present when serviceTier was sent in request + ) + + +class ToolJsonSchemaBlock(TypedDict, total=False): + type: Literal["object"] + properties: dict + required: List[str] + + +class ToolInputSchemaBlock(TypedDict): + json: Optional[ToolJsonSchemaBlock] + + +class ToolSpecBlock(TypedDict, total=False): + inputSchema: Required[ToolInputSchemaBlock] + name: Required[str] + description: str + + +class SystemToolBlock(TypedDict, total=False): + """ + System tool block for Nova grounding and other built-in tools. + + Example: + { + "systemTool": { + "name": "nova_grounding" + } + } + """ + + name: Required[str] + + +class ToolBlock(TypedDict, total=False): + toolSpec: Optional[ToolSpecBlock] + systemTool: Optional[SystemToolBlock] + cachePoint: Optional[CachePointBlock] + + +class SpecificToolChoiceBlock(TypedDict): + name: str + + +class ToolChoiceValuesBlock(TypedDict, total=False): + any: dict + auto: dict + tool: SpecificToolChoiceBlock + + +class ToolConfigBlock(TypedDict, total=False): + tools: Required[List[ToolBlock]] + toolChoice: Union[str, ToolChoiceValuesBlock] + + +class GuardrailConfigBlock(TypedDict, total=False): + guardrailIdentifier: str + guardrailVersion: str + trace: Literal["enabled", "disabled"] + + +class InferenceConfig(TypedDict, total=False): + maxTokens: int + stopSequences: List[str] + temperature: float + topP: float + topK: int + + +class ToolBlockDeltaEvent(TypedDict): + input: str + + +class ToolUseBlockStartEvent(TypedDict): + name: str + toolUseId: str + + +class ContentBlockStartEvent(TypedDict, total=False): + toolUse: Optional[ToolUseBlockStartEvent] + reasoningContent: BedrockConverseReasoningContentBlockDelta + + +class ContentBlockDeltaEvent(TypedDict, total=False): + """ + Either 'text' or 'toolUse' will be specified for Converse API streaming response. + May also include 'citationsContent' when Nova grounding is enabled. + """ + + text: str + toolUse: ToolBlockDeltaEvent + reasoningContent: BedrockConverseReasoningContentBlockDelta + citationsContent: CitationsContentBlock + + +class PerformanceConfigBlock(TypedDict): + latency: Literal["optimized", "throughput"] + + +class JsonSchemaDefinition(TypedDict, total=False): + """JSON schema structured output format options for Bedrock Converse API.""" + + schema: Required[str] # JSON string, not dict + name: str + description: str + + +class OutputFormatStructure(TypedDict, total=False): + """The structure that the model's output must adhere to (union type).""" + + jsonSchema: Required[JsonSchemaDefinition] + + +class OutputFormat(TypedDict): + """Structured output parameters to control the model's response.""" + + type: Literal["json_schema"] + structure: OutputFormatStructure + + +class OutputConfigBlock(TypedDict, total=False): + """Output configuration for a model response in Converse/ConverseStream.""" + + textFormat: OutputFormat + + +class CommonRequestObject( + TypedDict, total=False +): # common request object across sync + async flows + additionalModelRequestFields: dict + additionalModelResponseFieldPaths: List[str] + inferenceConfig: InferenceConfig + system: List[SystemContentBlock] + toolConfig: ToolConfigBlock + guardrailConfig: Optional[GuardrailConfigBlock] + performanceConfig: Optional[PerformanceConfigBlock] + serviceTier: Optional[ServiceTierBlock] + requestMetadata: Optional[Dict[str, str]] + outputConfig: Optional[OutputConfigBlock] + + +class RequestObject(CommonRequestObject, total=False): + messages: Required[List[MessageBlock]] + + +class BedrockInvokeNovaRequest(TypedDict, total=False): + """ + Request object for sending `nova` requests to `/bedrock/invoke/` + """ + + messages: List[MessageBlock] + inferenceConfig: InferenceConfig + system: List[SystemContentBlock] + toolConfig: ToolConfigBlock + guardrailConfig: Optional[GuardrailConfigBlock] + + +class GenericStreamingChunk(TypedDict): + text: Required[str] + tool_use: Optional[ChatCompletionToolCallChunk] + is_finished: Required[bool] + finish_reason: Required[str] + usage: Optional[ConverseTokenUsageBlock] + index: int + + +class Document(TypedDict): + title: str + snippet: str + + +class ServerSentEvent: + def __init__( + self, + *, + event: Optional[str] = None, + data: Optional[str] = None, + id: Optional[str] = None, + retry: Optional[int] = None, + ) -> None: + if data is None: + data = "" + + self._id = id + self._data = data + self._event = event or None + self._retry = retry + + @property + def event(self) -> Optional[str]: + return self._event + + @property + def id(self) -> Optional[str]: + return self._id + + @property + def retry(self) -> Optional[int]: + return self._retry + + @property + def data(self) -> str: + return self._data + + def json(self) -> Any: + return json.loads(self.data) + + @override + def __repr__(self) -> str: + return f"ServerSentEvent(event={self.event}, data={self.data}, id={self.id}, retry={self.retry})" + + +COHERE_EMBEDDING_INPUT_TYPES = Literal[ + "search_document", "search_query", "classification", "clustering", "image" +] + + +class CohereEmbeddingRequest(TypedDict, total=False): + texts: List[str] + images: List[str] + input_type: Required[COHERE_EMBEDDING_INPUT_TYPES] + truncate: Literal["NONE", "START", "END"] + embedding_types: Literal["float", "int8", "uint8", "binary", "ubinary"] + output_dimension: int + + +class CohereEmbeddingRequestWithModel(CohereEmbeddingRequest): + model: Required[str] + + +class CohereEmbeddingResponse(TypedDict): + embeddings: List[List[float]] + id: str + response_type: Literal["embedding_floats"] + texts: List[str] + + +class AmazonTitanV2EmbeddingRequest(TypedDict, total=False): + inputText: Required[str] + dimensions: int + normalize: bool + embeddingTypes: List[Literal["float", "binary"]] + + +class AmazonTitanV2EmbeddingsByType(TypedDict, total=False): + binary: List[int] # Array of integers for binary format + float: List[float] # Array of floats for float format + + +class AmazonTitanV2EmbeddingResponse(TypedDict, total=False): + embedding: List[float] # Legacy field - array of floats (backward compatibility) + embeddingsByType: AmazonTitanV2EmbeddingsByType # New format per AWS schema + inputTextTokenCount: Required[int] # Always present in AWS response + + +class AmazonTitanG1EmbeddingRequest(TypedDict): + inputText: str + + +class AmazonTitanG1EmbeddingResponse(TypedDict): + embedding: List[float] + inputTextTokenCount: int + + +class AmazonTitanMultimodalEmbeddingConfig(TypedDict): + outputEmbeddingLength: Literal[256, 384, 1024] + + +class AmazonTitanMultimodalEmbeddingRequest(TypedDict, total=False): + inputText: str + inputImage: str + embeddingConfig: AmazonTitanMultimodalEmbeddingConfig + + +class AmazonTitanMultimodalEmbeddingResponse(TypedDict): + embedding: List[float] + inputTextTokenCount: int + message: str # Specifies any errors that occur during generation. + + +# TwelveLabs Marengo Embed 2.7 types +TWELVELABS_EMBEDDING_INPUT_TYPES = Literal["text", "image", "video", "audio"] +TWELVELABS_EMBEDDING_OPTIONS = Literal["visual-text", "visual-image", "audio"] + + +class TwelveLabsS3Location(TypedDict, total=False): + uri: str + bucketOwner: str + + +class TwelveLabsMediaSource(TypedDict, total=False): + base64String: str + s3Location: TwelveLabsS3Location + + +class TwelveLabsMarengoEmbeddingRequest(TypedDict, total=False): + inputType: Required[TWELVELABS_EMBEDDING_INPUT_TYPES] + inputText: str + mediaSource: TwelveLabsMediaSource + textTruncate: Literal["end", "none"] + startSec: float + lengthSec: float + useFixedLengthSec: float + minClipSec: int + embeddingOption: List[TWELVELABS_EMBEDDING_OPTIONS] + + +class TwelveLabsMarengoEmbeddingResponse(TypedDict): + embedding: List[float] + embeddingOption: TWELVELABS_EMBEDDING_OPTIONS + startSec: float + endSec: float + + +class TwelveLabsS3OutputDataConfig(TypedDict): + s3Uri: str + + +class TwelveLabsOutputDataConfig(TypedDict): + s3OutputDataConfig: TwelveLabsS3OutputDataConfig + + +class TwelveLabsAsyncInvokeRequest(TypedDict): + modelId: str + modelInput: TwelveLabsMarengoEmbeddingRequest + outputDataConfig: TwelveLabsOutputDataConfig + + +class TwelveLabsAsyncInvokeStatusResponse(TypedDict): + invocationArn: str + modelArn: str + status: str # "InProgress" | "Completed" | "Failed" + submitTime: str + lastModifiedTime: str + endTime: Optional[str] + outputDataConfig: TwelveLabsOutputDataConfig + clientRequestToken: Optional[str] + failureMessage: Optional[str] + + +# Amazon Nova Multimodal Embeddings types +NOVA_EMBEDDING_PURPOSES = Literal[ + "GENERIC_INDEX", + "GENERIC_RETRIEVAL", + "TEXT_RETRIEVAL", + "IMAGE_RETRIEVAL", + "VIDEO_RETRIEVAL", + "DOCUMENT_RETRIEVAL", + "AUDIO_RETRIEVAL", + "CLASSIFICATION", + "CLUSTERING", +] + +NOVA_EMBEDDING_DIMENSIONS = Literal[256, 384, 1024, 3072] + +NOVA_TRUNCATION_MODES = Literal["START", "END", "NONE"] + +NOVA_DETAIL_LEVELS = Literal["STANDARD_IMAGE", "DOCUMENT_IMAGE"] + +NOVA_EMBEDDING_MODES = Literal["AUDIO_VIDEO_COMBINED", "AUDIO_VIDEO_SEPARATE"] + +NOVA_EMBEDDING_TYPES = Literal[ + "TEXT", "IMAGE", "VIDEO", "AUDIO", "AUDIO_VIDEO_COMBINED" +] + + +class NovaSourceS3Location(TypedDict): + uri: str + + +class NovaSourceObject(TypedDict, total=False): + bytes: str # base64 encoded + s3Location: NovaSourceS3Location + + +class NovaTextParams(TypedDict, total=False): + truncationMode: NOVA_TRUNCATION_MODES + value: str + source: NovaSourceObject + + +class NovaImageParams(TypedDict, total=False): + format: str # png, jpeg, gif, webp + source: Required[NovaSourceObject] + detailLevel: NOVA_DETAIL_LEVELS + + +class NovaVideoParams(TypedDict, total=False): + format: str # mp4, mov, mkv, webm, flv, mpeg, mpg, wmv, 3gp + source: Required[NovaSourceObject] + embeddingMode: Required[NOVA_EMBEDDING_MODES] + + +class NovaAudioParams(TypedDict, total=False): + format: str # mp3, wav, ogg + source: Required[NovaSourceObject] + + +class NovaTextSegmentationConfig(TypedDict, total=False): + maxLengthChars: int # 800-50,000, default 32,000 + + +class NovaMediaSegmentationConfig(TypedDict, total=False): + durationSeconds: int # 1-30, default 5 + + +class NovaTextParamsWithSegmentation(NovaTextParams, total=False): + segmentationConfig: NovaTextSegmentationConfig + + +class NovaVideoParamsWithSegmentation(NovaVideoParams, total=False): + segmentationConfig: NovaMediaSegmentationConfig + + +class NovaAudioParamsWithSegmentation(NovaAudioParams, total=False): + segmentationConfig: NovaMediaSegmentationConfig + + +class NovaSingleEmbeddingParams(TypedDict, total=False): + embeddingPurpose: Required[NOVA_EMBEDDING_PURPOSES] + embeddingDimension: NOVA_EMBEDDING_DIMENSIONS + text: NovaTextParams + image: NovaImageParams + video: NovaVideoParams + audio: NovaAudioParams + + +class NovaSegmentedEmbeddingParams(TypedDict, total=False): + embeddingPurpose: Required[NOVA_EMBEDDING_PURPOSES] + embeddingDimension: NOVA_EMBEDDING_DIMENSIONS + text: NovaTextParamsWithSegmentation + image: NovaImageParams + video: NovaVideoParamsWithSegmentation + audio: NovaAudioParamsWithSegmentation + + +class NovaEmbeddingRequest(TypedDict, total=False): + schemaVersion: str # "nova-multimodal-embed-v1" + taskType: Literal["SINGLE_EMBEDDING", "SEGMENTED_EMBEDDING"] + singleEmbeddingParams: NovaSingleEmbeddingParams + segmentedEmbeddingParams: NovaSegmentedEmbeddingParams + + +class NovaEmbeddingItem(TypedDict, total=False): + embeddingType: NOVA_EMBEDDING_TYPES + embedding: Required[List[float]] + truncatedCharLength: int # Only for text + + +class NovaEmbeddingResponse(TypedDict): + embeddings: List[NovaEmbeddingItem] + + +class NovaS3OutputDataConfig(TypedDict): + s3Uri: str + + +class NovaOutputDataConfig(TypedDict): + s3OutputDataConfig: NovaS3OutputDataConfig + + +class NovaAsyncInvokeRequest(TypedDict): + modelId: str + modelInput: NovaEmbeddingRequest + outputDataConfig: NovaOutputDataConfig + + +AmazonEmbeddingRequest = Union[ + AmazonTitanMultimodalEmbeddingRequest, + AmazonTitanV2EmbeddingRequest, + AmazonTitanG1EmbeddingRequest, +] + + +class AmazonStability3TextToImageRequest(TypedDict, total=False): + """ + Request for Amazon Stability 3 Text to Image API + + Ref here: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-diffusion-3-text-image.html + """ + + prompt: str + aspect_ratio: Literal[ + "16:9", "1:1", "21:9", "2:3", "3:2", "4:5", "5:4", "9:16", "9:21" + ] + mode: Literal["image-to-image", "text-to-image"] + output_format: Literal["JPEG", "PNG"] + seed: int + negative_prompt: str + + +class AmazonStability3TextToImageResponse(TypedDict, total=False): + """ + Response for Amazon Stability 3 Text to Image API + + Ref: https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-diffusion-3-text-image.html + """ + + images: List[str] + seeds: List[str] + finish_reasons: List[str] + + +class AmazonTitanTextToImageParams(TypedDict, total=False): + """ + Params for Amazon Titan Text to Image API + """ + + text: Required[str] + negativeText: str + + +class AmazonNovaCanvasRequestBase(TypedDict, total=False): + """ + Base class for Amazon Nova Canvas API requests + """ + + pass + + +class AmazonNovaCanvasImageGenerationConfig(TypedDict, total=False): + """ + Config for Amazon Nova Canvas Text to Image API + + Ref: https://docs.aws.amazon.com/nova/latest/userguide/image-gen-req-resp-structure.html + """ + + cfgScale: int + seed: int + quality: Literal["standard", "premium"] + width: int + height: int + numberOfImages: int + + +class AmazonNovaCanvasTextToImageParams(TypedDict, total=False): + """ + Params for Amazon Nova Canvas Text to Image API + """ + + text: str + negativeText: str + controlStrength: float + controlMode: Literal["CANNY_EDIT", "SEGMENTATION"] + conditionImage: str + + +class AmazonNovaCanvasTextToImageRequest( + AmazonNovaCanvasRequestBase, TypedDict, total=False +): + """ + Request for Amazon Nova Canvas Text to Image API + + Ref: https://docs.aws.amazon.com/nova/latest/userguide/image-gen-req-resp-structure.html + """ + + textToImageParams: AmazonNovaCanvasTextToImageParams + taskType: Literal["TEXT_IMAGE"] + imageGenerationConfig: AmazonNovaCanvasImageGenerationConfig + + +class AmazonNovaCanvasColorGuidedGenerationParams(TypedDict, total=False): + """ + Params for Amazon Nova Canvas Color Guided Generation API + """ + + colors: List[str] + referenceImage: str + text: str + negativeText: str + + +class AmazonNovaCanvasColorGuidedRequest( + AmazonNovaCanvasRequestBase, TypedDict, total=False +): + """ + Request for Amazon Nova Canvas Color Guided Generation API + + Ref: https://docs.aws.amazon.com/nova/latest/userguide/image-gen-req-resp-structure.html + """ + + taskType: Literal["COLOR_GUIDED_GENERATION"] + colorGuidedGenerationParams: AmazonNovaCanvasColorGuidedGenerationParams + imageGenerationConfig: AmazonNovaCanvasImageGenerationConfig + + +class AmazonNovaCanvasTextToImageResponse(TypedDict, total=False): + """ + Response for Amazon Nova Canvas Text to Image API + + Ref: https://docs.aws.amazon.com/nova/latest/userguide/image-gen-req-resp-structure.html + """ + + images: List[str] + + +class AmazonNovaCanvasInpaintingParams(TypedDict, total=False): + """ + Params for Amazon Nova Canvas Inpainting API + """ + + text: str + maskImage: str + inputImage: str + negativeText: str + + +class AmazonNovaCanvasInpaintingRequest( + AmazonNovaCanvasRequestBase, TypedDict, total=False +): + """ + Request for Amazon Nova Canvas Inpainting API + + Ref: https://docs.aws.amazon.com/nova/latest/userguide/image-gen-req-resp-structure.html + """ + + taskType: Literal["INPAINTING"] + inpaintingParams: AmazonNovaCanvasInpaintingParams + imageGenerationConfig: AmazonNovaCanvasImageGenerationConfig + + +class AmazonTitanImageGenerationRequestBody(TypedDict, total=False): + """ + Config for Amazon Titan Image Generation API + """ + + taskType: Literal["TEXT_IMAGE", "COLOR_GUIDED_GENERATION", "INPAINTING"] + textToImageParams: AmazonTitanTextToImageParams + imageGenerationConfig: AmazonNovaCanvasImageGenerationConfig + + +if TYPE_CHECKING: + from botocore.awsrequest import AWSPreparedRequest +else: + AWSPreparedRequest = Any + + +class BedrockPreparedRequest(TypedDict): + """ + Internal/Helper class for preparing the request for bedrock image generation + """ + + endpoint_url: str + prepped: AWSPreparedRequest + body: bytes + data: dict + + +class BedrockRerankTextQuery(TypedDict): + text: str + + +class BedrockRerankQuery(TypedDict): + textQuery: BedrockRerankTextQuery + type: Literal["TEXT"] + + +class BedrockRerankModelConfiguration(TypedDict, total=False): + modelArn: Required[str] + modelConfiguration: dict + + +class BedrockRerankBedrockRerankingConfiguration(TypedDict): + modelConfiguration: BedrockRerankModelConfiguration + numberOfResults: int + + +class BedrockRerankConfiguration(TypedDict): + bedrockRerankingConfiguration: BedrockRerankBedrockRerankingConfiguration + type: Literal["BEDROCK_RERANKING_MODEL"] + + +class BedrockRerankTextDocument(TypedDict, total=False): + text: str + + +class BedrockRerankInlineDocumentSource(TypedDict, total=False): + jsonDocument: dict + textDocument: BedrockRerankTextDocument + type: Literal["TEXT", "JSON"] + + +class BedrockRerankSource(TypedDict): + inlineDocumentSource: BedrockRerankInlineDocumentSource + type: Literal["INLINE"] + + +class BedrockRerankRequest(TypedDict): + """ + Request for Bedrock Rerank API + """ + + queries: List[BedrockRerankQuery] + rerankingConfiguration: BedrockRerankConfiguration + sources: List[BedrockRerankSource] + + +class AmazonDeepSeekR1StreamingResponse(TypedDict): + generation: str + generation_token_count: int + stop_reason: Optional[str] + prompt_token_count: int + + +################ Bedrock Batch Types ################# + + +class BedrockS3InputDataConfig(TypedDict): + """S3 input data configuration for Bedrock batch jobs.""" + + s3Uri: str + + +class BedrockInputDataConfig(TypedDict): + """Input data configuration for Bedrock batch jobs.""" + + s3InputDataConfig: BedrockS3InputDataConfig + + +class BedrockS3OutputDataConfig(TypedDict, total=False): + """S3 output data configuration for Bedrock batch jobs.""" + + s3Uri: str + s3EncryptionKeyId: Optional[str] + + +class BedrockOutputDataConfig(TypedDict): + """Output data configuration for Bedrock batch jobs.""" + + s3OutputDataConfig: BedrockS3OutputDataConfig + + +class BedrockCreateBatchRequest(TypedDict, total=False): + """ + Request structure for creating a Bedrock batch inference job. + + Reference: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_CreateModelInvocationJob.html + """ + + jobName: str + roleArn: str + modelId: str + inputDataConfig: BedrockInputDataConfig + outputDataConfig: BedrockOutputDataConfig + timeoutDurationInHours: Optional[int] + clientRequestToken: Optional[str] + tags: Optional[List[dict]] + + +BedrockBatchJobStatus = Literal[ + "Submitted", "InProgress", "Completed", "Failed", "Stopping", "Stopped" +] + + +class BedrockCreateBatchResponse(TypedDict): + """ + Response structure from creating a Bedrock batch inference job. + + Reference: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_CreateModelInvocationJob.html + """ + + jobArn: str + jobName: str + status: BedrockBatchJobStatus + + +class BedrockGetBatchResponse(TypedDict, total=False): + """ + Response structure from getting a Bedrock batch inference job. + + Reference: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_GetModelInvocationJob.html + """ + + jobArn: str + jobName: str + modelId: str + roleArn: str + status: BedrockBatchJobStatus + message: Optional[str] + submitTime: Optional[str] + lastModifiedTime: Optional[str] + endTime: Optional[str] + inputDataConfig: BedrockInputDataConfig + outputDataConfig: BedrockOutputDataConfig + timeoutDurationInHours: Optional[int] + clientRequestToken: Optional[str] + + +class BedrockToolBlock(TypedDict, total=False): + toolSpec: Optional[ToolSpecBlock] + systemTool: Optional[SystemToolBlock] # For Nova grounding + cachePoint: Optional[CachePointBlock] + + +class BedrockInvokeAnthropicMessagesRequest(TypedDict, total=False): + """ + Top-level request body accepted by AWS Bedrock `InvokeModel` / + `InvokeModelWithResponseStream` when calling an Anthropic Claude model with + the Messages API format. The LiteLLM /v1/messages → Bedrock Invoke + transformation filters outgoing requests to the keys of this TypedDict; any + other field (Anthropic-only extension, internal metadata, future addition) + is dropped before signing so Bedrock doesn't 400 with + "Extra inputs are not permitted". + + Reference: + https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-anthropic-claude-messages.html + https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-anthropic-claude-messages-request-response.html + + Editing this type is the single source of truth — the runtime allowlist in + `AmazonAnthropicClaudeMessagesConfig.BEDROCK_INVOKE_ALLOWED_TOP_LEVEL_FIELDS` + is derived from `__annotations__`, and a test asserts the resolved set + exactly, so any edit forces a conscious review. + + Value types are intentionally loose (`list`, `dict`) — this type exists to + pin the allowed field names, not to validate nested structure. + """ + + # Required by Bedrock + anthropic_version: str + max_tokens: int + messages: list + + # Documented optional fields + anthropic_beta: List[str] + system: object # str or list[TextBlock] + stop_sequences: List[str] + temperature: float + top_p: float + top_k: int + tools: list + tool_choice: dict + + # `thinking` is required for Opus 4.5 / Sonnet 4 extended thinking, + # `metadata` is part of the common Anthropic Messages API shape. + thinking: dict + metadata: dict + output_config: dict diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/bedrock_agentcore.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/bedrock_agentcore.py new file mode 100644 index 0000000000000000000000000000000000000000..cd6b75f2ac3c1858e1cb2b678db1484bf3e515de --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/bedrock_agentcore.py @@ -0,0 +1,134 @@ +""" +Type definitions for AWS Bedrock AgentCore API. + +https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agentcore_InvokeAgentRuntime.html +""" + +from typing import Dict, List, Optional + +from typing_extensions import Literal, TypedDict + + +# Request Types +class AgentCoreRequestPayload(TypedDict): + """Payload for AgentCore request.""" + + prompt: str + + +class AgentCoreRequest(TypedDict, total=False): + """Complete request structure for AgentCore API (internal use).""" + + payload: str # JSON-encoded AgentCoreRequestPayload + + +# Response SSE Event Types +class AgentCoreMessageRole(TypedDict): + """Message role information.""" + + role: Literal["assistant"] + + +class AgentCoreMessageStart(TypedDict): + """Message start event.""" + + role: Literal["assistant"] + + +class AgentCoreContentBlockDelta(TypedDict): + """Content delta information.""" + + text: str + + +class AgentCoreContentBlockDeltaEvent(TypedDict): + """Content block delta event.""" + + delta: AgentCoreContentBlockDelta + contentBlockIndex: int + + +class AgentCoreContentBlockStop(TypedDict): + """Content block stop event.""" + + contentBlockIndex: int + + +class AgentCoreMessageStop(TypedDict): + """Message stop event.""" + + stopReason: Literal["end_turn", "max_tokens", "stop_sequence"] + + +class AgentCoreUsage(TypedDict): + """Token usage information.""" + + inputTokens: int + outputTokens: int + totalTokens: int + + +class AgentCoreMetrics(TypedDict): + """Response metrics.""" + + latencyMs: int + + +class AgentCoreMetadata(TypedDict): + """Metadata event payload.""" + + usage: AgentCoreUsage + metrics: AgentCoreMetrics + + +class AgentCoreEventPayload(TypedDict, total=False): + """Union payload for different event types.""" + + # messageStart event + messageStart: Optional[AgentCoreMessageStart] + + # contentBlockDelta event + contentBlockDelta: Optional[AgentCoreContentBlockDeltaEvent] + + # contentBlockStop event + contentBlockStop: Optional[AgentCoreContentBlockStop] + + # messageStop event + messageStop: Optional[AgentCoreMessageStop] + + # metadata event + metadata: Optional[AgentCoreMetadata] + + +class AgentCoreEvent(TypedDict, total=False): + """SSE event structure from AgentCore.""" + + event: Optional[AgentCoreEventPayload] + + +class AgentCoreContentBlock(TypedDict): + """Content block in final message.""" + + text: str + + +class AgentCoreMessage(TypedDict): + """Complete message structure.""" + + role: Literal["assistant"] + content: List[AgentCoreContentBlock] + + +class AgentCoreFinalMessage(TypedDict): + """Final message event containing complete response.""" + + message: AgentCoreMessage + + +# Response parsing result (internal use) +class AgentCoreParsedResponse(TypedDict): + """Parsed response from SSE stream.""" + + content: str + usage: Optional[AgentCoreUsage] + final_message: Optional[AgentCoreMessage] diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/bedrock_invoke_agents.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/bedrock_invoke_agents.py new file mode 100644 index 0000000000000000000000000000000000000000..385048b4ff69dc9628a16928047faa837cc4f75a --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/bedrock_invoke_agents.py @@ -0,0 +1,129 @@ +""" +Type definitions for AWS Bedrock Invoke Agent API responses. + +https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html +""" + +from typing import Any, Dict, List, Optional, Union + +from typing_extensions import TypedDict + + +class InvokeAgentEventHeaders(TypedDict, total=False): + """Headers for AWS Invoke Agent events.""" + + event_type: str # 'trace', 'chunk', etc. + content_type: str # 'application/json', etc. + message_type: str # 'event', etc. + + +class InvokeAgentUsage(TypedDict): + """Token usage information from trace events.""" + + inputTokens: int + outputTokens: int + model: Optional[str] + + +class InvokeAgentMetadata(TypedDict, total=False): + """Metadata from model invocation.""" + + clientRequestId: Optional[str] + endTime: Optional[str] + startTime: Optional[str] + totalTimeMs: Optional[int] + usage: Optional[InvokeAgentUsage] + + +class InvokeAgentModelInvocationInput(TypedDict, total=False): + """Model invocation input details.""" + + foundationModel: Optional[str] + inferenceConfiguration: Optional[Dict[str, Any]] + text: Optional[str] + traceId: Optional[str] + type: Optional[str] + + +class InvokeAgentModelInvocationOutput(TypedDict, total=False): + """Model invocation output details.""" + + metadata: Optional[InvokeAgentMetadata] + parsedResponse: Optional[Dict[str, Any]] + rawResponse: Optional[Dict[str, Any]] + reasoningContent: Optional[Dict[str, Any]] + traceId: Optional[str] + + +class InvokeAgentOrchestrationTrace(TypedDict, total=False): + """Orchestration trace information.""" + + modelInvocationInput: Optional[InvokeAgentModelInvocationInput] + modelInvocationOutput: Optional[InvokeAgentModelInvocationOutput] + + +class InvokeAgentPreProcessingTrace(TypedDict, total=False): + """Pre-processing trace information.""" + + modelInvocationInput: Optional[InvokeAgentModelInvocationInput] + modelInvocationOutput: Optional[InvokeAgentModelInvocationOutput] + + +class InvokeAgentTrace(TypedDict, total=False): + """Trace information container.""" + + orchestrationTrace: Optional[InvokeAgentOrchestrationTrace] + preProcessingTrace: Optional[InvokeAgentPreProcessingTrace] + + +class InvokeAgentCallerChain(TypedDict, total=False): + """Caller chain information.""" + + agentAliasArn: str + + +class InvokeAgentTracePayload(TypedDict, total=False): + """Payload for trace events.""" + + agentAliasId: str + agentId: str + agentVersion: str + callerChain: List[InvokeAgentCallerChain] + eventTime: str + sessionId: str + trace: InvokeAgentTrace + + +class InvokeAgentChunkPayload(TypedDict, total=False): + """Payload for chunk events containing response content.""" + + bytes: str # Base64 encoded response content + + +class InvokeAgentEventPayload(TypedDict, total=False): + """Union type for different event payload types.""" + + # Trace event fields + agentAliasId: Optional[str] + agentId: Optional[str] + agentVersion: Optional[str] + callerChain: Optional[List[InvokeAgentCallerChain]] + eventTime: Optional[str] + sessionId: Optional[str] + trace: Optional[InvokeAgentTrace] + + # Chunk event fields + bytes: Optional[str] + + +class InvokeAgentEvent(TypedDict, total=False): + """Complete event structure for AWS Invoke Agent responses.""" + + headers: InvokeAgentEventHeaders + payload: Optional[InvokeAgentEventPayload] + + +# Type aliases for convenience +InvokeAgentEventList = List[InvokeAgentEvent] +InvokeAgentTraceEvent = InvokeAgentEvent # When headers.event_type == 'trace' +InvokeAgentChunkEvent = InvokeAgentEvent # When headers.event_type == 'chunk' diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/cohere.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/cohere.py new file mode 100644 index 0000000000000000000000000000000000000000..ea41bacd965881ad411897b7473e635bdf006d42 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/cohere.py @@ -0,0 +1,102 @@ +from typing import Iterable, List, Optional, Union + +from typing_extensions import Literal, Required, TypedDict + + +class CallObject(TypedDict): + name: str + parameters: dict + + +class ToolResultObject(TypedDict): + call: CallObject + outputs: List[dict] + + +class ChatHistoryToolResult(TypedDict, total=False): + role: Required[Literal["TOOL"]] + tool_results: List[ToolResultObject] + + +class ToolCallObject(TypedDict): + name: str + parameters: dict + + +class ChatHistoryUser(TypedDict, total=False): + role: Required[Literal["USER"]] + message: str + tool_calls: List[ToolCallObject] + + +class ChatHistorySystem(TypedDict, total=False): + role: Required[Literal["SYSTEM"]] + message: str + tool_calls: List[ToolCallObject] + + +class ChatHistoryChatBot(TypedDict, total=False): + role: Required[Literal["CHATBOT"]] + message: str + tool_calls: List[ToolCallObject] + + +ChatHistory = List[ + Union[ChatHistorySystem, ChatHistoryChatBot, ChatHistoryUser, ChatHistoryToolResult] +] + + +class CohereV2ChatResponseMessageToolCallFunction(TypedDict, total=False): + name: str + parameters: dict + + +class CohereV2ChatResponseMessageToolCall(TypedDict): + id: str + type: Literal["function"] + function: CohereV2ChatResponseMessageToolCallFunction + + +class CohereV2ChatResponseMessageContent(TypedDict): + id: str + type: Literal["tool"] + tool: str + + +class CohereV2ChatResponseMessage(TypedDict, total=False): + role: Required[Literal["assistant"]] + tool_calls: List[CohereV2ChatResponseMessageToolCall] + tool_plan: str + content: List[CohereV2ChatResponseMessageContent] + citations: List[dict] + + +class CohereV2ChatResponseUsageBilledUnits(TypedDict, total=False): + input_tokens: int + output_tokens: int + search_units: int + classifications: int + + +class CohereV2ChatResponseUsageTokens(TypedDict, total=False): + input_tokens: int + output_tokens: int + + +class CohereV2ChatResponseUsage(TypedDict, total=False): + billed_units: CohereV2ChatResponseUsageBilledUnits + tokens: CohereV2ChatResponseUsageTokens + + +class CohereV2ChatResponseLogProbs(TypedDict, total=False): + token_ids: Required[List[int]] + text: str + logprobs: List[float] + + +class CohereV2ChatResponse(TypedDict): + id: str + finish_reason: str + message: CohereV2ChatResponseMessage + usage: CohereV2ChatResponseUsage + logprobs: CohereV2ChatResponseLogProbs diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/custom_http.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/custom_http.py new file mode 100644 index 0000000000000000000000000000000000000000..792adb4182dc5adc927a343519bb46b56deae511 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/custom_http.py @@ -0,0 +1,34 @@ +import ssl +from enum import Enum +from typing import Union + + +class httpxSpecialProvider(str, Enum): + """ + Httpx Clients can be created for these litellm internal providers + + Example: + - langsmith logging would need a custom async httpx client + - pass through endpoint would need a custom async httpx client + """ + + LoggingCallback = "logging_callback" + GuardrailCallback = "guardrail_callback" + Caching = "caching" + Oauth2Check = "oauth2_check" + Oauth2Register = "oauth2_register" + SecretManager = "secret_manager" + PassThroughEndpoint = "pass_through_endpoint" + PromptFactory = "prompt_factory" + SSO_HANDLER = "sso_handler" + Search = "search" + MCP = "mcp" + RAG = "rag" + A2AProvider = "a2a_provider" + AgentHealthCheck = "agent_health_check" + A2A = "a2a" + PromptManagement = "prompt_management" + UI = "ui" + + +VerifyTypes = Union[str, bool, ssl.SSLContext] diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/custom_llm.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/custom_llm.py new file mode 100644 index 0000000000000000000000000000000000000000..d5499a4194431004f6d27d4ed20ea31eccde8123 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/custom_llm.py @@ -0,0 +1,10 @@ +from typing import List + +from typing_extensions import Dict, Required, TypedDict, override + +from litellm.llms.custom_llm import CustomLLM + + +class CustomLLMItem(TypedDict): + provider: str + custom_handler: CustomLLM diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/databricks.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/databricks.py new file mode 100644 index 0000000000000000000000000000000000000000..c862bf0e4ac7afb00563b3beab26e8a57e9cde4d --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/databricks.py @@ -0,0 +1,84 @@ +import json +from typing import Any, Dict, List, Literal, Optional, Union + +from pydantic import BaseModel +from typing_extensions import ( + Protocol, + Required, + Self, + TypedDict, + TypeGuard, + get_origin, + override, + runtime_checkable, +) + +from .openai import ChatCompletionToolCallChunk, ChatCompletionUsageBlock + + +class GenericStreamingChunk(TypedDict, total=False): + text: Required[str] + is_finished: Required[bool] + finish_reason: Required[Optional[str]] + logprobs: Optional[BaseModel] + original_chunk: Optional[BaseModel] + usage: Optional[BaseModel] + + +class DatabricksTextContent(TypedDict, total=False): + type: Literal["text"] + text: Required[str] + citations: Optional[List[Dict[str, Any]]] + + +class DatabricksReasoningSummary(TypedDict): + type: Literal["summary_text"] + text: str + signature: str + + +class DatabricksReasoningContent(TypedDict, total=False): + type: Literal["reasoning"] + summary: Required[List[DatabricksReasoningSummary]] + citations: Optional[List[Dict[str, Any]]] + + +AllDatabricksContentListValues = Union[ + DatabricksTextContent, DatabricksReasoningContent +] + +AllDatabricksContentValues = Union[str, List[AllDatabricksContentListValues]] + + +class DatabricksFunction(TypedDict, total=False): + name: Required[str] + description: Union[dict, str] + parameters: dict + strict: bool + + +class DatabricksTool(TypedDict): + function: DatabricksFunction + type: Literal["function"] + + +class DatabricksMessage(TypedDict, total=False): + role: Required[str] + content: Required[AllDatabricksContentValues] + tool_calls: Optional[List[DatabricksTool]] + + +class DatabricksChoice(TypedDict, total=False): + index: Required[int] + message: Required[DatabricksMessage] + finish_reason: Required[Optional[str]] + extra_fields: str + + +class DatabricksResponse(TypedDict): + id: str + object: str + created: int + model: str + choices: List[DatabricksChoice] + usage: ChatCompletionUsageBlock diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/gemini.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/gemini.py new file mode 100644 index 0000000000000000000000000000000000000000..9e3fea1bbbbece5dcc0751d2061a9a6d8d1891a4 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/gemini.py @@ -0,0 +1,361 @@ +from enum import Enum +from typing import Any, Dict, Iterable, List, Literal, Optional, Union + +from typing_extensions import Required, TypedDict + +from .vertex_ai import ( + GenerationConfig, + HttpxBlobType, + HttpxContentType, + Tools, + UsageMetadata, +) + + +class GeminiFilesState(Enum): + STATE_UNSPECIFIED = "STATE_UNSPECIFIED" + PROCESSING = "PROCESSING" + ACTIVE = "ACTIVE" + FAILED = "FAILED" + + +class GeminiFilesSource(Enum): + SOURCE_UNSPECIFIED = "SOURCE_UNSPECIFIED" + UPLOADED = "UPLOADED" + GENERATED = "GENERATED" + + +class GeminiCreateFilesResponseObject(TypedDict): + name: str + displayName: str + mimeType: str + sizeBytes: str + createTime: str + updateTime: str + expirationTime: str + sha256Hash: str + uri: str + state: GeminiFilesState + source: GeminiFilesSource + error: dict + metadata: dict + + +class BidiGenerateContentTranscription(TypedDict): + text: str + """Output only. The transcription of the audio.""" + + +class BidiGenerateContentServerContent(TypedDict, total=False): + generationComplete: bool + """Output only. If true, indicates that the model is done generating.""" + + turnComplete: bool + """Output only. If true, indicates that the model has completed its turn. Generation will only start in response to additional client messages.""" + + interrupted: bool + """Output only. If true, indicates that a client message has interrupted current model generation. If the client is playing out the content in real time, this is a good signal to stop and empty the current playback queue.""" + + groundingMetadata: dict + """Output only. Grounding metadata for the generated content.""" + + inputTranscription: BidiGenerateContentTranscription + """Output only. Input audio transcription. The transcription is sent independently of the other server messages and there is no guaranteed ordering.""" + + outputTranscription: BidiGenerateContentTranscription + """Output only. Output audio transcription. The transcription is sent independently of the other server messages and there is no guaranteed ordering, in particular not between serverContent and this outputTranscription.""" + + modelTurn: HttpxContentType + """Output only. The content that the model is currently generating.""" + + +class BidiGenerateContentServerMessage(TypedDict, total=False): + usageMetadata: UsageMetadata + """Output only. Usage metadata for the generated content.""" + + serverContent: BidiGenerateContentServerContent + """Output only. The content that the model is currently generating.""" + + setupComplete: dict + """Output only. The setup complete message.""" + + +class BidiGenerateContentRealtimeInput(TypedDict, total=False): + text: str + """The text to be sent to the model.""" + + audio: HttpxBlobType + """The audio to be sent to the model.""" + + video: HttpxBlobType + """The video to be sent to the model.""" + + audioStreamEnd: bool + """Output only. If true, indicates that the audio stream has ended.""" + + activityStart: bool + """Output only. If true, indicates that the activity has started.""" + + activityEnd: bool + """Output only. If true, indicates that the activity has ended.""" + + +StartOfSpeechSensitivityEnum = Literal[ + "START_SENSITIVITY_UNSPECIFIED", "START_SENSITIVITY_HIGH", "START_SENSITIVITY_LOW" +] +EndOfSpeechSensitivityEnum = Literal[ + "END_SENSITIVITY_UNSPECIFIED", "END_SENSITIVITY_HIGH", "END_SENSITIVITY_LOW" +] + + +class AutomaticActivityDetection(TypedDict, total=False): + disabled: bool + startOfSpeechSensitivity: StartOfSpeechSensitivityEnum + prefixPaddingMs: int + endOfSpeechSensitivity: EndOfSpeechSensitivityEnum + silenceDurationMs: int + + +class BidiGenerateContentRealtimeInputConfig(TypedDict, total=False): + automaticActivityDetection: AutomaticActivityDetection + + +class BidiGenerateContentSetup(TypedDict, total=False): + model: str + """The model to be used for the realtime session.""" + + generationConfig: GenerationConfig + """The generation config to be used for the realtime session.""" + + systemInstruction: HttpxContentType + """The system instruction to be used for the realtime session.""" + + tools: List[Tools] + """The tools to be used for the realtime session.""" + + realtimeInputConfig: dict + """The realtime config to be used for the realtime session.""" + + sessionResumption: dict + """The session resumption to be used for the realtime session.""" + + sessionResumptionConfig: dict + """The session resumption config to be used for the realtime session.""" + + contextWindowCompression: dict + """The context window compression to be used for the realtime session.""" + + inputAudioTranscription: dict + """The input audio transcription to be used for the realtime session.""" + + outputAudioTranscription: dict + """The output audio transcription to be used for the realtime session.""" + + +# Image Generation Types +from pydantic import BaseModel + + +class GeminiImageGenerationInstance(TypedDict): + """Instance data for Gemini image generation request""" + + prompt: str + + +class GeminiImageGenerationParameters(BaseModel): + """Parameters for Gemini image generation request""" + + sampleCount: Optional[int] = None + """Number of images to generate (maps to OpenAI 'n' parameter)""" + + aspectRatio: Optional[str] = None + """Aspect ratio for generated images (e.g., '1:1', '16:9', '9:16', '4:3', '3:4')""" + + personGeneration: Optional[str] = None + """Controls person generation in images""" + + # Additional parameters that might be passed through + background: Optional[str] = None + """Background specification""" + + input_fidelity: Optional[str] = None + """Input fidelity specification""" + + moderation: Optional[str] = None + """Moderation settings""" + + output_compression: Optional[str] = None + """Output compression settings""" + + output_format: Optional[str] = None + """Output format specification""" + + quality: Optional[str] = None + """Quality settings""" + + response_format: Optional[str] = None + """Response format specification""" + + style: Optional[str] = None + """Style specification""" + + user: Optional[str] = None + """User specification""" + + +class GeminiImageGenerationRequest(BaseModel): + """Complete request body for Gemini image generation""" + + instances: List[GeminiImageGenerationInstance] + parameters: GeminiImageGenerationParameters + + +class GeminiGeneratedImage(TypedDict): + """Individual generated image data from Gemini response""" + + bytesBase64Encoded: str + """Base64 encoded image data""" + + +class GeminiImageGenerationPrediction(TypedDict): + """Prediction object containing generated images""" + + generatedImages: List[GeminiGeneratedImage] + + +class GeminiImageGenerationResponse(TypedDict): + """Complete response body from Gemini image generation API""" + + predictions: List[GeminiImageGenerationPrediction] + + +# Video Generation Types +class GeminiVideoGenerationInstance(TypedDict): + """Instance data for Gemini video generation request""" + + prompt: str + + +class GeminiVideoGenerationParameters(BaseModel): + """ + Parameters for Gemini video generation request. + + See: Veo 3/3.1 parameter guide. + """ + + aspectRatio: Optional[str] = None + """Aspect ratio for generated video (e.g., '16:9', '9:16').""" + + durationSeconds: Optional[int] = None + """ + Length of the generated video in seconds (e.g., 4, 5, 6, 8). + Must be 8 when using extension/interpolation or referenceImages. + """ + + resolution: Optional[str] = None + """ + Video resolution (e.g., '720p', '1080p'). + '1080p' only supports 8s duration; extension only supports '720p'. + """ + + negativePrompt: Optional[str] = None + """Text describing what not to include in the video.""" + + image: Optional[Any] = None + """ + An initial image to animate (Image object). + """ + + lastFrame: Optional[Any] = None + """ + The final image for interpolation video to transition. + Should be used with the 'image' parameter. + """ + + referenceImages: Optional[list] = None + """ + Up to three images to be used as style/content references. + Only supported in Veo 3.1 (list of VideoGenerationReferenceImage objects). + """ + + video: Optional[Any] = None + """ + Video to be used for video extension (Video object). + Only supported in Veo 3.1 & Veo 3 Fast. + """ + + personGeneration: Optional[str] = None + """ + Controls the generation of people. + Text-to-video & Extension: "allow_all" only + Image-to-video, Interpolation, & Reference images (Veo 3.x): "allow_adult" only + See documentation for region restrictions & more. + """ + + +class GeminiVideoGenerationRequest(BaseModel): + """Complete request body for Gemini video generation""" + + instances: List[GeminiVideoGenerationInstance] + parameters: Optional[GeminiVideoGenerationParameters] = None + + +# Video Generation Operation Response Types +class GeminiVideoUri(BaseModel): + """Video URI in the generated sample""" + + uri: str + """File URI of the generated video (e.g., 'files/abc123...')""" + + +class GeminiGeneratedVideoSample(BaseModel): + """Individual generated video sample""" + + video: GeminiVideoUri + """Video object containing the URI""" + + +class GeminiGenerateVideoResponse(BaseModel): + """Generate video response containing the samples""" + + generatedSamples: List[GeminiGeneratedVideoSample] + """List of generated video samples""" + + +class GeminiOperationResponse(BaseModel): + """Response object in the operation when done""" + + generateVideoResponse: GeminiGenerateVideoResponse + """Video generation response""" + + +class GeminiOperationMetadata(BaseModel): + """Metadata for the operation""" + + createTime: Optional[str] = None + """Creation timestamp""" + model: Optional[str] = None + """Model used for generation""" + + +class GeminiLongRunningOperationResponse(BaseModel): + """ + Complete response for a long-running operation. + + Used when polling operation status and extracting results. + """ + + name: str + """Operation name (e.g., 'operations/generate_1234567890')""" + + done: bool = False + """Whether the operation is complete""" + + metadata: Optional[GeminiOperationMetadata] = None + """Operation metadata""" + + response: Optional[GeminiOperationResponse] = None + """Response object when operation is complete""" + + error: Optional[Dict[str, Any]] = None + """Error details if operation failed""" diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/langgraph.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/langgraph.py new file mode 100644 index 0000000000000000000000000000000000000000..9286ca463eec012e53ab52b523742faec15652cf --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/langgraph.py @@ -0,0 +1,67 @@ +""" +Type definitions for LangGraph API. + +LangGraph provides a streaming and non-streaming API for running agents. +""" + +from typing import Any, Dict, List, Optional + +from typing_extensions import Literal, TypedDict + + +# Request Types +class LangGraphMessage(TypedDict, total=False): + """Message format for LangGraph input.""" + + role: Literal["human", "assistant", "system"] + content: str + + +class LangGraphInput(TypedDict, total=False): + """Input structure for LangGraph request.""" + + messages: List[LangGraphMessage] + + +class LangGraphRequest(TypedDict, total=False): + """Request structure for LangGraph API.""" + + assistant_id: str + input: LangGraphInput + stream_mode: Optional[str] + config: Optional[Dict[str, Any]] + metadata: Optional[Dict[str, Any]] + + +# Response Types - Streaming +class LangGraphStreamEvent(TypedDict, total=False): + """Single event in a LangGraph stream response.""" + + event: str + data: Any + + +# Response Types - Non-streaming +class LangGraphResponseMessage(TypedDict, total=False): + """Message in LangGraph response.""" + + type: str + content: str + id: Optional[str] + name: Optional[str] + + +class LangGraphResponse(TypedDict, total=False): + """Non-streaming response structure from LangGraph.""" + + messages: List[LangGraphResponseMessage] + values: Dict[str, Any] + + +# Parsed response for internal use +class LangGraphParsedResponse(TypedDict): + """Parsed response from LangGraph.""" + + content: str + role: str + usage: Optional[Dict[str, int]] diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/mistral.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/mistral.py new file mode 100644 index 0000000000000000000000000000000000000000..34f501ef69fe55d6f1dc1f6487308bf350545ae6 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/mistral.py @@ -0,0 +1,24 @@ +from typing import List, Literal, Optional, Union + +from typing_extensions import TypedDict + + +class FunctionCall(TypedDict): + name: Optional[str] + arguments: Optional[Union[str, dict]] + + +class MistralToolCallMessage(TypedDict): + id: Optional[str] + type: Literal["function"] + function: Optional[FunctionCall] + + +class MistralTextBlock(TypedDict): + type: Literal["text"] + text: str + + +class MistralThinkingBlock(TypedDict): + type: Literal["thinking"] + thinking: List[MistralTextBlock] diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/oci.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/oci.py new file mode 100644 index 0000000000000000000000000000000000000000..e041810158a4d0a88bd1de0e54bd6d94fac09b24 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/oci.py @@ -0,0 +1,396 @@ +from __future__ import annotations + +from enum import Enum +from typing import Any, Dict, List, Literal, Optional, Union + +from pydantic import BaseModel + +OCIRoles = Literal["SYSTEM", "USER", "ASSISTANT", "TOOL"] + + +class OCIVendors(Enum): + """ + A class to hold the vendor names for OCI models. + This is used to map model names to their respective vendors. + """ + + COHERE = "COHERE" + GEMINI = "GEMINI" + GENERIC = "GENERIC" + + +# --- Base Models and Content Parts --- + + +class OCIContentPart(BaseModel): + """Base model for content parts in an OCI message.""" + + pass + + +class OCITextContentPart(OCIContentPart): + """Text content part for the OCI API.""" + + type: Literal["TEXT"] = "TEXT" + text: str + + +class OCIImageUrl(BaseModel): + """ImageUrl object for OCI API. See: https://docs.oracle.com/en-us/iaas/tools/python/latest/api/generative_ai_inference/models/oci.generative_ai_inference.models.ImageUrl.html""" + + url: str + detail: Optional[Literal["AUTO", "HIGH", "LOW"]] = None + + +class OCIImageContentPart(OCIContentPart): + """Image content part for the OCI API.""" + + type: Literal["IMAGE"] = "IMAGE" + imageUrl: OCIImageUrl + + +OCIContentPartUnion = Union[OCITextContentPart, OCIImageContentPart] + +# --- Models for Tools and Tool Calls --- + + +class OCIToolCall(BaseModel): + """Represents a tool call made by the model.""" + + id: str + type: Literal["FUNCTION"] = "FUNCTION" + name: str + arguments: str # Arguments should be a JSON-serialized string + + +class OCIToolDefinition(BaseModel): + """Defines a tool that can be used by the model.""" + + type: Literal["FUNCTION"] = "FUNCTION" + name: Optional[str] = None + description: Optional[str] = None + parameters: Optional[dict] = None + + +# --- Message Models (Request and Response) --- + + +class OCIMessage(BaseModel): + """Model for a single message in the request/response payload.""" + + role: OCIRoles + content: Optional[List[OCIContentPartUnion]] = None + toolCalls: Optional[List[OCIToolCall]] = None + toolCallId: Optional[str] = None + + +# --- Request Payload Models --- + + +class OCIChatRequestPayload(BaseModel): + """Internal 'chatRequest' payload for the OCI API.""" + + apiFormat: str + messages: List[OCIMessage] + tools: Optional[List[OCIToolDefinition]] = None + isStream: bool = False + numGenerations: Optional[int] = None + maxTokens: Optional[int] = None + temperature: Optional[float] = None + topP: Optional[float] = None + stop: Optional[List[str]] = None + seed: Optional[int] = None + frequencyPenalty: Optional[float] = None + presencePenalty: Optional[float] = None + responseFormat: Optional[Dict[str, Any]] = None + + +class OCIServingMode(BaseModel): + """Defines the serving mode and the model to be used.""" + + servingType: str + endpointId: Optional[str] = None + modelId: Optional[str] = None + + +class OCICompletionPayload(BaseModel): + """Pydantic model for the complete OCI chat request body.""" + + compartmentId: str + servingMode: OCIServingMode + chatRequest: Union[OCIChatRequestPayload, CohereChatRequest] + + +# --- API Response Models (Non-streaming) --- + + +class OCICompletionTokenDetails(BaseModel): + """Completion token details in the OCI response.""" + + acceptedPredictionTokens: Optional[int] = None + reasoningTokens: Optional[int] = None + + +class OCIPromptTokensDetails(BaseModel): + """Prompt token details in the OCI response.""" + + cachedTokens: Optional[int] = None + + +class OCIResponseUsage(BaseModel): + """Token usage in the OCI response.""" + + promptTokens: int + completionTokens: int + totalTokens: int + completionTokensDetails: Optional[OCICompletionTokenDetails] = None + promptTokensDetails: Optional[OCIPromptTokensDetails] = None + + +class OCIResponseChoice(BaseModel): + """A completion choice in the OCI response.""" + + index: int + message: OCIMessage + finishReason: Optional[str] = None + logprobs: Optional[Dict[str, Any]] = None + + +class OCIChatResponse(BaseModel): + """The 'chatResponse' object in the OCI response.""" + + apiFormat: str + timeCreated: str + choices: List[OCIResponseChoice] + usage: OCIResponseUsage + + +class OCICompletionResponse(BaseModel): + """Model for the complete non-streaming OCI response body.""" + + modelId: str + modelVersion: str + chatResponse: OCIChatResponse + + +# --- API Response Models (Streaming) --- + + +class OCIStreamDelta(BaseModel): + """The content delta in a streaming chunk.""" + + content: Optional[List[OCIContentPartUnion]] = None + role: Optional[str] = None + toolCalls: Optional[List[OCIToolCall]] = None + + +class OCIStreamChunk(BaseModel): + """Model for a single SSE event chunk from OCI.""" + + finishReason: Optional[str] = None + message: Optional[OCIStreamDelta] = None + pad: Optional[str] = None + index: Optional[int] = None + + +# --- Cohere-Specific Models --- + + +class CohereStreamChunk(BaseModel): + """Model for a single SSE event chunk from OCI Cohere API.""" + + apiFormat: str + text: Optional[str] = None + chatHistory: Optional[List[CohereMessage]] = None + finishReason: Optional[str] = None + pad: Optional[str] = None + index: Optional[int] = None + + +class CohereMessage(BaseModel): + """Base model for Cohere messages.""" + + role: str + message: Optional[str] = None + toolCalls: Optional[List[CohereToolCall]] = None + + +class CohereUserMessage(CohereMessage): + """User message in Cohere chat.""" + + role: Literal["USER"] = "USER" + + +class CohereChatBotMessage(CohereMessage): + """Chatbot message in Cohere chat.""" + + role: Literal["CHATBOT"] = "CHATBOT" + + +class CohereSystemMessage(CohereMessage): + """System message in Cohere chat.""" + + role: Literal["SYSTEM"] = "SYSTEM" + + +class CohereToolMessage(CohereMessage): + """Tool message in Cohere chat.""" + + role: Literal["TOOL"] = "TOOL" + toolCallId: str + + +class CohereParameterDefinition(BaseModel): + """Parameter definition for Cohere tools.""" + + description: str + type: str + isRequired: bool = False + + +class CohereTool(BaseModel): + """Tool definition for Cohere.""" + + name: str + description: str + parameterDefinitions: Dict[str, CohereParameterDefinition] + + +class CohereToolCall(BaseModel): + """Tool call made by Cohere model.""" + + name: str + parameters: Dict[str, Any] + + +class CohereToolResult(BaseModel): + """Result of a tool call.""" + + callId: str + result: str + + +class CohereResponseFormat(BaseModel): + """Response format for Cohere.""" + + type: str + + +class CohereResponseTextFormat(CohereResponseFormat): + """Text response format for Cohere.""" + + type: Literal["text"] = "text" + + +class CohereResponseJSONSchemaFormat(CohereResponseFormat): + """JSON schema response format for Cohere.""" + + type: Literal["json_schema"] = "json_schema" + jsonSchema: Dict[str, Any] + + +class CohereChatRequest(BaseModel): + """Cohere chat request model.""" + + # Required fields + message: str + apiFormat: Literal["COHERE"] = "COHERE" + + # Optional fields + chatHistory: Optional[List[CohereMessage]] = None + maxTokens: Optional[int] = None + temperature: Optional[float] = None + topP: Optional[float] = None + topK: Optional[int] = None + frequencyPenalty: Optional[float] = None + presencePenalty: Optional[float] = None + stopSequences: Optional[List[str]] = None + seed: Optional[int] = None + tools: Optional[List[CohereTool]] = None + toolChoice: Optional[Union[str, Dict[str, Any]]] = None + responseFormat: Optional[ + Union[ + CohereResponseTextFormat, + CohereResponseJSONSchemaFormat, + CohereResponseFormat, + ] + ] = None + preambleOverride: Optional[str] = None + documents: Optional[List[Dict[str, Any]]] = None + searchQueriesOnly: Optional[bool] = None + searchEntryPoint: Optional[str] = None + grounding: Optional[Dict[str, Any]] = None + isEcho: Optional[bool] = None + isSearchQueriesOnly: Optional[bool] = None + isRawPrompting: Optional[bool] = None + isForceSingleStep: Optional[bool] = None + promptTruncation: Optional[str] = None + safetyMode: Optional[str] = None + citationQuality: Optional[str] = None + maxInputTokens: Optional[int] = None + isStream: Optional[bool] = None + streamOptions: Optional[Dict[str, Any]] = None + + +class CohereUsage(BaseModel): + """Usage information for Cohere response.""" + + promptTokens: int + completionTokens: int + totalTokens: int + promptTokensDetails: Optional[Dict[str, Any]] = None + completionTokensDetails: Optional[Dict[str, Any]] = None + + +class CohereCitation(BaseModel): + """Citation in Cohere response.""" + + start: int + end: int + text: str + document_ids: List[str] + + +class CohereSearchQuery(BaseModel): + """Search query generated by Cohere.""" + + text: str + generation_id: str + + +class CohereChatResponse(BaseModel): + """Cohere chat response model.""" + + # Required fields + text: str + apiFormat: Literal["COHERE"] = "COHERE" + finishReason: Literal[ + "COMPLETE", "ERROR_TOXIC", "ERROR_LIMIT", "ERROR", "USER_CANCEL", "MAX_TOKENS" + ] + + # Optional fields + chatHistory: Optional[List[CohereMessage]] = None + citations: Optional[List[CohereCitation]] = None + documents: Optional[List[Dict[str, Any]]] = None + errorMessage: Optional[str] = None + isSearchRequired: Optional[bool] = None + prompt: Optional[str] = None + searchQueries: Optional[List[CohereSearchQuery]] = None + toolCalls: Optional[List[CohereToolCall]] = None + usage: Optional[CohereUsage] = None + + +class CohereChatDetails(BaseModel): + """Chat details for Cohere request.""" + + compartmentId: str + servingMode: OCIServingMode + chatRequest: CohereChatRequest + + +class CohereChatResult(BaseModel): + """Complete Cohere chat result.""" + + modelId: str + modelVersion: str + chatResponse: CohereChatResponse diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/ollama.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/ollama.py new file mode 100644 index 0000000000000000000000000000000000000000..ca28120dd9dc3eecc2c4f6364d8dd460bce9dc8a --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/ollama.py @@ -0,0 +1,40 @@ +import json +from typing import Any, List, Optional, Union + +from pydantic import BaseModel +from typing_extensions import ( + Protocol, + Required, + Self, + TypedDict, + TypeGuard, + get_origin, + override, + runtime_checkable, +) + + +class OllamaToolCallFunction( + TypedDict +): # follows - https://github.com/ollama/ollama/blob/6bd8a4b0a1ac15d5718f52bbe1cd56f827beb694/api/types.go#L148 + name: str + arguments: dict + + +class OllamaToolCall(TypedDict): + function: OllamaToolCallFunction + + +class OllamaVisionModelObject(TypedDict): + prompt: str + images: List[str] + + +class OllamaChatCompletionMessage(TypedDict, total=False): + role: Required[str] + content: str + thinking: str + images: List[str] + tool_calls: List[OllamaToolCall] + tool_name: str + tool_call_id: str diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/openai.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/openai.py new file mode 100644 index 0000000000000000000000000000000000000000..986ec39f3bb055a3418c9c6a0caf90add71cea14 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/openai.py @@ -0,0 +1,2284 @@ +from enum import Enum +from os import PathLike +from typing import ( + IO, + Any, + Dict, + Iterable, + List, + Literal, + Mapping, + Optional, + Tuple, + Union, +) + +import httpx +from openai import Omit +from openai._legacy_response import ( + HttpxBinaryResponseContent as _HttpxBinaryResponseContent, +) +from openai.lib.streaming._assistants import ( + AssistantEventHandler, + AssistantStreamManager, + AsyncAssistantEventHandler, + AsyncAssistantStreamManager, +) +from openai.pagination import AsyncCursorPage, SyncCursorPage +from openai.types import Batch, EmbeddingCreateParams, FileObject +from openai.types.beta.assistant import Assistant +from openai.types.beta.assistant_tool_param import AssistantToolParam +from openai.types.beta.thread_create_params import ( + Message as OpenAICreateThreadParamsMessage, +) +from openai.types.beta.threads.message import Message as OpenAIMessage +from openai.types.beta.threads.message_content import MessageContent +from openai.types.beta.threads.run import Run +from openai.types.chat import ChatCompletionChunk +from openai.types.chat.chat_completion_audio_param import ChatCompletionAudioParam +from openai.types.chat.chat_completion_content_part_input_audio_param import ( + ChatCompletionContentPartInputAudioParam, +) +from openai.types.chat.chat_completion_modality import ChatCompletionModality +from openai.types.chat.chat_completion_prediction_content_param import ( + ChatCompletionPredictionContentParam, +) +from openai.types.embedding import Embedding as OpenAIEmbedding +from openai.types.fine_tuning.fine_tuning_job import FineTuningJob +from openai.types.responses.response import ( + IncompleteDetails, + Response, + ResponseOutputItem, + Tool, + ToolChoice, +) + +# Handle OpenAI SDK version compatibility for Text type +try: + from openai.types.responses.response_create_params import Text as ResponseText # type: ignore[attr-defined] # fmt: skip # isort: skip +except (ImportError, AttributeError): + # Fall back to the concrete config type available in all SDK versions + from openai.types.responses.response_text_config_param import ( + ResponseTextConfigParam as ResponseText, + ) + +from openai.types.responses import ResponseFunctionToolCall +from openai.types.responses.response_create_params import ( + Reasoning, + ResponseIncludable, + ResponseInputParam, + ToolChoice, + ToolParam, +) +from openai.types.responses.response_function_tool_call import ResponseFunctionToolCall +from pydantic import ( + BaseModel, + ConfigDict, + Discriminator, + PrivateAttr, + field_serializer, + field_validator, +) +from typing_extensions import Annotated, Dict, Required, TypedDict, override + +from litellm.types.llms.base import BaseLiteLLMOpenAIResponseObject +from litellm.types.responses.main import ( + GenericResponseOutputItem, + OutputCodeInterpreterCall, + OutputFunctionToolCall, + OutputImageGenerationCall, +) + +FileContent = Union[IO[bytes], bytes, PathLike] + +FileTypes = Union[ + # file (or bytes) + FileContent, + # (filename, file (or bytes)) + Tuple[Optional[str], FileContent], + # (filename, file (or bytes), content_type) + Tuple[Optional[str], FileContent, Optional[str]], + # (filename, file (or bytes), content_type, headers) + Tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]], +] + + +EmbeddingInput = Union[str, List[str]] + + +class HttpxBinaryResponseContent(_HttpxBinaryResponseContent): + _hidden_params: dict = {} + pass + + +class NotGiven: + """ + A sentinel singleton class used to distinguish omitted keyword arguments + from those passed in with the value None (which may have different behavior). + + For example: + + ```py + def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: + ... + + + get(timeout=1) # 1s timeout + get(timeout=None) # No timeout + get() # Default timeout behavior, which may not be statically known at the method definition. + ``` + """ + + def __bool__(self) -> Literal[False]: + return False + + @override + def __repr__(self) -> str: + return "NOT_GIVEN" + + +NOT_GIVEN = NotGiven() + + +class ToolResourcesCodeInterpreter(TypedDict, total=False): + file_ids: List[str] + """ + A list of [file](https://platform.openai.com/docs/api-reference/files) IDs made + available to the `code_interpreter` tool. There can be a maximum of 20 files + associated with the tool. + """ + + +class ToolResourcesFileSearchVectorStore(TypedDict, total=False): + file_ids: List[str] + """ + A list of [file](https://platform.openai.com/docs/api-reference/files) IDs to + add to the vector store. There can be a maximum of 10000 files in a vector + store. + """ + + metadata: object + """Set of 16 key-value pairs that can be attached to a vector store. + + This can be useful for storing additional information about the vector store in + a structured format. Keys can be a maximum of 64 characters long and values can + be a maxium of 512 characters long. + """ + + +class ToolResourcesFileSearch(TypedDict, total=False): + vector_store_ids: List[str] + """ + The + [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) + attached to this thread. There can be a maximum of 1 vector store attached to + the thread. + """ + + vector_stores: Iterable[ToolResourcesFileSearchVectorStore] + """ + A helper to create a + [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object) + with file_ids and attach it to this thread. There can be a maximum of 1 vector + store attached to the thread. + """ + + +class OpenAICreateThreadParamsToolResources(TypedDict, total=False): + code_interpreter: ToolResourcesCodeInterpreter + + file_search: ToolResourcesFileSearch + + +class FileSearchToolParam(TypedDict, total=False): + type: Required[Literal["file_search"]] + """The type of tool being defined: `file_search`""" + + +class CodeInterpreterToolParam(TypedDict, total=False): + type: Required[Literal["code_interpreter"]] + """The type of tool being defined: `code_interpreter`""" + + +AttachmentTool = Union[CodeInterpreterToolParam, FileSearchToolParam] + + +class Attachment(TypedDict, total=False): + file_id: str + """The ID of the file to attach to the message.""" + + tools: Iterable[AttachmentTool] + """The tools to add this file to.""" + + +class ImageFileObject(TypedDict): + file_id: Required[str] + detail: Optional[str] + + +class ImageURLObject(TypedDict, total=False): + url: Required[str] + detail: Optional[str] + + +class ImageURLListItem(TypedDict): + image_url: ImageURLObject + index: int + type: Literal["image_url"] + + +class MessageContentTextObject(TypedDict): + type: Required[Literal["text"]] + text: str + + +class MessageContentImageFileObject(TypedDict): + type: Literal["image_file"] + image_file: ImageFileObject + + +class MessageContentImageURLObject(TypedDict): + type: Required[str] + image_url: ImageURLObject + + +class MessageData(TypedDict): + role: Literal["user", "assistant"] + content: Union[ + str, + List[ + Union[ + MessageContentTextObject, + MessageContentImageFileObject, + MessageContentImageURLObject, + ] + ], + ] + attachments: Optional[List[Attachment]] + metadata: Optional[dict] + + +class Thread(BaseModel): + id: str + """The identifier, which can be referenced in API endpoints.""" + + created_at: int + """The Unix timestamp (in seconds) for when the thread was created.""" + + metadata: Optional[object] = None + """Set of 16 key-value pairs that can be attached to an object. + + This can be useful for storing additional information about the object in a + structured format. Keys can be a maximum of 64 characters long and values can be + a maxium of 512 characters long. + """ + + object: Literal["thread"] + """The object type, which is always `thread`.""" + + +OpenAICreateFileRequestOptionalParams = Literal["purpose"] + +OpenAIFilesPurpose = Literal[ + "assistants", + "assistants_output", + "batch", + "batch_output", + "fine-tune", + "fine-tune-results", + "vision", + "user_data", + "messages", +] + + +class OpenAIFileObject(BaseModel): + id: str + """The file identifier, which can be referenced in the API endpoints.""" + + bytes: int + """The size of the file, in bytes.""" + + created_at: int + """The Unix timestamp (in seconds) for when the file was created.""" + + filename: str + """The name of the file.""" + + object: Literal["file"] + """The object type, which is always `file`.""" + + purpose: OpenAIFilesPurpose + """The intended purpose of the file. + + Supported values are `assistants`, `assistants_output`, `batch`, `batch_output`, + `fine-tune`, `fine-tune-results`, `vision`, and `user_data`. + """ + + status: Optional[Literal["uploaded", "processed", "error", "pending"]] = None + """Deprecated. + + The current status of the file, which can be either `uploaded`, `processed`, + `error`, or `pending` (Azure may return `pending` immediately after upload). + """ + + expires_at: Optional[int] = None + """The Unix timestamp (in seconds) for when the file will expire.""" + + status_details: Optional[str] = None + """Deprecated. + + For details on why a fine-tuning training file failed validation, see the + `error` field on `fine_tuning.job`. + """ + + _hidden_params: dict = {"response_cost": 0.0} # no cost for writing a file + + def __contains__(self, key): + # Define custom behavior for the 'in' operator + return hasattr(self, key) + + def get(self, key, default=None): + # Custom .get() method to access attributes with a default value if the attribute doesn't exist + return getattr(self, key, default) + + def __getitem__(self, key): + # Allow dictionary-style access to attributes + return getattr(self, key) + + def json(self, **kwargs): # type: ignore + try: + return self.model_dump() # noqa + except Exception: + # if using pydantic v1 + return self.dict() + + +CREATE_FILE_REQUESTS_PURPOSE = Literal["assistants", "batch", "fine-tune", "messages"] + + +# File expiration policy +class FileExpiresAfter(TypedDict): + """ + File expiration policy + + Properties: + anchor: Anchor timestamp after which the expiration policy applies. Supported anchors: created_at. + seconds: The number of seconds after the anchor time that the file will expire. Must be between 3600 (1 hour) and 2592000 (30 days). + """ + + anchor: Required[Literal["created_at"]] + seconds: Required[int] + + +# OpenAI Files Types +class CreateFileRequest(TypedDict, total=False): + """ + CreateFileRequest + Used by Assistants API, Batches API, Fine-Tunes API, and Anthropic Files API + + Required Params: + file: FileTypes + purpose: Literal['assistants', 'batch', 'fine-tune', 'messages'] + + Optional Params: + expires_after: Optional[FileExpiresAfter] - The expiration policy for a file + extra_headers: Optional[Dict[str, str]] + extra_body: Optional[Dict[str, str]] = None + timeout: Optional[float] = None + """ + + file: Required[FileTypes] + purpose: Required[CREATE_FILE_REQUESTS_PURPOSE] + expires_after: Optional[FileExpiresAfter] + extra_headers: Optional[Dict[str, str]] + extra_body: Optional[Dict[str, str]] + timeout: Optional[float] + + +class FileContentRequest(TypedDict, total=False): + """ + FileContentRequest + Used by Assistants API, Batches API, and Fine-Tunes API + + Required Params: + file_id: str + + Optional Params: + extra_headers: Optional[Dict[str, str]] + extra_body: Optional[Dict[str, str]] = None + timeout: Optional[float] = None + """ + + file_id: str + extra_headers: Optional[Dict[str, str]] + extra_body: Optional[Dict[str, str]] + timeout: Optional[float] + + +# OpenAI Batches Types +class CreateBatchRequest(TypedDict, total=False): + """ + CreateBatchRequest + """ + + completion_window: Literal["24h"] + endpoint: Literal["/v1/chat/completions", "/v1/embeddings", "/v1/completions"] + input_file_id: str + metadata: Optional[Dict[str, str]] + output_expires_after: FileExpiresAfter + extra_headers: Optional[Dict[str, str]] + extra_body: Optional[Dict[str, str]] + timeout: Optional[float] + + +class LiteLLMBatchCreateRequest(CreateBatchRequest, total=False): + model: str + + +class RetrieveBatchRequest(TypedDict, total=False): + """ + RetrieveBatchRequest + """ + + batch_id: str + extra_headers: Optional[Dict[str, str]] + extra_body: Optional[Dict[str, str]] + timeout: Optional[float] + + +class CancelBatchRequest(TypedDict, total=False): + """ + CancelBatchRequest + """ + + batch_id: str + extra_headers: Optional[Dict[str, str]] + extra_body: Optional[Dict[str, str]] + timeout: Optional[float] + + +class ListBatchRequest(TypedDict, total=False): + """ + ListBatchRequest - List your organization's batches + Calls https://api.openai.com/v1/batches + """ + + after: Union[str, NotGiven] + + +# OpenAI Batch Result Types +class OpenAIErrorBody(TypedDict, total=False): + """Error body in OpenAI batch response format.""" + + error: Dict[str, str] + + +BatchJobStatus = Literal[ + "validating", + "failed", + "in_progress", + "finalizing", + "completed", + "expired", + "cancelling", + "cancelled", +] + + +class ChatCompletionAudioDelta(TypedDict, total=False): + data: str + transcript: str + expires_at: int + id: str + + +class ChatCompletionToolCallFunctionChunk(TypedDict, total=False): + name: Optional[str] + arguments: str + provider_specific_fields: Optional[Dict[str, Any]] + + +class ChatCompletionAssistantToolCall(TypedDict): + id: Optional[str] + type: Literal["function"] + function: ChatCompletionToolCallFunctionChunk + + +class ChatCompletionToolCallChunk(TypedDict): # result of /chat/completions call + id: Optional[str] + type: Literal["function"] + function: ChatCompletionToolCallFunctionChunk + index: int + + +class ChatCompletionDeltaToolCallChunk(TypedDict, total=False): + id: str + type: Literal["function"] + function: ChatCompletionToolCallFunctionChunk + index: int + + +class ChatCompletionCachedContent(TypedDict): + type: Literal["ephemeral"] + + +class ChatCompletionThinkingBlock(TypedDict, total=False): + type: Required[Literal["thinking"]] + thinking: str + signature: str + cache_control: Optional[Union[dict, ChatCompletionCachedContent]] + + +class ChatCompletionRedactedThinkingBlock(TypedDict, total=False): + type: Required[Literal["redacted_thinking"]] + data: str + cache_control: Optional[Union[dict, ChatCompletionCachedContent]] + + +class ChatCompletionReasoningSummaryTextBlock(TypedDict, total=False): + type: Required[Literal["summary_text"]] + text: str + + +class ChatCompletionReasoningItem(TypedDict, total=False): + """Represents an OpenAI Responses API reasoning item for round-tripping in conversation history.""" + + type: Required[Literal["reasoning"]] + id: str + encrypted_content: Optional[str] + summary: List["ChatCompletionReasoningSummaryTextBlock"] + + +class WebSearchOptionsUserLocationApproximate(TypedDict, total=False): + city: str + """Free text input for the city of the user, e.g. `San Francisco`.""" + + country: str + """ + The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of + the user, e.g. `US`. + """ + + region: str + """Free text input for the region of the user, e.g. `California`.""" + + timezone: str + """ + The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the + user, e.g. `America/Los_Angeles`. + """ + + +class WebSearchOptionsUserLocation(TypedDict, total=False): + approximate: Required[WebSearchOptionsUserLocationApproximate] + """Approximate location parameters for the search.""" + + type: Required[Literal["approximate"]] + """The type of location approximation. Always `approximate`.""" + + +class WebSearchOptions(TypedDict, total=False): + search_context_size: Literal["low", "medium", "high"] + """ + High level guidance for the amount of context window space to use for the + search. One of `low`, `medium`, or `high`. `medium` is the default. + """ + + user_location: Optional[WebSearchOptionsUserLocation] + """Approximate location parameters for the search.""" + + +class FileSearchTool(TypedDict, total=False): + type: Literal["file_search"] + """The type of tool being defined: `file_search`""" + + vector_store_ids: Optional[List[str]] + """The IDs of the vector stores to search.""" + + +class ChatCompletionAnnotationURLCitation(TypedDict, total=False): + end_index: int + """The index of the last character of the URL citation in the message.""" + + start_index: int + """The index of the first character of the URL citation in the message.""" + + title: str + """The title of the web resource.""" + + url: str + """The URL of the web resource.""" + + +class ChatCompletionAnnotation(TypedDict, total=False): + type: Literal["url_citation"] + """The type of the URL citation. Always `url_citation`.""" + + url_citation: ChatCompletionAnnotationURLCitation + """A URL citation when using web search.""" + + +class OpenAIChatCompletionTextObject(TypedDict): + type: Literal["text"] + text: str + + +class ChatCompletionTextObject( + OpenAIChatCompletionTextObject, total=False +): # litellm wrapper on top of openai object for handling cached content + cache_control: ChatCompletionCachedContent + + +class ChatCompletionImageUrlObject(TypedDict, total=False): + url: Required[str] + detail: str + format: str + + +class ChatCompletionImageObject(TypedDict): + type: Literal["image_url"] + image_url: Union[str, ChatCompletionImageUrlObject] + + +class ChatCompletionVideoUrlObject(TypedDict, total=False): + url: Required[str] + detail: str + + +class ChatCompletionVideoObject(TypedDict): + type: Literal["video_url"] + video_url: Union[str, ChatCompletionVideoUrlObject] + + +class ChatCompletionAudioObject(ChatCompletionContentPartInputAudioParam): + pass + + +class DocumentObject(TypedDict): + type: Literal["text"] + media_type: str + data: str + + +class CitationsObject(TypedDict): + enabled: bool + + +class ChatCompletionDocumentObject(TypedDict): + type: Literal["document"] + source: DocumentObject + title: str + context: str + citations: Optional[CitationsObject] + + +class ChatCompletionFileObjectFile(TypedDict, total=False): + file_data: str + file_id: str + filename: str + format: str + detail: str # For video/image resolution control (low, medium, high, ultra_high) + video_metadata: Dict[ + str, Any + ] # For video-specific metadata (fps, start_offset, end_offset) + + +class ChatCompletionFileObject(TypedDict): + type: Literal["file"] + file: ChatCompletionFileObjectFile + + +OpenAIMessageContentListBlock = Union[ + ChatCompletionTextObject, + ChatCompletionImageObject, + ChatCompletionAudioObject, + ChatCompletionDocumentObject, + ChatCompletionVideoObject, + ChatCompletionFileObject, +] + +OpenAIMessageContent = Union[ + str, + Iterable[OpenAIMessageContentListBlock], +] + +# The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays. +AllPromptValues = Union[str, List[str], Iterable[int], Iterable[Iterable[int]], None] + + +class OpenAIChatCompletionUserMessage(TypedDict): + role: Literal["user"] + content: OpenAIMessageContent + + +class OpenAITextCompletionUserMessage(TypedDict): + role: Literal["user"] + content: AllPromptValues + + +class ChatCompletionUserMessage(OpenAIChatCompletionUserMessage, total=False): + cache_control: ChatCompletionCachedContent + + +class OpenAIChatCompletionAssistantMessage(TypedDict, total=False): + role: Required[Literal["assistant"]] + content: Optional[ + Union[ + str, + Iterable[ + Union[ + ChatCompletionTextObject, + ChatCompletionThinkingBlock, + ChatCompletionRedactedThinkingBlock, + ChatCompletionImageObject, + ] + ], + ] + ] + name: Optional[str] + tool_calls: Optional[List[ChatCompletionAssistantToolCall]] + function_call: Optional[ChatCompletionToolCallFunctionChunk] + reasoning_content: Optional[str] + + +class ChatCompletionAssistantMessage(OpenAIChatCompletionAssistantMessage, total=False): + cache_control: ChatCompletionCachedContent + thinking_blocks: Optional[ + List[Union[ChatCompletionThinkingBlock, ChatCompletionRedactedThinkingBlock]] + ] + reasoning_items: Optional[List[ChatCompletionReasoningItem]] + + +class ChatCompletionToolMessage(TypedDict): + role: Literal["tool"] + content: Union[str, Iterable[ChatCompletionTextObject]] + tool_call_id: str + + +class ChatCompletionFunctionMessage(TypedDict): + role: Literal["function"] + content: Optional[Union[str, Iterable[ChatCompletionTextObject]]] + name: str + tool_call_id: Optional[str] + + +class OpenAIChatCompletionSystemMessage(TypedDict, total=False): + role: Required[Literal["system"]] + content: Required[Union[str, List]] + name: str + + +class OpenAIChatCompletionDeveloperMessage(TypedDict, total=False): + role: Required[Literal["developer"]] + content: Required[Union[str, List]] + name: str + + +class ChatCompletionSystemMessage(OpenAIChatCompletionSystemMessage, total=False): + cache_control: ChatCompletionCachedContent + + +class ChatCompletionDeveloperMessage(OpenAIChatCompletionDeveloperMessage, total=False): + cache_control: ChatCompletionCachedContent + + +class GenericChatCompletionMessage(TypedDict, total=False): + role: Required[str] + content: Required[Union[str, List]] + + +ValidUserMessageContentTypes = [ + "text", + "image_url", + "input_audio", + "audio_url", + "document", + "guarded_text", + "video_url", + "file", +] # used for validating user messages. Prevent users from accidentally sending anthropic messages. + +ValidUserMessageContentTypesLiteral = Literal[ + "text", + "image_url", + "input_audio", + "audio_url", + "document", + "guarded_text", + "video_url", + "file", +] + +ValidUserMessageContentTypes = [ + "text", + "image_url", + "input_audio", + "audio_url", + "document", + "guarded_text", + "video_url", + "file", +] # used for validating user messages. Prevent users from accidentally sending anthropic messages. + +# Assistant message content types (text, thinking, redacted_thinking, image_url) +ValidAssistantMessageContentTypesLiteral = Literal[ + "text", + "thinking", + "redacted_thinking", + "image_url", +] + +ValidAssistantMessageContentTypes = [ + "text", + "thinking", + "redacted_thinking", + "image_url", +] + +# Combined valid content types for chat completion messages +ValidChatCompletionMessageContentTypesLiteral = Literal[ + "text", + "image_url", + "input_audio", + "audio_url", + "document", + "guarded_text", + "video_url", + "file", + "thinking", + "redacted_thinking", +] + +ValidChatCompletionMessageContentTypes = [ + "text", + "image_url", + "input_audio", + "audio_url", + "document", + "guarded_text", + "video_url", + "file", + "thinking", + "redacted_thinking", +] + +AllMessageValues = Union[ + ChatCompletionUserMessage, + ChatCompletionAssistantMessage, + ChatCompletionToolMessage, + ChatCompletionSystemMessage, + ChatCompletionFunctionMessage, + ChatCompletionDeveloperMessage, +] + + +class ChatCompletionToolChoiceFunctionParam(TypedDict): + name: str + + +class ChatCompletionToolChoiceObjectParam(TypedDict): + type: Literal["function"] + function: ChatCompletionToolChoiceFunctionParam + + +ChatCompletionToolChoiceStringValues = Literal["none", "auto", "required"] + +ChatCompletionToolChoiceValues = Union[ + ChatCompletionToolChoiceStringValues, ChatCompletionToolChoiceObjectParam +] + + +class ChatCompletionToolParamFunctionChunk(TypedDict, total=False): + name: Required[str] + description: str + parameters: dict + strict: bool + + +class OpenAIChatCompletionToolParam(TypedDict): + type: Union[Literal["function"], str] + function: ChatCompletionToolParamFunctionChunk + + +class ChatCompletionToolParam(OpenAIChatCompletionToolParam, total=False): + cache_control: ChatCompletionCachedContent + + +class Function(TypedDict, total=False): + name: Required[str] + """The name of the function to call.""" + + +class ChatCompletionNamedToolChoiceParam(TypedDict, total=False): + function: Required[Function] + + type: Required[Literal["function"]] + """The type of the tool. Currently, only `function` is supported.""" + + +class ChatCompletionRequest(TypedDict, total=False): + model: Required[str] + messages: Required[List[AllMessageValues]] + frequency_penalty: float + logit_bias: dict + logprobs: bool + top_logprobs: int + max_tokens: int + n: int + presence_penalty: float + response_format: dict + seed: int + service_tier: str + safety_identifier: str + stop: Union[str, List[str]] + stream_options: dict + temperature: float + top_p: float + tools: List[ChatCompletionToolParam] + tool_choice: ChatCompletionToolChoiceValues + parallel_tool_calls: bool + function_call: Union[str, dict] + functions: List + user: str + metadata: dict # litellm specific param + reasoning_effort: str # OpenAI o1/o3 reasoning parameter + + +class ChatCompletionDeltaChunk(TypedDict, total=False): + content: Optional[str] + tool_calls: List[ChatCompletionDeltaToolCallChunk] + role: str + + +ChatCompletionAssistantContentValue = ( + str # keep as var, used in stream_chunk_builder as well +) + + +class ChatCompletionResponseMessage(TypedDict, total=False): + content: Optional[ChatCompletionAssistantContentValue] + tool_calls: Optional[List[ChatCompletionToolCallChunk]] + role: Literal["assistant"] + function_call: Optional[ChatCompletionToolCallFunctionChunk] + provider_specific_fields: Optional[dict] + reasoning_content: Optional[str] + thinking_blocks: Optional[ + List[Union[ChatCompletionThinkingBlock, ChatCompletionRedactedThinkingBlock]] + ] + + +class ChatCompletionUsageBlock(TypedDict, total=False): + prompt_tokens: Required[int] + completion_tokens: Required[int] + total_tokens: Required[int] + prompt_tokens_details: Optional[dict] + completion_tokens_details: Optional[dict] + + +class OpenAIChatCompletionChunk(ChatCompletionChunk): + def __init__(self, **kwargs): + # Set the 'object' kwarg to 'chat.completion.chunk' + kwargs["object"] = "chat.completion.chunk" + super().__init__(**kwargs) + + +class Hyperparameters(BaseModel): + batch_size: Optional[Union[str, int]] = None # "Number of examples in each batch." + learning_rate_multiplier: Optional[Union[str, float]] = ( + None # Scaling factor for the learning rate + ) + n_epochs: Optional[Union[str, int]] = ( + None # "The number of epochs to train the model for" + ) + + model_config = {"extra": "allow"} + + +class FineTuningJobCreate(BaseModel): + """ + FineTuningJobCreate - Create a fine-tuning job + + Example Request + ``` + { + "model": "gpt-3.5-turbo", + "training_file": "file-abc123", + "hyperparameters": { + "batch_size": "auto", + "learning_rate_multiplier": 0.1, + "n_epochs": 3 + }, + "suffix": "custom-model-name", + "validation_file": "file-xyz789", + "integrations": ["slack"], + "seed": 42 + } + ``` + """ + + model: str # "The name of the model to fine-tune." + training_file: str # "The ID of an uploaded file that contains training data." + hyperparameters: Optional[Hyperparameters] = ( + None # "The hyperparameters used for the fine-tuning job." + ) + suffix: Optional[str] = ( + None # "A string of up to 18 characters that will be added to your fine-tuned model name." + ) + validation_file: Optional[str] = ( + None # "The ID of an uploaded file that contains validation data." + ) + integrations: Optional[List[str]] = ( + None # "A list of integrations to enable for your fine-tuning job." + ) + seed: Optional[int] = None # "The seed controls the reproducibility of the job." + + +class LiteLLMFineTuningJobCreate(FineTuningJobCreate): + custom_llm_provider: Optional[Literal["openai", "azure", "vertex_ai"]] = None + + model_config = { + "extra": "allow" + } # This allows the model to accept additional fields + + +AllEmbeddingInputValues = Union[str, List[str], List[int], List[List[int]]] + +OpenAIAudioTranscriptionOptionalParams = Literal[ + "language", + "prompt", + "temperature", + "response_format", + "timestamp_granularities", + "include", +] + + +OpenAIImageVariationOptionalParams = Literal["n", "size", "response_format", "user"] + + +OpenAIImageGenerationOptionalParams = Literal[ + "background", + "moderation", + "n", + "output_compression", + "output_format", + "quality", + "response_format", + "size", + "style", + "user", + "seed", + "safety_tolerance", + "prompt_upsampling", + "raw", + "num_images", + "image_url", + "image_prompt_strength", + "aspect_ratio", +] + +OpenAIImageEditOptionalParams = Literal[ + "background", + "n", + "mask" "output_compression", + "output_format", + "quality", + "partial_images", + "response_format", + "size", + "style", + "user", +] + + +class ComputerToolParam(TypedDict, total=False): + display_height: Required[float] + """The height of the computer display.""" + + display_width: Required[float] + """The width of the computer display.""" + + environment: Required[Union[Literal["mac", "windows", "ubuntu", "browser"], str]] + """The type of computer environment to control.""" + + type: Required[Union[Literal["computer_use_preview"], str]] + + +class ShellToolParam(TypedDict, total=False): + """ + Shell tool for Responses API: run commands in hosted containers or local runtime. + See https://developers.openai.com/api/docs/guides/tools-shell. + """ + + type: Required[Union[Literal["shell"], str]] + """The type of tool. Use ``\"shell\"``.""" + + environment: Required[Dict[str, Any]] + """Environment config: ``type`` (e.g. ``\"container_auto\"``, ``\"container_reference\"``, ``\"local\"``), optional ``container_id``, ``network_policy``, ``domain_secrets``, ``skills``.""" + + +ALL_RESPONSES_API_TOOL_PARAMS = Union[ToolParam, ComputerToolParam, ShellToolParam] + + +class PromptObject(TypedDict, total=False): + """Reference to a stored prompt template.""" + + id: Required[str] + """The unique identifier of the prompt template to use.""" + + variables: Optional[Dict] + """Variables to substitute into the prompt template.""" + + version: Optional[str] + """Optional version of the prompt template.""" + + +class ContextManagementEntry(TypedDict, total=False): + """ + Context management configuration entry for a request. + See https://developers.openai.com/api/docs/guides/compaction. + """ + + type: str + """The context management entry type. Currently only ``'compaction'`` is supported.""" + + compact_threshold: int + """Token threshold at which compaction is triggered for this entry. Minimum 1000.""" + + +class ResponsesAPIOptionalRequestParams(TypedDict, total=False): + """TypedDict for Optional parameters supported by the responses API.""" + + include: Optional[List[ResponseIncludable]] + instructions: Optional[str] + max_output_tokens: Optional[int] + metadata: Optional[Dict[str, Any]] + parallel_tool_calls: Optional[bool] + previous_response_id: Optional[str] + reasoning: Optional[Reasoning] + store: Optional[bool] + background: Optional[bool] + stream: Optional[bool] + temperature: Optional[float] + text: Optional["ResponseText"] + tool_choice: Optional[ToolChoice] + tools: Optional[List[ALL_RESPONSES_API_TOOL_PARAMS]] + top_p: Optional[float] + truncation: Optional[Literal["auto", "disabled"]] + user: Optional[str] + service_tier: Optional[str] + safety_identifier: Optional[str] + prompt: Optional[PromptObject] + max_tool_calls: Optional[int] + prompt_cache_key: Optional[str] + prompt_cache_retention: Optional[str] + stream_options: Optional[dict] + top_logprobs: Optional[int] + partial_images: Optional[ + int + ] # Number of partial images to generate (1-3) for streaming image generation + context_management: Optional[List[ContextManagementEntry]] + """Context management configuration. E.g. [{\"type\": \"compaction\", \"compact_threshold\": 200000}] for server-side compaction (minimum 1000).""" + + +class ResponsesAPIRequestParams(ResponsesAPIOptionalRequestParams, total=False): + """TypedDict for request parameters supported by the responses API.""" + + input: Union[str, ResponseInputParam] + model: str + + +class OutputTokensDetails(BaseLiteLLMOpenAIResponseObject): + reasoning_tokens: int = 0 + + text_tokens: Optional[int] = None + + model_config = {"extra": "allow"} + + +class InputTokensDetails(BaseLiteLLMOpenAIResponseObject): + audio_tokens: Optional[int] = None + cached_tokens: int = 0 + text_tokens: Optional[int] = None + + model_config = {"extra": "allow"} + + +class ResponseAPIUsage(BaseLiteLLMOpenAIResponseObject): + input_tokens: int + """The number of input tokens.""" + + input_tokens_details: Optional[InputTokensDetails] = None + """A detailed breakdown of the input tokens.""" + + output_tokens: int + """The number of output tokens.""" + + output_tokens_details: Optional[OutputTokensDetails] = None + """A detailed breakdown of the output tokens.""" + + total_tokens: int + """The total number of tokens used.""" + + cost: Optional[float] = None + """The cost of the request.""" + + @field_validator("cost", mode="before") + @classmethod + def parse_cost(cls, v: Any) -> Optional[float]: + """Normalise cost: accept either a float or a dict with a ``total_cost`` key.""" + if isinstance(v, dict): + return v.get("total_cost") + return v + + model_config = {"extra": "allow"} + + +ResponsesAPIStatus = Literal[ + "completed", "failed", "in_progress", "cancelled", "queued", "incomplete" +] +""" +The status of the response generation. +One of: completed, failed, in_progress, cancelled, queued, or incomplete. +""" + + +class ResponsesAPIResponse(BaseLiteLLMOpenAIResponseObject): + id: str + created_at: int + error: Optional[dict] = None + incomplete_details: Optional[IncompleteDetails] = None + instructions: Optional[str] = None + metadata: Optional[Dict] = None + model: Optional[str] = None + object: Optional[str] = None + output: Union[ + List[Union[ResponseOutputItem, Dict]], + List[ + Union[ + GenericResponseOutputItem, + OutputCodeInterpreterCall, + OutputFunctionToolCall, + OutputImageGenerationCall, + ResponseFunctionToolCall, + ] + ], + ] + parallel_tool_calls: Optional[bool] = None + temperature: Optional[float] = None + tool_choice: Optional[ToolChoice] = None + tools: Optional[ + Union[List[Tool], List[ResponseFunctionToolCall], List[Dict[str, Any]]] + ] = None + top_p: Optional[float] = None + max_output_tokens: Optional[int] = None + previous_response_id: Optional[str] = None + reasoning: Optional[Dict[str, Any]] = None + status: Optional[str] = None + text: Optional[Union["ResponseText", Dict[str, Any]]] = None + truncation: Optional[Literal["auto", "disabled"]] = None + usage: Optional[ResponseAPIUsage] = None + user: Optional[str] = None + store: Optional[bool] = None + # Define private attributes using PrivateAttr + _hidden_params: dict = PrivateAttr(default_factory=dict) + + @field_validator("reasoning", mode="before") + @classmethod + def validate_reasoning_to_dict(cls, value: Any) -> Optional[Dict[str, Any]]: + """Accept API reasoning dict (including effort 'none'/'xhigh'); always store as dict.""" + if value is None: + return None + if isinstance(value, dict): + return value + if hasattr(value, "model_dump"): + return value.model_dump() + return value + + @field_validator("usage", mode="before") + @classmethod + def validate_usage(cls, value): + """Convert usage dict to ResponseAPIUsage object if needed""" + if value is None: + return value + if isinstance(value, dict): + return ResponseAPIUsage(**value) + return value + + @field_serializer("output", mode="wrap") + @classmethod + def _serialize_output_filter_reasoning_nulls(cls, value, handler, _info): + """ + Filter null status/content/encrypted_content from reasoning output items. + + Mirrors the request-side filtering in + OpenAIResponsesAPIConfig._handle_reasoning_item() which filters these + same fields before sending requests to providers. + + Without this, reasoning items include null fields that cause SDK errors + (e.g., the OpenAI C# SDK crashes on status=null). + + Issue: https://github.com/BerriAI/litellm/issues/16824 + """ + serialized = handler(value) + if not isinstance(serialized, list): + return serialized + return [ + ( + { + k: v + for k, v in item.items() + if v is not None + or k not in ("status", "content", "encrypted_content") + } + if isinstance(item, dict) and item.get("type") == "reasoning" + else item + ) + for item in serialized + ] + + @property + def output_text(self) -> str: + """ + Convenience property that aggregates all `output_text` items from the `output` list. + + If no `output_text` content blocks exist, then an empty string is returned. + + This matches the OpenAI SDK's Response.output_text behavior. + """ + texts: List[str] = [] + for output_item in self.output: + # Handle both dict and object access patterns + if isinstance(output_item, dict): + item_type = output_item.get("type") + content = output_item.get("content", []) + else: + item_type = getattr(output_item, "type", None) + content = getattr(output_item, "content", []) + + if item_type == "message" and content: + for content_item in content: + if isinstance(content_item, dict): + content_type = content_item.get("type") + text = content_item.get("text", "") or "" + else: + content_type = getattr(content_item, "type", None) + text = getattr(content_item, "text", "") or "" + + if content_type == "output_text": + texts.append(text) + + return "".join(texts) + + +class ResponsesAPIStreamEvents(str, Enum): + """ + Enum representing all supported OpenAI stream event types for the Responses API. + + Inherits from str to allow direct string comparison and usage as dictionary keys. + """ + + # Response lifecycle events + RESPONSE_CREATED = "response.created" + RESPONSE_IN_PROGRESS = "response.in_progress" + RESPONSE_COMPLETED = "response.completed" + RESPONSE_FAILED = "response.failed" + RESPONSE_INCOMPLETE = "response.incomplete" + + # Reasoning summary events + RESPONSE_PART_ADDED = "response.reasoning_summary_part.added" + REASONING_SUMMARY_TEXT_DELTA = "response.reasoning_summary_text.delta" + REASONING_SUMMARY_TEXT_DONE = "response.reasoning_summary_text.done" + REASONING_SUMMARY_PART_DONE = "response.reasoning_summary_part.done" + + # Output item events + OUTPUT_ITEM_ADDED = "response.output_item.added" + OUTPUT_ITEM_DONE = "response.output_item.done" + + # Content part events + CONTENT_PART_ADDED = "response.content_part.added" + CONTENT_PART_DONE = "response.content_part.done" + + # Output text events + OUTPUT_TEXT_DELTA = "response.output_text.delta" + OUTPUT_TEXT_ANNOTATION_ADDED = "response.output_text.annotation.added" + OUTPUT_TEXT_DONE = "response.output_text.done" + + # Refusal events + REFUSAL_DELTA = "response.refusal.delta" + REFUSAL_DONE = "response.refusal.done" + + # Function call events + FUNCTION_CALL_ARGUMENTS_DELTA = "response.function_call_arguments.delta" + FUNCTION_CALL_ARGUMENTS_DONE = "response.function_call_arguments.done" + + # File search events + FILE_SEARCH_CALL_IN_PROGRESS = "response.file_search_call.in_progress" + FILE_SEARCH_CALL_SEARCHING = "response.file_search_call.searching" + FILE_SEARCH_CALL_COMPLETED = "response.file_search_call.completed" + + # Web search events + WEB_SEARCH_CALL_IN_PROGRESS = "response.web_search_call.in_progress" + WEB_SEARCH_CALL_SEARCHING = "response.web_search_call.searching" + WEB_SEARCH_CALL_COMPLETED = "response.web_search_call.completed" + + # MCP events - matching OpenAI's official specification + MCP_LIST_TOOLS_IN_PROGRESS = "response.mcp_list_tools.in_progress" + MCP_LIST_TOOLS_COMPLETED = "response.mcp_list_tools.completed" + MCP_LIST_TOOLS_FAILED = "response.mcp_list_tools.failed" + MCP_CALL_IN_PROGRESS = "response.mcp_call.in_progress" + MCP_CALL_ARGUMENTS_DELTA = "response.mcp_call_arguments.delta" + MCP_CALL_ARGUMENTS_DONE = "response.mcp_call_arguments.done" + MCP_CALL_COMPLETED = "response.mcp_call.completed" + MCP_CALL_FAILED = "response.mcp_call.failed" + + # Image generation events + IMAGE_GENERATION_PARTIAL_IMAGE = "image_generation.partial_image" + + # Shell tool events (Responses API; passthrough via GenericEvent) + SHELL_CALL_IN_PROGRESS = "response.shell_call.in_progress" + SHELL_CALL_COMPLETED = "response.shell_call.completed" + SHELL_CALL_OUTPUT = "response.shell_call_output.done" + + # Error event + ERROR = "error" + + +class ResponseCreatedEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.RESPONSE_CREATED] + response: ResponsesAPIResponse + + +class ResponseInProgressEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.RESPONSE_IN_PROGRESS] + response: ResponsesAPIResponse + + +class ResponseCompletedEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.RESPONSE_COMPLETED] + response: ResponsesAPIResponse + _hidden_params: dict = PrivateAttr(default_factory=dict) + + +class ResponseFailedEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.RESPONSE_FAILED] + response: ResponsesAPIResponse + + +class ResponseIncompleteEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.RESPONSE_INCOMPLETE] + response: ResponsesAPIResponse + + +class ResponsePartAddedEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.RESPONSE_PART_ADDED] + item_id: str + output_index: int + part: dict + + +class ReasoningSummaryTextDeltaEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.REASONING_SUMMARY_TEXT_DELTA] + item_id: str + output_index: int + summary_index: int = 0 + delta: str + + +class ReasoningSummaryTextDoneEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.REASONING_SUMMARY_TEXT_DONE] + item_id: str + output_index: int + sequence_number: int + summary_index: int = 0 + text: str + + +class ReasoningSummaryPartDoneEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.REASONING_SUMMARY_PART_DONE] + item_id: str + output_index: int + sequence_number: int + summary_index: int = 0 + part: BaseLiteLLMOpenAIResponseObject + + +class OutputItemAddedEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.OUTPUT_ITEM_ADDED] + output_index: int + item: Optional[BaseLiteLLMOpenAIResponseObject] + + +class OutputItemDoneEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.OUTPUT_ITEM_DONE] + output_index: int + sequence_number: int = 1 + item: BaseLiteLLMOpenAIResponseObject + + +class OpenAIChatCompletionLogprobsContentTopLogprobs(TypedDict, total=False): + bytes: List + logprob: Required[float] + token: Required[str] + + +class OpenAIChatCompletionLogprobsContent(TypedDict, total=False): + bytes: List + logprob: Required[float] + token: Required[str] + top_logprobs: List[OpenAIChatCompletionLogprobsContentTopLogprobs] + + +class ContentPartAddedEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.CONTENT_PART_ADDED] + item_id: str + output_index: int + content_index: int + part: BaseLiteLLMOpenAIResponseObject + + +class ContentPartDonePartOutputText(BaseLiteLLMOpenAIResponseObject): + type: Literal["output_text"] + text: str + annotations: List[BaseLiteLLMOpenAIResponseObject] + logprobs: Optional[List[OpenAIChatCompletionLogprobsContent]] + + +class ContentPartDonePartRefusal(BaseLiteLLMOpenAIResponseObject): + type: Literal["refusal"] + refusal: str + + +class ContentPartDonePartReasoningText(BaseLiteLLMOpenAIResponseObject): + type: Literal["reasoning_text"] + reasoning: str + + +PART_UNION_TYPES = Union[ + ContentPartDonePartOutputText, + ContentPartDonePartRefusal, + ContentPartDonePartReasoningText, +] + + +class ContentPartDoneEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.CONTENT_PART_DONE] + item_id: str + output_index: int + content_index: int + part: PART_UNION_TYPES + + +class OutputTextDeltaEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.OUTPUT_TEXT_DELTA] + item_id: str + output_index: int + content_index: int + delta: str + + +class OutputTextAnnotationAddedEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.OUTPUT_TEXT_ANNOTATION_ADDED] + item_id: str + output_index: int + content_index: int + annotation_index: int + annotation: dict + + +class OutputTextDoneEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.OUTPUT_TEXT_DONE] + item_id: str + output_index: int + content_index: int + text: str + + +class RefusalDeltaEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.REFUSAL_DELTA] + item_id: str + output_index: int + content_index: int + delta: str + + +class RefusalDoneEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.REFUSAL_DONE] + item_id: str + output_index: int + content_index: int + refusal: str + + +class FunctionCallArgumentsDeltaEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.FUNCTION_CALL_ARGUMENTS_DELTA] + item_id: str + output_index: int + delta: str + + +class FunctionCallArgumentsDoneEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.FUNCTION_CALL_ARGUMENTS_DONE] + item_id: str + output_index: int + arguments: str + + +class FileSearchCallInProgressEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.FILE_SEARCH_CALL_IN_PROGRESS] + output_index: int + item_id: str + + +class FileSearchCallSearchingEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.FILE_SEARCH_CALL_SEARCHING] + output_index: int + item_id: str + + +class FileSearchCallCompletedEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.FILE_SEARCH_CALL_COMPLETED] + output_index: int + item_id: str + + +class WebSearchCallInProgressEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.WEB_SEARCH_CALL_IN_PROGRESS] + output_index: int + item_id: str + + +class WebSearchCallSearchingEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.WEB_SEARCH_CALL_SEARCHING] + output_index: int + item_id: str + + +class WebSearchCallCompletedEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.WEB_SEARCH_CALL_COMPLETED] + output_index: int + item_id: str + + +# MCP List Tools Events +class MCPListToolsInProgressEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.MCP_LIST_TOOLS_IN_PROGRESS] + sequence_number: int + output_index: int + item_id: str + + +class MCPListToolsCompletedEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.MCP_LIST_TOOLS_COMPLETED] + sequence_number: int + output_index: int + item_id: str + + +class MCPListToolsFailedEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.MCP_LIST_TOOLS_FAILED] + sequence_number: int + output_index: int + item_id: str + + +# MCP Call Events +class MCPCallInProgressEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.MCP_CALL_IN_PROGRESS] + sequence_number: int + output_index: int + item_id: str + + +class MCPCallArgumentsDeltaEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.MCP_CALL_ARGUMENTS_DELTA] + output_index: int + item_id: str + delta: str # JSON string containing partial update to arguments + sequence_number: int + + +class MCPCallArgumentsDoneEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.MCP_CALL_ARGUMENTS_DONE] + output_index: int + item_id: str + arguments: str # JSON string containing finalized arguments + sequence_number: int + + +class MCPCallCompletedEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.MCP_CALL_COMPLETED] + sequence_number: int + item_id: str + output_index: int + + +class MCPCallFailedEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.MCP_CALL_FAILED] + sequence_number: int + item_id: str + output_index: int + + +class ImageGenerationPartialImageEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.IMAGE_GENERATION_PARTIAL_IMAGE] + partial_image_index: int + b64_json: str + + +class ErrorEventError(BaseLiteLLMOpenAIResponseObject): + """Nested error object within ErrorEvent.""" + + type: str # e.g., 'invalid_request_error' + code: str # e.g., 'context_length_exceeded' + message: str + param: Optional[str] = None + + +class ErrorEvent(BaseLiteLLMOpenAIResponseObject): + type: Literal[ResponsesAPIStreamEvents.ERROR] + sequence_number: int + error: ErrorEventError + + +class GenericEvent(BaseLiteLLMOpenAIResponseObject): + type: str + + model_config = ConfigDict(extra="allow", protected_namespaces=()) + + +# Union type for all possible streaming responses +ResponsesAPIStreamingResponse = Annotated[ + Union[ + ResponseCreatedEvent, + ResponseInProgressEvent, + ResponseCompletedEvent, + ResponseFailedEvent, + ResponseIncompleteEvent, + ResponsePartAddedEvent, + ReasoningSummaryTextDeltaEvent, + ReasoningSummaryTextDoneEvent, + ReasoningSummaryPartDoneEvent, + OutputItemAddedEvent, + OutputItemDoneEvent, + ContentPartAddedEvent, + ContentPartDoneEvent, + OutputTextDeltaEvent, + OutputTextAnnotationAddedEvent, + OutputTextDoneEvent, + RefusalDeltaEvent, + RefusalDoneEvent, + FunctionCallArgumentsDeltaEvent, + FunctionCallArgumentsDoneEvent, + FileSearchCallInProgressEvent, + FileSearchCallSearchingEvent, + FileSearchCallCompletedEvent, + WebSearchCallInProgressEvent, + WebSearchCallSearchingEvent, + WebSearchCallCompletedEvent, + MCPListToolsInProgressEvent, + MCPListToolsCompletedEvent, + MCPListToolsFailedEvent, + MCPCallInProgressEvent, + MCPCallArgumentsDeltaEvent, + MCPCallArgumentsDoneEvent, + MCPCallCompletedEvent, + MCPCallFailedEvent, + ImageGenerationPartialImageEvent, + ErrorEvent, + GenericEvent, + BaseLiteLLMOpenAIResponseObject, + ], + Discriminator("type"), +] + + +REASONING_EFFORT = Literal["none", "minimal", "low", "medium", "high", "xhigh"] + + +class OpenAIRealtimeStreamSession(TypedDict, total=False): + id: Required[str] + """ + Unique identifier for the session that looks like sess_1234567890abcdef. + """ + + input_audio_format: str + """ + The format of input audio. Options are pcm16, g711_ulaw, or g711_alaw. For pcm16, input audio must be 16-bit PCM at a 24kHz sample rate, single channel (mono), and little-endian byte order. + """ + + input_audio_noise_reduction: object + """ + Configuration for input audio noise reduction. This can be set to null to turn off. Noise reduction filters audio added to the input audio buffer before it is sent to VAD and the model. Filtering the audio can improve VAD and turn detection accuracy (reducing false positives) and model performance by improving perception of the input audio. + """ + + input_audio_transcription: object + """ + Configuration for input audio transcription, defaults to off and can be set to null to turn off once on. Input audio transcription is not native to the model, since the model consumes audio directly. Transcription runs asynchronously through the /audio/transcriptions endpoint and should be treated as guidance of input audio content rather than precisely what the model heard. The client can optionally set the language and prompt for transcription, these offer additional guidance to the transcription service. + """ + + instructions: str + """ + The default system instructions (i.e. system message) prepended to model calls. This field allows the client to guide the model on desired responses. The model can be instructed on response content and format, (e.g. "be extremely succinct", "act friendly", "here are examples of good responses") and on audio behavior (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The instructions are not guaranteed to be followed by the model, but they provide guidance to the model on the desired behavior. + """ + + max_response_output_tokens: Union[int, Literal["inf"]] + """ + Maximum number of output tokens for a single assistant response, inclusive of tool calls. Provide an integer between 1 and 4096 to limit output tokens, or inf for the maximum available tokens for a given model. Defaults to inf. + """ + + modalities: List[str] + """ + The set of modalities the model can respond with. To disable audio, set this to ["text"]. + """ + + model: str + """ + The Realtime model used for this session. + """ + + output_audio_format: str + """ + The format of output audio. Options are pcm16, g711_ulaw, or g711_alaw. For pcm16, output audio is sampled at a rate of 24kHz. + """ + + temperature: float + """ + Sampling temperature for the model, limited to [0.6, 1.2]. For audio models a temperature of 0.8 is highly recommended for best performance. + """ + + tool_choice: str + """ + How the model chooses tools. Options are auto, none, required, or specify a function. + """ + + tools: list + """ + Tools (functions) available to the model. + """ + + turn_detection: object + """ + + Configuration for turn detection, ether Server VAD or Semantic VAD. This can be set to null to turn off, in which case the client must manually trigger model response. Server VAD means that the model will detect the start and end of speech based on audio volume and respond at the end of user speech. Semantic VAD is more advanced and uses a turn detection model (in conjuction with VAD) to semantically estimate whether the user has finished speaking, then dynamically sets a timeout based on this probability. For example, if user audio trails off with "uhhm", the model will score a low probability of turn end and wait longer for the user to continue speaking. This can be useful for more natural conversations, but may have a higher latency. + """ + + voice: str + """ + The voice the model uses to respond. + """ + + +class OpenAIRealtimeStreamSessionEvents(TypedDict): + event_id: str + session: OpenAIRealtimeStreamSession + type: Union[Literal["session.created"], Literal["session.updated"]] + + +class OpenAIRealtimeStreamResponseOutputItemContent(TypedDict, total=False): + audio: str + """Base64-encoded audio bytes, used for 'input_audio' content types""" + id: str + """The ID of the previous conversation item for reference""" + text: str + """The text content, used for 'input_text' and 'text' content types""" + transcript: str + """The transcript content, used for 'input_audio' content types""" + type: Literal["input_audio", "input_text", "text", "item_reference", "audio"] + """The type of content""" + + +class OpenAIRealtimeStreamResponseOutputItem(TypedDict, total=False): + arguments: str + """For function call items""" + + call_id: str + """The ID of the function call""" + + id: str + """The ID of the previous conversation item for reference""" + + content: List[OpenAIRealtimeStreamResponseOutputItemContent] + + name: str + """The name of the function call""" + + object: Literal["realtime.item"] + """The object type""" + + role: Literal["assistant", "user", "system"] + """The role of the item, only used for 'message' items""" + + status: Literal["completed", "incomplete", "in_progress"] + """The status of the item""" + + output: str + """The output of the function call""" + + type: Literal["function_call", "message", "function_call_output"] + """The type of item""" + + +class OpenAIRealtimeStreamResponseOutputItemAdded(TypedDict): + type: Literal["response.output_item.added"] + response_id: str + output_index: int + item: OpenAIRealtimeStreamResponseOutputItem + + +class OpenAIRealtimeStreamResponseBaseObject(TypedDict): + event_id: str + response: dict + type: str + + +class OpenAIRealtimeConversationObject(TypedDict, total=False): + id: str + object: Required[Literal["realtime.conversation"]] + + +class OpenAIRealtimeConversationCreated(TypedDict, total=False): + type: Required[Literal["conversation.created"]] + conversation: OpenAIRealtimeConversationObject + event_id: str + + +class OpenAIRealtimeConversationItemCreated(TypedDict, total=False): + type: Required[Literal["conversation.item.created"]] + item: OpenAIRealtimeStreamResponseOutputItem + event_id: str + previous_item_id: str + + +class OpenAIRealtimeResponseContentPart(TypedDict, total=False): + audio: str + """Base64-encoded audio bytes, if type is 'audio'""" + + text: str + """The text content, if type is 'text'""" + + transcript: str + """The transcript content, if type is 'audio'""" + + type: Literal["audio", "text"] + """The type of content""" + + +class OpenAIRealtimeResponseContentPartAdded(TypedDict): + type: Literal["response.content_part.added"] + content_index: int + event_id: str + item_id: str + output_index: int + part: OpenAIRealtimeResponseContentPart + response_id: str + + +class OpenAIRealtimeResponseDelta(TypedDict): + content_index: int + delta: str + event_id: str + item_id: str + output_index: int + response_id: str + type: Union[Literal["response.text.delta"], Literal["response.audio.delta"]] + + +class OpenAIRealtimeResponseTextDone(TypedDict): + content_index: int + event_id: str + item_id: str + output_index: int + response_id: str + text: str + type: Literal["response.text.done"] + + +class OpenAIRealtimeResponseAudioDone(TypedDict): + content_index: int + event_id: str + item_id: str + output_index: int + response_id: str + type: Literal["response.audio.done"] + + +class OpenAIRealtimeContentPartDone(TypedDict): + content_index: int + event_id: str + item_id: str + output_index: int + response_id: str + part: OpenAIRealtimeResponseContentPart + type: Literal["response.content_part.done"] + + +class OpenAIRealtimeOutputItemDone(TypedDict): + event_id: str + item: OpenAIRealtimeStreamResponseOutputItem + output_index: int + response_id: str + type: Literal["response.output_item.done"] + + +class OpenAIRealtimeResponseDoneObject(TypedDict, total=False): + conversation_id: str + id: str + max_output_tokens: int + metadata: dict + modalities: list + object: Literal["realtime.response"] + output: List[OpenAIRealtimeStreamResponseOutputItem] + output_audio_format: str + status: Literal["completed", "cancelled", "failed", "incomplete"] + status_details: dict + temperature: float + usage: dict # ResponseAPIUsage + voice: str + + +class OpenAIRealtimeDoneEvent(TypedDict): + event_id: str + response: OpenAIRealtimeResponseDoneObject + type: Literal["response.done"] + + +class OpenAIRealtimeEventTypes(Enum): + SESSION_CREATED = "session.created" + RESPONSE_TEXT_DELTA = "response.text.delta" + RESPONSE_AUDIO_DELTA = "response.audio.delta" + RESPONSE_TEXT_DONE = "response.text.done" + RESPONSE_AUDIO_DONE = "response.audio.done" + RESPONSE_DONE = "response.done" + RESPONSE_OUTPUT_ITEM_ADDED = "response.output_item.added" + RESPONSE_CONTENT_PART_ADDED = "response.content_part.added" + + +OpenAIRealtimeEvents = Union[ + OpenAIRealtimeStreamResponseBaseObject, + OpenAIRealtimeStreamSessionEvents, + OpenAIRealtimeStreamResponseOutputItemAdded, + OpenAIRealtimeResponseContentPartAdded, + OpenAIRealtimeConversationItemCreated, + OpenAIRealtimeConversationCreated, + OpenAIRealtimeResponseDelta, + OpenAIRealtimeResponseTextDone, + OpenAIRealtimeResponseAudioDone, + OpenAIRealtimeContentPartDone, + OpenAIRealtimeOutputItemDone, + OpenAIRealtimeDoneEvent, +] + +OpenAIRealtimeStreamList = List[OpenAIRealtimeEvents] + + +class ImageGenerationRequestQuality(str, Enum): + LOW = "low" + MEDIUM = "medium" + HIGH = "high" + AUTO = "auto" + STANDARD = "standard" + HD = "hd" + + +class OpenAIModerationResult(BaseLiteLLMOpenAIResponseObject): + categories: Optional[Dict] + category_applied_input_types: Optional[Dict] + category_scores: Optional[Dict] + flagged: Optional[bool] + + +class OpenAIModerationResponse(BaseLiteLLMOpenAIResponseObject): + """ + Response from the OpenAI Moderation API. + """ + + id: str + """The unique identifier for the moderation request.""" + + model: str + """The model used to generate the moderation results.""" + + results: List[OpenAIModerationResult] + """A list of moderation objects.""" + + # Define private attributes using PrivateAttr + _hidden_params: dict = PrivateAttr(default_factory=dict) + + +class OpenAIChatCompletionLogprobs(TypedDict, total=False): + content: List[OpenAIChatCompletionLogprobsContent] + refusal: List[OpenAIChatCompletionLogprobsContent] + + +class OpenAIChatCompletionChoices(TypedDict, total=False): + finish_reason: Required[str] + index: Required[int] + logprobs: Optional[OpenAIChatCompletionLogprobs] + message: Required[ChatCompletionResponseMessage] + + +class OpenAIChatCompletionResponse(TypedDict, total=False): + id: Required[str] + object: Required[str] + created: Required[int] + model: Required[str] + choices: Required[List[OpenAIChatCompletionChoices]] + usage: Required[ChatCompletionUsageBlock] + system_fingerprint: str + service_tier: str + + +# OpenAI Batch Result Types (defined after OpenAIChatCompletionResponse for forward reference) +class OpenAIBatchResponse(TypedDict, total=False): + """Response wrapper in OpenAI batch result format.""" + + status_code: int + request_id: str + body: Union[OpenAIChatCompletionResponse, OpenAIErrorBody] + + +class OpenAIBatchResult(TypedDict, total=False): + """OpenAI batch result format.""" + + custom_id: str + response: OpenAIBatchResponse + + +OpenAIChatCompletionFinishReason = Literal[ + "stop", + "content_filter", + "function_call", + "tool_calls", + "length", + "guardrail_intervened", + "eos", + "finish_reason_unspecified", + "malformed_function_call", # last 2 are vertex ai specific, guardrail_intervened is bedrock specific +] + + +class OpenAIWebSearchUserLocationApproximate(TypedDict): + city: str + country: str + region: str + timezone: str + + +class OpenAIWebSearchUserLocation(TypedDict): + approximate: OpenAIWebSearchUserLocationApproximate + type: Literal["approximate"] + + +class OpenAIWebSearchOptions(TypedDict, total=False): + search_context_size: Optional[Literal["low", "medium", "high"]] + user_location: Optional[OpenAIWebSearchUserLocation] + + +class OpenAIRealtimeTurnDetection(TypedDict, total=False): + create_response: bool + eagerness: str + interrupt_response: bool + prefix_padding_ms: int + silence_duration_ms: int + threshold: int + type: str + + +class OpenAIMcpServerTool(TypedDict, total=False): + type: Required[Literal["mcp"]] + server_label: Required[str] + server_url: Required[str] + require_approval: str + allowed_tools: Optional[List[str]] + headers: Optional[Dict[str, str]] + + +# Video Generation Types +class CreateVideoRequest(TypedDict, total=False): + """ + CreateVideoRequest for OpenAI video generation API + + Required Params: + prompt: str - Text prompt that describes the video to generate + + Optional Params: + input_reference: Optional[str] - Optional image reference that guides generation + model: Optional[str] - The video generation model to use (defaults to sora-2) + seconds: Optional[str] - Clip duration in seconds (defaults to 4 seconds) + size: Optional[str] - Output resolution formatted as width x height (defaults to 720x1280) + characters: Optional[List[Dict[str, str]]] - Character references to include in generation + user: Optional[str] - A unique identifier representing your end-user + extra_headers: Optional[Dict[str, str]] - Additional headers + extra_body: Optional[Dict[str, str]] - Additional body parameters + timeout: Optional[float] - Request timeout + """ + + prompt: Required[str] + input_reference: Optional[str] + model: Optional[str] + seconds: Optional[str] + size: Optional[str] + characters: Optional[List[Dict[str, str]]] + user: Optional[str] + extra_headers: Optional[Dict[str, str]] + extra_body: Optional[Dict[str, str]] + timeout: Optional[float] + + +class OpenAIVideoObject(BaseModel): + """OpenAI Video Object representing a video generation job.""" + + id: str + """Unique identifier for the video job.""" + + object: Literal["video"] + """The object type, which is always 'video'.""" + + status: str + """Current lifecycle status of the video job.""" + + created_at: int + """Unix timestamp (seconds) for when the job was created.""" + + completed_at: Optional[int] = None + """Unix timestamp (seconds) for when the job completed, if finished.""" + + expires_at: Optional[int] = None + """Unix timestamp (seconds) for when the downloadable assets expire, if set.""" + + error: Optional[Dict[str, Any]] = None + """Error payload that explains why generation failed, if applicable.""" + + progress: Optional[int] = None + """Approximate completion percentage for the generation task.""" + + remixed_from_video_id: Optional[str] = None + """Identifier of the source video if this video is a remix.""" + + seconds: Optional[str] = None + """Duration of the generated clip in seconds.""" + + size: Optional[str] = None + """The resolution of the generated video.""" + + model: Optional[str] = None + """The video generation model that produced the job.""" + + _hidden_params: Dict[str, Any] = {} + + def __contains__(self, key): + return hasattr(self, key) + + def get(self, key, default=None): + return getattr(self, key, default) + + def __getitem__(self, key): + return getattr(self, key) + + def json(self, **kwargs): # type: ignore + try: + return self.model_dump(**kwargs) + except Exception: + return self.dict() diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/openai_evals.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/openai_evals.py new file mode 100644 index 0000000000000000000000000000000000000000..431dd34647f83ac8b69e9c1568140568659066ca --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/openai_evals.py @@ -0,0 +1,421 @@ +""" +Type definitions for OpenAI Evals API +""" + +from typing import Any, Dict, List, Literal, Optional, Union + +from pydantic import BaseModel, Field +from typing_extensions import Required, TypedDict + + +# Evals API Request Types +class DataSourceConfigCustom(TypedDict, total=False): + """Data source configuration for custom data sources""" + + type: Required[Literal["custom"]] + """Data source type - custom""" + + item_schema: Required[Dict[str, Any]] + """JSON schema describing the structure of each row in the dataset""" + + include_sample_schema: Optional[bool] + """Whether eval expects sample schema population""" + + +class DataSourceConfigLogs(TypedDict, total=False): + """Data source configuration for logs-based evals""" + + type: Required[Literal["logs"]] + """Data source type - logs""" + + metadata: Optional[Dict[str, Any]] + """Optional metadata for filtering logs""" + + +class DataSourceConfigStoredCompletions(TypedDict, total=False): + """Data source configuration for stored completions (deprecated)""" + + type: Required[Literal["stored_completions"]] + """Data source type - stored_completions (deprecated)""" + + metadata: Optional[Dict[str, Any]] + """Optional metadata for filtering stored completions""" + + +DataSourceConfig = Union[ + DataSourceConfigCustom, DataSourceConfigLogs, DataSourceConfigStoredCompletions +] + + +class LLMAsJudgeGraderConfig(TypedDict, total=False): + """Configuration for LLM as judge grading""" + + type: Required[Literal["llm_as_judge"]] + """Grader type - LLM as judge""" + + model: Optional[str] + """Model to use as judge (e.g., 'gpt-4')""" + + prompt: Optional[str] + """Custom prompt for the judge model""" + + +class GroundTruthGraderConfig(TypedDict, total=False): + """Configuration for ground truth grading""" + + type: Required[Literal["ground_truth"]] + """Grader type - ground truth comparison""" + + metric: Optional[Literal["exact_match", "f1_score", "bleu"]] + """Metric to use for comparison""" + + +class CustomGraderConfig(TypedDict, total=False): + """Configuration for custom grading function""" + + type: Required[Literal["custom"]] + """Grader type - custom""" + + function_id: Required[str] + """ID of the custom grading function""" + + +GraderConfig = Union[ + LLMAsJudgeGraderConfig, GroundTruthGraderConfig, CustomGraderConfig +] + + +class CreateEvalRequest(TypedDict, total=False): + """Request parameters for creating an evaluation""" + + name: Optional[str] + """The name of the evaluation""" + + data_source_config: Required[DataSourceConfig] + """Configuration for the data source""" + + testing_criteria: Required[List[GraderConfig]] + """List of graders for all eval runs""" + + metadata: Optional[Dict[str, Any]] + """Set of 16 key-value pairs that can be attached to an object (max 64 char keys, 512 char values)""" + + +class UpdateEvalRequest(TypedDict, total=False): + """Request parameters for updating an evaluation""" + + name: Optional[str] + """Updated name""" + + metadata: Optional[Dict[str, Any]] + """Updated metadata""" + + +class ListEvalsParams(TypedDict, total=False): + """Query parameters for listing evaluations""" + + limit: Optional[int] + """Number of results to return per page. Maximum value is 100. Defaults to 20.""" + + after: Optional[str] + """Cursor for pagination - returns evals after this ID""" + + before: Optional[str] + """Cursor for pagination - returns evals before this ID""" + + order: Optional[Literal["asc", "desc"]] + """Sort order for results. Defaults to 'desc'.""" + + order_by: Optional[Literal["created_at", "updated_at"]] + """Field to sort by. Defaults to 'created_at'.""" + + +# Evals API Response Types +class Eval(BaseModel): + """Represents an evaluation from the OpenAI Evals API""" + + id: str + """Unique identifier for the evaluation""" + + object: str = "eval" + """Object type, always 'eval'""" + + created_at: int + """Unix timestamp of when the evaluation was created""" + + updated_at: Optional[int] = None + """Unix timestamp of when the evaluation was last updated""" + + name: Optional[str] = None + """The name of the evaluation""" + + data_source_config: Dict[str, Any] + """Configuration for the data source""" + + testing_criteria: List[Dict[str, Any]] + """List of graders for the evaluation""" + + metadata: Optional[Dict[str, Any]] = None + """Additional metadata""" + + +class ListEvalsResponse(BaseModel): + """Response from listing evaluations""" + + object: str = "list" + """Object type, always 'list'""" + + data: List[Eval] + """List of evaluations""" + + first_id: Optional[str] = None + """ID of the first evaluation in the list""" + + last_id: Optional[str] = None + """ID of the last evaluation in the list""" + + has_more: bool = False + """Whether there are more evaluations available""" + + +class DeleteEvalResponse(BaseModel): + """Response from deleting an evaluation""" + + eval_id: str + """The ID of the deleted evaluation""" + + object: str = "eval.deleted" + """Object type, always 'eval.deleted'""" + + deleted: bool + """Whether the evaluation was successfully deleted""" + + +class CancelEvalResponse(BaseModel): + """Response from cancelling an evaluation""" + + id: str + """The ID of the cancelled evaluation""" + + object: str = "eval" + """Object type, always 'eval'""" + + status: Literal["cancelled"] + """Status after cancellation, always 'cancelled'""" + + +# Run API Request Types +class DataSourceDatasetConfig(TypedDict, total=False): + """Data source configuration for dataset-based runs""" + + type: Required[Literal["dataset"]] + """Data source type - dataset""" + + dataset_id: Required[str] + """ID of the dataset to use for the run""" + + +class DataSourceSampleSetConfig(TypedDict, total=False): + """Data source configuration for sample set-based runs""" + + type: Required[Literal["sample_set"]] + """Data source type - sample_set""" + + sample_set_id: Required[str] + """ID of the sample set to use for the run""" + + +class DataSourceInlineConfig(TypedDict, total=False): + """Data source configuration for inline samples""" + + type: Required[Literal["inline"]] + """Data source type - inline""" + + samples: Required[List[Dict[str, Any]]] + """List of inline samples to use for the run""" + + +RunDataSourceConfig = Union[ + DataSourceDatasetConfig, DataSourceSampleSetConfig, DataSourceInlineConfig +] + + +class CompletionConfig(TypedDict, total=False): + """Configuration for model completions in a run""" + + model: Required[str] + """Model to use for completions""" + + temperature: Optional[float] + """Sampling temperature (0-2)""" + + max_tokens: Optional[int] + """Maximum tokens to generate""" + + top_p: Optional[float] + """Nucleus sampling parameter""" + + frequency_penalty: Optional[float] + """Frequency penalty (-2.0 to 2.0)""" + + presence_penalty: Optional[float] + """Presence penalty (-2.0 to 2.0)""" + + +class CreateRunRequest(TypedDict, total=False): + """Request parameters for creating a run""" + + data_source: Required[Dict[str, Any]] + """Data source configuration for the run (can be jsonl, completions, or responses type)""" + + name: Optional[str] + """Optional name for the run""" + + metadata: Optional[Dict[str, Any]] + """Optional metadata for the run""" + + +class ListRunsParams(TypedDict, total=False): + """Query parameters for listing runs""" + + limit: Optional[int] + """Number of results to return per page. Maximum value is 100. Defaults to 20.""" + + after: Optional[str] + """Cursor for pagination - returns runs after this ID""" + + before: Optional[str] + """Cursor for pagination - returns runs before this ID""" + + order: Optional[Literal["asc", "desc"]] + """Sort order for results. Defaults to 'desc'.""" + + +# Run API Response Types +class ResultCounts(BaseModel): + """Result counts for a run""" + + total: int + """Total number of results""" + + passed: int = 0 + """Number of passed results""" + + failed: int = 0 + """Number of failed results""" + + error: int = 0 + """Number of error results""" + + +class PerTestingCriteriaResult(BaseModel): + """Results for a specific testing criteria""" + + testing_criteria_index: int + """Index of the testing criteria""" + + result_counts: ResultCounts + """Result counts for this criteria""" + + average_score: Optional[float] = None + """Average score for this criteria""" + + +class Run(BaseModel): + """Represents a run from the OpenAI Evals API""" + + id: str + """Unique identifier for the run""" + + object: str = "eval.run" + """Object type, always 'eval.run'""" + + created_at: int + """Unix timestamp of when the run was created""" + + status: Literal["queued", "running", "completed", "failed", "cancelled"] + """Current status of the run""" + + data_source: Dict[str, Any] + """Data source configuration used for the run""" + + eval_id: str + """ID of the evaluation this run belongs to""" + + name: Optional[str] = None + """Name of the run""" + + started_at: Optional[int] = None + """Unix timestamp of when the run started""" + + completed_at: Optional[int] = None + """Unix timestamp of when the run completed""" + + model: Optional[str] = None + """Model used for the run, if any""" + + per_model_usage: Optional[Any] = None + """Model usage details per model, if available""" + + per_testing_criteria_results: Optional[List[PerTestingCriteriaResult]] = None + """Per-criteria results""" + + report_url: Optional[str] = None + """URL for the evaluation report""" + + result_counts: Optional[Dict[str, int]] = None + """Aggregate result counts (e.g., {"passed": 0, "failed": 0, "errored": 0, "total": 0})""" + + shared_with_openai: Optional[bool] = None + """Whether run is shared with OpenAI""" + + metadata: Optional[Dict[str, Any]] = None + """Additional metadata""" + + error: Optional[Dict[str, Any]] = None + """Error details if the run failed""" + + +class ListRunsResponse(BaseModel): + """Response from listing runs""" + + object: str = "list" + """Object type, always 'list'""" + + data: List[Run] + """List of runs""" + + first_id: Optional[str] = None + """ID of the first run in the list""" + + last_id: Optional[str] = None + """ID of the last run in the list""" + + has_more: bool = False + """Whether there are more runs available""" + + +class CancelRunResponse(BaseModel): + """Response from cancelling a run""" + + id: str + """The ID of the cancelled run""" + + object: str = "eval.run" + """Object type, always 'eval.run'""" + + status: Literal["cancelled"] + """Status after cancellation, always 'cancelled'""" + + +class RunDeleteResponse(BaseModel): + """Response from deleting a run""" + + run_id: str + """The ID of the deleted run""" + + object: Optional[str] = "eval.run.deleted" + """Object type, always 'eval.run.deleted'""" + + deleted: Optional[bool] = True + """Whether the run was successfully deleted""" diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/openrouter.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/openrouter.py new file mode 100644 index 0000000000000000000000000000000000000000..39ed7e104fb4f97d9824dc970bd48b7235e090cd --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/openrouter.py @@ -0,0 +1,11 @@ +import json +from enum import Enum +from typing import Any, Dict, List, Literal, Optional, Tuple, Union + +from typing_extensions import TypedDict + + +class OpenRouterErrorMessage(TypedDict): + message: str + code: int + metadata: Dict diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/recraft.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/recraft.py new file mode 100644 index 0000000000000000000000000000000000000000..35e4101ee051dbc920061f0449c9026c4e55933c --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/recraft.py @@ -0,0 +1,36 @@ +from typing import Dict, List, Optional + +from typing_extensions import TypedDict + + +class RecraftImageGenerationRequestParams(TypedDict, total=False): + prompt: str + text_layout: Optional[List[Dict]] + n: Optional[int] + style_id: Optional[str] + style: Optional[str] + substyle: Optional[str] + model: Optional[str] + response_format: Optional[str] + size: Optional[str] + negative_prompt: Optional[str] + controls: Optional[Dict] + + +class RecraftImageEditRequestParams(TypedDict, total=False): + """ + TypedDict for Recraft image edit request parameters. + + Based on Recraft API docs: https://www.recraft.ai/docs#image-to-image + """ + + prompt: str # required - A text description of areas to change. Max 1000 bytes + strength: float # required - Defines difference with original image, [0, 1] + model: Optional[str] # The model to use, default is recraftv3 + n: Optional[int] # The number of images to generate, must be between 1 and 6 + style_id: Optional[str] # Use a previously uploaded style as reference + style: Optional[str] # The style of generated images, default is realistic_image + substyle: Optional[str] # Additional style specification + response_format: Optional[str] # Format of returned images: url or b64_json + negative_prompt: Optional[str] # Description of undesired elements + controls: Optional[Dict] # Custom parameters to tweak generation process diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/rerank.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/rerank.py new file mode 100644 index 0000000000000000000000000000000000000000..fac093161c1e2428fc1e97e87aab8dbb6f40f9fe --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/rerank.py @@ -0,0 +1,20 @@ +import json +from enum import Enum +from typing import Any, Dict, List, Literal, Optional, Tuple, Union + +from typing_extensions import ( + Protocol, + Required, + Self, + TypedDict, + TypeGuard, + get_origin, + override, + runtime_checkable, +) + + +class InfinityRerankResult(TypedDict): + index: int + relevance_score: float + document: Optional[str] diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/stability.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/stability.py new file mode 100644 index 0000000000000000000000000000000000000000..c439a3b59e3908f75ca716d3176686dba96a953f --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/stability.py @@ -0,0 +1,232 @@ +""" +Type definitions for Stability AI API + +API Reference: https://platform.stability.ai/docs/api-reference +""" + +from typing import List, Literal, Optional + +from typing_extensions import TypedDict + + +class StabilityImageGenerationRequest(TypedDict, total=False): + """ + Base request parameters for Stability AI image generation. + + Used for endpoints: + - /v2beta/stable-image/generate/sd3 + - /v2beta/stable-image/generate/ultra + - /v2beta/stable-image/generate/core + """ + + prompt: str # Required - text prompt for image generation + negative_prompt: Optional[str] # What to avoid in the image + aspect_ratio: Optional[ + str + ] # e.g., "1:1", "16:9", "9:16", "4:3", "3:4", "21:9", "9:21" + seed: Optional[int] # Random seed for reproducibility (0 to 4294967294) + output_format: Optional[Literal["jpeg", "png", "webp"]] # Output format + model: Optional[str] # Model variant (e.g., "sd3.5-large", "sd3.5-medium") + mode: Optional[Literal["text-to-image", "image-to-image"]] # Generation mode + image: Optional[str] # Base64-encoded image for image-to-image + strength: Optional[float] # How much to transform the image (0-1) + style_preset: Optional[str] # Style preset name + + +class StabilityImageEditRequest(StabilityImageGenerationRequest): + """ + Request parameters for Stability AI image edit endpoint. + + Endpoint: /v2beta/stable-image/edit/inpaint + """ + + mask: Optional[str] # Base64-encoded mask (white = edit, black = keep) + + +class StabilityImageGenerationResponse(TypedDict, total=False): + """ + Response from Stability AI image generation endpoints. + """ + + image: str # Base64-encoded image + finish_reason: str # "SUCCESS", "CONTENT_FILTERED", etc. + seed: int # The seed used for generation + + +class StabilityUpscaleRequest(TypedDict, total=False): + """ + Request parameters for Stability AI upscale endpoints. + + Used for endpoints: + - /v2beta/stable-image/upscale/fast + - /v2beta/stable-image/upscale/conservative + - /v2beta/stable-image/upscale/creative + """ + + image: str # Required - Base64-encoded image to upscale + prompt: Optional[str] # Text prompt (required for creative upscale) + negative_prompt: Optional[str] # What to avoid + output_format: Optional[Literal["jpeg", "png", "webp"]] # Output format + seed: Optional[int] # Random seed + creativity: Optional[float] # Creativity level for creative upscale (0-0.35) + + +class StabilityInpaintRequest(TypedDict, total=False): + """ + Request parameters for Stability AI inpaint endpoint. + + Endpoint: /v2beta/stable-image/edit/inpaint + """ + + image: str # Required - Base64-encoded image to edit + prompt: str # Required - Description of desired changes + mask: Optional[str] # Base64-encoded mask (white = edit, black = keep) + negative_prompt: Optional[str] # What to avoid + seed: Optional[int] # Random seed + output_format: Optional[Literal["jpeg", "png", "webp"]] # Output format + grow_mask: Optional[int] # Pixels to grow the mask by (0-100) + + +class StabilityOutpaintRequest(TypedDict, total=False): + """ + Request parameters for Stability AI outpaint endpoint. + + Endpoint: /v2beta/stable-image/edit/outpaint + """ + + image: str # Required - Base64-encoded image to expand + prompt: Optional[str] # Description of content to generate + negative_prompt: Optional[str] # What to avoid + left: Optional[int] # Pixels to expand left (0-2000) + right: Optional[int] # Pixels to expand right (0-2000) + up: Optional[int] # Pixels to expand up (0-2000) + down: Optional[int] # Pixels to expand down (0-2000) + seed: Optional[int] # Random seed + output_format: Optional[Literal["jpeg", "png", "webp"]] # Output format + creativity: Optional[float] # How creative to be (0-1) + + +class StabilityEraseRequest(TypedDict, total=False): + """ + Request parameters for Stability AI erase endpoint. + + Endpoint: /v2beta/stable-image/edit/erase + """ + + image: str # Required - Base64-encoded image + mask: Optional[str] # Base64-encoded mask (white = erase) + seed: Optional[int] # Random seed + output_format: Optional[Literal["jpeg", "png", "webp"]] # Output format + grow_mask: Optional[int] # Pixels to grow the mask by (0-100) + + +class StabilitySearchReplaceRequest(TypedDict, total=False): + """ + Request parameters for Stability AI search-and-replace endpoint. + + Endpoint: /v2beta/stable-image/edit/search-and-replace + """ + + image: str # Required - Base64-encoded image + prompt: str # Required - Description of object to add + search_prompt: str # Required - Description of object to find and replace + negative_prompt: Optional[str] # What to avoid + seed: Optional[int] # Random seed + output_format: Optional[Literal["jpeg", "png", "webp"]] # Output format + grow_mask: Optional[int] # Pixels to grow detected mask + + +class StabilityRemoveBackgroundRequest(TypedDict, total=False): + """ + Request parameters for Stability AI remove-background endpoint. + + Endpoint: /v2beta/stable-image/edit/remove-background + """ + + image: str # Required - Base64-encoded image + output_format: Optional[ + Literal["png", "webp"] + ] # Output format (no jpeg - needs transparency) + + +class StabilityControlRequest(TypedDict, total=False): + """ + Request parameters for Stability AI control endpoints. + + Used for endpoints: + - /v2beta/stable-image/control/sketch + - /v2beta/stable-image/control/structure + - /v2beta/stable-image/control/style + """ + + image: str # Required - Base64-encoded control image (sketch/structure/style reference) + prompt: str # Required - Description of desired output + negative_prompt: Optional[str] # What to avoid + control_strength: Optional[float] # How strongly to follow the control (0-1) + seed: Optional[int] # Random seed + output_format: Optional[Literal["jpeg", "png", "webp"]] # Output format + + +class StabilityEditResponse(TypedDict, total=False): + """ + Response from Stability AI edit/upscale/control endpoints. + """ + + image: str # Base64-encoded result image + finish_reason: str # "SUCCESS", "CONTENT_FILTERED", etc. + seed: int # The seed used + + +# Mapping of OpenAI size to Stability aspect_ratio +OPENAI_SIZE_TO_STABILITY_ASPECT_RATIO = { + "1024x1024": "1:1", + "1792x1024": "16:9", + "1024x1792": "9:16", + "512x512": "1:1", + "256x256": "1:1", +} + +# Stability AI supported aspect ratios +STABILITY_ASPECT_RATIOS = [ + "1:1", + "16:9", + "9:16", + "4:3", + "3:4", + "21:9", + "9:21", + "3:2", + "2:3", + "5:4", + "4:5", +] + +# Stability AI model endpoints +STABILITY_GENERATION_MODELS = { + "sd3": "/v2beta/stable-image/generate/sd3", + "sd3.5-large": "/v2beta/stable-image/generate/sd3", + "sd3.5-large-turbo": "/v2beta/stable-image/generate/sd3", + "sd3.5-medium": "/v2beta/stable-image/generate/sd3", + "sd3-large": "/v2beta/stable-image/generate/sd3", + "sd3-large-turbo": "/v2beta/stable-image/generate/sd3", + "sd3-medium": "/v2beta/stable-image/generate/sd3", + "stable-image-ultra": "/v2beta/stable-image/generate/ultra", + "stable-image-core": "/v2beta/stable-image/generate/core", +} + +STABILITY_EDIT_ENDPOINTS = { + "inpaint": "/v2beta/stable-image/edit/inpaint", + "outpaint": "/v2beta/stable-image/edit/outpaint", + "erase": "/v2beta/stable-image/edit/erase", + "search-and-replace": "/v2beta/stable-image/edit/search-and-replace", + "search-and-recolor": "/v2beta/stable-image/edit/search-and-recolor", + "remove-background": "/v2beta/stable-image/edit/remove-background", + "replace-background-and-relight": "/v2beta/stable-image/edit/replace-background-and-relight", + "fast": "/v2beta/stable-image/upscale/fast", + "conservative": "/v2beta/stable-image/upscale/conservative", + "creative": "/v2beta/stable-image/upscale/creative", + "sketch": "/v2beta/stable-image/control/sketch", + "structure": "/v2beta/stable-image/control/structure", + "style": "/v2beta/stable-image/control/style", + "style-transfer": "/v2beta/stable-image/control/style-transfer", +} diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/triton.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/triton.py new file mode 100644 index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/triton.py @@ -0,0 +1 @@ + diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/vertex_ai.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/vertex_ai.py new file mode 100644 index 0000000000000000000000000000000000000000..87bf11a9026109108be3d43587cb65c73d51468c --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/vertex_ai.py @@ -0,0 +1,743 @@ +from enum import Enum +from typing import Any, Dict, List, Literal, Optional, Union + +from typing_extensions import ( + Required, + TypedDict, +) + +from litellm.types.llms.openai import EmbeddingInput + +# Gemini supports nested-list inputs (e.g. [["text", "image"]]) as an explicit +# opt-in for combined embeddings — a provider-specific extension of the +# OpenAI-faithful EmbeddingInput shape. +GeminiEmbeddingInput = Union[EmbeddingInput, List[List[str]]] + + +class FunctionResponse(TypedDict): + name: str + response: Optional[dict] + + +class FunctionCall(TypedDict): + name: str + args: Optional[dict] + + +class FileDataType(TypedDict): + mime_type: str + file_uri: str # the cloud storage uri of storing this file + + +class BlobType(TypedDict, total=False): + mime_type: Required[str] + data: Required[str] + + +class PartType(TypedDict, total=False): + text: str + inline_data: BlobType + file_data: FileDataType + function_call: FunctionCall + function_response: FunctionResponse + thought: bool + thoughtSignature: str + media_resolution: Literal["low", "medium", "high"] + + +class HttpxFunctionCall(TypedDict): + name: str + args: dict + + +class HttpxExecutableCode(TypedDict): + code: str + language: str + + +class HttpxCodeExecutionResult(TypedDict): + outcome: str + output: str + + +class HttpxBlobType(TypedDict, total=False): + mimeType: str + data: str + + +class HttpxServerSideToolCall(TypedDict, total=False): + toolType: str + id: str + args: dict + + +class HttpxServerSideToolResponse(TypedDict, total=False): + toolType: str + id: str + response: Union[str, dict] + + +class HttpxPartType(TypedDict, total=False): + text: str + inlineData: HttpxBlobType + fileData: FileDataType + functionCall: HttpxFunctionCall + functionResponse: FunctionResponse + toolCall: HttpxServerSideToolCall + toolResponse: HttpxServerSideToolResponse + executableCode: HttpxExecutableCode + codeExecutionResult: HttpxCodeExecutionResult + thought: bool + thoughtSignature: str + mediaResolution: Literal["low", "medium", "high"] + + +class HttpxContentType(TypedDict, total=False): + role: Literal["user", "model"] + parts: List[HttpxPartType] + + +class ContentType(TypedDict, total=False): + role: Literal["user", "model"] + parts: Required[List[PartType]] + + +class SystemInstructions(TypedDict): + parts: Required[List[PartType]] + + +class Schema(TypedDict, total=False): + type: Literal["STRING", "INTEGER", "BOOLEAN", "NUMBER", "ARRAY", "OBJECT"] + format: Literal["enum", "date-time"] + title: str + description: str + nullable: bool + default: Any + items: "Schema" + minItems: str + maxItems: str + enum: List[str] + properties: Dict[str, "Schema"] + propertyOrdering: List[str] + required: List[str] + minProperties: str + maxProperties: str + minimum: float + maximum: float + minLength: str + maxLength: str + pattern: str + example: Any + anyOf: List["Schema"] + + +class FunctionDeclaration(TypedDict, total=False): + name: Required[str] + description: str + parameters: Union[Schema, dict] + response: Schema + + +class VertexAISearch(TypedDict, total=False): + datastore: Required[str] + + +class Retrieval(TypedDict): + source: VertexAISearch + + +class FunctionCallingConfig(TypedDict, total=False): + mode: Literal["ANY", "AUTO", "NONE"] + allowed_function_names: List[str] + + +HarmCategory = Literal[ + "HARM_CATEGORY_UNSPECIFIED", + "HARM_CATEGORY_HATE_SPEECH", + "HARM_CATEGORY_DANGEROUS_CONTENT", + "HARM_CATEGORY_HARASSMENT", + "HARM_CATEGORY_SEXUALLY_EXPLICIT", +] +HarmBlockThreshold = Literal[ + "HARM_BLOCK_THRESHOLD_UNSPECIFIED", + "BLOCK_LOW_AND_ABOVE", + "BLOCK_MEDIUM_AND_ABOVE", + "BLOCK_ONLY_HIGH", + "BLOCK_NONE", +] +HarmBlockMethod = Literal["HARM_BLOCK_METHOD_UNSPECIFIED", "SEVERITY", "PROBABILITY"] + +HarmProbability = Literal[ + "HARM_PROBABILITY_UNSPECIFIED", "NEGLIGIBLE", "LOW", "MEDIUM", "HIGH" +] + +HarmSeverity = Literal[ + "HARM_SEVERITY_UNSPECIFIED", + "HARM_SEVERITY_NEGLIGIBLE", + "HARM_SEVERITY_LOW", + "HARM_SEVERITY_MEDIUM", + "HARM_SEVERITY_HIGH", +] + + +class SafetSettingsConfig(TypedDict, total=False): + category: HarmCategory + threshold: HarmBlockThreshold + max_influential_terms: int + method: HarmBlockMethod + + +class GeminiThinkingConfig(TypedDict, total=False): + includeThoughts: bool + thinkingBudget: int + thinkingLevel: Literal["minimal", "low", "medium", "high"] + + +GeminiResponseModalities = Literal["TEXT", "IMAGE", "AUDIO", "VIDEO"] + +GeminiImageAspectRatio = Literal[ + "1:1", "2:3", "3:2", "3:4", "4:3", "9:16", "16:9", "21:9" +] + +GeminiImageSize = Literal["1K", "2K", "4K"] + + +class GeminiImageConfig(TypedDict, total=False): + aspectRatio: GeminiImageAspectRatio + imageSize: GeminiImageSize + + +class PrebuiltVoiceConfig(TypedDict): + voiceName: str + + +class VoiceConfig(TypedDict): + prebuiltVoiceConfig: PrebuiltVoiceConfig + + +class SpeechConfig(TypedDict, total=False): + voiceConfig: VoiceConfig + + +class GenerationConfig(TypedDict, total=False): + temperature: float + top_p: float + top_k: float + candidate_count: int + max_output_tokens: int + stop_sequences: List[str] + presence_penalty: float + frequency_penalty: float + response_mime_type: Literal["text/plain", "application/json"] + response_schema: dict + response_json_schema: dict + seed: int + responseLogprobs: bool + logprobs: int + responseModalities: List[GeminiResponseModalities] + imageConfig: GeminiImageConfig + thinkingConfig: GeminiThinkingConfig + mediaResolution: str + speechConfig: SpeechConfig + + +class VertexToolName(str, Enum): + """Enum for Vertex AI tool field names.""" + + GOOGLE_SEARCH = "googleSearch" + GOOGLE_SEARCH_RETRIEVAL = "googleSearchRetrieval" + ENTERPRISE_WEB_SEARCH = "enterpriseWebSearch" + URL_CONTEXT = "url_context" + CODE_EXECUTION = "code_execution" + GOOGLE_MAPS = "googleMaps" + COMPUTER_USE = "computerUse" + + +class Tools(TypedDict, total=False): + function_declarations: List[FunctionDeclaration] + googleSearch: dict + googleSearchRetrieval: dict + enterpriseWebSearch: dict + url_context: dict + code_execution: dict + googleMaps: dict + computerUse: dict + retrieval: Retrieval + + +class ToolConfig(TypedDict, total=False): + functionCallingConfig: FunctionCallingConfig + includeServerSideToolInvocations: bool + + +class TTL(TypedDict, total=False): + seconds: Required[float] + nano: float + + +class PromptTokensDetails(TypedDict): + modality: Literal["TEXT", "AUDIO", "IMAGE", "VIDEO"] + tokenCount: int + + +class UsageMetadata(TypedDict, total=False): + promptTokenCount: int + totalTokenCount: int + candidatesTokenCount: int + responseTokenCount: int + cachedContentTokenCount: int + promptTokensDetails: List[PromptTokensDetails] + cacheTokensDetails: List[PromptTokensDetails] + thoughtsTokenCount: int + responseTokensDetails: List[PromptTokensDetails] + candidatesTokensDetails: List[ + PromptTokensDetails + ] # Alternative key name used in some responses + + +class TokenCountDetailsResponse(TypedDict): + """ + Response structure for token count details with modality breakdown. + + Example: + {'totalTokens': 12, 'promptTokensDetails': [{'modality': 'TEXT', 'tokenCount': 12}]} + """ + + totalTokens: int + promptTokensDetails: List[PromptTokensDetails] + + +class CachedContent(TypedDict, total=False): + ttl: TTL + expire_time: str + contents: List[ContentType] + tools: List[Tools] + createTime: str # "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z" + updateTime: str # "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z" + usageMetadata: UsageMetadata + expireTime: str # "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z" + name: str + displayName: str + model: str + systemInstruction: ContentType + toolConfig: ToolConfig + + +class RequestBody(TypedDict, total=False): + contents: Required[List[ContentType]] + system_instruction: SystemInstructions + tools: Tools + toolConfig: ToolConfig + safetySettings: List[SafetSettingsConfig] + generationConfig: GenerationConfig + cachedContent: str + labels: Dict[str, str] + serviceTier: str + + +class CachedContentRequestBody(TypedDict, total=False): + contents: Required[List[ContentType]] + system_instruction: SystemInstructions + tools: Tools + toolConfig: ToolConfig + model: Required[str] # Format: models/{model} + ttl: str # ending in 's' - Example: "3.5s". + displayName: str + + +class CachedContentListAllResponseBody(TypedDict, total=False): + cachedContents: List[CachedContent] + nextPageToken: str + + +class SafetyRatings(TypedDict): + category: HarmCategory + probability: HarmProbability + probabilityScore: int + severity: HarmSeverity + blocked: bool + + +class Date(TypedDict): + year: int + month: int + date: int + + +class Citation(TypedDict): + startIndex: int + endIndex: int + uri: str + title: str + license: str + publicationDate: Date + + +class CitationMetadata(TypedDict): + citations: List[Citation] + + +class SearchEntryPoint(TypedDict, total=False): + renderedContent: str + sdkBlob: str + + +class GroundingMetadata(TypedDict, total=False): + webSearchQueries: List[str] + searchEntryPoint: SearchEntryPoint + groundingAttributions: List[dict] + + +class LogprobsCandidate(TypedDict): + token: str + tokenId: int + logProbability: float + + +class LogprobsTopCandidate(TypedDict): + candidates: List[LogprobsCandidate] + + +class LogprobsResult(TypedDict, total=False): + topCandidates: List[LogprobsTopCandidate] + chosenCandidates: List[LogprobsCandidate] + + +class UrlMetadata(TypedDict, total=False): + retrievedUrl: str + urlRetrievalStatus: str + + +class UrlContextMetadata(TypedDict, total=False): + urlMetadata: List[UrlMetadata] + + +class Candidates(TypedDict, total=False): + index: int + content: HttpxContentType + finishReason: Literal[ + "FINISH_REASON_UNSPECIFIED", + "STOP", + "MAX_TOKENS", + "SAFETY", + "RECITATION", + "OTHER", + "BLOCKLIST", + "PROHIBITED_CONTENT", + "SPII", + "MALFORMED_FUNCTION_CALL", + "IMAGE_SAFETY", + ] + safetyRatings: List[SafetyRatings] + citationMetadata: CitationMetadata + groundingMetadata: GroundingMetadata + finishMessage: str + logprobsResult: LogprobsResult + urlContextMetadata: UrlContextMetadata + + +class PromptFeedback(TypedDict): + blockReason: str + safetyRatings: List[SafetyRatings] + blockReasonMessage: str + + +class GenerateContentResponseBody(TypedDict, total=False): + candidates: List[Candidates] + promptFeedback: PromptFeedback + usageMetadata: Required[UsageMetadata] + responseId: str + + +class FineTuneHyperparameters(TypedDict, total=False): + epoch_count: Optional[int] + learning_rate_multiplier: Optional[float] + adapter_size: Optional[ + Literal[ + "ADAPTER_SIZE_UNSPECIFIED", + "ADAPTER_SIZE_ONE", + "ADAPTER_SIZE_FOUR", + "ADAPTER_SIZE_EIGHT", + "ADAPTER_SIZE_SIXTEEN", + ] + ] + + +class FineTunesupervisedTuningSpec(TypedDict, total=False): + training_dataset_uri: str + validation_dataset: Optional[str] + tuned_model_display_name: Optional[str] + hyperParameters: Optional[FineTuneHyperparameters] + + +class FineTuneJobCreate(TypedDict, total=False): + baseModel: str + supervisedTuningSpec: FineTunesupervisedTuningSpec + tunedModelDisplayName: Optional[str] + + +class ResponseSupervisedTuningSpec(TypedDict, total=False): + trainingDatasetUri: Optional[str] + hyperParameters: Optional[FineTuneHyperparameters] + + +class ResponseTuningJob(TypedDict): + name: Optional[str] + tunedModelDisplayName: Optional[str] + baseModel: Optional[str] + supervisedTuningSpec: Optional[ResponseSupervisedTuningSpec] + state: Optional[ + Literal[ + "JOB_STATE_PENDING", + "JOB_STATE_RUNNING", + "JOB_STATE_SUCCEEDED", + "JOB_STATE_FAILED", + "JOB_STATE_CANCELLED", + ] + ] + createTime: Optional[str] + updateTime: Optional[str] + + +class VideoSegmentConfig(TypedDict, total=False): + startOffsetSec: int + endOffsetSec: int + intervalSec: int + + +class InstanceVideo(TypedDict, total=False): + gcsUri: str + videoSegmentConfig: VideoSegmentConfig + + +class InstanceImage(TypedDict, total=False): + gcsUri: Optional[str] + bytesBase64Encoded: Optional[str] + mimeType: Optional[str] + + +class Instance(TypedDict, total=False): + text: str + image: InstanceImage + video: InstanceVideo + + +class VertexMultimodalEmbeddingRequest(TypedDict, total=False): + instances: Required[List[Instance]] + parameters: dict + + +class VideoEmbedding(TypedDict): + startOffsetSec: int + endOffsetSec: int + embedding: List[float] + + +class MultimodalPrediction(TypedDict, total=False): + textEmbedding: List[float] + imageEmbedding: List[float] + videoEmbeddings: List[VideoEmbedding] + + +class MultimodalPredictions(TypedDict): + predictions: List[MultimodalPrediction] + + +class VertexAICachedContentResponseObject(TypedDict): + name: str + model: str + + +class TaskTypeEnum(Enum): + TASK_TYPE_UNSPECIFIED = "TASK_TYPE_UNSPECIFIED" + RETRIEVAL_QUERY = "RETRIEVAL_QUERY" + RETRIEVAL_DOCUMENT = "RETRIEVAL_DOCUMENT" + SEMANTIC_SIMILARITY = "SEMANTIC_SIMILARITY" + CLASSIFICATION = "CLASSIFICATION" + CLUSTERING = "CLUSTERING" + QUESTION_ANSWERING = "QUESTION_ANSWERING" + FACT_VERIFICATION = "FACT_VERIFICATION" + + +class VertexAITextEmbeddingsRequestBody(TypedDict, total=False): + content: Required[ContentType] + taskType: TaskTypeEnum + title: str + outputDimensionality: int + + +class ContentEmbeddings(TypedDict): + values: List[int] + + +class VertexAITextEmbeddingsResponseObject(TypedDict): + embedding: ContentEmbeddings + + +class EmbedContentRequest(VertexAITextEmbeddingsRequestBody): + model: Required[str] + + +class VertexAIBatchEmbeddingsRequestBody(TypedDict, total=False): + requests: List[EmbedContentRequest] + + +class VertexAIBatchEmbeddingsResponseObject(TypedDict): + embeddings: List[ContentEmbeddings] + + +class GeminiEmbedContentRequestBody(TypedDict, total=False): + content: Required[ContentType] + taskType: TaskTypeEnum + title: str + outputDimensionality: int + + +class GeminiEmbedContentResponseObject(TypedDict): + embedding: ContentEmbeddings + + +# Vertex AI Batch Prediction + + +class GcsSource(TypedDict): + uris: List[str] + + +class InputConfig(TypedDict): + instancesFormat: str + gcsSource: GcsSource + + +class GcsDestination(TypedDict): + outputUriPrefix: str + + +class OutputConfig(TypedDict, total=False): + predictionsFormat: str + gcsDestination: GcsDestination + + +class OutputInfo(TypedDict, total=False): + gcsOutputDirectory: str + + +class GcsBucketResponse(TypedDict): + """ + TypedDict for GCS bucket upload response + + Attributes: + kind: The kind of item this is. For objects, this is always storage#object + id: The ID of the object + selfLink: The link to this object + mediaLink: The link to download the object + name: The name of the object + bucket: The name of the bucket containing this object + generation: The content generation of this object + metageneration: The metadata generation of this object + contentType: The content type of the object + storageClass: The storage class of the object + size: The size of the object in bytes + md5Hash: The MD5 hash of the object + crc32c: The CRC32c checksum of the object + etag: The ETag of the object + timeCreated: The creation time of the object + updated: The last update time of the object + timeStorageClassUpdated: The time the storage class was last updated + timeFinalized: The time the object was finalized + """ + + kind: Literal["storage#object"] + id: str + selfLink: str + mediaLink: str + name: str + bucket: str + generation: str + metageneration: str + contentType: str + storageClass: str + size: str + md5Hash: str + crc32c: str + etag: str + timeCreated: str + updated: str + timeStorageClassUpdated: str + timeFinalized: str + + +class VertexAIBatchPredictionJob(TypedDict): + displayName: str + model: str + inputConfig: InputConfig + outputConfig: OutputConfig + + +class VertexBatchPredictionResponse(TypedDict, total=False): + name: str + displayName: str + model: str + inputConfig: InputConfig + outputConfig: OutputConfig + outputInfo: OutputInfo + state: str + createTime: str + updateTime: str + modelVersionId: str + + +class VertexVideoImage(TypedDict, total=False): + """Image input for video generation""" + + bytesBase64Encoded: str + mimeType: str + + +class VertexVideoGenerationInstance(TypedDict, total=False): + """Instance object for Vertex AI video generation request""" + + prompt: Required[str] + image: VertexVideoImage + + +class VertexVideoGenerationParameters(TypedDict, total=False): + """Parameters for Vertex AI video generation""" + + aspectRatio: Literal["9:16", "16:9"] + durationSeconds: int + + +class VertexVideoGenerationRequest(TypedDict): + """Complete request body for Vertex AI video generation""" + + instances: Required[List[VertexVideoGenerationInstance]] + parameters: VertexVideoGenerationParameters + + +class VertexVideoOutput(TypedDict, total=False): + """Video output in response""" + + bytesBase64Encoded: str + mimeType: str + gcsUri: str + + +class VertexVideoGenerationResponse(TypedDict, total=False): + """Response body for Vertex AI video generation""" + + name: str + done: bool + response: Dict[str, Any] + metadata: Dict[str, Any] + error: Dict[str, Any] + + +VERTEX_CREDENTIALS_TYPES = Union[str, Dict[str, str]] + + +class VertexPartnerProvider(str, Enum): + mistralai = "mistralai" + llama = "llama" + ai21 = "ai21" + claude = "claude" diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/vertex_ai_text_to_speech.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/vertex_ai_text_to_speech.py new file mode 100644 index 0000000000000000000000000000000000000000..8ac3e352167d5c3d0d1ae9d155709ad631a5d463 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/vertex_ai_text_to_speech.py @@ -0,0 +1,58 @@ +""" +Type definitions for Vertex AI Text-to-Speech API + +Reference: https://cloud.google.com/text-to-speech/docs/reference/rest/v1/text/synthesize +""" + +from typing import Optional + +from typing_extensions import TypedDict + + +class VertexTextToSpeechInput(TypedDict, total=False): + """ + Input for Vertex AI Text-to-Speech synthesis. + + Exactly one of text or ssml must be provided. + """ + + text: Optional[str] + ssml: Optional[str] + + +class VertexTextToSpeechVoice(TypedDict, total=False): + """ + Voice configuration for Vertex AI Text-to-Speech. + + Attributes: + languageCode: The language code (e.g., "en-US", "de-DE") + name: The voice name (e.g., "en-US-Studio-O", "en-US-Wavenet-D") + """ + + languageCode: str + name: str + + +class VertexTextToSpeechAudioConfig(TypedDict, total=False): + """ + Audio configuration for Vertex AI Text-to-Speech. + + Attributes: + audioEncoding: The audio encoding format (e.g., "LINEAR16", "MP3", "OGG_OPUS") + speakingRate: The speaking rate (0.25 to 4.0, default "1") + """ + + audioEncoding: str + speakingRate: str + + +class VertexTextToSpeechRequest(TypedDict, total=False): + """ + Request body for Vertex AI Text-to-Speech API. + + Reference: https://cloud.google.com/text-to-speech/docs/reference/rest/v1/text/synthesize + """ + + input: VertexTextToSpeechInput + voice: VertexTextToSpeechVoice + audioConfig: Optional[VertexTextToSpeechAudioConfig] diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/watsonx.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/watsonx.py new file mode 100644 index 0000000000000000000000000000000000000000..21e58500c6fc32c9de6166be074b14f5bd302475 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/watsonx.py @@ -0,0 +1,76 @@ +from enum import Enum +from typing import List, Optional + +from typing_extensions import NotRequired, TypedDict + + +class WatsonXAPIParams(TypedDict): + project_id: Optional[str] + space_id: Optional[str] + region_name: Optional[str] + + +class WatsonXCredentials(TypedDict): + api_key: str + api_base: str + token: Optional[str] + + +class WatsonXAudioTranscriptionRequestBody(TypedDict): + """ + WatsonX Audio Transcription API request body. + + Follows multipart/form-data format for WatsonX Whisper models. + See: https://cloud.ibm.com/apidocs/watsonx-ai + """ + + model: str + """Model name (e.g., 'whisper-large-v3-turbo')""" + + project_id: NotRequired[str] + """WatsonX project ID (optional)""" + + space_id: NotRequired[str] + """WatsonX space ID (optional)""" + + language: NotRequired[str] + """Language code (e.g., 'en', 'es')""" + + prompt: NotRequired[str] + """Optional prompt to guide transcription""" + + response_format: NotRequired[str] + """Response format: 'json', 'text', 'srt', 'verbose_json', 'vtt'""" + + temperature: NotRequired[float] + """Sampling temperature (0-1)""" + + timestamp_granularities: NotRequired[List[str]] + """Timestamp granularities: ['word', 'segment']""" + + +class WatsonXAIEndpoint(str, Enum): + TEXT_GENERATION = "/ml/v1/text/generation" + TEXT_GENERATION_STREAM = "/ml/v1/text/generation_stream" + CHAT = "/ml/v1/text/chat" + CHAT_STREAM = "/ml/v1/text/chat_stream" + DEPLOYMENT_TEXT_GENERATION = "/ml/v1/deployments/{deployment_id}/text/generation" + DEPLOYMENT_TEXT_GENERATION_STREAM = ( + "/ml/v1/deployments/{deployment_id}/text/generation_stream" + ) + DEPLOYMENT_CHAT = "/ml/v1/deployments/{deployment_id}/text/chat" + DEPLOYMENT_CHAT_STREAM = "/ml/v1/deployments/{deployment_id}/text/chat_stream" + EMBEDDINGS = "/ml/v1/text/embeddings" + PROMPTS = "/ml/v1/prompts" + AVAILABLE_MODELS = "/ml/v1/foundation_model_specs" + RERANK = "/ml/v1/text/rerank" + + +class WatsonXModelPattern(str, Enum): + """Model identifier patterns for WatsonX models""" + + GRANITE_CHAT = "granite-chat" + IBM_MISTRAL = "ibm-mistral" + IBM_MISTRALAI = "ibm-mistralai" + GPT_OSS = "openai/gpt-oss" + LLAMA3_INSTRUCT = "meta-llama/llama-3-instruct" diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/xai.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/xai.py new file mode 100644 index 0000000000000000000000000000000000000000..8500e218d833d850f4de9c004f19733dd7ae4114 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/xai.py @@ -0,0 +1,28 @@ +from typing import List, Literal, Optional, TypedDict + + +class XAIWebSearchFilters(TypedDict, total=False): + """Filters for XAI web search tool""" + + allowed_domains: Optional[List[str]] # Max 5 domains + excluded_domains: Optional[List[str]] # Max 5 domains + + +class XAIWebSearchTool(TypedDict, total=False): + """XAI web search tool configuration""" + + type: Literal["web_search"] + filters: Optional[XAIWebSearchFilters] + enable_image_understanding: Optional[bool] + + +class XAIXSearchTool(TypedDict, total=False): + """XAI X (Twitter) search tool configuration""" + + type: Literal["x_search"] + allowed_x_handles: Optional[List[str]] # Max 10 handles + excluded_x_handles: Optional[List[str]] # Max 10 handles + from_date: Optional[str] # ISO8601 format: YYYY-MM-DD + to_date: Optional[str] # ISO8601 format: YYYY-MM-DD + enable_image_understanding: Optional[bool] + enable_video_understanding: Optional[bool] diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/mcp_server/__pycache__/mcp_server_manager.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/mcp_server/__pycache__/mcp_server_manager.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9636e16f36a6b366a0d910ade7277614db2f8c19 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/mcp_server/__pycache__/mcp_server_manager.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/mcp_server/__pycache__/mcp_toolset.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/mcp_server/__pycache__/mcp_toolset.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f6b41c077d7670c9108aa27d8ad0f13f5ccf0be3 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/mcp_server/__pycache__/mcp_toolset.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/mcp_server/__pycache__/tool_registry.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/mcp_server/__pycache__/tool_registry.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..04e05815c8196882d244b7273adc27d6c2959a9f Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/mcp_server/__pycache__/tool_registry.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/mcp_server/mcp_server_manager.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/mcp_server/mcp_server_manager.py new file mode 100644 index 0000000000000000000000000000000000000000..8f8673b0a7dca80fb6367c7c4f019d3fd69ccbeb --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/mcp_server/mcp_server_manager.py @@ -0,0 +1,129 @@ +from datetime import datetime +from typing import Any, Dict, List, Literal, Optional + +from pydantic import BaseModel, ConfigDict + +from litellm.proxy._types import MCPAuthType, MCPTransportType +from litellm.types.mcp import MCPAuth + +# MCPInfo now allows arbitrary additional fields for custom metadata +MCPInfo = Dict[str, Any] + + +class MCPOAuthMetadata(BaseModel): + scopes: Optional[List[str]] = None + authorization_url: Optional[str] = None + token_url: Optional[str] = None + registration_url: Optional[str] = None + + +class MCPServer(BaseModel): + server_id: str + name: str + alias: Optional[str] = None + server_name: Optional[str] = None + url: Optional[str] = None + transport: MCPTransportType + spec_path: Optional[str] = None + auth_type: Optional[MCPAuthType] = None + authentication_token: Optional[str] = None + instructions: Optional[str] = None + mcp_info: Optional[MCPInfo] = None + extra_headers: Optional[List[str]] = ( + None # allow admin to specify which headers to forward from client to the MCP server + ) + allowed_tools: Optional[List[str]] = None + disallowed_tools: Optional[List[str]] = None + tool_name_to_display_name: Optional[Dict[str, str]] = None + tool_name_to_description: Optional[Dict[str, str]] = None + allowed_params: Optional[Dict[str, List[str]]] = ( + None # map of tool names to allowed parameter lists + ) + static_headers: Optional[Dict[str, str]] = ( + None # static headers to forward to the MCP server + ) + # OAuth-specific fields + client_id: Optional[str] = None + client_secret: Optional[str] = None + scopes: Optional[List[str]] = None + authorization_url: Optional[str] = None + token_url: Optional[str] = None + registration_url: Optional[str] = None + # AWS SigV4 fields + aws_access_key_id: Optional[str] = None + aws_secret_access_key: Optional[str] = None + aws_session_token: Optional[str] = None + aws_region_name: Optional[str] = None + aws_service_name: Optional[str] = None # defaults to "bedrock-agentcore" + aws_role_name: Optional[str] = None # IAM role ARN for STS AssumeRole + aws_session_name: Optional[str] = None # session name for CloudTrail auditing + # Stdio-specific fields + command: Optional[str] = None + args: Optional[List[str]] = None + env: Optional[Dict[str, str]] = None + access_groups: Optional[List[str]] = None + allow_all_keys: bool = False + available_on_public_internet: bool = True + is_byok: bool = False + byok_description: List[str] = [] + byok_api_key_help_url: Optional[str] = None + created_at: Optional[datetime] = None + updated_at: Optional[datetime] = None + # OAuth2 flow type. Defaults to None (interactive / authorization_code). + # Set to "client_credentials" to enable M2M token fetching. + oauth2_flow: Optional[Literal["client_credentials", "authorization_code"]] = None + # Per-user OAuth server-side storage config. + # token_validation: key-value pairs that must match fields in the OAuth token + # response (supports dot-notation for nested fields, e.g. "team.enterprise_id"). + # Tokens that fail validation are rejected before storage. + token_validation: Optional[Dict[str, Any]] = None + # Optional TTL override (seconds) for the Redis per-user token cache. + # Defaults to the token's expires_in minus the expiry buffer, or + # MCP_PER_USER_TOKEN_DEFAULT_TTL when expires_in is absent. + token_storage_ttl_seconds: Optional[int] = None + # Resolved short-ID tool prefix when LITELLM_USE_SHORT_MCP_TOOL_PREFIX is + # enabled. Set by ``MCPServerManager._assign_unique_short_prefix`` at + # registration time so that natural-hash collisions between two + # different ``server_id`` values are bumped deterministically. Left + # ``None`` in default-prefix mode. + short_prefix: Optional[str] = None + model_config = ConfigDict(arbitrary_types_allowed=True) + + @property + def has_client_credentials(self) -> bool: + """True if this server should use the OAuth2 client_credentials (M2M) flow. + + M2M flow must be opted into explicitly via ``oauth2_flow: client_credentials``. + Having client_id / client_secret / token_url present is NOT sufficient — + those fields are also used for interactive (authorization_code) OAuth, + e.g. GitHub Enterprise. Auto-detecting M2M from field presence was a + breaking regression introduced with the M2M feature. + """ + return self.oauth2_flow == "client_credentials" + + @property + def needs_user_oauth_token(self) -> bool: + """True if this is an OAuth2 server that relies on per-user tokens (no client_credentials).""" + return self.auth_type == MCPAuth.oauth2 and not self.has_client_credentials + + @property + def requires_per_user_auth(self) -> bool: + """ + True if this server requires per-user/per-request authentication. + This includes: + - OAuth2 servers without client credentials + - Servers with auth_type=none but extra_headers configured for auth passthrough + + Health checks should be skipped for these servers since they cannot + authenticate without user-provided credentials. + """ + # OAuth2 without client credentials + if self.needs_user_oauth_token: + return True + + # PAT passthrough: auth_type is none but extra_headers includes auth headers + if self.auth_type == MCPAuth.none and self.extra_headers: + auth_header_names = {"authorization", "x-api-key", "api-key", "apikey"} + return any(h.lower() in auth_header_names for h in self.extra_headers) + + return False diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/mcp_server/mcp_toolset.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/mcp_server/mcp_toolset.py new file mode 100644 index 0000000000000000000000000000000000000000..7f78a22bfe278184e5efc18ba7e43ffc4839e776 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/mcp_server/mcp_toolset.py @@ -0,0 +1,34 @@ +from datetime import datetime +from typing import List, Optional + +from pydantic import BaseModel +from typing_extensions import TypedDict + + +class MCPToolsetTool(TypedDict): + server_id: str + tool_name: str + + +class MCPToolset(BaseModel): + toolset_id: str + toolset_name: str + description: Optional[str] = None + tools: List[MCPToolsetTool] = [] + created_at: Optional[datetime] = None + created_by: Optional[str] = None + updated_at: Optional[datetime] = None + updated_by: Optional[str] = None + + +class NewMCPToolsetRequest(BaseModel): + toolset_name: str + description: Optional[str] = None + tools: List[MCPToolsetTool] = [] + + +class UpdateMCPToolsetRequest(BaseModel): + toolset_id: str + toolset_name: Optional[str] = None + description: Optional[str] = None + tools: Optional[List[MCPToolsetTool]] = None diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/mcp_server/tool_registry.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/mcp_server/tool_registry.py new file mode 100644 index 0000000000000000000000000000000000000000..8e3f1d9657e0b3eb5667e74cd51c2645664b4e0b --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/mcp_server/tool_registry.py @@ -0,0 +1,33 @@ +from typing import Any, Callable, ClassVar, Dict, List, Optional + +from pydantic import BaseModel, ConfigDict + + +class MCPTool(BaseModel): + model_config: ClassVar[ConfigDict] = ConfigDict(arbitrary_types_allowed=True) + name: str + description: str + input_schema: Dict[str, Any] + handler: Callable + + +class ToolSchema(BaseModel): + name: str + description: str + inputSchema: Dict[str, Any] + + +class ListToolsResponse(BaseModel): + tools: List[ToolSchema] + nextCursor: Optional[str] = None + _meta: Optional[Dict[str, Any]] = None + + +class CallToolRequest(BaseModel): + method: str = "tools/call" + params: Dict[str, Any] + + +class ContentItem(BaseModel): + type: str + text: Optional[str] = None diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/passthrough_endpoints/__pycache__/assembly_ai.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/passthrough_endpoints/__pycache__/assembly_ai.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..884acbaeddde79b7e1c40430407e7ef6a9c3b410 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/passthrough_endpoints/__pycache__/assembly_ai.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/passthrough_endpoints/__pycache__/pass_through_endpoints.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/passthrough_endpoints/__pycache__/pass_through_endpoints.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5ccc1c43ffe42b5d28ff275414efaea5d7600d3a Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/passthrough_endpoints/__pycache__/pass_through_endpoints.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/passthrough_endpoints/__pycache__/vertex_ai.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/passthrough_endpoints/__pycache__/vertex_ai.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e212e6d2350c2011762cb2766445d4df57001142 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/passthrough_endpoints/__pycache__/vertex_ai.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/passthrough_endpoints/assembly_ai.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/passthrough_endpoints/assembly_ai.py new file mode 100644 index 0000000000000000000000000000000000000000..91b7273a48c2c156440af261941bb3bf9f2b0330 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/passthrough_endpoints/assembly_ai.py @@ -0,0 +1,2 @@ +ASSEMBLY_AI_POLLING_INTERVAL = 10 +ASSEMBLY_AI_MAX_POLLING_ATTEMPTS = 180 diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/passthrough_endpoints/pass_through_endpoints.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/passthrough_endpoints/pass_through_endpoints.py new file mode 100644 index 0000000000000000000000000000000000000000..4a07fa5e84927a3df76b2b08a9d712b5a185be0c --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/passthrough_endpoints/pass_through_endpoints.py @@ -0,0 +1,48 @@ +from enum import Enum +from typing import Optional + +from typing_extensions import TypedDict + +# Request.state key for programmatic pass-through callers (e.g. Bedrock proxy) that attach +# JSON without a FastAPI `custom_body` parameter (which would consume the HTTP body). +LITELLM_PASS_THROUGH_CUSTOM_BODY_STATE_KEY = "litellm_pass_through_custom_body" + + +class EndpointType(str, Enum): + VERTEX_AI = "vertex-ai" + ANTHROPIC = "anthropic" + OPENAI = "openai" + GENERIC = "generic" + + +class PassthroughStandardLoggingPayload(TypedDict, total=False): + """ + Standard logging payload for all pass through endpoints + """ + + url: str + """ + The full url of the request + """ + + request_method: Optional[str] + """ + The method of the request + "GET", "POST", "PUT", "DELETE", etc. + """ + + request_body: Optional[dict] + """ + The body of the request + """ + response_body: Optional[dict] # only tracked for non-streaming responses + """ + The body of the response + """ + + cost_per_request: Optional[float] + """ + The cost per request to the target endpoint + + Optional field, we use this for cost tracking only if it's set. + """ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/passthrough_endpoints/vertex_ai.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/passthrough_endpoints/vertex_ai.py new file mode 100644 index 0000000000000000000000000000000000000000..9087119807e09605cdbde9fc941f7e7a9dae87bf --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/passthrough_endpoints/vertex_ai.py @@ -0,0 +1,20 @@ +""" +Used for /vertex_ai/ pass through endpoints +""" + +from typing import Optional + +from pydantic import BaseModel + +from ..llms.vertex_ai import VERTEX_CREDENTIALS_TYPES + + +class VertexPassThroughCredentials(BaseModel): + # Example: vertex_project = "my-project-123" + vertex_project: Optional[str] = None + + # Example: vertex_location = "us-central1" + vertex_location: Optional[str] = None + + # Example: vertex_credentials = "/path/to/credentials.json" or "os.environ/GOOGLE_CREDS" + vertex_credentials: Optional[VERTEX_CREDENTIALS_TYPES] = None diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/proxy/cloudzero_endpoints.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/proxy/cloudzero_endpoints.py new file mode 100644 index 0000000000000000000000000000000000000000..3ac5795b358944c30912bbbc455ea9a2e9698037 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/proxy/cloudzero_endpoints.py @@ -0,0 +1,84 @@ +""" +CloudZero endpoint types for LiteLLM Proxy +""" + +from datetime import datetime +from typing import Any, Dict, List, Optional + +from pydantic import BaseModel, Field + + +class CloudZeroInitRequest(BaseModel): + """Request model for initializing CloudZero settings""" + + api_key: str = Field(..., description="CloudZero API key for authentication") + connection_id: str = Field( + ..., description="CloudZero connection ID for data submission" + ) + timezone: str = Field( + default="UTC", description="Timezone for date handling (default: UTC)" + ) + + +class CloudZeroInitResponse(BaseModel): + """Response model for CloudZero initialization""" + + message: str + status: str + + +class CloudZeroExportRequest(BaseModel): + """Request model for CloudZero export operations""" + + limit: Optional[int] = Field( + None, description="Optional limit on number of records to export" + ) + operation: str = Field( + default="replace_hourly", + description="CloudZero operation type (replace_hourly or sum)", + ) + start_time_utc: Optional[datetime] = Field( + None, description="Start time for data export in UTC" + ) + end_time_utc: Optional[datetime] = Field( + None, description="End time for data export in UTC" + ) + + +class CloudZeroExportResponse(BaseModel): + """Response model for CloudZero export operations""" + + message: str + status: str + records_exported: Optional[int] = None + dry_run_data: Optional[Dict[str, Any]] = Field( + None, description="Dry run data including usage data and CBF transformed data" + ) + summary: Optional[Dict[str, Any]] = Field( + None, description="Summary statistics for dry run" + ) + + +class CloudZeroSettingsView(BaseModel): + """Response model for viewing CloudZero settings with masked API key""" + + api_key_masked: Optional[str] = Field( + None, description="Masked API key showing only first 4 and last 4 characters" + ) + connection_id: Optional[str] = Field( + None, description="CloudZero connection ID for data submission" + ) + timezone: Optional[str] = Field(None, description="Timezone for date handling") + status: Optional[str] = Field(None, description="Configuration status") + + +class CloudZeroSettingsUpdate(BaseModel): + """Request model for updating CloudZero settings""" + + api_key: Optional[str] = Field( + None, description="New CloudZero API key for authentication" + ) + connection_id: Optional[str] = Field( + None, description="New CloudZero connection ID for data submission" + ) + timezone: Optional[str] = Field(None, description="New timezone for date handling") diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/proxy/prompt_endpoints.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/proxy/prompt_endpoints.py new file mode 100644 index 0000000000000000000000000000000000000000..609a6e55c9e7a95b1e6dfc44cad49d0f0cf17898 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/proxy/prompt_endpoints.py @@ -0,0 +1,9 @@ +from typing import Any, Dict, List, Optional + +from pydantic import BaseModel + + +class TestPromptRequest(BaseModel): + dotprompt_content: str + prompt_variables: Optional[Dict[str, Any]] = None + conversation_history: Optional[List[Dict[str, str]]] = None diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/responses/__pycache__/main.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/responses/__pycache__/main.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e5226b3b045863ca19066ee20b8a4b3f89a1af30 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/responses/__pycache__/main.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/responses/main.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/responses/main.py new file mode 100644 index 0000000000000000000000000000000000000000..ebd2ad5b5a892f5e820866d247f31124a5e75045 --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/responses/main.py @@ -0,0 +1,126 @@ +from typing import List, Literal, Optional, Union + +from openai.types.responses.response_function_tool_call import ResponseFunctionToolCall +from pydantic import PrivateAttr +from typing_extensions import Any, List, Optional, TypedDict + +from litellm.types.llms.base import BaseLiteLLMOpenAIResponseObject + +Phase = Optional[Literal["commentary", "final_answer"]] + + +class GenericResponseOutputItemContentAnnotation(BaseLiteLLMOpenAIResponseObject): + """Annotation for content in a message""" + + type: Optional[str] + start_index: Optional[int] + end_index: Optional[int] + url: Optional[str] + title: Optional[str] + pass + + +class OutputText(BaseLiteLLMOpenAIResponseObject): + """Text output content from an assistant message""" + + type: Optional[str] # "output_text" + text: Optional[str] + annotations: Optional[List[GenericResponseOutputItemContentAnnotation]] + + +class OutputFunctionToolCall(BaseLiteLLMOpenAIResponseObject): + """A tool call to run a function""" + + arguments: Optional[str] + call_id: Optional[str] + name: Optional[str] + type: Optional[str] # "function_call" + id: Optional[str] + status: Literal["in_progress", "completed", "incomplete"] + phase: Phase = None + + +class OutputImageGenerationCall(BaseLiteLLMOpenAIResponseObject): + """An image generation call output""" + + type: Literal["image_generation_call"] + id: str + status: Literal["in_progress", "completed", "incomplete", "failed"] + result: Optional[str] # Base64 encoded image data (without data:image prefix) + + +class OutputCodeInterpreterCallLog(BaseLiteLLMOpenAIResponseObject): + """Log output from a code interpreter call""" + + type: Literal["logs"] + logs: str + + +class OutputCodeInterpreterCall(BaseLiteLLMOpenAIResponseObject): + """A code interpreter / code execution call output""" + + type: Literal["code_interpreter_call"] + id: str + code: Optional[str] + container_id: Optional[str] + status: Literal["in_progress", "completed", "incomplete", "failed"] + outputs: Optional[List[OutputCodeInterpreterCallLog]] + + +def build_code_interpreter_log_outputs( + content: Any, +) -> Optional[List[OutputCodeInterpreterCallLog]]: + """Convert Anthropic bash_code_execution stdout/stderr to log outputs. + + Shared by streaming (handler.py) and non-streaming (transformation.py) paths. + """ + if not isinstance(content, dict): + return None + parts = [] + if content.get("stdout"): + parts.append(content["stdout"]) + if content.get("stderr"): + parts.append(f"STDERR: {content['stderr']}") + logs = "".join(parts) + return [OutputCodeInterpreterCallLog(type="logs", logs=logs)] if logs else None + + +class GenericResponseOutputItem(BaseLiteLLMOpenAIResponseObject): + """ + Generic response API output item + + """ + + type: str # "message" + id: str + status: str # "completed", "in_progress", etc. + role: str # "assistant", "user", etc. + content: List[OutputText] + phase: Phase = None + + +class DeleteResponseResult(BaseLiteLLMOpenAIResponseObject): + """ + Result of a delete response request + + { + "id": "resp_6786a1bec27481909a17d673315b29f6", + "object": "response", + "deleted": true + } + """ + + id: Optional[str] + object: Optional[str] + deleted: Optional[bool] + + # Define private attributes using PrivateAttr + _hidden_params: dict = PrivateAttr(default_factory=dict) + + +class DecodedResponseId(TypedDict, total=False): + """Structure representing a decoded response ID""" + + custom_llm_provider: Optional[str] + model_id: Optional[str] + response_id: str diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/secret_managers/__pycache__/get_azure_ad_token_provider.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/secret_managers/__pycache__/get_azure_ad_token_provider.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ae33cf90c7ea28c411c2c6bca306ae94a7ed7f45 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/secret_managers/__pycache__/get_azure_ad_token_provider.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/secret_managers/__pycache__/main.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/secret_managers/__pycache__/main.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..764724ad9774ef0cd57c235599d137826353ac00 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/secret_managers/__pycache__/main.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/secret_managers/get_azure_ad_token_provider.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/secret_managers/get_azure_ad_token_provider.py new file mode 100644 index 0000000000000000000000000000000000000000..5d2f7409f95229ffda87d5550f9d0330bb0b309d --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/secret_managers/get_azure_ad_token_provider.py @@ -0,0 +1,8 @@ +from enum import Enum + + +class AzureCredentialType(str, Enum): + ClientSecretCredential = "ClientSecretCredential" + ManagedIdentityCredential = "ManagedIdentityCredential" + CertificateCredential = "CertificateCredential" + DefaultAzureCredential = "DefaultAzureCredential" diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/secret_managers/main.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/secret_managers/main.py new file mode 100644 index 0000000000000000000000000000000000000000..b0a294188cd763fab206a013fb29b62d6ce2eb0e --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/secret_managers/main.py @@ -0,0 +1,74 @@ +import enum +from typing import Dict, List, Literal, Optional + +from litellm.types.llms.base import LiteLLMPydanticObjectBase + + +class KeyManagementSystem(enum.Enum): + GOOGLE_KMS = "google_kms" + AZURE_KEY_VAULT = "azure_key_vault" + AWS_SECRET_MANAGER = "aws_secret_manager" + GOOGLE_SECRET_MANAGER = "google_secret_manager" + HASHICORP_VAULT = "hashicorp_vault" + CYBERARK = "cyberark" + LOCAL = "local" + AWS_KMS = "aws_kms" + CUSTOM = "custom" + + +class KeyManagementSettings(LiteLLMPydanticObjectBase): + hosted_keys: Optional[List] = None + store_virtual_keys: Optional[bool] = False + """ + If True, virtual keys created by litellm will be stored in the secret manager + """ + prefix_for_stored_virtual_keys: str = "litellm/" + """ + If set, this prefix will be used for stored virtual keys in the secret manager + """ + + access_mode: Literal["read_only", "write_only", "read_and_write"] = "read_only" + """ + Access mode for the secret manager, when write_only will only use for writing secrets + """ + + primary_secret_name: Optional[str] = None + """ + If set, will read secrets from this primary secret in the secret manager + + eg. on AWS you can store multiple secret values as K/V pairs in a single secret + """ + + description: Optional[str] = None + """Optional description attached when creating secrets (visible in AWS console).""" + + tags: Optional[Dict[str, str]] = None + """Optional tags to attach when creating secrets (e.g. {"Environment": "Prod", "Owner": "AI-Platform"}).""" + + custom_secret_manager: Optional[str] = None + """ + Path to custom secret manager class (e.g. "my_secret_manager.InMemorySecretManager") + Required when key_management_system is "custom" + """ + + # AWS IAM Role Assumption Settings (for AWS Secret Manager) + aws_region_name: Optional[str] = None + """AWS region for Secret Manager operations (e.g., 'us-east-1')""" + + aws_role_name: Optional[str] = None + """ARN of IAM role to assume for Secret Manager access (e.g., 'arn:aws:iam::123456789012:role/MyRole')""" + + aws_session_name: Optional[str] = None + """Session name for the assumed role session (optional, auto-generated if not provided)""" + + aws_external_id: Optional[str] = None + """External ID for role assumption (required for cross-account access)""" + + aws_profile_name: Optional[str] = None + """AWS profile name to use from ~/.aws/credentials""" + + aws_web_identity_token: Optional[str] = None + """Web identity token for OIDC/IRSA authentication""" + + aws_sts_endpoint: Optional[str] = None + """Custom STS endpoint URL (useful for VPC endpoints or testing)""" diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/videos/__pycache__/main.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/videos/__pycache__/main.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6da13f0c269886b3206eec7dd8348cf7e2a91616 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/videos/__pycache__/main.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/videos/__pycache__/utils.cpython-310.pyc b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/videos/__pycache__/utils.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..56b8fbe06dacdc373907a02f54bde0ca18389811 Binary files /dev/null and b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/videos/__pycache__/utils.cpython-310.pyc differ diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/videos/main.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/videos/main.py new file mode 100644 index 0000000000000000000000000000000000000000..ec0277c789a06adcfbe126a66b296b097aa49fbe --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/videos/main.py @@ -0,0 +1,146 @@ +from typing import Any, Dict, List, Literal, Optional + +from openai.types.audio.transcription_create_params import FileTypes # type: ignore +from pydantic import BaseModel +from typing_extensions import TypedDict + + +class VideoObject(BaseModel): + """Represents a generated video object.""" + + id: str + object: Literal["video"] + status: str + created_at: Optional[int] = None + completed_at: Optional[int] = None + expires_at: Optional[int] = None + error: Optional[Dict[str, Any]] = None + progress: Optional[int] = None + remixed_from_video_id: Optional[str] = None + seconds: Optional[str] = None + size: Optional[str] = None + model: Optional[str] = None + usage: Optional[Dict[str, Any]] = None + _hidden_params: Dict[str, Any] = {} + + def __contains__(self, key): + # Define custom behavior for the 'in' operator + return hasattr(self, key) + + def get(self, key, default=None): + # Custom .get() method to access attributes with a default value if the attribute doesn't exist + return getattr(self, key, default) + + def __getitem__(self, key): + # Allow dictionary-style access to attributes + return getattr(self, key) + + def json(self, **kwargs): # type: ignore + try: + return self.model_dump(**kwargs) + except Exception: + # if using pydantic v1 + return self.dict() + + +class VideoResponse(BaseModel): + """Response object for video generation requests.""" + + data: List[VideoObject] + hidden_params: Dict[str, Any] = {} + + def __contains__(self, key): + return hasattr(self, key) + + def get(self, key, default=None): + return getattr(self, key, default) + + def __getitem__(self, key): + return getattr(self, key) + + def json(self, **kwargs): # type: ignore + try: + return self.model_dump(**kwargs) + except Exception: + return self.dict() + + +class VideoCreateOptionalRequestParams(TypedDict, total=False): + """ + TypedDict for Optional parameters supported by OpenAI's video creation API. + + Params here: https://platform.openai.com/docs/api-reference/videos/create + """ + + input_reference: Optional[FileTypes] # File reference for input image + image: Optional[ + Any + ] # Image for image-to-video; dict with gcsUri/bytesBase64Encoded, or file-like object + parameters: Optional[ + Dict[str, Any] + ] # Provider-specific parameters block passed directly to the API + model: Optional[str] + seconds: Optional[str] + size: Optional[str] + characters: Optional[List[Dict[str, str]]] + user: Optional[str] + extra_headers: Optional[Dict[str, str]] + extra_body: Optional[Dict[str, str]] + + +class VideoCreateRequestParams(VideoCreateOptionalRequestParams, total=False): + """ + TypedDict for request parameters supported by OpenAI's video creation API. + + Params here: https://platform.openai.com/docs/api-reference/videos/create + """ + + prompt: str + + +class DecodedVideoId(TypedDict, total=False): + """Structure representing a decoded video ID""" + + custom_llm_provider: Optional[str] + model_id: Optional[str] + video_id: str + + +class CharacterObject(BaseModel): + """Represents a character created from a video.""" + + id: str + object: Literal["character"] = "character" + created_at: int + name: str + _hidden_params: Dict[str, Any] = {} + + def __contains__(self, key): + return hasattr(self, key) + + def get(self, key, default=None): + return getattr(self, key, default) + + def __getitem__(self, key): + return getattr(self, key) + + def json(self, **kwargs): # type: ignore + try: + return self.model_dump(**kwargs) + except Exception: + return self.dict() + + +class VideoEditRequestParams(TypedDict, total=False): + """TypedDict for video edit request parameters.""" + + prompt: str + video: Dict[str, str] # {"id": "video_123"} + + +class VideoExtensionRequestParams(TypedDict, total=False): + """TypedDict for video extension request parameters.""" + + prompt: str + seconds: str + video: Dict[str, str] # {"id": "video_123"} diff --git a/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/videos/utils.py b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/videos/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..afa368ecdc331affa372f7e53525c12f0a5be32c --- /dev/null +++ b/data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/videos/utils.py @@ -0,0 +1,212 @@ +""" +Utility functions for video ID encoding/decoding with provider information. + +Follows the pattern used in responses/utils.py for consistency. +Format: vid_{base64_encoded_string} +""" + +import base64 +from typing import Optional, Tuple + +from litellm._logging import verbose_logger +from litellm.types.utils import SpecialEnums +from litellm.types.videos.main import DecodedVideoId + +VIDEO_ID_PREFIX = "video_" +CHARACTER_ID_PREFIX = "character_" +CHARACTER_ID_TEMPLATE = "litellm:custom_llm_provider:{};model_id:{};character_id:{}" + + +class DecodedCharacterId(dict): + """Structure representing a decoded character ID.""" + + custom_llm_provider: Optional[str] + model_id: Optional[str] + character_id: str + + +def _add_base64_padding(value: str) -> str: + """ + Add missing base64 padding when IDs are copied without trailing '=' chars. + """ + missing_padding = len(value) % 4 + if missing_padding: + value += "=" * (4 - missing_padding) + return value + + +def encode_video_id_with_provider( + video_id: str, provider: str, model_id: Optional[str] = None +) -> str: + """Encode provider and model_id into video_id using base64.""" + if not provider or not video_id: + return video_id + + # Try to decode the ID first to check if it's already encoded + # This handles the case where Azure/OpenAI return IDs that start with "video_" + # but are not yet encoded with provider information + decoded = decode_video_id_with_provider(video_id) + if decoded.get("custom_llm_provider") is not None: + # ID is already encoded, return as-is + return video_id + + # ID is not encoded (even if it starts with video_), so encode it + assembled_id = str(SpecialEnums.LITELLM_MANAGED_VIDEO_COMPLETE_STR.value).format( + provider, model_id or "", video_id + ) + + base64_encoded_id: str = base64.b64encode(assembled_id.encode("utf-8")).decode( + "utf-8" + ) + + return f"{VIDEO_ID_PREFIX}{base64_encoded_id}" + + +def decode_video_id_with_provider(encoded_video_id: str) -> DecodedVideoId: + """Decode provider and model_id from encoded video_id.""" + if not encoded_video_id: + return DecodedVideoId( + custom_llm_provider=None, + model_id=None, + video_id=encoded_video_id, + ) + + if not encoded_video_id.startswith(VIDEO_ID_PREFIX): + return DecodedVideoId( + custom_llm_provider=None, + model_id=None, + video_id=encoded_video_id, + ) + + try: + cleaned_id = encoded_video_id.replace(VIDEO_ID_PREFIX, "") + cleaned_id = _add_base64_padding(cleaned_id) + decoded_id = base64.b64decode(cleaned_id.encode("utf-8")).decode("utf-8") + + if ";" not in decoded_id: + return DecodedVideoId( + custom_llm_provider=None, + model_id=None, + video_id=encoded_video_id, + ) + + parts = decoded_id.split(";") + + custom_llm_provider = None + model_id = None + decoded_video_id = encoded_video_id + + if len(parts) >= 3: + custom_llm_provider_part = parts[0] + model_id_part = parts[1] + video_id_part = parts[2] + + custom_llm_provider = custom_llm_provider_part.replace( + "litellm:custom_llm_provider:", "" + ) + model_id = model_id_part.replace("model_id:", "") + decoded_video_id = video_id_part.replace("video_id:", "") + + return DecodedVideoId( + custom_llm_provider=custom_llm_provider, + model_id=model_id, + video_id=decoded_video_id, + ) + except Exception as e: + verbose_logger.debug(f"Error decoding video_id '{encoded_video_id}': {e}") + return DecodedVideoId( + custom_llm_provider=None, + model_id=None, + video_id=encoded_video_id, + ) + + +def extract_original_video_id(encoded_video_id: str) -> str: + """Extract original video ID without encoding.""" + decoded = decode_video_id_with_provider(encoded_video_id) + return decoded.get("video_id", encoded_video_id) + + +def encode_character_id_with_provider( + character_id: str, provider: str, model_id: Optional[str] = None +) -> str: + """Encode provider and model_id into character_id using base64.""" + if not provider or not character_id: + return character_id + + decoded = decode_character_id_with_provider(character_id) + if decoded.get("custom_llm_provider") is not None: + return character_id + + assembled_id = CHARACTER_ID_TEMPLATE.format(provider, model_id or "", character_id) + base64_encoded_id: str = base64.b64encode(assembled_id.encode("utf-8")).decode( + "utf-8" + ) + return f"{CHARACTER_ID_PREFIX}{base64_encoded_id}" + + +def decode_character_id_with_provider(encoded_character_id: str) -> DecodedCharacterId: + """Decode provider and model_id from encoded character_id.""" + if not encoded_character_id: + return DecodedCharacterId( + custom_llm_provider=None, + model_id=None, + character_id=encoded_character_id, + ) + + if not encoded_character_id.startswith(CHARACTER_ID_PREFIX): + return DecodedCharacterId( + custom_llm_provider=None, + model_id=None, + character_id=encoded_character_id, + ) + + try: + cleaned_id = encoded_character_id.replace(CHARACTER_ID_PREFIX, "") + cleaned_id = _add_base64_padding(cleaned_id) + decoded_id = base64.b64decode(cleaned_id.encode("utf-8")).decode("utf-8") + + if ";" not in decoded_id: + return DecodedCharacterId( + custom_llm_provider=None, + model_id=None, + character_id=encoded_character_id, + ) + + parts = decoded_id.split(";") + + custom_llm_provider = None + model_id = None + decoded_character_id = encoded_character_id + + if len(parts) >= 3: + custom_llm_provider_part = parts[0] + model_id_part = parts[1] + character_id_part = parts[2] + + custom_llm_provider = custom_llm_provider_part.replace( + "litellm:custom_llm_provider:", "" + ) + model_id = model_id_part.replace("model_id:", "") + decoded_character_id = character_id_part.replace("character_id:", "") + + return DecodedCharacterId( + custom_llm_provider=custom_llm_provider, + model_id=model_id, + character_id=decoded_character_id, + ) + except Exception as e: + verbose_logger.debug( + f"Error decoding character_id '{encoded_character_id}': {e}" + ) + return DecodedCharacterId( + custom_llm_provider=None, + model_id=None, + character_id=encoded_character_id, + ) + + +def extract_original_character_id(encoded_character_id: str) -> str: + """Extract original character ID without encoding.""" + decoded = decode_character_id_with_provider(encoded_character_id) + return decoded.get("character_id", encoded_character_id)