Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/access_group.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/adapter.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/agents.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/caching.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/completion.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/compression.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/embedding.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/files.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/fine_tuning.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/guardrails.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/mcp.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/memory_management.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/policy_engine.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/rag.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/realtime.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/rerank.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/router.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/scheduler.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/search.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/services.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/tag_management.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/tool_management.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/utils.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/vector_store_files.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/vector_stores.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/__init__.py +13 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/__pycache__/__init__.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/__pycache__/main.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/main.py +59 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/litellm_core_utils/__pycache__/streaming_chunk_builder_utils.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/litellm_core_utils/streaming_chunk_builder_utils.py +16 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/aiml.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/anthropic_tool_search.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/custom_llm.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/gemini.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/langgraph.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/oci.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/ollama.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/rerank.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/stability.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/triton.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/vertex_ai.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/vertex_ai_text_to_speech.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/xai.cpython-310.pyc +0 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/aiml.py +29 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic.py +689 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_messages/anthropic_request.py +13 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_messages/anthropic_response.py +96 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_skills.py +158 -0
- data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_tool_search.py +34 -0
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/access_group.cpython-310.pyc
ADDED
|
Binary file (1.67 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/adapter.cpython-310.pyc
ADDED
|
Binary file (618 Bytes). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/agents.cpython-310.pyc
ADDED
|
Binary file (9.96 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/caching.cpython-310.pyc
ADDED
|
Binary file (3.45 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/completion.cpython-310.pyc
ADDED
|
Binary file (4.37 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/compression.cpython-310.pyc
ADDED
|
Binary file (894 Bytes). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/embedding.cpython-310.pyc
ADDED
|
Binary file (1.03 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/files.cpython-310.pyc
ADDED
|
Binary file (7.22 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/fine_tuning.cpython-310.pyc
ADDED
|
Binary file (488 Bytes). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/guardrails.cpython-310.pyc
ADDED
|
Binary file (28.7 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/mcp.cpython-310.pyc
ADDED
|
Binary file (5.19 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/memory_management.cpython-310.pyc
ADDED
|
Binary file (2.27 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/policy_engine.cpython-310.pyc
ADDED
|
Binary file (829 Bytes). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/rag.cpython-310.pyc
ADDED
|
Binary file (8.72 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/realtime.cpython-310.pyc
ADDED
|
Binary file (4.33 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/rerank.cpython-310.pyc
ADDED
|
Binary file (3.17 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/router.cpython-310.pyc
ADDED
|
Binary file (28.9 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/scheduler.cpython-310.pyc
ADDED
|
Binary file (439 Bytes). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/search.cpython-310.pyc
ADDED
|
Binary file (2.67 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/services.cpython-310.pyc
ADDED
|
Binary file (3.95 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/tag_management.cpython-310.pyc
ADDED
|
Binary file (1.85 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/tool_management.cpython-310.pyc
ADDED
|
Binary file (3.95 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/utils.cpython-310.pyc
ADDED
|
Binary file (89.2 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/vector_store_files.cpython-310.pyc
ADDED
|
Binary file (4.13 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/__pycache__/vector_stores.cpython-310.pyc
ADDED
|
Binary file (9.71 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/__init__.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .main import (
|
| 2 |
+
ContentListUnion,
|
| 3 |
+
ContentListUnionDict,
|
| 4 |
+
GenerateContentConfigOrDict,
|
| 5 |
+
GenerateContentResponse,
|
| 6 |
+
)
|
| 7 |
+
|
| 8 |
+
__all__ = [
|
| 9 |
+
"ContentListUnion",
|
| 10 |
+
"ContentListUnionDict",
|
| 11 |
+
"GenerateContentConfigOrDict",
|
| 12 |
+
"GenerateContentResponse",
|
| 13 |
+
]
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (367 Bytes). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/__pycache__/main.cpython-310.pyc
ADDED
|
Binary file (2.55 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/google_genai/main.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Import types from the Google GenAI SDK
|
| 2 |
+
from typing import TYPE_CHECKING, Any, Dict, List, Optional, TypeAlias
|
| 3 |
+
|
| 4 |
+
from pydantic import BaseModel
|
| 5 |
+
from typing_extensions import TypedDict
|
| 6 |
+
|
| 7 |
+
from litellm.types.llms.openai import BaseLiteLLMOpenAIResponseObject
|
| 8 |
+
|
| 9 |
+
# During static type-checking we can rely on the real google-genai types.
|
| 10 |
+
if TYPE_CHECKING:
|
| 11 |
+
from google.genai import types as _genai_types # type: ignore
|
| 12 |
+
|
| 13 |
+
ContentListUnion = _genai_types.ContentListUnion
|
| 14 |
+
ContentListUnionDict = _genai_types.ContentListUnionDict
|
| 15 |
+
GenerateContentConfigOrDict = _genai_types.GenerateContentConfigOrDict
|
| 16 |
+
GoogleGenAIGenerateContentResponse = _genai_types.GenerateContentResponse
|
| 17 |
+
GenerateContentContentListUnionDict = _genai_types.ContentListUnionDict
|
| 18 |
+
GenerateContentConfigDict = _genai_types.GenerateContentConfigDict
|
| 19 |
+
GenerateContentRequestParametersDict = _genai_types._GenerateContentParametersDict
|
| 20 |
+
ToolConfigDict = _genai_types.ToolConfigDict
|
| 21 |
+
|
| 22 |
+
class GenerateContentRequestDict(GenerateContentRequestParametersDict): # type: ignore[misc, valid-type]
|
| 23 |
+
generationConfig: Optional[Any]
|
| 24 |
+
tools: Optional[ToolConfigDict] # type: ignore[assignment, valid-type]
|
| 25 |
+
|
| 26 |
+
class GenerateContentResponse(GoogleGenAIGenerateContentResponse, BaseLiteLLMOpenAIResponseObject): # type: ignore[misc, valid-type]
|
| 27 |
+
_hidden_params: dict = {}
|
| 28 |
+
pass
|
| 29 |
+
|
| 30 |
+
else:
|
| 31 |
+
# Fallback types when google.genai is not available
|
| 32 |
+
ContentListUnion = Any
|
| 33 |
+
ContentListUnionDict = Dict[str, Any]
|
| 34 |
+
GenerateContentConfigOrDict = Dict[str, Any]
|
| 35 |
+
GoogleGenAIGenerateContentResponse = Dict[str, Any]
|
| 36 |
+
GenerateContentContentListUnionDict = Dict[str, Any]
|
| 37 |
+
|
| 38 |
+
# Create a proper fallback class that can be instantiated
|
| 39 |
+
class GenerateContentConfigDict(dict): # type: ignore[misc]
|
| 40 |
+
def __init__(self, **kwargs): # type: ignore
|
| 41 |
+
super().__init__(**kwargs)
|
| 42 |
+
|
| 43 |
+
class GenerateContentRequestParametersDict(dict): # type: ignore[misc]
|
| 44 |
+
def __init__(self, **kwargs): # type: ignore
|
| 45 |
+
super().__init__(**kwargs)
|
| 46 |
+
|
| 47 |
+
ToolConfigDict = Dict[str, Any]
|
| 48 |
+
|
| 49 |
+
class GenerateContentRequestDict(GenerateContentRequestParametersDict): # type: ignore[misc]
|
| 50 |
+
def __init__(self, **kwargs): # type: ignore
|
| 51 |
+
# Extract specific fields
|
| 52 |
+
self.generationConfig = kwargs.get("generationConfig")
|
| 53 |
+
self.tools = kwargs.get("tools")
|
| 54 |
+
super().__init__(**kwargs)
|
| 55 |
+
|
| 56 |
+
class GenerateContentResponse(BaseLiteLLMOpenAIResponseObject): # type: ignore[misc]
|
| 57 |
+
def __init__(self, **kwargs): # type: ignore
|
| 58 |
+
super().__init__(**kwargs)
|
| 59 |
+
self._hidden_params = kwargs.get("_hidden_params", {})
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/litellm_core_utils/__pycache__/streaming_chunk_builder_utils.cpython-310.pyc
ADDED
|
Binary file (946 Bytes). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/litellm_core_utils/streaming_chunk_builder_utils.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import TYPE_CHECKING, Optional
|
| 2 |
+
|
| 3 |
+
from typing_extensions import TypedDict
|
| 4 |
+
|
| 5 |
+
from ..utils import CompletionTokensDetails, PromptTokensDetailsWrapper, ServerToolUse
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class UsagePerChunk(TypedDict):
|
| 9 |
+
prompt_tokens: int
|
| 10 |
+
completion_tokens: int
|
| 11 |
+
cache_creation_input_tokens: Optional[int]
|
| 12 |
+
cache_read_input_tokens: Optional[int]
|
| 13 |
+
server_tool_use: Optional[ServerToolUse]
|
| 14 |
+
web_search_requests: Optional[int]
|
| 15 |
+
completion_tokens_details: Optional[CompletionTokensDetails]
|
| 16 |
+
prompt_tokens_details: Optional[PromptTokensDetailsWrapper]
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/aiml.cpython-310.pyc
ADDED
|
Binary file (1.18 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/anthropic_tool_search.cpython-310.pyc
ADDED
|
Binary file (1.09 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/custom_llm.cpython-310.pyc
ADDED
|
Binary file (627 Bytes). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/gemini.cpython-310.pyc
ADDED
|
Binary file (8.7 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/langgraph.cpython-310.pyc
ADDED
|
Binary file (2.51 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/oci.cpython-310.pyc
ADDED
|
Binary file (13 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/ollama.cpython-310.pyc
ADDED
|
Binary file (1.49 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/rerank.cpython-310.pyc
ADDED
|
Binary file (842 Bytes). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/stability.cpython-310.pyc
ADDED
|
Binary file (6.63 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/triton.cpython-310.pyc
ADDED
|
Binary file (190 Bytes). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/vertex_ai.cpython-310.pyc
ADDED
|
Binary file (25.1 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/vertex_ai_text_to_speech.cpython-310.pyc
ADDED
|
Binary file (2.07 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/__pycache__/xai.cpython-310.pyc
ADDED
|
Binary file (1.38 kB). View file
|
|
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/aiml.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Dict, Optional, Union
|
| 2 |
+
|
| 3 |
+
from typing_extensions import TypedDict
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class AimlImageSize(TypedDict, total=False):
|
| 7 |
+
"""Custom image size specification for AI/ML API"""
|
| 8 |
+
|
| 9 |
+
width: int # Must be multiple of 32, min 256, max 1440
|
| 10 |
+
height: int # Must be multiple of 32, min 256, max 1440
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class AimlImageGenerationRequestParams(TypedDict, total=False):
|
| 14 |
+
"""
|
| 15 |
+
TypedDict for AI/ML flux image generation request parameters.
|
| 16 |
+
|
| 17 |
+
Based on AI/ML API docs: https://api.aimlapi.com/v1/images/generations
|
| 18 |
+
"""
|
| 19 |
+
|
| 20 |
+
model: str # Required: flux-pro/v1.1
|
| 21 |
+
prompt: str # Required: Text prompt (max 4000 chars)
|
| 22 |
+
image_size: Union[
|
| 23 |
+
AimlImageSize, str
|
| 24 |
+
] # Custom size or predefined: square_hd, square, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9
|
| 25 |
+
safety_tolerance: Optional[str] # 1-6, default 2 (1=strict, 6=permissive)
|
| 26 |
+
output_format: Optional[str] # jpeg or png, default jpeg
|
| 27 |
+
num_images: Optional[int] # 1-4, default 1
|
| 28 |
+
seed: Optional[int] # Min 1, for reproducibility
|
| 29 |
+
enable_safety_checker: Optional[bool] # Default true
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic.py
ADDED
|
@@ -0,0 +1,689 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from enum import Enum
|
| 2 |
+
from typing import Any, Dict, Iterable, List, Optional, Union
|
| 3 |
+
|
| 4 |
+
from pydantic import BaseModel, ConfigDict
|
| 5 |
+
from typing_extensions import Literal, Required, TypedDict
|
| 6 |
+
|
| 7 |
+
from .openai import (
|
| 8 |
+
ChatCompletionCachedContent,
|
| 9 |
+
ChatCompletionRedactedThinkingBlock,
|
| 10 |
+
ChatCompletionThinkingBlock,
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
class AnthropicMessagesToolChoice(TypedDict, total=False):
|
| 15 |
+
type: Required[Literal["auto", "any", "tool", "none"]]
|
| 16 |
+
name: str
|
| 17 |
+
disable_parallel_tool_use: bool # default is false
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
AnthropicInputSchema = TypedDict(
|
| 21 |
+
"AnthropicInputSchema",
|
| 22 |
+
{
|
| 23 |
+
"type": Optional[str],
|
| 24 |
+
"properties": Optional[dict],
|
| 25 |
+
"additionalProperties": Optional[bool],
|
| 26 |
+
"required": Optional[List[str]],
|
| 27 |
+
"$defs": Optional[Dict],
|
| 28 |
+
"strict": Optional[bool],
|
| 29 |
+
},
|
| 30 |
+
total=False,
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
class AnthropicOutputSchema(TypedDict, total=False):
|
| 35 |
+
type: Required[Literal["json_schema"]]
|
| 36 |
+
schema: Required[dict]
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
class AnthropicOutputConfig(TypedDict, total=False):
|
| 40 |
+
"""Configuration for controlling Claude's output behavior."""
|
| 41 |
+
|
| 42 |
+
effort: Literal["high", "medium", "low"]
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class AnthropicMessagesTool(TypedDict, total=False):
|
| 46 |
+
name: Required[str]
|
| 47 |
+
description: str
|
| 48 |
+
input_schema: Optional[AnthropicInputSchema]
|
| 49 |
+
type: Literal["custom"]
|
| 50 |
+
cache_control: Optional[Union[dict, ChatCompletionCachedContent]]
|
| 51 |
+
defer_loading: bool
|
| 52 |
+
allowed_callers: Optional[List[str]]
|
| 53 |
+
input_examples: Optional[List[Dict[str, Any]]]
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
class AnthropicComputerTool(TypedDict, total=False):
|
| 57 |
+
display_width_px: Required[int]
|
| 58 |
+
display_height_px: Required[int]
|
| 59 |
+
display_number: int
|
| 60 |
+
cache_control: Optional[Union[dict, ChatCompletionCachedContent]]
|
| 61 |
+
type: Required[str]
|
| 62 |
+
name: Required[str]
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
class AnthropicWebSearchUserLocation(TypedDict, total=False):
|
| 66 |
+
city: Optional[str]
|
| 67 |
+
country: Optional[str]
|
| 68 |
+
region: Optional[str]
|
| 69 |
+
timezone: Optional[str]
|
| 70 |
+
type: Required[Literal["approximate"]]
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
class AnthropicWebSearchTool(TypedDict, total=False):
|
| 74 |
+
name: Required[Literal["web_search"]]
|
| 75 |
+
type: Required[str]
|
| 76 |
+
cache_control: Optional[Union[dict, ChatCompletionCachedContent]]
|
| 77 |
+
max_uses: Optional[int]
|
| 78 |
+
user_location: Optional[AnthropicWebSearchUserLocation]
|
| 79 |
+
defer_loading: Optional[bool]
|
| 80 |
+
allowed_callers: Optional[List[str]]
|
| 81 |
+
input_examples: Optional[List[Dict[str, Any]]]
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
class AnthropicHostedTools(TypedDict, total=False): # for bash_tool and text_editor
|
| 85 |
+
type: Required[str]
|
| 86 |
+
name: Required[str]
|
| 87 |
+
cache_control: Optional[Union[dict, ChatCompletionCachedContent]]
|
| 88 |
+
defer_loading: Optional[bool]
|
| 89 |
+
allowed_callers: Optional[List[str]]
|
| 90 |
+
input_examples: Optional[List[Dict[str, Any]]]
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
class AnthropicCodeExecutionTool(TypedDict, total=False):
|
| 94 |
+
type: Required[str]
|
| 95 |
+
name: Required[Literal["code_execution"]]
|
| 96 |
+
cache_control: Optional[Union[dict, ChatCompletionCachedContent]]
|
| 97 |
+
defer_loading: Optional[bool]
|
| 98 |
+
allowed_callers: Optional[List[str]]
|
| 99 |
+
input_examples: Optional[List[Dict[str, Any]]]
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
class AnthropicMemoryTool(TypedDict, total=False):
|
| 103 |
+
type: Required[str]
|
| 104 |
+
name: Required[Literal["memory"]]
|
| 105 |
+
cache_control: Optional[Union[dict, ChatCompletionCachedContent]]
|
| 106 |
+
defer_loading: Optional[bool]
|
| 107 |
+
allowed_callers: Optional[List[str]]
|
| 108 |
+
input_examples: Optional[List[Dict[str, Any]]]
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
class AnthropicToolSearchToolRegex(TypedDict, total=False):
|
| 112 |
+
"""Tool search tool using regex patterns for tool discovery."""
|
| 113 |
+
|
| 114 |
+
type: Required[Literal["tool_search_tool_regex_20251119"]]
|
| 115 |
+
name: Required[str]
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
class AnthropicToolSearchToolBM25(TypedDict, total=False):
|
| 119 |
+
"""Tool search tool using BM25 algorithm for tool discovery."""
|
| 120 |
+
|
| 121 |
+
type: Required[Literal["tool_search_tool_bm25_20251119"]]
|
| 122 |
+
name: Required[str]
|
| 123 |
+
cache_control: Optional[Union[dict, ChatCompletionCachedContent]]
|
| 124 |
+
defer_loading: Optional[bool]
|
| 125 |
+
allowed_callers: Optional[List[str]]
|
| 126 |
+
input_examples: Optional[List[Dict[str, Any]]]
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
ANTHROPIC_ADVISOR_TOOL_TYPE: Literal["advisor_20260301"] = "advisor_20260301"
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
class AnthropicAdvisorTool(TypedDict, total=False):
|
| 133 |
+
"""Advisor tool — pairs a fast executor model with a high-intelligence advisor model."""
|
| 134 |
+
|
| 135 |
+
type: Required[Literal["advisor_20260301"]]
|
| 136 |
+
name: Required[Literal["advisor"]]
|
| 137 |
+
model: Required[str]
|
| 138 |
+
max_uses: Optional[int]
|
| 139 |
+
caching: Optional[dict]
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
class ToolReference(TypedDict, total=False):
|
| 143 |
+
"""Reference to a tool that should be expanded from deferred tools."""
|
| 144 |
+
|
| 145 |
+
type: Required[Literal["tool_reference"]]
|
| 146 |
+
tool_name: Required[str]
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
class DirectToolCaller(TypedDict, total=False):
|
| 150 |
+
"""Indicates a tool was called directly by Claude."""
|
| 151 |
+
|
| 152 |
+
type: Required[Literal["direct"]]
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
class CodeExecutionToolCaller(TypedDict, total=False):
|
| 156 |
+
"""Indicates a tool was called programmatically from code execution."""
|
| 157 |
+
|
| 158 |
+
type: Required[Literal["code_execution_20250825"]]
|
| 159 |
+
tool_id: Required[str] # ID of the code execution tool that made the call
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
ToolCaller = Union[DirectToolCaller, CodeExecutionToolCaller]
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
class AnthropicContainer(TypedDict, total=False):
|
| 166 |
+
"""Container metadata for code execution."""
|
| 167 |
+
|
| 168 |
+
id: Required[str]
|
| 169 |
+
expires_at: Optional[str] # ISO 8601 timestamp
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
AllAnthropicToolsValues = Union[
|
| 173 |
+
AnthropicComputerTool,
|
| 174 |
+
AnthropicHostedTools,
|
| 175 |
+
AnthropicMessagesTool,
|
| 176 |
+
AnthropicWebSearchTool,
|
| 177 |
+
AnthropicCodeExecutionTool,
|
| 178 |
+
AnthropicMemoryTool,
|
| 179 |
+
AnthropicToolSearchToolRegex,
|
| 180 |
+
AnthropicToolSearchToolBM25,
|
| 181 |
+
AnthropicAdvisorTool,
|
| 182 |
+
]
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
class AnthropicMcpServerToolConfiguration(TypedDict, total=False):
|
| 186 |
+
allowed_tools: Optional[List[str]]
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
class AnthropicMcpServerTool(TypedDict, total=False):
|
| 190 |
+
type: Required[Literal["url"]]
|
| 191 |
+
url: Required[str]
|
| 192 |
+
name: Required[str]
|
| 193 |
+
tool_configuration: AnthropicMcpServerToolConfiguration
|
| 194 |
+
authorization_token: str
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
class AnthropicMessagesTextParam(TypedDict, total=False):
|
| 198 |
+
type: Required[Literal["text"]]
|
| 199 |
+
text: Required[str]
|
| 200 |
+
cache_control: Optional[Union[dict, ChatCompletionCachedContent]]
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
class AnthropicMessagesToolUseParam(TypedDict, total=False):
|
| 204 |
+
type: Required[Literal["tool_use"]]
|
| 205 |
+
id: str
|
| 206 |
+
name: str
|
| 207 |
+
input: dict
|
| 208 |
+
cache_control: Optional[Union[dict, ChatCompletionCachedContent]]
|
| 209 |
+
caller: Optional[ToolCaller]
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
AnthropicMessagesAssistantMessageValues = Union[
|
| 213 |
+
AnthropicMessagesTextParam,
|
| 214 |
+
AnthropicMessagesToolUseParam,
|
| 215 |
+
ChatCompletionThinkingBlock,
|
| 216 |
+
ChatCompletionRedactedThinkingBlock,
|
| 217 |
+
]
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
class AnthopicMessagesAssistantMessageParam(TypedDict, total=False):
|
| 221 |
+
content: Required[Union[str, Iterable[AnthropicMessagesAssistantMessageValues]]]
|
| 222 |
+
"""The contents of the system message."""
|
| 223 |
+
|
| 224 |
+
role: Required[Literal["assistant"]]
|
| 225 |
+
"""The role of the messages author, in this case `author`."""
|
| 226 |
+
|
| 227 |
+
name: str
|
| 228 |
+
"""An optional name for the participant.
|
| 229 |
+
|
| 230 |
+
Provides the model information to differentiate between participants of the same
|
| 231 |
+
role.
|
| 232 |
+
"""
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
class AnthropicContentParamSource(TypedDict):
|
| 236 |
+
type: Literal["base64"]
|
| 237 |
+
media_type: str
|
| 238 |
+
data: str
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
class AnthropicContentParamSourceUrl(TypedDict):
|
| 242 |
+
type: Literal["url"]
|
| 243 |
+
url: str
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
class AnthropicContentParamSourceFileId(TypedDict):
|
| 247 |
+
type: Literal["file"]
|
| 248 |
+
file_id: str
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
class AnthropicMessagesContainerUploadParam(TypedDict, total=False):
|
| 252 |
+
type: Required[Literal["container_upload"]]
|
| 253 |
+
file_id: str
|
| 254 |
+
cache_control: Optional[Union[dict, ChatCompletionCachedContent]]
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
class AnthropicMessagesImageParam(TypedDict, total=False):
|
| 258 |
+
type: Required[Literal["image"]]
|
| 259 |
+
source: Required[
|
| 260 |
+
Union[
|
| 261 |
+
AnthropicContentParamSource,
|
| 262 |
+
AnthropicContentParamSourceFileId,
|
| 263 |
+
AnthropicContentParamSourceUrl,
|
| 264 |
+
]
|
| 265 |
+
]
|
| 266 |
+
cache_control: Optional[Union[dict, ChatCompletionCachedContent]]
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
class CitationsObject(TypedDict):
|
| 270 |
+
enabled: bool
|
| 271 |
+
|
| 272 |
+
|
| 273 |
+
class AnthropicCitationPageLocation(TypedDict, total=False):
|
| 274 |
+
"""
|
| 275 |
+
Anthropic citation for page-based references.
|
| 276 |
+
Used when citing from documents with page numbers.
|
| 277 |
+
"""
|
| 278 |
+
|
| 279 |
+
type: Literal["page_location"]
|
| 280 |
+
cited_text: str # The exact text being cited (not counted towards output tokens)
|
| 281 |
+
document_index: int # Index referencing the cited document
|
| 282 |
+
document_title: Optional[str] # Title of the cited document
|
| 283 |
+
start_page_number: int # 1-indexed starting page
|
| 284 |
+
end_page_number: int # Exclusive ending page
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
class AnthropicCitationCharLocation(TypedDict, total=False):
|
| 288 |
+
"""
|
| 289 |
+
Anthropic citation for character-based references.
|
| 290 |
+
Used when citing from text with character positions.
|
| 291 |
+
"""
|
| 292 |
+
|
| 293 |
+
type: Literal["char_location"]
|
| 294 |
+
cited_text: str # The exact text being cited (not counted towards output tokens)
|
| 295 |
+
document_index: int # Index referencing the cited document
|
| 296 |
+
document_title: Optional[str] # Title of the cited document
|
| 297 |
+
start_char_index: int # Starting character index for the citation
|
| 298 |
+
end_char_index: int # Ending character index for the citation
|
| 299 |
+
|
| 300 |
+
|
| 301 |
+
# Union type for all citation formats
|
| 302 |
+
AnthropicCitation = Union[AnthropicCitationPageLocation, AnthropicCitationCharLocation]
|
| 303 |
+
|
| 304 |
+
|
| 305 |
+
class AnthropicMessagesDocumentParam(TypedDict, total=False):
|
| 306 |
+
type: Required[Literal["document"]]
|
| 307 |
+
source: Required[
|
| 308 |
+
Union[
|
| 309 |
+
AnthropicContentParamSource,
|
| 310 |
+
AnthropicContentParamSourceFileId,
|
| 311 |
+
AnthropicContentParamSourceUrl,
|
| 312 |
+
]
|
| 313 |
+
]
|
| 314 |
+
cache_control: Optional[Union[dict, ChatCompletionCachedContent]]
|
| 315 |
+
title: str
|
| 316 |
+
context: str
|
| 317 |
+
citations: Optional[CitationsObject]
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
class AnthropicMessagesToolResultContent(TypedDict, total=False):
|
| 321 |
+
type: Required[Literal["text"]]
|
| 322 |
+
text: Required[str]
|
| 323 |
+
cache_control: Optional[Union[dict, ChatCompletionCachedContent]]
|
| 324 |
+
|
| 325 |
+
|
| 326 |
+
class AnthropicMessagesToolResultParam(TypedDict, total=False):
|
| 327 |
+
type: Required[Literal["tool_result"]]
|
| 328 |
+
tool_use_id: Required[str]
|
| 329 |
+
is_error: bool
|
| 330 |
+
content: Union[
|
| 331 |
+
str,
|
| 332 |
+
Iterable[
|
| 333 |
+
Union[
|
| 334 |
+
AnthropicMessagesToolResultContent,
|
| 335 |
+
AnthropicMessagesImageParam,
|
| 336 |
+
AnthropicMessagesDocumentParam,
|
| 337 |
+
]
|
| 338 |
+
],
|
| 339 |
+
]
|
| 340 |
+
cache_control: Optional[Union[dict, ChatCompletionCachedContent]]
|
| 341 |
+
|
| 342 |
+
|
| 343 |
+
AnthropicMessagesUserMessageValues = Union[
|
| 344 |
+
AnthropicMessagesTextParam,
|
| 345 |
+
AnthropicMessagesImageParam,
|
| 346 |
+
AnthropicMessagesToolResultParam,
|
| 347 |
+
AnthropicMessagesDocumentParam,
|
| 348 |
+
AnthropicMessagesContainerUploadParam,
|
| 349 |
+
]
|
| 350 |
+
|
| 351 |
+
|
| 352 |
+
class AnthropicMessagesUserMessageParam(TypedDict, total=False):
|
| 353 |
+
role: Required[Literal["user"]]
|
| 354 |
+
content: Required[Union[str, Iterable[AnthropicMessagesUserMessageValues]]]
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
class AnthropicMetadata(TypedDict, total=False):
|
| 358 |
+
user_id: str
|
| 359 |
+
|
| 360 |
+
|
| 361 |
+
class AnthropicSystemMessageContent(TypedDict, total=False):
|
| 362 |
+
type: str
|
| 363 |
+
text: str
|
| 364 |
+
cache_control: Optional[Union[dict, ChatCompletionCachedContent]]
|
| 365 |
+
|
| 366 |
+
|
| 367 |
+
AllAnthropicMessageValues = Union[
|
| 368 |
+
AnthropicMessagesUserMessageParam, AnthopicMessagesAssistantMessageParam
|
| 369 |
+
]
|
| 370 |
+
|
| 371 |
+
|
| 372 |
+
class AnthropicMessagesRequestOptionalParams(TypedDict, total=False):
|
| 373 |
+
max_tokens: Optional[int]
|
| 374 |
+
metadata: Optional[Union[AnthropicMetadata, Dict]]
|
| 375 |
+
stop_sequences: Optional[List[str]]
|
| 376 |
+
stream: Optional[bool]
|
| 377 |
+
system: Optional[Union[str, List]]
|
| 378 |
+
temperature: Optional[float]
|
| 379 |
+
thinking: Optional[Dict]
|
| 380 |
+
tool_choice: Optional[Union[AnthropicMessagesToolChoice, Dict]]
|
| 381 |
+
tools: Optional[List[Union[AllAnthropicToolsValues, Dict]]]
|
| 382 |
+
top_k: Optional[int]
|
| 383 |
+
inference_geo: Optional[str]
|
| 384 |
+
top_p: Optional[float]
|
| 385 |
+
mcp_servers: Optional[List[AnthropicMcpServerTool]]
|
| 386 |
+
context_management: Optional[Dict[str, Any]]
|
| 387 |
+
container: Optional[
|
| 388 |
+
Dict[str, Any]
|
| 389 |
+
] # Container config with skills for code execution
|
| 390 |
+
output_format: Optional[AnthropicOutputSchema] # Structured outputs support
|
| 391 |
+
speed: Optional[str] # Fast mode support for Opus models
|
| 392 |
+
output_config: Optional[
|
| 393 |
+
AnthropicOutputConfig
|
| 394 |
+
] # Configuration for Claude's output behavior
|
| 395 |
+
cache_control: Optional[Dict[str, Any]] # Automatic prompt caching
|
| 396 |
+
reasoning_effort: Optional[str]
|
| 397 |
+
|
| 398 |
+
|
| 399 |
+
class AnthropicMessagesRequest(AnthropicMessagesRequestOptionalParams, total=False):
|
| 400 |
+
model: Required[str]
|
| 401 |
+
messages: Required[Union[List[AllAnthropicMessageValues], List[Dict]]]
|
| 402 |
+
# litellm param - used for tracking litellm proxy metadata in the request
|
| 403 |
+
litellm_metadata: dict
|
| 404 |
+
|
| 405 |
+
|
| 406 |
+
class ContentTextBlockDelta(TypedDict):
|
| 407 |
+
"""
|
| 408 |
+
'delta': {'type': 'text_delta', 'text': 'Hello'}
|
| 409 |
+
"""
|
| 410 |
+
|
| 411 |
+
type: str
|
| 412 |
+
text: str
|
| 413 |
+
|
| 414 |
+
|
| 415 |
+
class ContentCitationsBlockDelta(TypedDict):
|
| 416 |
+
type: Literal["citations"]
|
| 417 |
+
citation: dict
|
| 418 |
+
|
| 419 |
+
|
| 420 |
+
class ContentJsonBlockDelta(TypedDict):
|
| 421 |
+
"""
|
| 422 |
+
"delta": {"type": "input_json_delta","partial_json": "{\"location\": \"San Fra"}}
|
| 423 |
+
"""
|
| 424 |
+
|
| 425 |
+
type: str
|
| 426 |
+
partial_json: str
|
| 427 |
+
|
| 428 |
+
|
| 429 |
+
class ContentThinkingBlockDelta(TypedDict):
|
| 430 |
+
"""
|
| 431 |
+
"delta": {"type": "thinking_delta", "thinking": "Let me solve this step by step:"}}
|
| 432 |
+
"""
|
| 433 |
+
|
| 434 |
+
type: Literal["thinking_delta"]
|
| 435 |
+
thinking: str
|
| 436 |
+
|
| 437 |
+
|
| 438 |
+
class ContentThinkingSignatureBlockDelta(TypedDict):
|
| 439 |
+
"""
|
| 440 |
+
"delta": {"type": "signature_delta", "signature": "EqQBCgIYAhIM1gbcDa9GJwZA2b3hGgxBdjrkzLoky3dl1pkiMOYds..."}}
|
| 441 |
+
"""
|
| 442 |
+
|
| 443 |
+
type: Literal["signature_delta"]
|
| 444 |
+
signature: str
|
| 445 |
+
|
| 446 |
+
|
| 447 |
+
class ContentBlockDelta(TypedDict):
|
| 448 |
+
type: Literal["content_block_delta"]
|
| 449 |
+
index: int
|
| 450 |
+
delta: Union[
|
| 451 |
+
ContentTextBlockDelta,
|
| 452 |
+
ContentJsonBlockDelta,
|
| 453 |
+
ContentCitationsBlockDelta,
|
| 454 |
+
ContentThinkingBlockDelta,
|
| 455 |
+
ContentThinkingSignatureBlockDelta,
|
| 456 |
+
]
|
| 457 |
+
|
| 458 |
+
|
| 459 |
+
class ContentBlockStop(TypedDict):
|
| 460 |
+
type: Literal["content_block_stop"]
|
| 461 |
+
index: int
|
| 462 |
+
|
| 463 |
+
|
| 464 |
+
class ToolUseBlock(TypedDict):
|
| 465 |
+
"""
|
| 466 |
+
"content_block":{"type":"tool_use","id":"toolu_01T1x1fJ34qAmk2tNTrN7Up6","name":"get_weather","input":{}}
|
| 467 |
+
"""
|
| 468 |
+
|
| 469 |
+
id: str
|
| 470 |
+
|
| 471 |
+
input: dict
|
| 472 |
+
|
| 473 |
+
name: str
|
| 474 |
+
|
| 475 |
+
type: Literal["tool_use"]
|
| 476 |
+
caller: Optional[ToolCaller]
|
| 477 |
+
|
| 478 |
+
|
| 479 |
+
class TextBlock(TypedDict):
|
| 480 |
+
text: str
|
| 481 |
+
|
| 482 |
+
type: Literal["text"]
|
| 483 |
+
|
| 484 |
+
|
| 485 |
+
class ContentBlockStartToolUse(TypedDict):
|
| 486 |
+
type: Literal["content_block_start"]
|
| 487 |
+
id: str
|
| 488 |
+
name: str
|
| 489 |
+
input: dict
|
| 490 |
+
content_block: ToolUseBlock
|
| 491 |
+
|
| 492 |
+
|
| 493 |
+
class ContentBlockStartText(TypedDict):
|
| 494 |
+
type: Literal["content_block_start"]
|
| 495 |
+
index: int
|
| 496 |
+
content_block: TextBlock
|
| 497 |
+
|
| 498 |
+
|
| 499 |
+
ContentBlockContentBlockDict = Union[
|
| 500 |
+
ToolUseBlock, TextBlock, ChatCompletionThinkingBlock
|
| 501 |
+
]
|
| 502 |
+
|
| 503 |
+
ContentBlockStart = Union[ContentBlockStartToolUse, ContentBlockStartText]
|
| 504 |
+
|
| 505 |
+
|
| 506 |
+
class MessageDelta(TypedDict, total=False):
|
| 507 |
+
stop_reason: Optional[str]
|
| 508 |
+
|
| 509 |
+
|
| 510 |
+
class UsageDelta(TypedDict, total=False):
|
| 511 |
+
input_tokens: int
|
| 512 |
+
output_tokens: int
|
| 513 |
+
cache_creation_input_tokens: int
|
| 514 |
+
cache_read_input_tokens: int
|
| 515 |
+
|
| 516 |
+
|
| 517 |
+
class MessageBlockDelta(TypedDict):
|
| 518 |
+
"""
|
| 519 |
+
Anthropic
|
| 520 |
+
chunk = {'type': 'message_delta', 'delta': {'stop_reason': 'max_tokens', 'stop_sequence': None}, 'usage': {'output_tokens': 10}}
|
| 521 |
+
"""
|
| 522 |
+
|
| 523 |
+
type: Literal["message_delta"]
|
| 524 |
+
delta: MessageDelta
|
| 525 |
+
usage: UsageDelta
|
| 526 |
+
|
| 527 |
+
|
| 528 |
+
class MessageChunk(TypedDict, total=False):
|
| 529 |
+
id: str
|
| 530 |
+
type: str
|
| 531 |
+
role: str
|
| 532 |
+
model: str
|
| 533 |
+
content: List
|
| 534 |
+
stop_reason: Optional[str]
|
| 535 |
+
stop_sequence: Optional[str]
|
| 536 |
+
usage: UsageDelta
|
| 537 |
+
|
| 538 |
+
|
| 539 |
+
class MessageStartBlock(TypedDict):
|
| 540 |
+
"""
|
| 541 |
+
Anthropic
|
| 542 |
+
chunk = {
|
| 543 |
+
"type": "message_start",
|
| 544 |
+
"message": {
|
| 545 |
+
"id": "msg_vrtx_011PqREFEMzd3REdCoUFAmdG",
|
| 546 |
+
"type": "message",
|
| 547 |
+
"role": "assistant",
|
| 548 |
+
"model": "claude-3-sonnet-20240229",
|
| 549 |
+
"content": [],
|
| 550 |
+
"stop_reason": null,
|
| 551 |
+
"stop_sequence": null,
|
| 552 |
+
"usage": {
|
| 553 |
+
"input_tokens": 270,
|
| 554 |
+
"output_tokens": 1
|
| 555 |
+
}
|
| 556 |
+
}
|
| 557 |
+
}
|
| 558 |
+
"""
|
| 559 |
+
|
| 560 |
+
type: Literal["message_start"]
|
| 561 |
+
message: MessageChunk
|
| 562 |
+
|
| 563 |
+
|
| 564 |
+
class AnthropicResponseContentBlockText(BaseModel):
|
| 565 |
+
type: Literal["text"]
|
| 566 |
+
text: str
|
| 567 |
+
|
| 568 |
+
|
| 569 |
+
class AnthropicResponseContentBlockToolUse(BaseModel):
|
| 570 |
+
type: Literal["tool_use"]
|
| 571 |
+
id: str
|
| 572 |
+
name: str
|
| 573 |
+
input: dict
|
| 574 |
+
provider_specific_fields: Optional[Dict[str, Any]] = None
|
| 575 |
+
|
| 576 |
+
model_config = ConfigDict(extra="allow") # Allow provider_specific_fields
|
| 577 |
+
|
| 578 |
+
|
| 579 |
+
class AnthropicResponseContentBlockThinking(BaseModel):
|
| 580 |
+
type: Literal["thinking"]
|
| 581 |
+
thinking: str
|
| 582 |
+
signature: Optional[str]
|
| 583 |
+
|
| 584 |
+
|
| 585 |
+
class AnthropicResponseContentBlockRedactedThinking(BaseModel):
|
| 586 |
+
type: Literal["redacted_thinking"]
|
| 587 |
+
data: str
|
| 588 |
+
|
| 589 |
+
|
| 590 |
+
class AnthropicResponseUsageBlock(BaseModel):
|
| 591 |
+
input_tokens: int
|
| 592 |
+
output_tokens: int
|
| 593 |
+
|
| 594 |
+
|
| 595 |
+
AnthropicFinishReason = Literal["end_turn", "max_tokens", "stop_sequence", "tool_use"]
|
| 596 |
+
|
| 597 |
+
|
| 598 |
+
class AnthropicResponse(BaseModel):
|
| 599 |
+
id: str
|
| 600 |
+
"""Unique object identifier."""
|
| 601 |
+
|
| 602 |
+
type: Literal["message"]
|
| 603 |
+
"""For Messages, this is always "message"."""
|
| 604 |
+
|
| 605 |
+
role: Literal["assistant"]
|
| 606 |
+
"""Conversational role of the generated message. This will always be "assistant"."""
|
| 607 |
+
|
| 608 |
+
content: List[
|
| 609 |
+
Union[
|
| 610 |
+
AnthropicResponseContentBlockText,
|
| 611 |
+
AnthropicResponseContentBlockToolUse,
|
| 612 |
+
AnthropicResponseContentBlockThinking,
|
| 613 |
+
AnthropicResponseContentBlockRedactedThinking,
|
| 614 |
+
]
|
| 615 |
+
]
|
| 616 |
+
"""Content generated by the model."""
|
| 617 |
+
|
| 618 |
+
model: str
|
| 619 |
+
"""The model that handled the request."""
|
| 620 |
+
|
| 621 |
+
stop_reason: Optional[AnthropicFinishReason]
|
| 622 |
+
"""The reason that we stopped."""
|
| 623 |
+
|
| 624 |
+
stop_sequence: Optional[str]
|
| 625 |
+
"""Which custom stop sequence was generated, if any."""
|
| 626 |
+
|
| 627 |
+
usage: AnthropicResponseUsageBlock
|
| 628 |
+
"""Billing and rate-limit usage."""
|
| 629 |
+
|
| 630 |
+
|
| 631 |
+
from .openai import ChatCompletionUsageBlock
|
| 632 |
+
|
| 633 |
+
|
| 634 |
+
class AnthropicChatCompletionUsageBlock(ChatCompletionUsageBlock, total=False):
|
| 635 |
+
cache_creation_input_tokens: int
|
| 636 |
+
cache_read_input_tokens: int
|
| 637 |
+
|
| 638 |
+
|
| 639 |
+
ANTHROPIC_API_HEADERS = {
|
| 640 |
+
"anthropic-version",
|
| 641 |
+
"anthropic-beta",
|
| 642 |
+
}
|
| 643 |
+
|
| 644 |
+
ANTHROPIC_API_ONLY_HEADERS = { # fails if calling anthropic on vertex ai / bedrock
|
| 645 |
+
"anthropic-beta",
|
| 646 |
+
}
|
| 647 |
+
|
| 648 |
+
|
| 649 |
+
class AnthropicThinkingParam(TypedDict, total=False):
|
| 650 |
+
type: Literal["enabled", "adaptive"]
|
| 651 |
+
budget_tokens: int
|
| 652 |
+
|
| 653 |
+
|
| 654 |
+
class ANTHROPIC_HOSTED_TOOLS(str, Enum):
|
| 655 |
+
WEB_SEARCH = "web_search"
|
| 656 |
+
BASH = "bash"
|
| 657 |
+
TEXT_EDITOR = "text_editor"
|
| 658 |
+
CODE_EXECUTION = "code_execution"
|
| 659 |
+
WEB_FETCH = "web_fetch"
|
| 660 |
+
MEMORY = "memory"
|
| 661 |
+
TOOL_SEARCH_TOOL = "tool_search_tool"
|
| 662 |
+
|
| 663 |
+
|
| 664 |
+
class ANTHROPIC_BETA_HEADER_VALUES(str, Enum):
|
| 665 |
+
"""
|
| 666 |
+
Known beta header values for Anthropic.
|
| 667 |
+
"""
|
| 668 |
+
|
| 669 |
+
WEB_FETCH_2025_09_10 = "web-fetch-2025-09-10"
|
| 670 |
+
WEB_SEARCH_2025_03_05 = "web-search-2025-03-05"
|
| 671 |
+
CONTEXT_MANAGEMENT_2025_06_27 = "context-management-2025-06-27"
|
| 672 |
+
COMPACT_2026_01_12 = "compact-2026-01-12"
|
| 673 |
+
STRUCTURED_OUTPUT_2025_09_25 = "structured-outputs-2025-11-13"
|
| 674 |
+
ADVANCED_TOOL_USE_2025_11_20 = "advanced-tool-use-2025-11-20"
|
| 675 |
+
FAST_MODE_2026_02_01 = "fast-mode-2026-02-01"
|
| 676 |
+
ADVISOR_TOOL_2026_03_01 = "advisor-tool-2026-03-01"
|
| 677 |
+
|
| 678 |
+
|
| 679 |
+
# Tool search beta header constant (for Anthropic direct API and Microsoft Foundry)
|
| 680 |
+
ANTHROPIC_TOOL_SEARCH_BETA_HEADER = "advanced-tool-use-2025-11-20"
|
| 681 |
+
|
| 682 |
+
# Effort beta header constant
|
| 683 |
+
ANTHROPIC_EFFORT_BETA_HEADER = "effort-2025-11-24"
|
| 684 |
+
|
| 685 |
+
# OAuth constants
|
| 686 |
+
ANTHROPIC_OAUTH_TOKEN_PREFIX = "sk-ant-oat"
|
| 687 |
+
ANTHROPIC_OAUTH_BETA_HEADER = "oauth-2025-04-20"
|
| 688 |
+
|
| 689 |
+
ANTHROPIC_PROMPT_CACHING_SCOPE_BETA_HEADER = "prompt-caching-scope-2026-01-05"
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_messages/anthropic_request.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Optional
|
| 2 |
+
|
| 3 |
+
from pydantic import BaseModel
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class AnthropicMetadata(BaseModel):
|
| 7 |
+
"""
|
| 8 |
+
Object with allowed fields for Anthropic API metadata
|
| 9 |
+
|
| 10 |
+
https://docs.anthropic.com/en/api/messages#body-metadata-user-id
|
| 11 |
+
"""
|
| 12 |
+
|
| 13 |
+
user_id: Optional[str] = None
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_messages/anthropic_response.py
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any, Dict, List, Literal, Optional, Union
|
| 2 |
+
|
| 3 |
+
from typing_extensions import TypeAlias, TypedDict
|
| 4 |
+
|
| 5 |
+
from litellm.types.llms.anthropic import (
|
| 6 |
+
AnthropicResponseContentBlockText,
|
| 7 |
+
AnthropicResponseContentBlockToolUse,
|
| 8 |
+
)
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class AnthropicResponseTextBlock(TypedDict, total=False):
|
| 12 |
+
"""
|
| 13 |
+
Anthropic Response Text Block: https://docs.anthropic.com/en/api/messages
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
+
citations: Optional[List[Dict[str, Any]]]
|
| 17 |
+
text: str
|
| 18 |
+
type: Literal["text"]
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
class AnthropicResponseToolUseBlock(TypedDict, total=False):
|
| 22 |
+
"""
|
| 23 |
+
Anthropic Response Tool Use Block: https://docs.anthropic.com/en/api/messages
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
id: Optional[str]
|
| 27 |
+
input: Optional[str]
|
| 28 |
+
name: Optional[str]
|
| 29 |
+
type: Literal["tool_use"]
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
class AnthropicResponseThinkingBlock(TypedDict, total=False):
|
| 33 |
+
"""
|
| 34 |
+
Anthropic Response Thinking Block: https://docs.anthropic.com/en/api/messages
|
| 35 |
+
"""
|
| 36 |
+
|
| 37 |
+
signature: Optional[str]
|
| 38 |
+
thinking: Optional[str]
|
| 39 |
+
type: Literal["thinking"]
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
class AnthropicResponseRedactedThinkingBlock(TypedDict, total=False):
|
| 43 |
+
"""
|
| 44 |
+
Anthropic Response Redacted Thinking Block: https://docs.anthropic.com/en/api/messages
|
| 45 |
+
"""
|
| 46 |
+
|
| 47 |
+
data: Optional[str]
|
| 48 |
+
type: Literal["redacted_thinking"]
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
AnthropicResponseContentBlock: TypeAlias = Union[
|
| 52 |
+
AnthropicResponseTextBlock,
|
| 53 |
+
AnthropicResponseToolUseBlock,
|
| 54 |
+
AnthropicResponseThinkingBlock,
|
| 55 |
+
AnthropicResponseRedactedThinkingBlock,
|
| 56 |
+
]
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
class AnthropicUsage(TypedDict, total=False):
|
| 60 |
+
"""
|
| 61 |
+
Input and output tokens used in the request
|
| 62 |
+
"""
|
| 63 |
+
|
| 64 |
+
input_tokens: int
|
| 65 |
+
output_tokens: int
|
| 66 |
+
|
| 67 |
+
"""
|
| 68 |
+
Cache Tokens Used
|
| 69 |
+
"""
|
| 70 |
+
cache_creation_input_tokens: int
|
| 71 |
+
cache_read_input_tokens: int
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
class AnthropicMessagesResponse(TypedDict, total=False):
|
| 75 |
+
"""
|
| 76 |
+
Anthropic Messages API Response: https://docs.anthropic.com/en/api/messages
|
| 77 |
+
"""
|
| 78 |
+
|
| 79 |
+
content: Optional[
|
| 80 |
+
List[
|
| 81 |
+
Union[
|
| 82 |
+
AnthropicResponseContentBlock,
|
| 83 |
+
AnthropicResponseContentBlockText,
|
| 84 |
+
AnthropicResponseContentBlockToolUse,
|
| 85 |
+
]
|
| 86 |
+
]
|
| 87 |
+
]
|
| 88 |
+
id: str
|
| 89 |
+
model: Optional[str] # This represents the Model type from Anthropic
|
| 90 |
+
role: Optional[Literal["assistant"]]
|
| 91 |
+
stop_reason: Optional[
|
| 92 |
+
Literal["end_turn", "max_tokens", "stop_sequence", "tool_use"]
|
| 93 |
+
]
|
| 94 |
+
stop_sequence: Optional[str]
|
| 95 |
+
type: Optional[Literal["message"]]
|
| 96 |
+
usage: Optional[AnthropicUsage]
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_skills.py
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Type definitions for Anthropic Skills API
|
| 3 |
+
"""
|
| 4 |
+
|
| 5 |
+
from typing import Any, Dict, List, Literal, Optional, Union
|
| 6 |
+
|
| 7 |
+
from pydantic import BaseModel, Field
|
| 8 |
+
from typing_extensions import Required, TypedDict
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
# Skills API Request Types
|
| 12 |
+
class CreateSkillRequest(TypedDict, total=False):
|
| 13 |
+
"""Request parameters for creating a skill"""
|
| 14 |
+
|
| 15 |
+
display_title: Optional[str]
|
| 16 |
+
"""Display title for the skill (optional)"""
|
| 17 |
+
|
| 18 |
+
files: Optional[List[Any]]
|
| 19 |
+
"""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."""
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class ListSkillsParams(TypedDict, total=False):
|
| 23 |
+
"""Query parameters for listing skills"""
|
| 24 |
+
|
| 25 |
+
limit: Optional[int]
|
| 26 |
+
"""Number of results to return per page. Maximum value is 100. Defaults to 20."""
|
| 27 |
+
|
| 28 |
+
page: Optional[str]
|
| 29 |
+
"""Pagination token for fetching a specific page of results"""
|
| 30 |
+
|
| 31 |
+
source: Optional[str]
|
| 32 |
+
"""Filter skills by source ('custom' or 'anthropic')"""
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
# Skills API Response Types
|
| 36 |
+
class Skill(BaseModel):
|
| 37 |
+
"""Represents a skill from the Anthropic Skills API"""
|
| 38 |
+
|
| 39 |
+
id: str
|
| 40 |
+
"""Unique identifier for the skill"""
|
| 41 |
+
|
| 42 |
+
created_at: str
|
| 43 |
+
"""ISO 8601 timestamp of when the skill was created"""
|
| 44 |
+
|
| 45 |
+
display_title: Optional[str] = None
|
| 46 |
+
"""Display title for the skill"""
|
| 47 |
+
|
| 48 |
+
latest_version: Optional[str] = None
|
| 49 |
+
"""The latest version identifier for the skill"""
|
| 50 |
+
|
| 51 |
+
source: str
|
| 52 |
+
"""Source of the skill (custom or anthropic)"""
|
| 53 |
+
|
| 54 |
+
type: str = "skill"
|
| 55 |
+
"""Object type, always 'skill'"""
|
| 56 |
+
|
| 57 |
+
updated_at: str
|
| 58 |
+
"""ISO 8601 timestamp of when the skill was last updated"""
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
class ListSkillsResponse(BaseModel):
|
| 62 |
+
"""Response from listing skills"""
|
| 63 |
+
|
| 64 |
+
data: List[Skill]
|
| 65 |
+
"""List of skills"""
|
| 66 |
+
|
| 67 |
+
next_page: Optional[str] = None
|
| 68 |
+
"""Pagination token for the next page"""
|
| 69 |
+
|
| 70 |
+
has_more: bool = False
|
| 71 |
+
"""Whether there are more skills available"""
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
class DeleteSkillResponse(BaseModel):
|
| 75 |
+
"""Response from deleting a skill"""
|
| 76 |
+
|
| 77 |
+
id: str
|
| 78 |
+
"""The ID of the deleted skill"""
|
| 79 |
+
|
| 80 |
+
type: str = "skill_deleted"
|
| 81 |
+
"""Deleted object type, always 'skill_deleted'"""
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
# Skill Version Types
|
| 85 |
+
class CreateSkillVersionRequest(TypedDict, total=False):
|
| 86 |
+
"""Request parameters for creating a skill version"""
|
| 87 |
+
|
| 88 |
+
display_title: Optional[str]
|
| 89 |
+
"""Display title for this version"""
|
| 90 |
+
|
| 91 |
+
description: Optional[str]
|
| 92 |
+
"""Description of this version"""
|
| 93 |
+
|
| 94 |
+
instructions: Optional[str]
|
| 95 |
+
"""Instructions for this version"""
|
| 96 |
+
|
| 97 |
+
metadata: Optional[Dict[str, Any]]
|
| 98 |
+
"""Additional metadata"""
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
class SkillVersion(BaseModel):
|
| 102 |
+
"""Represents a skill version"""
|
| 103 |
+
|
| 104 |
+
id: str
|
| 105 |
+
"""Unique identifier for the version"""
|
| 106 |
+
|
| 107 |
+
skill_id: str
|
| 108 |
+
"""ID of the parent skill"""
|
| 109 |
+
|
| 110 |
+
created_at: str
|
| 111 |
+
"""ISO 8601 timestamp of when the version was created"""
|
| 112 |
+
|
| 113 |
+
display_title: Optional[str] = None
|
| 114 |
+
"""Display title for this version"""
|
| 115 |
+
|
| 116 |
+
description: Optional[str] = None
|
| 117 |
+
"""Description of this version"""
|
| 118 |
+
|
| 119 |
+
instructions: Optional[str] = None
|
| 120 |
+
"""Instructions for this version"""
|
| 121 |
+
|
| 122 |
+
metadata: Optional[Dict[str, Any]] = None
|
| 123 |
+
"""Additional metadata"""
|
| 124 |
+
|
| 125 |
+
type: str = "skill.version"
|
| 126 |
+
"""Object type"""
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
class ListSkillVersionsResponse(BaseModel):
|
| 130 |
+
"""Response from listing skill versions"""
|
| 131 |
+
|
| 132 |
+
object: str = "list"
|
| 133 |
+
"""Object type, always 'list'"""
|
| 134 |
+
|
| 135 |
+
data: List[SkillVersion]
|
| 136 |
+
"""List of skill versions"""
|
| 137 |
+
|
| 138 |
+
first_id: Optional[str] = None
|
| 139 |
+
"""ID of the first version in the list"""
|
| 140 |
+
|
| 141 |
+
last_id: Optional[str] = None
|
| 142 |
+
"""ID of the last version in the list"""
|
| 143 |
+
|
| 144 |
+
has_more: bool = False
|
| 145 |
+
"""Whether there are more versions available"""
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
class DeleteSkillVersionResponse(BaseModel):
|
| 149 |
+
"""Response from deleting a skill version"""
|
| 150 |
+
|
| 151 |
+
id: str
|
| 152 |
+
"""The ID of the deleted version"""
|
| 153 |
+
|
| 154 |
+
object: str = "skill.version.deleted"
|
| 155 |
+
"""Object type"""
|
| 156 |
+
|
| 157 |
+
deleted: bool
|
| 158 |
+
"""Whether the version was successfully deleted"""
|
data/tefig/envs/olmes-eval/lib/python3.10/site-packages/litellm/types/llms/anthropic_tool_search.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Tool Search Beta Header Configuration
|
| 3 |
+
|
| 4 |
+
Reference: https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from typing import Dict
|
| 8 |
+
|
| 9 |
+
from litellm.types.utils import LlmProviders
|
| 10 |
+
|
| 11 |
+
# Tool search beta header values
|
| 12 |
+
TOOL_SEARCH_BETA_HEADER_ANTHROPIC = "advanced-tool-use-2025-11-20"
|
| 13 |
+
TOOL_SEARCH_BETA_HEADER_VERTEX = "tool-search-tool-2025-10-19"
|
| 14 |
+
TOOL_SEARCH_BETA_HEADER_BEDROCK = "tool-search-tool-2025-10-19"
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# Mapping of custom_llm_provider -> tool search beta header
|
| 18 |
+
TOOL_SEARCH_BETA_HEADER_BY_PROVIDER: Dict[str, str] = {
|
| 19 |
+
LlmProviders.ANTHROPIC.value: TOOL_SEARCH_BETA_HEADER_ANTHROPIC,
|
| 20 |
+
LlmProviders.AZURE.value: TOOL_SEARCH_BETA_HEADER_ANTHROPIC,
|
| 21 |
+
LlmProviders.AZURE_AI.value: TOOL_SEARCH_BETA_HEADER_ANTHROPIC,
|
| 22 |
+
LlmProviders.VERTEX_AI.value: TOOL_SEARCH_BETA_HEADER_VERTEX,
|
| 23 |
+
LlmProviders.VERTEX_AI_BETA.value: TOOL_SEARCH_BETA_HEADER_VERTEX,
|
| 24 |
+
LlmProviders.BEDROCK.value: TOOL_SEARCH_BETA_HEADER_BEDROCK,
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def get_tool_search_beta_header(custom_llm_provider: str) -> str:
|
| 29 |
+
"""
|
| 30 |
+
Get the tool search beta header for a given provider.
|
| 31 |
+
"""
|
| 32 |
+
return TOOL_SEARCH_BETA_HEADER_BY_PROVIDER.get(
|
| 33 |
+
custom_llm_provider, TOOL_SEARCH_BETA_HEADER_ANTHROPIC
|
| 34 |
+
)
|