mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 15:48:29 +00:00
* supporting thinking for anthropic models * drop comments here * thinking and tool calling support * fix: properly mock tool use and text block types in Anthropic tests - Updated the test for the Anthropic tool use conversation flow to include type attributes for mocked ToolUseBlock and text blocks, ensuring accurate simulation of tool interactions during testing. * feat: add AnthropicThinkingConfig for enhanced thinking capabilities This update introduces the AnthropicThinkingConfig class to manage thinking parameters for the Anthropic completion model. The LLM and AnthropicCompletion classes have been updated to utilize this new configuration. Additionally, new test cassettes have been added to validate the functionality of thinking blocks across interactions.
220 lines
7.0 KiB
YAML
220 lines
7.0 KiB
YAML
interactions:
|
|
- request:
|
|
body: '{"max_tokens":4096,"messages":[{"role":"user","content":"What is the weather
|
|
in Tokyo? Use the get_weather tool."}],"model":"claude-sonnet-4-5","stream":false,"tools":[{"name":"get_weather","description":"Get
|
|
the current weather in a given location","input_schema":{"type":"object","properties":{"location":{"type":"string","description":"The
|
|
city and state, e.g. San Francisco, CA"},"unit":{"type":"string","enum":["celsius","fahrenheit"],"description":"The
|
|
unit of temperature"}},"required":["location"]}}]}'
|
|
headers:
|
|
accept:
|
|
- application/json
|
|
accept-encoding:
|
|
- gzip, deflate, zstd
|
|
anthropic-version:
|
|
- '2023-06-01'
|
|
connection:
|
|
- keep-alive
|
|
content-length:
|
|
- '509'
|
|
content-type:
|
|
- application/json
|
|
host:
|
|
- api.anthropic.com
|
|
user-agent:
|
|
- Anthropic/Python 0.71.0
|
|
x-stainless-arch:
|
|
- arm64
|
|
x-stainless-async:
|
|
- 'false'
|
|
x-stainless-lang:
|
|
- python
|
|
x-stainless-os:
|
|
- MacOS
|
|
x-stainless-package-version:
|
|
- 0.71.0
|
|
x-stainless-retry-count:
|
|
- '0'
|
|
x-stainless-runtime:
|
|
- CPython
|
|
x-stainless-runtime-version:
|
|
- 3.13.3
|
|
x-stainless-timeout:
|
|
- NOT_GIVEN
|
|
method: POST
|
|
uri: https://api.anthropic.com/v1/messages
|
|
response:
|
|
body:
|
|
string: !!binary |
|
|
H4sIAAAAAAAAA3SQzU7DMBCE32XPjpQEUqhviCKkcmn5qVQhZBlnSaI6drDXlDbKuyMHFQqI4843
|
|
s6PdHlpbogYOSstQYuKtMUjJaVIkeZoX6TSfAoOmBA6tr0SaPSwXLrt7uZ6vFup9ttpfLCd0WwED
|
|
2nUYXei9rBAYOKujIL1vPElDwEBZQ2gI+GN/8JO1WgSPh5Y4B5FmV/a52p5Xs9nkBqv1fJ81u/Xl
|
|
GTAwso25CklsUVKNLkZNFwh4D9oqSY01wOHebnYWhuGJgSfbCYfSj+CocgQeXwMahcBN0JpBGA/g
|
|
/edWQXaDxgOf5CkDJVWNQjkcW8RPxxd3KMv/2CEbC7CrsUUntSjav/5vmtW/6cDABjqWihMGHt1b
|
|
o1BQgw44xLeX0pUwDB8AAAD//wMA6heqv+kBAAA=
|
|
headers:
|
|
CF-RAY:
|
|
- 9a4c0d75ba3d6800-SJC
|
|
Connection:
|
|
- keep-alive
|
|
Content-Encoding:
|
|
- gzip
|
|
Content-Type:
|
|
- application/json
|
|
Date:
|
|
- Wed, 26 Nov 2025 20:14:34 GMT
|
|
Server:
|
|
- cloudflare
|
|
Transfer-Encoding:
|
|
- chunked
|
|
X-Robots-Tag:
|
|
- none
|
|
anthropic-organization-id:
|
|
- 32982f3d-354e-4063-a1d9-6e3e0361bcfe
|
|
anthropic-ratelimit-input-tokens-limit:
|
|
- '30000'
|
|
anthropic-ratelimit-input-tokens-remaining:
|
|
- '30000'
|
|
anthropic-ratelimit-input-tokens-reset:
|
|
- '2025-11-26T20:14:33Z'
|
|
anthropic-ratelimit-output-tokens-limit:
|
|
- '8000'
|
|
anthropic-ratelimit-output-tokens-remaining:
|
|
- '8000'
|
|
anthropic-ratelimit-output-tokens-reset:
|
|
- '2025-11-26T20:14:34Z'
|
|
anthropic-ratelimit-requests-limit:
|
|
- '50'
|
|
anthropic-ratelimit-requests-remaining:
|
|
- '49'
|
|
anthropic-ratelimit-requests-reset:
|
|
- '2025-11-26T20:14:32Z'
|
|
anthropic-ratelimit-tokens-limit:
|
|
- '38000'
|
|
anthropic-ratelimit-tokens-remaining:
|
|
- '38000'
|
|
anthropic-ratelimit-tokens-reset:
|
|
- '2025-11-26T20:14:33Z'
|
|
cf-cache-status:
|
|
- DYNAMIC
|
|
request-id:
|
|
- req_011CVX7YqtSMhTjqLnjZvaj1
|
|
retry-after:
|
|
- '28'
|
|
strict-transport-security:
|
|
- max-age=31536000; includeSubDomains; preload
|
|
x-envoy-upstream-service-time:
|
|
- '2874'
|
|
status:
|
|
code: 200
|
|
message: OK
|
|
- request:
|
|
body: "{\"max_tokens\":4096,\"messages\":[{\"role\":\"user\",\"content\":\"What
|
|
is the weather in Tokyo? Use the get_weather tool.\"},{\"role\":\"assistant\",\"content\":[{\"type\":\"tool_use\",\"id\":\"toolu_01Eobgw8gDD6KegYJz1iyYC7\",\"name\":\"get_weather\",\"input\":{\"location\":\"Tokyo\"}}]},{\"role\":\"user\",\"content\":[{\"type\":\"tool_result\",\"tool_use_id\":\"toolu_01Eobgw8gDD6KegYJz1iyYC7\",\"content\":\"The
|
|
weather in Tokyo is sunny and 72\xB0F\"}]}],\"model\":\"claude-sonnet-4-5\",\"stream\":false,\"tools\":[{\"name\":\"get_weather\",\"description\":\"Get
|
|
the current weather in a given location\",\"input_schema\":{\"type\":\"object\",\"properties\":{\"location\":{\"type\":\"string\",\"description\":\"The
|
|
city and state, e.g. San Francisco, CA\"},\"unit\":{\"type\":\"string\",\"enum\":[\"celsius\",\"fahrenheit\"],\"description\":\"The
|
|
unit of temperature\"}},\"required\":[\"location\"]}}]}"
|
|
headers:
|
|
accept:
|
|
- application/json
|
|
accept-encoding:
|
|
- gzip, deflate, zstd
|
|
anthropic-version:
|
|
- '2023-06-01'
|
|
connection:
|
|
- keep-alive
|
|
content-length:
|
|
- '800'
|
|
content-type:
|
|
- application/json
|
|
host:
|
|
- api.anthropic.com
|
|
user-agent:
|
|
- Anthropic/Python 0.71.0
|
|
x-stainless-arch:
|
|
- arm64
|
|
x-stainless-async:
|
|
- 'false'
|
|
x-stainless-lang:
|
|
- python
|
|
x-stainless-os:
|
|
- MacOS
|
|
x-stainless-package-version:
|
|
- 0.71.0
|
|
x-stainless-retry-count:
|
|
- '0'
|
|
x-stainless-runtime:
|
|
- CPython
|
|
x-stainless-runtime-version:
|
|
- 3.13.3
|
|
x-stainless-timeout:
|
|
- NOT_GIVEN
|
|
method: POST
|
|
uri: https://api.anthropic.com/v1/messages
|
|
response:
|
|
body:
|
|
string: !!binary |
|
|
H4sIAAAAAAAAA3SQTWrDMBBGryJm1YJcHNE0RMsGktLu2mxKKUZYQ6zGHjnSqIkJvlPOkJMVh4b+
|
|
0dXA994ww7eHxlusQUNZm2Qxi54IObvOxpnK1TifqilIcBY0NHFV5KO5fWsebv32WW0XT/d3oxnu
|
|
HhcbkMBdi4OFMZoVgoTg6yEwMbrIhhgklJ4YiUG/7M8+424gp6FhWaHYouEKg3Akln7deeGiKFMI
|
|
SFx3IiaiThiyYqKOh7m4MG0b/M41hrHuhFLHw+zyCvpXCZF9WwQ00RNoQLIFp0DwCSJuElKJoCnV
|
|
tYR0elvvwVGbuGC/Roqgb6YTCaUpKyzKgIadp+KnkZ95QGP/Y+fd4QC2FTYYTF2Mm7/+Fx1Vv2kv
|
|
wSf+HiklIWJ4dyUW7DCAhqFsa4KFvv8AAAD//wMANWIHid8BAAA=
|
|
headers:
|
|
CF-RAY:
|
|
- 9a4c0d886f9e6800-SJC
|
|
Connection:
|
|
- keep-alive
|
|
Content-Encoding:
|
|
- gzip
|
|
Content-Type:
|
|
- application/json
|
|
Date:
|
|
- Wed, 26 Nov 2025 20:14:36 GMT
|
|
Server:
|
|
- cloudflare
|
|
Transfer-Encoding:
|
|
- chunked
|
|
X-Robots-Tag:
|
|
- none
|
|
anthropic-organization-id:
|
|
- 32982f3d-354e-4063-a1d9-6e3e0361bcfe
|
|
anthropic-ratelimit-input-tokens-limit:
|
|
- '30000'
|
|
anthropic-ratelimit-input-tokens-remaining:
|
|
- '30000'
|
|
anthropic-ratelimit-input-tokens-reset:
|
|
- '2025-11-26T20:14:36Z'
|
|
anthropic-ratelimit-output-tokens-limit:
|
|
- '8000'
|
|
anthropic-ratelimit-output-tokens-remaining:
|
|
- '8000'
|
|
anthropic-ratelimit-output-tokens-reset:
|
|
- '2025-11-26T20:14:36Z'
|
|
anthropic-ratelimit-requests-limit:
|
|
- '50'
|
|
anthropic-ratelimit-requests-remaining:
|
|
- '49'
|
|
anthropic-ratelimit-requests-reset:
|
|
- '2025-11-26T20:14:35Z'
|
|
anthropic-ratelimit-tokens-limit:
|
|
- '38000'
|
|
anthropic-ratelimit-tokens-remaining:
|
|
- '38000'
|
|
anthropic-ratelimit-tokens-reset:
|
|
- '2025-11-26T20:14:36Z'
|
|
cf-cache-status:
|
|
- DYNAMIC
|
|
request-id:
|
|
- req_011CVX7Z4is92Sz8oA63UNxC
|
|
retry-after:
|
|
- '26'
|
|
strict-transport-security:
|
|
- max-age=31536000; includeSubDomains; preload
|
|
x-envoy-upstream-service-time:
|
|
- '2240'
|
|
status:
|
|
code: 200
|
|
message: OK
|
|
version: 1
|