coco-framework 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- coco/__init__.py +3 -0
- coco/agents/__init__.py +9 -0
- coco/agents/_subagent_transformer.py +307 -0
- coco/agents/factory.py +2164 -0
- coco/agents/middleware/__init__.py +100 -0
- coco/agents/middleware/_execution.py +385 -0
- coco/agents/middleware/_redaction.py +454 -0
- coco/agents/middleware/_retry.py +134 -0
- coco/agents/middleware/_trace_policy.py +61 -0
- coco/agents/middleware/context_editing.py +306 -0
- coco/agents/middleware/file_search.py +433 -0
- coco/agents/middleware/human_in_the_loop.py +680 -0
- coco/agents/middleware/internal_call_transformer.py +108 -0
- coco/agents/middleware/model_call_limit.py +267 -0
- coco/agents/middleware/model_fallback.py +417 -0
- coco/agents/middleware/model_retry.py +327 -0
- coco/agents/middleware/pii.py +878 -0
- coco/agents/middleware/provider_tool_search.py +307 -0
- coco/agents/middleware/shell_tool.py +949 -0
- coco/agents/middleware/summarization.py +910 -0
- coco/agents/middleware/todo.py +357 -0
- coco/agents/middleware/tool_call_limit.py +495 -0
- coco/agents/middleware/tool_emulator.py +251 -0
- coco/agents/middleware/tool_error.py +209 -0
- coco/agents/middleware/tool_retry.py +421 -0
- coco/agents/middleware/tool_selection.py +515 -0
- coco/agents/middleware/types.py +2201 -0
- coco/agents/structured_output.py +472 -0
- coco/chat_models/__init__.py +7 -0
- coco/chat_models/base.py +1082 -0
- coco/embeddings/__init__.py +18 -0
- coco/embeddings/base.py +279 -0
- coco/mcp/__init__.py +36 -0
- coco/mcp/adapter.py +245 -0
- coco/mcp/elicitation.py +394 -0
- coco/mcp/tools.py +307 -0
- coco/messages/__init__.py +73 -0
- coco/py.typed +0 -0
- coco/rate_limiters/__init__.py +13 -0
- coco/tools/__init__.py +22 -0
- coco/tools/tool_node.py +20 -0
- coco_anthropic/__init__.py +15 -0
- coco_anthropic/_client_utils.py +81 -0
- coco_anthropic/_compat.py +228 -0
- coco_anthropic/_sdk_compat.py +124 -0
- coco_anthropic/_version.py +3 -0
- coco_anthropic/chat_models.py +3349 -0
- coco_anthropic/data/__init__.py +1 -0
- coco_anthropic/data/_profiles.py +491 -0
- coco_anthropic/data/profile_augmentations.toml +69 -0
- coco_anthropic/experimental.py +140 -0
- coco_anthropic/llms.py +428 -0
- coco_anthropic/middleware/__init__.py +25 -0
- coco_anthropic/middleware/anthropic_tools.py +1197 -0
- coco_anthropic/middleware/bash.py +84 -0
- coco_anthropic/middleware/file_search.py +360 -0
- coco_anthropic/middleware/prompt_caching.py +276 -0
- coco_anthropic/output_parsers.py +93 -0
- coco_anthropic/py.typed +0 -0
- coco_core/__init__.py +20 -0
- coco_core/_api/__init__.py +87 -0
- coco_core/_api/beta_decorator.py +266 -0
- coco_core/_api/deprecation.py +637 -0
- coco_core/_api/internal.py +23 -0
- coco_core/_api/path.py +50 -0
- coco_core/_import_utils.py +41 -0
- coco_core/_protocol.py +625 -0
- coco_core/_security/__init__.py +36 -0
- coco_core/_security/_exceptions.py +9 -0
- coco_core/_security/_policy.py +313 -0
- coco_core/_security/_ssrf_protection.py +155 -0
- coco_core/_security/_transport.py +254 -0
- coco_core/agents.py +258 -0
- coco_core/caches.py +272 -0
- coco_core/callbacks/__init__.py +132 -0
- coco_core/callbacks/base.py +1229 -0
- coco_core/callbacks/file.py +266 -0
- coco_core/callbacks/manager.py +2826 -0
- coco_core/callbacks/stdout.py +123 -0
- coco_core/callbacks/streaming_stdout.py +154 -0
- coco_core/callbacks/usage.py +124 -0
- coco_core/chat_history.py +267 -0
- coco_core/chat_loaders.py +26 -0
- coco_core/chat_sessions.py +19 -0
- coco_core/cross_encoders.py +18 -0
- coco_core/document_loaders/__init__.py +36 -0
- coco_core/document_loaders/base.py +155 -0
- coco_core/document_loaders/blob_loaders.py +38 -0
- coco_core/documents/__init__.py +55 -0
- coco_core/documents/base.py +347 -0
- coco_core/documents/compressor.py +74 -0
- coco_core/documents/transformers.py +79 -0
- coco_core/embeddings/__init__.py +31 -0
- coco_core/embeddings/embeddings.py +78 -0
- coco_core/embeddings/fake.py +129 -0
- coco_core/env.py +22 -0
- coco_core/example_selectors/__init__.py +47 -0
- coco_core/example_selectors/base.py +60 -0
- coco_core/example_selectors/length_based.py +131 -0
- coco_core/example_selectors/semantic_similarity.py +366 -0
- coco_core/exceptions.py +166 -0
- coco_core/globals.py +72 -0
- coco_core/indexing/__init__.py +53 -0
- coco_core/indexing/api.py +954 -0
- coco_core/indexing/base.py +661 -0
- coco_core/indexing/in_memory.py +104 -0
- coco_core/language_models/__init__.py +116 -0
- coco_core/language_models/_compat_bridge.py +844 -0
- coco_core/language_models/_utils.py +343 -0
- coco_core/language_models/base.py +500 -0
- coco_core/language_models/chat_model_stream.py +1525 -0
- coco_core/language_models/chat_models.py +2748 -0
- coco_core/language_models/fake.py +137 -0
- coco_core/language_models/fake_chat_models.py +396 -0
- coco_core/language_models/llms.py +1569 -0
- coco_core/language_models/model_profile.py +183 -0
- coco_core/load/__init__.py +44 -0
- coco_core/load/_validation.py +191 -0
- coco_core/load/dump.py +120 -0
- coco_core/load/load.py +828 -0
- coco_core/load/mapping.py +1097 -0
- coco_core/load/serializable.py +406 -0
- coco_core/messages/__init__.py +198 -0
- coco_core/messages/ai.py +854 -0
- coco_core/messages/base.py +518 -0
- coco_core/messages/block_translators/__init__.py +112 -0
- coco_core/messages/block_translators/anthropic.py +534 -0
- coco_core/messages/block_translators/bedrock.py +108 -0
- coco_core/messages/block_translators/bedrock_converse.py +329 -0
- coco_core/messages/block_translators/coco_v0.py +303 -0
- coco_core/messages/block_translators/google_genai.py +610 -0
- coco_core/messages/block_translators/google_vertexai.py +21 -0
- coco_core/messages/block_translators/groq.py +157 -0
- coco_core/messages/block_translators/openai.py +1089 -0
- coco_core/messages/chat.py +64 -0
- coco_core/messages/content.py +1488 -0
- coco_core/messages/function.py +62 -0
- coco_core/messages/human.py +70 -0
- coco_core/messages/modifier.py +33 -0
- coco_core/messages/system.py +70 -0
- coco_core/messages/tool.py +418 -0
- coco_core/messages/utils.py +2442 -0
- coco_core/output_parsers/__init__.py +101 -0
- coco_core/output_parsers/base.py +361 -0
- coco_core/output_parsers/format_instructions.py +16 -0
- coco_core/output_parsers/json.py +139 -0
- coco_core/output_parsers/list.py +249 -0
- coco_core/output_parsers/openai_functions.py +324 -0
- coco_core/output_parsers/openai_tools.py +383 -0
- coco_core/output_parsers/pydantic.py +141 -0
- coco_core/output_parsers/string.py +63 -0
- coco_core/output_parsers/transform.py +175 -0
- coco_core/output_parsers/xml.py +301 -0
- coco_core/outputs/__init__.py +66 -0
- coco_core/outputs/chat_generation.py +147 -0
- coco_core/outputs/chat_result.py +39 -0
- coco_core/outputs/generation.py +80 -0
- coco_core/outputs/llm_result.py +112 -0
- coco_core/outputs/run_info.py +22 -0
- coco_core/prompt_values.py +161 -0
- coco_core/prompts/__init__.py +101 -0
- coco_core/prompts/base.py +508 -0
- coco_core/prompts/chat.py +1495 -0
- coco_core/prompts/dict.py +177 -0
- coco_core/prompts/few_shot.py +483 -0
- coco_core/prompts/few_shot_with_templates.py +239 -0
- coco_core/prompts/image.py +177 -0
- coco_core/prompts/loading.py +296 -0
- coco_core/prompts/message.py +97 -0
- coco_core/prompts/prompt.py +312 -0
- coco_core/prompts/string.py +399 -0
- coco_core/prompts/structured.py +214 -0
- coco_core/py.typed +0 -0
- coco_core/rate_limiters.py +254 -0
- coco_core/retrievers.py +328 -0
- coco_core/runnables/__init__.py +136 -0
- coco_core/runnables/base.py +6725 -0
- coco_core/runnables/branch.py +457 -0
- coco_core/runnables/config.py +712 -0
- coco_core/runnables/configurable.py +710 -0
- coco_core/runnables/fallbacks.py +663 -0
- coco_core/runnables/graph.py +741 -0
- coco_core/runnables/graph_ascii.py +366 -0
- coco_core/runnables/graph_mermaid.py +503 -0
- coco_core/runnables/graph_png.py +215 -0
- coco_core/runnables/history.py +631 -0
- coco_core/runnables/passthrough.py +849 -0
- coco_core/runnables/retry.py +379 -0
- coco_core/runnables/router.py +239 -0
- coco_core/runnables/schema.py +188 -0
- coco_core/runnables/utils.py +798 -0
- coco_core/stores.py +291 -0
- coco_core/structured_query.py +203 -0
- coco_core/sys_info.py +154 -0
- coco_core/tools/__init__.py +95 -0
- coco_core/tools/base.py +1948 -0
- coco_core/tools/convert.py +497 -0
- coco_core/tools/render.py +67 -0
- coco_core/tools/retriever.py +94 -0
- coco_core/tools/simple.py +208 -0
- coco_core/tools/structured.py +322 -0
- coco_core/tracers/__init__.py +47 -0
- coco_core/tracers/_compat.py +95 -0
- coco_core/tracers/_context.py +337 -0
- coco_core/tracers/_streaming.py +53 -0
- coco_core/tracers/base.py +955 -0
- coco_core/tracers/coco.py +279 -0
- coco_core/tracers/context.py +205 -0
- coco_core/tracers/core.py +766 -0
- coco_core/tracers/event_stream.py +1101 -0
- coco_core/tracers/log_stream.py +765 -0
- coco_core/tracers/memory_stream.py +200 -0
- coco_core/tracers/root_listeners.py +130 -0
- coco_core/tracers/run_collector.py +40 -0
- coco_core/tracers/schemas.py +14 -0
- coco_core/tracers/stdout.py +205 -0
- coco_core/utils/__init__.py +111 -0
- coco_core/utils/_gateway.py +274 -0
- coco_core/utils/_merge.py +218 -0
- coco_core/utils/aiter.py +357 -0
- coco_core/utils/env.py +86 -0
- coco_core/utils/formatting.py +80 -0
- coco_core/utils/function_calling.py +869 -0
- coco_core/utils/html.py +132 -0
- coco_core/utils/image.py +15 -0
- coco_core/utils/input.py +82 -0
- coco_core/utils/interactive_env.py +12 -0
- coco_core/utils/iter.py +229 -0
- coco_core/utils/json.py +230 -0
- coco_core/utils/json_schema.py +273 -0
- coco_core/utils/mustache.py +706 -0
- coco_core/utils/pydantic.py +631 -0
- coco_core/utils/strings.py +69 -0
- coco_core/utils/usage.py +61 -0
- coco_core/utils/utils.py +528 -0
- coco_core/utils/uuid.py +57 -0
- coco_core/vectorstores/__init__.py +53 -0
- coco_core/vectorstores/base.py +1111 -0
- coco_core/vectorstores/in_memory.py +546 -0
- coco_core/vectorstores/utils.py +163 -0
- coco_core/version.py +3 -0
- coco_framework-0.1.0.dist-info/METADATA +184 -0
- coco_framework-0.1.0.dist-info/RECORD +400 -0
- coco_framework-0.1.0.dist-info/WHEEL +4 -0
- coco_framework-0.1.0.dist-info/licenses/LICENSE +24 -0
- coco_framework-0.1.0.dist-info/licenses/NOTICE +15 -0
- coco_graph/_internal/__init__.py +4 -0
- coco_graph/_internal/_cache.py +31 -0
- coco_graph/_internal/_config.py +474 -0
- coco_graph/_internal/_constants.py +140 -0
- coco_graph/_internal/_fields.py +213 -0
- coco_graph/_internal/_future.py +220 -0
- coco_graph/_internal/_pydantic.py +275 -0
- coco_graph/_internal/_queue.py +124 -0
- coco_graph/_internal/_replay.py +90 -0
- coco_graph/_internal/_retry.py +29 -0
- coco_graph/_internal/_runnable.py +969 -0
- coco_graph/_internal/_scratchpad.py +19 -0
- coco_graph/_internal/_serde.py +253 -0
- coco_graph/_internal/_timeout.py +25 -0
- coco_graph/_internal/_typing.py +54 -0
- coco_graph/cache/base/__init__.py +48 -0
- coco_graph/cache/base/py.typed +0 -0
- coco_graph/cache/memory/__init__.py +73 -0
- coco_graph/cache/redis/__init__.py +144 -0
- coco_graph/cache/sqlite/__init__.py +120 -0
- coco_graph/callbacks.py +394 -0
- coco_graph/channels/__init__.py +29 -0
- coco_graph/channels/any_value.py +72 -0
- coco_graph/channels/base.py +121 -0
- coco_graph/channels/binop.py +155 -0
- coco_graph/channels/delta.py +202 -0
- coco_graph/channels/ephemeral_value.py +79 -0
- coco_graph/channels/last_value.py +151 -0
- coco_graph/channels/named_barrier_value.py +167 -0
- coco_graph/channels/topic.py +94 -0
- coco_graph/channels/untracked_value.py +73 -0
- coco_graph/checkpoint/base/__init__.py +861 -0
- coco_graph/checkpoint/base/id.py +109 -0
- coco_graph/checkpoint/base/py.typed +0 -0
- coco_graph/checkpoint/memory/__init__.py +698 -0
- coco_graph/checkpoint/memory/py.typed +0 -0
- coco_graph/checkpoint/postgres/__init__.py +602 -0
- coco_graph/checkpoint/postgres/_ainternal.py +23 -0
- coco_graph/checkpoint/postgres/_internal.py +21 -0
- coco_graph/checkpoint/postgres/aio.py +691 -0
- coco_graph/checkpoint/postgres/base.py +666 -0
- coco_graph/checkpoint/postgres/py.typed +0 -0
- coco_graph/checkpoint/postgres/shallow.py +967 -0
- coco_graph/checkpoint/serde/__init__.py +0 -0
- coco_graph/checkpoint/serde/_msgpack.py +97 -0
- coco_graph/checkpoint/serde/base.py +64 -0
- coco_graph/checkpoint/serde/encrypted.py +80 -0
- coco_graph/checkpoint/serde/event_hooks.py +52 -0
- coco_graph/checkpoint/serde/jsonplus.py +883 -0
- coco_graph/checkpoint/serde/py.typed +0 -0
- coco_graph/checkpoint/serde/types.py +68 -0
- coco_graph/checkpoint/sqlite/__init__.py +645 -0
- coco_graph/checkpoint/sqlite/_delta.py +172 -0
- coco_graph/checkpoint/sqlite/aio.py +738 -0
- coco_graph/checkpoint/sqlite/py.typed +0 -0
- coco_graph/checkpoint/sqlite/utils.py +116 -0
- coco_graph/config.py +196 -0
- coco_graph/constants.py +64 -0
- coco_graph/errors.py +241 -0
- coco_graph/func/__init__.py +620 -0
- coco_graph/graph/__init__.py +12 -0
- coco_graph/graph/_branch.py +225 -0
- coco_graph/graph/_node.py +103 -0
- coco_graph/graph/message.py +437 -0
- coco_graph/graph/state.py +1978 -0
- coco_graph/graph/ui.py +227 -0
- coco_graph/managed/__init__.py +3 -0
- coco_graph/managed/base.py +31 -0
- coco_graph/managed/is_last_step.py +24 -0
- coco_graph/prebuilt/__init__.py +23 -0
- coco_graph/prebuilt/_tool_call_stream.py +117 -0
- coco_graph/prebuilt/_tool_call_transformer.py +165 -0
- coco_graph/prebuilt/chat_agent_executor.py +1015 -0
- coco_graph/prebuilt/interrupt.py +105 -0
- coco_graph/prebuilt/py.typed +0 -0
- coco_graph/prebuilt/tool_node.py +2030 -0
- coco_graph/prebuilt/tool_validator.py +221 -0
- coco_graph/pregel/__init__.py +3 -0
- coco_graph/pregel/_algo.py +1460 -0
- coco_graph/pregel/_call.py +298 -0
- coco_graph/pregel/_checkpoint.py +331 -0
- coco_graph/pregel/_config.py +0 -0
- coco_graph/pregel/_draw.py +294 -0
- coco_graph/pregel/_executor.py +223 -0
- coco_graph/pregel/_io.py +174 -0
- coco_graph/pregel/_log.py +3 -0
- coco_graph/pregel/_loop.py +1988 -0
- coco_graph/pregel/_messages.py +461 -0
- coco_graph/pregel/_read.py +312 -0
- coco_graph/pregel/_retry.py +854 -0
- coco_graph/pregel/_runner.py +941 -0
- coco_graph/pregel/_tools.py +268 -0
- coco_graph/pregel/_utils.py +221 -0
- coco_graph/pregel/_validate.py +120 -0
- coco_graph/pregel/_write.py +192 -0
- coco_graph/pregel/debug.py +302 -0
- coco_graph/pregel/main.py +4364 -0
- coco_graph/pregel/protocol.py +288 -0
- coco_graph/pregel/types.py +38 -0
- coco_graph/py.typed +0 -0
- coco_graph/runtime.py +350 -0
- coco_graph/store/base/__init__.py +1322 -0
- coco_graph/store/base/batch.py +371 -0
- coco_graph/store/base/embed.py +436 -0
- coco_graph/store/base/py.typed +0 -0
- coco_graph/store/memory/__init__.py +592 -0
- coco_graph/store/memory/py.typed +0 -0
- coco_graph/store/postgres/__init__.py +4 -0
- coco_graph/store/postgres/aio.py +592 -0
- coco_graph/store/postgres/base.py +1480 -0
- coco_graph/store/postgres/py.typed +0 -0
- coco_graph/store/sqlite/__init__.py +4 -0
- coco_graph/store/sqlite/aio.py +632 -0
- coco_graph/store/sqlite/base.py +1514 -0
- coco_graph/stream/__init__.py +45 -0
- coco_graph/stream/_convert.py +32 -0
- coco_graph/stream/_mux.py +523 -0
- coco_graph/stream/_types.py +330 -0
- coco_graph/stream/run_stream.py +735 -0
- coco_graph/stream/stream_channel.py +341 -0
- coco_graph/stream/transformers.py +1039 -0
- coco_graph/types.py +1079 -0
- coco_graph/typing.py +48 -0
- coco_graph/utils/__init__.py +1 -0
- coco_graph/utils/config.py +4 -0
- coco_graph/utils/runnable.py +3 -0
- coco_graph/version.py +13 -0
- coco_graph/warnings.py +69 -0
- coco_openai/__init__.py +20 -0
- coco_openai/_compat.py +45 -0
- coco_openai/_version.py +3 -0
- coco_openai/chat_models/__init__.py +6 -0
- coco_openai/chat_models/_client_utils.py +684 -0
- coco_openai/chat_models/_compat.py +525 -0
- coco_openai/chat_models/azure.py +1227 -0
- coco_openai/chat_models/base.py +5654 -0
- coco_openai/chat_models/codex.py +557 -0
- coco_openai/chatgpt_oauth.py +1063 -0
- coco_openai/data/__init__.py +1 -0
- coco_openai/data/_profiles.py +1655 -0
- coco_openai/data/profile_augmentations.toml +127 -0
- coco_openai/embeddings/__init__.py +6 -0
- coco_openai/embeddings/azure.py +240 -0
- coco_openai/embeddings/base.py +820 -0
- coco_openai/llms/__init__.py +6 -0
- coco_openai/llms/azure.py +249 -0
- coco_openai/llms/base.py +919 -0
- coco_openai/middleware/__init__.py +11 -0
- coco_openai/middleware/openai_moderation.py +484 -0
- coco_openai/output_parsers/__init__.py +9 -0
- coco_openai/output_parsers/tools.py +9 -0
- coco_openai/py.typed +0 -0
- coco_openai/tools/__init__.py +5 -0
- coco_openai/tools/custom_tool.py +111 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Model profile data. All edits should be made in profile_augmentations.toml."""
|
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
"""Auto-generated model profiles.
|
|
2
|
+
|
|
3
|
+
DO NOT EDIT THIS FILE MANUALLY.
|
|
4
|
+
This file is generated by the trustcoco-profiles CLI tool.
|
|
5
|
+
|
|
6
|
+
It contains data derived from the models.dev project.
|
|
7
|
+
|
|
8
|
+
Source: https://github.com/sst/models.dev
|
|
9
|
+
License: MIT License
|
|
10
|
+
|
|
11
|
+
To update these data, refer to the instructions here:
|
|
12
|
+
|
|
13
|
+
https://docs.langchain.com/oss/python/langchain/models#updating-or-overwriting-profile-data
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from typing import Any
|
|
17
|
+
|
|
18
|
+
_PROFILES: dict[str, dict[str, Any]] = {
|
|
19
|
+
"claude-fable-5": {
|
|
20
|
+
"name": "Claude Fable 5",
|
|
21
|
+
"release_date": "2026-06-07",
|
|
22
|
+
"last_updated": "2026-06-09",
|
|
23
|
+
"open_weights": False,
|
|
24
|
+
"max_input_tokens": 1000000,
|
|
25
|
+
"max_output_tokens": 128000,
|
|
26
|
+
"text_inputs": True,
|
|
27
|
+
"image_inputs": True,
|
|
28
|
+
"audio_inputs": False,
|
|
29
|
+
"pdf_inputs": True,
|
|
30
|
+
"video_inputs": False,
|
|
31
|
+
"text_outputs": True,
|
|
32
|
+
"image_outputs": False,
|
|
33
|
+
"audio_outputs": False,
|
|
34
|
+
"video_outputs": False,
|
|
35
|
+
"reasoning_output": True,
|
|
36
|
+
"tool_calling": True,
|
|
37
|
+
"structured_output": True,
|
|
38
|
+
"attachment": True,
|
|
39
|
+
"temperature": False,
|
|
40
|
+
"image_url_inputs": True,
|
|
41
|
+
"pdf_tool_message": True,
|
|
42
|
+
"image_tool_message": True,
|
|
43
|
+
"tool_call_streaming": True,
|
|
44
|
+
"reasoning_effort_levels": [
|
|
45
|
+
"low",
|
|
46
|
+
"medium",
|
|
47
|
+
"high",
|
|
48
|
+
"xhigh",
|
|
49
|
+
"max",
|
|
50
|
+
],
|
|
51
|
+
"reasoning_effort_default": "high",
|
|
52
|
+
},
|
|
53
|
+
"claude-fable-5-1": {
|
|
54
|
+
"name": "Claude Fable 5.1",
|
|
55
|
+
"release_date": "2026-09-01",
|
|
56
|
+
"last_updated": "2026-09-01",
|
|
57
|
+
"open_weights": False,
|
|
58
|
+
"max_input_tokens": 1000000,
|
|
59
|
+
"max_output_tokens": 128000,
|
|
60
|
+
"text_inputs": True,
|
|
61
|
+
"image_inputs": True,
|
|
62
|
+
"audio_inputs": False,
|
|
63
|
+
"pdf_inputs": True,
|
|
64
|
+
"video_inputs": False,
|
|
65
|
+
"text_outputs": True,
|
|
66
|
+
"image_outputs": False,
|
|
67
|
+
"audio_outputs": False,
|
|
68
|
+
"video_outputs": False,
|
|
69
|
+
"reasoning_output": True,
|
|
70
|
+
"tool_calling": True,
|
|
71
|
+
"structured_output": True,
|
|
72
|
+
"attachment": True,
|
|
73
|
+
"temperature": False,
|
|
74
|
+
"image_url_inputs": True,
|
|
75
|
+
"pdf_tool_message": True,
|
|
76
|
+
"image_tool_message": True,
|
|
77
|
+
"tool_call_streaming": True,
|
|
78
|
+
"reasoning_effort_levels": [
|
|
79
|
+
"low",
|
|
80
|
+
"medium",
|
|
81
|
+
"high",
|
|
82
|
+
"xhigh",
|
|
83
|
+
"max",
|
|
84
|
+
],
|
|
85
|
+
"reasoning_effort_default": "high",
|
|
86
|
+
},
|
|
87
|
+
"claude-haiku-4-5": {
|
|
88
|
+
"name": "Claude Haiku 4.5 (latest)",
|
|
89
|
+
"release_date": "2025-10-15",
|
|
90
|
+
"last_updated": "2025-10-15",
|
|
91
|
+
"open_weights": False,
|
|
92
|
+
"max_input_tokens": 200000,
|
|
93
|
+
"max_output_tokens": 64000,
|
|
94
|
+
"text_inputs": True,
|
|
95
|
+
"image_inputs": True,
|
|
96
|
+
"audio_inputs": False,
|
|
97
|
+
"pdf_inputs": True,
|
|
98
|
+
"video_inputs": False,
|
|
99
|
+
"text_outputs": True,
|
|
100
|
+
"image_outputs": False,
|
|
101
|
+
"audio_outputs": False,
|
|
102
|
+
"video_outputs": False,
|
|
103
|
+
"reasoning_output": True,
|
|
104
|
+
"tool_calling": True,
|
|
105
|
+
"structured_output": True,
|
|
106
|
+
"attachment": True,
|
|
107
|
+
"temperature": True,
|
|
108
|
+
"image_url_inputs": True,
|
|
109
|
+
"pdf_tool_message": True,
|
|
110
|
+
"image_tool_message": True,
|
|
111
|
+
"tool_call_streaming": True,
|
|
112
|
+
},
|
|
113
|
+
"claude-haiku-4-5-20251001": {
|
|
114
|
+
"name": "Claude Haiku 4.5",
|
|
115
|
+
"release_date": "2025-10-15",
|
|
116
|
+
"last_updated": "2025-10-15",
|
|
117
|
+
"open_weights": False,
|
|
118
|
+
"max_input_tokens": 200000,
|
|
119
|
+
"max_output_tokens": 64000,
|
|
120
|
+
"text_inputs": True,
|
|
121
|
+
"image_inputs": True,
|
|
122
|
+
"audio_inputs": False,
|
|
123
|
+
"pdf_inputs": True,
|
|
124
|
+
"video_inputs": False,
|
|
125
|
+
"text_outputs": True,
|
|
126
|
+
"image_outputs": False,
|
|
127
|
+
"audio_outputs": False,
|
|
128
|
+
"video_outputs": False,
|
|
129
|
+
"reasoning_output": True,
|
|
130
|
+
"tool_calling": True,
|
|
131
|
+
"structured_output": False,
|
|
132
|
+
"attachment": True,
|
|
133
|
+
"temperature": True,
|
|
134
|
+
"image_url_inputs": True,
|
|
135
|
+
"pdf_tool_message": True,
|
|
136
|
+
"image_tool_message": True,
|
|
137
|
+
"tool_call_streaming": True,
|
|
138
|
+
},
|
|
139
|
+
"claude-opus-4-5": {
|
|
140
|
+
"name": "Claude Opus 4.5 (latest)",
|
|
141
|
+
"release_date": "2025-11-24",
|
|
142
|
+
"last_updated": "2025-11-24",
|
|
143
|
+
"open_weights": False,
|
|
144
|
+
"max_input_tokens": 200000,
|
|
145
|
+
"max_output_tokens": 64000,
|
|
146
|
+
"text_inputs": True,
|
|
147
|
+
"image_inputs": True,
|
|
148
|
+
"audio_inputs": False,
|
|
149
|
+
"pdf_inputs": True,
|
|
150
|
+
"video_inputs": False,
|
|
151
|
+
"text_outputs": True,
|
|
152
|
+
"image_outputs": False,
|
|
153
|
+
"audio_outputs": False,
|
|
154
|
+
"video_outputs": False,
|
|
155
|
+
"reasoning_output": True,
|
|
156
|
+
"tool_calling": True,
|
|
157
|
+
"structured_output": True,
|
|
158
|
+
"attachment": True,
|
|
159
|
+
"temperature": True,
|
|
160
|
+
"image_url_inputs": True,
|
|
161
|
+
"pdf_tool_message": True,
|
|
162
|
+
"image_tool_message": True,
|
|
163
|
+
"tool_call_streaming": True,
|
|
164
|
+
"reasoning_effort_levels": [
|
|
165
|
+
"low",
|
|
166
|
+
"medium",
|
|
167
|
+
"high",
|
|
168
|
+
],
|
|
169
|
+
"reasoning_effort_default": "high",
|
|
170
|
+
},
|
|
171
|
+
"claude-opus-4-5-20251101": {
|
|
172
|
+
"name": "Claude Opus 4.5",
|
|
173
|
+
"release_date": "2025-11-24",
|
|
174
|
+
"last_updated": "2025-11-01",
|
|
175
|
+
"open_weights": False,
|
|
176
|
+
"max_input_tokens": 200000,
|
|
177
|
+
"max_output_tokens": 64000,
|
|
178
|
+
"text_inputs": True,
|
|
179
|
+
"image_inputs": True,
|
|
180
|
+
"audio_inputs": False,
|
|
181
|
+
"pdf_inputs": True,
|
|
182
|
+
"video_inputs": False,
|
|
183
|
+
"text_outputs": True,
|
|
184
|
+
"image_outputs": False,
|
|
185
|
+
"audio_outputs": False,
|
|
186
|
+
"video_outputs": False,
|
|
187
|
+
"reasoning_output": True,
|
|
188
|
+
"tool_calling": True,
|
|
189
|
+
"structured_output": False,
|
|
190
|
+
"attachment": True,
|
|
191
|
+
"temperature": True,
|
|
192
|
+
"image_url_inputs": True,
|
|
193
|
+
"pdf_tool_message": True,
|
|
194
|
+
"image_tool_message": True,
|
|
195
|
+
"tool_call_streaming": True,
|
|
196
|
+
"reasoning_effort_levels": [
|
|
197
|
+
"low",
|
|
198
|
+
"medium",
|
|
199
|
+
"high",
|
|
200
|
+
],
|
|
201
|
+
"reasoning_effort_default": "high",
|
|
202
|
+
},
|
|
203
|
+
"claude-opus-4-6": {
|
|
204
|
+
"name": "Claude Opus 4.6",
|
|
205
|
+
"release_date": "2026-02-04",
|
|
206
|
+
"last_updated": "2026-03-13",
|
|
207
|
+
"open_weights": False,
|
|
208
|
+
"max_input_tokens": 1000000,
|
|
209
|
+
"max_output_tokens": 128000,
|
|
210
|
+
"text_inputs": True,
|
|
211
|
+
"image_inputs": True,
|
|
212
|
+
"audio_inputs": False,
|
|
213
|
+
"pdf_inputs": True,
|
|
214
|
+
"video_inputs": False,
|
|
215
|
+
"text_outputs": True,
|
|
216
|
+
"image_outputs": False,
|
|
217
|
+
"audio_outputs": False,
|
|
218
|
+
"video_outputs": False,
|
|
219
|
+
"reasoning_output": True,
|
|
220
|
+
"tool_calling": True,
|
|
221
|
+
"structured_output": True,
|
|
222
|
+
"attachment": True,
|
|
223
|
+
"temperature": True,
|
|
224
|
+
"image_url_inputs": True,
|
|
225
|
+
"pdf_tool_message": True,
|
|
226
|
+
"image_tool_message": True,
|
|
227
|
+
"tool_call_streaming": True,
|
|
228
|
+
"reasoning_effort_levels": [
|
|
229
|
+
"low",
|
|
230
|
+
"medium",
|
|
231
|
+
"high",
|
|
232
|
+
"max",
|
|
233
|
+
],
|
|
234
|
+
"reasoning_effort_default": "high",
|
|
235
|
+
},
|
|
236
|
+
"claude-opus-4-7": {
|
|
237
|
+
"name": "Claude Opus 4.7",
|
|
238
|
+
"release_date": "2026-04-14",
|
|
239
|
+
"last_updated": "2026-04-16",
|
|
240
|
+
"open_weights": False,
|
|
241
|
+
"max_input_tokens": 1000000,
|
|
242
|
+
"max_output_tokens": 128000,
|
|
243
|
+
"text_inputs": True,
|
|
244
|
+
"image_inputs": True,
|
|
245
|
+
"audio_inputs": False,
|
|
246
|
+
"pdf_inputs": True,
|
|
247
|
+
"video_inputs": False,
|
|
248
|
+
"text_outputs": True,
|
|
249
|
+
"image_outputs": False,
|
|
250
|
+
"audio_outputs": False,
|
|
251
|
+
"video_outputs": False,
|
|
252
|
+
"reasoning_output": True,
|
|
253
|
+
"tool_calling": True,
|
|
254
|
+
"structured_output": True,
|
|
255
|
+
"attachment": True,
|
|
256
|
+
"temperature": False,
|
|
257
|
+
"image_url_inputs": True,
|
|
258
|
+
"pdf_tool_message": True,
|
|
259
|
+
"image_tool_message": True,
|
|
260
|
+
"tool_call_streaming": True,
|
|
261
|
+
"reasoning_effort_levels": [
|
|
262
|
+
"low",
|
|
263
|
+
"medium",
|
|
264
|
+
"high",
|
|
265
|
+
"xhigh",
|
|
266
|
+
"max",
|
|
267
|
+
],
|
|
268
|
+
"reasoning_effort_default": "high",
|
|
269
|
+
},
|
|
270
|
+
"claude-opus-4-8": {
|
|
271
|
+
"name": "Claude Opus 4.8",
|
|
272
|
+
"release_date": "2026-05-28",
|
|
273
|
+
"last_updated": "2026-05-28",
|
|
274
|
+
"open_weights": False,
|
|
275
|
+
"max_input_tokens": 1000000,
|
|
276
|
+
"max_output_tokens": 128000,
|
|
277
|
+
"text_inputs": True,
|
|
278
|
+
"image_inputs": True,
|
|
279
|
+
"audio_inputs": False,
|
|
280
|
+
"pdf_inputs": True,
|
|
281
|
+
"video_inputs": False,
|
|
282
|
+
"text_outputs": True,
|
|
283
|
+
"image_outputs": False,
|
|
284
|
+
"audio_outputs": False,
|
|
285
|
+
"video_outputs": False,
|
|
286
|
+
"reasoning_output": True,
|
|
287
|
+
"tool_calling": True,
|
|
288
|
+
"structured_output": True,
|
|
289
|
+
"attachment": True,
|
|
290
|
+
"temperature": False,
|
|
291
|
+
"image_url_inputs": True,
|
|
292
|
+
"pdf_tool_message": True,
|
|
293
|
+
"image_tool_message": True,
|
|
294
|
+
"tool_call_streaming": True,
|
|
295
|
+
"reasoning_effort_levels": [
|
|
296
|
+
"low",
|
|
297
|
+
"medium",
|
|
298
|
+
"high",
|
|
299
|
+
"xhigh",
|
|
300
|
+
"max",
|
|
301
|
+
],
|
|
302
|
+
"reasoning_effort_default": "high",
|
|
303
|
+
},
|
|
304
|
+
"claude-opus-5": {
|
|
305
|
+
"name": "Claude Opus 5",
|
|
306
|
+
"release_date": "2026-07-24",
|
|
307
|
+
"last_updated": "2026-07-24",
|
|
308
|
+
"open_weights": False,
|
|
309
|
+
"max_input_tokens": 1000000,
|
|
310
|
+
"max_output_tokens": 128000,
|
|
311
|
+
"text_inputs": True,
|
|
312
|
+
"image_inputs": True,
|
|
313
|
+
"audio_inputs": False,
|
|
314
|
+
"pdf_inputs": True,
|
|
315
|
+
"video_inputs": False,
|
|
316
|
+
"text_outputs": True,
|
|
317
|
+
"image_outputs": False,
|
|
318
|
+
"audio_outputs": False,
|
|
319
|
+
"video_outputs": False,
|
|
320
|
+
"reasoning_output": True,
|
|
321
|
+
"tool_calling": True,
|
|
322
|
+
"structured_output": True,
|
|
323
|
+
"attachment": True,
|
|
324
|
+
"temperature": False,
|
|
325
|
+
"image_url_inputs": True,
|
|
326
|
+
"pdf_tool_message": True,
|
|
327
|
+
"image_tool_message": True,
|
|
328
|
+
"tool_call_streaming": True,
|
|
329
|
+
"reasoning_effort_levels": [
|
|
330
|
+
"low",
|
|
331
|
+
"medium",
|
|
332
|
+
"high",
|
|
333
|
+
"xhigh",
|
|
334
|
+
"max",
|
|
335
|
+
],
|
|
336
|
+
"reasoning_effort_default": "high",
|
|
337
|
+
},
|
|
338
|
+
"claude-opus-5-5": {
|
|
339
|
+
"name": "Claude Opus 5.5",
|
|
340
|
+
"release_date": "2026-09-22",
|
|
341
|
+
"last_updated": "2026-09-22",
|
|
342
|
+
"open_weights": False,
|
|
343
|
+
"max_input_tokens": 1000000,
|
|
344
|
+
"max_output_tokens": 128000,
|
|
345
|
+
"text_inputs": True,
|
|
346
|
+
"image_inputs": True,
|
|
347
|
+
"audio_inputs": False,
|
|
348
|
+
"pdf_inputs": True,
|
|
349
|
+
"video_inputs": False,
|
|
350
|
+
"text_outputs": True,
|
|
351
|
+
"image_outputs": False,
|
|
352
|
+
"audio_outputs": False,
|
|
353
|
+
"video_outputs": False,
|
|
354
|
+
"reasoning_output": True,
|
|
355
|
+
"tool_calling": True,
|
|
356
|
+
"structured_output": True,
|
|
357
|
+
"attachment": True,
|
|
358
|
+
"temperature": False,
|
|
359
|
+
"image_url_inputs": True,
|
|
360
|
+
"pdf_tool_message": True,
|
|
361
|
+
"image_tool_message": True,
|
|
362
|
+
"tool_call_streaming": True,
|
|
363
|
+
"reasoning_effort_levels": [
|
|
364
|
+
"low",
|
|
365
|
+
"medium",
|
|
366
|
+
"high",
|
|
367
|
+
"xhigh",
|
|
368
|
+
"max",
|
|
369
|
+
],
|
|
370
|
+
"reasoning_effort_default": "medium",
|
|
371
|
+
},
|
|
372
|
+
"claude-sonnet-4-5": {
|
|
373
|
+
"name": "Claude Sonnet 4.5 (latest)",
|
|
374
|
+
"release_date": "2025-09-29",
|
|
375
|
+
"last_updated": "2025-09-29",
|
|
376
|
+
"open_weights": False,
|
|
377
|
+
"max_input_tokens": 1000000,
|
|
378
|
+
"max_output_tokens": 64000,
|
|
379
|
+
"text_inputs": True,
|
|
380
|
+
"image_inputs": True,
|
|
381
|
+
"audio_inputs": False,
|
|
382
|
+
"pdf_inputs": True,
|
|
383
|
+
"video_inputs": False,
|
|
384
|
+
"text_outputs": True,
|
|
385
|
+
"image_outputs": False,
|
|
386
|
+
"audio_outputs": False,
|
|
387
|
+
"video_outputs": False,
|
|
388
|
+
"reasoning_output": True,
|
|
389
|
+
"tool_calling": True,
|
|
390
|
+
"structured_output": True,
|
|
391
|
+
"attachment": True,
|
|
392
|
+
"temperature": True,
|
|
393
|
+
"image_url_inputs": True,
|
|
394
|
+
"pdf_tool_message": True,
|
|
395
|
+
"image_tool_message": True,
|
|
396
|
+
"tool_call_streaming": True,
|
|
397
|
+
},
|
|
398
|
+
"claude-sonnet-4-5-20250929": {
|
|
399
|
+
"name": "Claude Sonnet 4.5",
|
|
400
|
+
"release_date": "2025-09-29",
|
|
401
|
+
"last_updated": "2025-09-29",
|
|
402
|
+
"open_weights": False,
|
|
403
|
+
"max_input_tokens": 1000000,
|
|
404
|
+
"max_output_tokens": 64000,
|
|
405
|
+
"text_inputs": True,
|
|
406
|
+
"image_inputs": True,
|
|
407
|
+
"audio_inputs": False,
|
|
408
|
+
"pdf_inputs": True,
|
|
409
|
+
"video_inputs": False,
|
|
410
|
+
"text_outputs": True,
|
|
411
|
+
"image_outputs": False,
|
|
412
|
+
"audio_outputs": False,
|
|
413
|
+
"video_outputs": False,
|
|
414
|
+
"reasoning_output": True,
|
|
415
|
+
"tool_calling": True,
|
|
416
|
+
"structured_output": False,
|
|
417
|
+
"attachment": True,
|
|
418
|
+
"temperature": True,
|
|
419
|
+
"image_url_inputs": True,
|
|
420
|
+
"pdf_tool_message": True,
|
|
421
|
+
"image_tool_message": True,
|
|
422
|
+
"tool_call_streaming": True,
|
|
423
|
+
},
|
|
424
|
+
"claude-sonnet-4-6": {
|
|
425
|
+
"name": "Claude Sonnet 4.6",
|
|
426
|
+
"release_date": "2026-02-17",
|
|
427
|
+
"last_updated": "2026-03-13",
|
|
428
|
+
"open_weights": False,
|
|
429
|
+
"max_input_tokens": 1000000,
|
|
430
|
+
"max_output_tokens": 128000,
|
|
431
|
+
"text_inputs": True,
|
|
432
|
+
"image_inputs": True,
|
|
433
|
+
"audio_inputs": False,
|
|
434
|
+
"pdf_inputs": True,
|
|
435
|
+
"video_inputs": False,
|
|
436
|
+
"text_outputs": True,
|
|
437
|
+
"image_outputs": False,
|
|
438
|
+
"audio_outputs": False,
|
|
439
|
+
"video_outputs": False,
|
|
440
|
+
"reasoning_output": True,
|
|
441
|
+
"tool_calling": True,
|
|
442
|
+
"structured_output": True,
|
|
443
|
+
"attachment": True,
|
|
444
|
+
"temperature": True,
|
|
445
|
+
"image_url_inputs": True,
|
|
446
|
+
"pdf_tool_message": True,
|
|
447
|
+
"image_tool_message": True,
|
|
448
|
+
"tool_call_streaming": True,
|
|
449
|
+
"reasoning_effort_levels": [
|
|
450
|
+
"low",
|
|
451
|
+
"medium",
|
|
452
|
+
"high",
|
|
453
|
+
"max",
|
|
454
|
+
],
|
|
455
|
+
"reasoning_effort_default": "high",
|
|
456
|
+
},
|
|
457
|
+
"claude-sonnet-5": {
|
|
458
|
+
"name": "Claude Sonnet 5",
|
|
459
|
+
"release_date": "2026-06-29",
|
|
460
|
+
"last_updated": "2026-06-30",
|
|
461
|
+
"open_weights": False,
|
|
462
|
+
"max_input_tokens": 1000000,
|
|
463
|
+
"max_output_tokens": 128000,
|
|
464
|
+
"text_inputs": True,
|
|
465
|
+
"image_inputs": True,
|
|
466
|
+
"audio_inputs": False,
|
|
467
|
+
"pdf_inputs": True,
|
|
468
|
+
"video_inputs": False,
|
|
469
|
+
"text_outputs": True,
|
|
470
|
+
"image_outputs": False,
|
|
471
|
+
"audio_outputs": False,
|
|
472
|
+
"video_outputs": False,
|
|
473
|
+
"reasoning_output": True,
|
|
474
|
+
"tool_calling": True,
|
|
475
|
+
"structured_output": True,
|
|
476
|
+
"attachment": True,
|
|
477
|
+
"temperature": False,
|
|
478
|
+
"image_url_inputs": True,
|
|
479
|
+
"pdf_tool_message": True,
|
|
480
|
+
"image_tool_message": True,
|
|
481
|
+
"tool_call_streaming": True,
|
|
482
|
+
"reasoning_effort_levels": [
|
|
483
|
+
"low",
|
|
484
|
+
"medium",
|
|
485
|
+
"high",
|
|
486
|
+
"xhigh",
|
|
487
|
+
"max",
|
|
488
|
+
],
|
|
489
|
+
"reasoning_effort_default": "high",
|
|
490
|
+
},
|
|
491
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
provider = "anthropic"
|
|
2
|
+
|
|
3
|
+
[overrides]
|
|
4
|
+
image_url_inputs = true
|
|
5
|
+
pdf_inputs = true
|
|
6
|
+
pdf_tool_message = true
|
|
7
|
+
image_tool_message = true
|
|
8
|
+
structured_output = false
|
|
9
|
+
tool_call_streaming = true
|
|
10
|
+
|
|
11
|
+
[overrides."claude-haiku-4-5"]
|
|
12
|
+
structured_output = true
|
|
13
|
+
|
|
14
|
+
[overrides."claude-sonnet-4-5"]
|
|
15
|
+
structured_output = true
|
|
16
|
+
|
|
17
|
+
[overrides."claude-sonnet-4-6"]
|
|
18
|
+
structured_output = true
|
|
19
|
+
reasoning_effort_levels = ["low", "medium", "high", "max"]
|
|
20
|
+
reasoning_effort_default = "high"
|
|
21
|
+
|
|
22
|
+
[overrides."claude-opus-4-5"]
|
|
23
|
+
structured_output = true
|
|
24
|
+
reasoning_effort_levels = ["low", "medium", "high"]
|
|
25
|
+
reasoning_effort_default = "high"
|
|
26
|
+
|
|
27
|
+
[overrides."claude-opus-4-5-20251101"]
|
|
28
|
+
reasoning_effort_levels = ["low", "medium", "high"]
|
|
29
|
+
reasoning_effort_default = "high"
|
|
30
|
+
|
|
31
|
+
[overrides."claude-opus-4-6"]
|
|
32
|
+
structured_output = true
|
|
33
|
+
reasoning_effort_levels = ["low", "medium", "high", "max"]
|
|
34
|
+
reasoning_effort_default = "high"
|
|
35
|
+
|
|
36
|
+
[overrides."claude-opus-4-7"]
|
|
37
|
+
structured_output = true
|
|
38
|
+
reasoning_effort_levels = ["low", "medium", "high", "xhigh", "max"]
|
|
39
|
+
reasoning_effort_default = "high"
|
|
40
|
+
|
|
41
|
+
[overrides."claude-opus-4-8"]
|
|
42
|
+
structured_output = true
|
|
43
|
+
reasoning_effort_levels = ["low", "medium", "high", "xhigh", "max"]
|
|
44
|
+
reasoning_effort_default = "high"
|
|
45
|
+
|
|
46
|
+
[overrides."claude-opus-5"]
|
|
47
|
+
structured_output = true
|
|
48
|
+
reasoning_effort_levels = ["low", "medium", "high", "xhigh", "max"]
|
|
49
|
+
reasoning_effort_default = "high"
|
|
50
|
+
|
|
51
|
+
[overrides."claude-opus-5-5"]
|
|
52
|
+
structured_output = true
|
|
53
|
+
reasoning_effort_levels = ["low", "medium", "high", "xhigh", "max"]
|
|
54
|
+
reasoning_effort_default = "medium"
|
|
55
|
+
|
|
56
|
+
[overrides."claude-sonnet-5"]
|
|
57
|
+
structured_output = true
|
|
58
|
+
reasoning_effort_levels = ["low", "medium", "high", "xhigh", "max"]
|
|
59
|
+
reasoning_effort_default = "high"
|
|
60
|
+
|
|
61
|
+
[overrides."claude-fable-5"]
|
|
62
|
+
structured_output = true
|
|
63
|
+
reasoning_effort_levels = ["low", "medium", "high", "xhigh", "max"]
|
|
64
|
+
reasoning_effort_default = "high"
|
|
65
|
+
|
|
66
|
+
[overrides."claude-fable-5-1"]
|
|
67
|
+
structured_output = true
|
|
68
|
+
reasoning_effort_levels = ["low", "medium", "high", "xhigh", "max"]
|
|
69
|
+
reasoning_effort_default = "high"
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"""Experimental tool-calling support for Anthropic chat models."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
from typing import (
|
|
7
|
+
Any,
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
SYSTEM_PROMPT_FORMAT = """In this environment you have access to a set of tools you can use to answer the user's question.
|
|
11
|
+
|
|
12
|
+
You may call them like this:
|
|
13
|
+
<function_calls>
|
|
14
|
+
<invoke>
|
|
15
|
+
<tool_name>$TOOL_NAME</tool_name>
|
|
16
|
+
<parameters>
|
|
17
|
+
<$PARAMETER_NAME>$PARAMETER_VALUE</$PARAMETER_NAME>
|
|
18
|
+
...
|
|
19
|
+
</parameters>
|
|
20
|
+
</invoke>
|
|
21
|
+
</function_calls>
|
|
22
|
+
|
|
23
|
+
Here are the tools available:
|
|
24
|
+
<tools>
|
|
25
|
+
{formatted_tools}
|
|
26
|
+
</tools>""" # noqa: E501
|
|
27
|
+
|
|
28
|
+
TOOL_FORMAT = """<tool_description>
|
|
29
|
+
<tool_name>{tool_name}</tool_name>
|
|
30
|
+
<description>{tool_description}</description>
|
|
31
|
+
<parameters>
|
|
32
|
+
{formatted_parameters}
|
|
33
|
+
</parameters>
|
|
34
|
+
</tool_description>"""
|
|
35
|
+
|
|
36
|
+
TOOL_PARAMETER_FORMAT = """<parameter>
|
|
37
|
+
<name>{parameter_name}</name>
|
|
38
|
+
<type>{parameter_type}</type>
|
|
39
|
+
<description>{parameter_description}</description>
|
|
40
|
+
</parameter>"""
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _get_type(parameter: dict[str, Any]) -> str:
|
|
44
|
+
if "type" in parameter:
|
|
45
|
+
return parameter["type"]
|
|
46
|
+
if "anyOf" in parameter:
|
|
47
|
+
return json.dumps({"anyOf": parameter["anyOf"]})
|
|
48
|
+
if "allOf" in parameter:
|
|
49
|
+
return json.dumps({"allOf": parameter["allOf"]})
|
|
50
|
+
return json.dumps(parameter)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def get_system_message(tools: list[dict]) -> str:
|
|
54
|
+
"""Generate a system message that describes the available tools."""
|
|
55
|
+
tools_data: list[dict] = [
|
|
56
|
+
{
|
|
57
|
+
"tool_name": tool["name"],
|
|
58
|
+
"tool_description": tool["description"],
|
|
59
|
+
"formatted_parameters": "\n".join(
|
|
60
|
+
[
|
|
61
|
+
TOOL_PARAMETER_FORMAT.format(
|
|
62
|
+
parameter_name=name,
|
|
63
|
+
parameter_type=_get_type(parameter),
|
|
64
|
+
parameter_description=parameter.get("description"),
|
|
65
|
+
)
|
|
66
|
+
for name, parameter in tool["parameters"]["properties"].items()
|
|
67
|
+
],
|
|
68
|
+
),
|
|
69
|
+
}
|
|
70
|
+
for tool in tools
|
|
71
|
+
]
|
|
72
|
+
tools_formatted = "\n".join(
|
|
73
|
+
[
|
|
74
|
+
TOOL_FORMAT.format(
|
|
75
|
+
tool_name=tool["tool_name"],
|
|
76
|
+
tool_description=tool["tool_description"],
|
|
77
|
+
formatted_parameters=tool["formatted_parameters"],
|
|
78
|
+
)
|
|
79
|
+
for tool in tools_data
|
|
80
|
+
],
|
|
81
|
+
)
|
|
82
|
+
return SYSTEM_PROMPT_FORMAT.format(formatted_tools=tools_formatted)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def _xml_to_dict(t: Any) -> str | dict[str, Any]:
|
|
86
|
+
# Base case: If the element has no children, return its text or an empty string.
|
|
87
|
+
if len(t) == 0:
|
|
88
|
+
return t.text or ""
|
|
89
|
+
|
|
90
|
+
# Recursive case: The element has children. Convert them into a dictionary.
|
|
91
|
+
d: dict[str, Any] = {}
|
|
92
|
+
for child in t:
|
|
93
|
+
if child.tag not in d:
|
|
94
|
+
d[child.tag] = _xml_to_dict(child)
|
|
95
|
+
else:
|
|
96
|
+
# Handle multiple children with the same tag
|
|
97
|
+
if not isinstance(d[child.tag], list):
|
|
98
|
+
d[child.tag] = [d[child.tag]] # Convert existing entry into a list
|
|
99
|
+
d[child.tag].append(_xml_to_dict(child))
|
|
100
|
+
return d
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def _xml_to_function_call(invoke: Any, tools: list[dict]) -> dict[str, Any]:
|
|
104
|
+
name = invoke.find("tool_name").text
|
|
105
|
+
arguments = _xml_to_dict(invoke.find("parameters"))
|
|
106
|
+
|
|
107
|
+
# make list elements in arguments actually lists
|
|
108
|
+
filtered_tools = [tool for tool in tools if tool["name"] == name]
|
|
109
|
+
if len(filtered_tools) > 0 and not isinstance(arguments, str):
|
|
110
|
+
tool = filtered_tools[0]
|
|
111
|
+
for key, value in arguments.items():
|
|
112
|
+
if (
|
|
113
|
+
key in tool["parameters"]["properties"]
|
|
114
|
+
and "type" in tool["parameters"]["properties"][key]
|
|
115
|
+
):
|
|
116
|
+
if tool["parameters"]["properties"][key][
|
|
117
|
+
"type"
|
|
118
|
+
] == "array" and not isinstance(value, list):
|
|
119
|
+
arguments[key] = [value]
|
|
120
|
+
if (
|
|
121
|
+
tool["parameters"]["properties"][key]["type"] != "object"
|
|
122
|
+
and isinstance(value, dict)
|
|
123
|
+
and len(value.keys()) == 1
|
|
124
|
+
):
|
|
125
|
+
arguments[key] = next(iter(value.values()))
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
"function": {
|
|
129
|
+
"name": name,
|
|
130
|
+
"arguments": json.dumps(arguments),
|
|
131
|
+
},
|
|
132
|
+
"type": "function",
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def _xml_to_tool_calls(elem: Any, tools: list[dict]) -> list[dict[str, Any]]:
|
|
137
|
+
"""Convert an XML element and its children into a dictionary of dictionaries."""
|
|
138
|
+
invokes = elem.findall("invoke")
|
|
139
|
+
|
|
140
|
+
return [_xml_to_function_call(invoke, tools) for invoke in invokes]
|