mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-12 20:48:15 +00:00
added tests
This commit is contained in:
@@ -675,23 +675,6 @@ class AnthropicCompletion(BaseLLM):
|
||||
usage = self._extract_anthropic_token_usage(response)
|
||||
self._track_token_usage_internal(usage)
|
||||
|
||||
if "tools" in params and response.content:
|
||||
tool_uses = [
|
||||
block
|
||||
for block in response.content
|
||||
if isinstance(block, (ToolUseBlock, BetaToolUseBlock))
|
||||
]
|
||||
if tool_uses:
|
||||
if not available_functions:
|
||||
self._emit_call_completed_event(
|
||||
response=list(tool_uses),
|
||||
call_type=LLMCallType.TOOL_CALL,
|
||||
from_task=from_task,
|
||||
from_agent=from_agent,
|
||||
messages=params["messages"],
|
||||
)
|
||||
return list(tool_uses)
|
||||
|
||||
if _is_pydantic_model_class(response_model) and response.content:
|
||||
if use_native_structured_output:
|
||||
for block in response.content:
|
||||
@@ -708,7 +691,7 @@ class AnthropicCompletion(BaseLLM):
|
||||
else:
|
||||
for block in response.content:
|
||||
if (
|
||||
isinstance(block, ToolUseBlock)
|
||||
isinstance(block, (ToolUseBlock, BetaToolUseBlock))
|
||||
and block.name == "structured_output"
|
||||
):
|
||||
structured_data = response_model.model_validate(block.input)
|
||||
@@ -721,6 +704,23 @@ class AnthropicCompletion(BaseLLM):
|
||||
)
|
||||
return structured_data
|
||||
|
||||
if "tools" in params and response.content:
|
||||
tool_uses = [
|
||||
block
|
||||
for block in response.content
|
||||
if isinstance(block, (ToolUseBlock, BetaToolUseBlock))
|
||||
]
|
||||
if tool_uses:
|
||||
if not available_functions:
|
||||
self._emit_call_completed_event(
|
||||
response=list(tool_uses),
|
||||
call_type=LLMCallType.TOOL_CALL,
|
||||
from_task=from_task,
|
||||
from_agent=from_agent,
|
||||
messages=params["messages"],
|
||||
)
|
||||
return list(tool_uses)
|
||||
|
||||
# Check if Claude wants to use tools
|
||||
if response.content:
|
||||
tool_uses = [
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,115 @@
|
||||
interactions:
|
||||
- request:
|
||||
body: '{"max_tokens":4096,"messages":[{"role":"user","content":"\nCurrent Task:
|
||||
Analyze the benefits of remote work briefly. Keep it concise.\n\nProvide your
|
||||
complete response:"}],"model":"claude-3-5-haiku-20241022","stop_sequences":["\nObservation:"],"stream":false,"system":"You
|
||||
are Analyst. You are an expert analyst who provides clear, structured insights.\nYour
|
||||
personal goal is: Provide structured analysis on topics","tool_choice":{"type":"tool","name":"structured_output"},"tools":[{"name":"structured_output","description":"Output
|
||||
the structured response","input_schema":{"type":"object","description":"Structured
|
||||
output for analysis results.","title":"AnalysisResult","properties":{"topic":{"type":"string","description":"The
|
||||
topic analyzed","title":"Topic"},"key_points":{"type":"array","description":"Key
|
||||
insights from the analysis","title":"Key Points","items":{"type":"string"}},"summary":{"type":"string","description":"Brief
|
||||
summary of findings","title":"Summary"}},"additionalProperties":false,"required":["topic","key_points","summary"]}}]}'
|
||||
headers:
|
||||
User-Agent:
|
||||
- X-USER-AGENT-XXX
|
||||
accept:
|
||||
- application/json
|
||||
accept-encoding:
|
||||
- ACCEPT-ENCODING-XXX
|
||||
anthropic-version:
|
||||
- '2023-06-01'
|
||||
connection:
|
||||
- keep-alive
|
||||
content-length:
|
||||
- '1051'
|
||||
content-type:
|
||||
- application/json
|
||||
host:
|
||||
- api.anthropic.com
|
||||
x-api-key:
|
||||
- X-API-KEY-XXX
|
||||
x-stainless-arch:
|
||||
- X-STAINLESS-ARCH-XXX
|
||||
x-stainless-async:
|
||||
- 'false'
|
||||
x-stainless-lang:
|
||||
- python
|
||||
x-stainless-os:
|
||||
- X-STAINLESS-OS-XXX
|
||||
x-stainless-package-version:
|
||||
- 0.73.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: '{"model":"claude-3-5-haiku-20241022","id":"msg_01AQxfNxBBTHkxB2XjJ5Tnef","type":"message","role":"assistant","content":[{"type":"tool_use","id":"toolu_01SxyUZ6vWTqa9a9fkbAnSUh","name":"structured_output","input":{"topic":"Benefits
|
||||
of Remote Work","summary":"Remote work offers significant advantages for both
|
||||
employees and employers, transforming traditional workplace dynamics.","key_points":["Increased
|
||||
flexibility in work hours and location","Improved work-life balance","Reduced
|
||||
commuting time and transportation costs","Higher employee productivity and
|
||||
job satisfaction","Lower overhead expenses for companies","Access to a global
|
||||
talent pool","Enhanced employee wellness and reduced workplace stress"]}}],"stop_reason":"tool_use","stop_sequence":null,"usage":{"input_tokens":589,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"cache_creation":{"ephemeral_5m_input_tokens":0,"ephemeral_1h_input_tokens":0},"output_tokens":146,"service_tier":"standard"}}'
|
||||
headers:
|
||||
CF-RAY:
|
||||
- CF-RAY-XXX
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Security-Policy:
|
||||
- CSP-FILTERED
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 30 Jan 2026 00:56:46 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
X-Robots-Tag:
|
||||
- none
|
||||
anthropic-organization-id:
|
||||
- ANTHROPIC-ORGANIZATION-ID-XXX
|
||||
anthropic-ratelimit-input-tokens-limit:
|
||||
- ANTHROPIC-RATELIMIT-INPUT-TOKENS-LIMIT-XXX
|
||||
anthropic-ratelimit-input-tokens-remaining:
|
||||
- ANTHROPIC-RATELIMIT-INPUT-TOKENS-REMAINING-XXX
|
||||
anthropic-ratelimit-input-tokens-reset:
|
||||
- ANTHROPIC-RATELIMIT-INPUT-TOKENS-RESET-XXX
|
||||
anthropic-ratelimit-output-tokens-limit:
|
||||
- ANTHROPIC-RATELIMIT-OUTPUT-TOKENS-LIMIT-XXX
|
||||
anthropic-ratelimit-output-tokens-remaining:
|
||||
- ANTHROPIC-RATELIMIT-OUTPUT-TOKENS-REMAINING-XXX
|
||||
anthropic-ratelimit-output-tokens-reset:
|
||||
- ANTHROPIC-RATELIMIT-OUTPUT-TOKENS-RESET-XXX
|
||||
anthropic-ratelimit-requests-limit:
|
||||
- '4000'
|
||||
anthropic-ratelimit-requests-remaining:
|
||||
- '3999'
|
||||
anthropic-ratelimit-requests-reset:
|
||||
- '2026-01-30T00:56:43Z'
|
||||
anthropic-ratelimit-tokens-limit:
|
||||
- ANTHROPIC-RATELIMIT-TOKENS-LIMIT-XXX
|
||||
anthropic-ratelimit-tokens-remaining:
|
||||
- ANTHROPIC-RATELIMIT-TOKENS-REMAINING-XXX
|
||||
anthropic-ratelimit-tokens-reset:
|
||||
- ANTHROPIC-RATELIMIT-TOKENS-RESET-XXX
|
||||
cf-cache-status:
|
||||
- DYNAMIC
|
||||
request-id:
|
||||
- REQUEST-ID-XXX
|
||||
strict-transport-security:
|
||||
- STS-XXX
|
||||
x-envoy-upstream-service-time:
|
||||
- '2886'
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
version: 1
|
||||
@@ -0,0 +1,172 @@
|
||||
interactions:
|
||||
- request:
|
||||
body: '{"messages": [{"role": "system", "content": "You are Calculator. You are
|
||||
a calculator assistant that uses tools to compute results.\nYour personal goal
|
||||
is: Perform calculations using available tools"}, {"role": "user", "content":
|
||||
"\nCurrent Task: Calculate 15 + 27 using your add_numbers tool. Report the result."}],
|
||||
"stream": false, "response_format": {"type": "json_schema", "json_schema": {"name":
|
||||
"CalculationResult", "schema": {"description": "Structured output for calculation
|
||||
results.", "properties": {"operation": {"description": "The mathematical operation
|
||||
performed", "title": "Operation", "type": "string"}, "result": {"description":
|
||||
"The result of the calculation", "title": "Result", "type": "integer"}, "explanation":
|
||||
{"description": "Brief explanation of the calculation", "title": "Explanation",
|
||||
"type": "string"}}, "required": ["operation", "result", "explanation"], "title":
|
||||
"CalculationResult", "type": "object", "additionalProperties": false}, "description":
|
||||
"Schema for CalculationResult", "strict": true}}, "stop": ["\nObservation:"],
|
||||
"tool_choice": "auto", "tools": [{"function": {"name": "add_numbers", "description":
|
||||
"Add two numbers together and return the sum.", "parameters": {"properties":
|
||||
{"a": {"title": "A", "type": "integer"}, "b": {"title": "B", "type": "integer"}},
|
||||
"required": ["a", "b"], "type": "object", "additionalProperties": false}}, "type":
|
||||
"function"}]}'
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '1397'
|
||||
Content-Type:
|
||||
- application/json
|
||||
User-Agent:
|
||||
- X-USER-AGENT-XXX
|
||||
accept-encoding:
|
||||
- ACCEPT-ENCODING-XXX
|
||||
api-key:
|
||||
- X-API-KEY-XXX
|
||||
authorization:
|
||||
- AUTHORIZATION-XXX
|
||||
x-ms-client-request-id:
|
||||
- X-MS-CLIENT-REQUEST-ID-XXX
|
||||
method: POST
|
||||
uri: https://fake-azure-endpoint.openai.azure.com/openai/deployments/gpt-4o-mini/chat/completions?api-version=2024-12-01-preview
|
||||
response:
|
||||
body:
|
||||
string: '{"choices":[{"content_filter_results":{},"finish_reason":"tool_calls","index":0,"logprobs":null,"message":{"annotations":[],"content":null,"refusal":null,"role":"assistant","tool_calls":[{"function":{"arguments":"{\"a\":15,\"b\":27}","name":"add_numbers"},"id":"call_xvUi7xS7jtnRyG6NIhRvbb5r","type":"function"}]}}],"created":1769734374,"id":"chatcmpl-D3X2kUbUq9WXlKVGu2D7h6pWVCx0E","model":"gpt-4o-mini-2024-07-18","object":"chat.completion","prompt_filter_results":[{"prompt_index":0,"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"jailbreak":{"filtered":false,"detected":false},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}}}],"system_fingerprint":"fp_f97eff32c5","usage":{"completion_tokens":19,"completion_tokens_details":{"accepted_prediction_tokens":0,"audio_tokens":0,"reasoning_tokens":0,"rejected_prediction_tokens":0},"prompt_tokens":194,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"total_tokens":213}}
|
||||
|
||||
'
|
||||
headers:
|
||||
Content-Length:
|
||||
- '1051'
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 30 Jan 2026 00:52:53 GMT
|
||||
Strict-Transport-Security:
|
||||
- STS-XXX
|
||||
apim-request-id:
|
||||
- APIM-REQUEST-ID-XXX
|
||||
azureml-model-session:
|
||||
- AZUREML-MODEL-SESSION-XXX
|
||||
x-accel-buffering:
|
||||
- 'no'
|
||||
x-content-type-options:
|
||||
- X-CONTENT-TYPE-XXX
|
||||
x-ms-client-request-id:
|
||||
- X-MS-CLIENT-REQUEST-ID-XXX
|
||||
x-ms-deployment-name:
|
||||
- gpt-4o-mini
|
||||
x-ms-rai-invoked:
|
||||
- 'true'
|
||||
x-ms-region:
|
||||
- X-MS-REGION-XXX
|
||||
x-ratelimit-limit-requests:
|
||||
- X-RATELIMIT-LIMIT-REQUESTS-XXX
|
||||
x-ratelimit-limit-tokens:
|
||||
- X-RATELIMIT-LIMIT-TOKENS-XXX
|
||||
x-ratelimit-remaining-requests:
|
||||
- X-RATELIMIT-REMAINING-REQUESTS-XXX
|
||||
x-ratelimit-remaining-tokens:
|
||||
- X-RATELIMIT-REMAINING-TOKENS-XXX
|
||||
x-request-id:
|
||||
- X-REQUEST-ID-XXX
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: '{"messages": [{"role": "system", "content": "You are Calculator. You are
|
||||
a calculator assistant that uses tools to compute results.\nYour personal goal
|
||||
is: Perform calculations using available tools"}, {"role": "user", "content":
|
||||
"\nCurrent Task: Calculate 15 + 27 using your add_numbers tool. Report the result."},
|
||||
{"role": "assistant", "content": "", "tool_calls": [{"id": "call_xvUi7xS7jtnRyG6NIhRvbb5r",
|
||||
"type": "function", "function": {"name": "add_numbers", "arguments": "{\"a\":15,\"b\":27}"}}]},
|
||||
{"role": "tool", "tool_call_id": "call_xvUi7xS7jtnRyG6NIhRvbb5r", "content":
|
||||
"42"}], "stream": false, "response_format": {"type": "json_schema", "json_schema":
|
||||
{"name": "CalculationResult", "schema": {"description": "Structured output for
|
||||
calculation results.", "properties": {"operation": {"description": "The mathematical
|
||||
operation performed", "title": "Operation", "type": "string"}, "result": {"description":
|
||||
"The result of the calculation", "title": "Result", "type": "integer"}, "explanation":
|
||||
{"description": "Brief explanation of the calculation", "title": "Explanation",
|
||||
"type": "string"}}, "required": ["operation", "result", "explanation"], "title":
|
||||
"CalculationResult", "type": "object", "additionalProperties": false}, "description":
|
||||
"Schema for CalculationResult", "strict": true}}, "stop": ["\nObservation:"],
|
||||
"tool_choice": "auto", "tools": [{"function": {"name": "add_numbers", "description":
|
||||
"Add two numbers together and return the sum.", "parameters": {"properties":
|
||||
{"a": {"title": "A", "type": "integer"}, "b": {"title": "B", "type": "integer"}},
|
||||
"required": ["a", "b"], "type": "object", "additionalProperties": false}}, "type":
|
||||
"function"}]}'
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '1669'
|
||||
Content-Type:
|
||||
- application/json
|
||||
User-Agent:
|
||||
- X-USER-AGENT-XXX
|
||||
accept-encoding:
|
||||
- ACCEPT-ENCODING-XXX
|
||||
api-key:
|
||||
- X-API-KEY-XXX
|
||||
authorization:
|
||||
- AUTHORIZATION-XXX
|
||||
x-ms-client-request-id:
|
||||
- X-MS-CLIENT-REQUEST-ID-XXX
|
||||
method: POST
|
||||
uri: https://fake-azure-endpoint.openai.azure.com/openai/deployments/gpt-4o-mini/chat/completions?api-version=2024-12-01-preview
|
||||
response:
|
||||
body:
|
||||
string: '{"choices":[{"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"protected_material_code":{"filtered":false,"detected":false},"protected_material_text":{"filtered":false,"detected":false},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}},"finish_reason":"stop","index":0,"logprobs":null,"message":{"annotations":[],"content":"{\"operation\":\"addition\",\"result\":42,\"explanation\":\"The
|
||||
sum of 15 and 27 is calculated as 15 + 27 = 42.\"}","refusal":null,"role":"assistant"}}],"created":1769734375,"id":"chatcmpl-D3X2lupVq0RsIVdaZc2XqZpm4EmSW","model":"gpt-4o-mini-2024-07-18","object":"chat.completion","prompt_filter_results":[{"prompt_index":0,"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"jailbreak":{"filtered":false,"detected":false},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}}}],"system_fingerprint":"fp_f97eff32c5","usage":{"completion_tokens":39,"completion_tokens_details":{"accepted_prediction_tokens":0,"audio_tokens":0,"reasoning_tokens":0,"rejected_prediction_tokens":0},"prompt_tokens":221,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"total_tokens":260}}
|
||||
|
||||
'
|
||||
headers:
|
||||
Content-Length:
|
||||
- '1327'
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 30 Jan 2026 00:52:55 GMT
|
||||
Strict-Transport-Security:
|
||||
- STS-XXX
|
||||
apim-request-id:
|
||||
- APIM-REQUEST-ID-XXX
|
||||
azureml-model-session:
|
||||
- AZUREML-MODEL-SESSION-XXX
|
||||
x-accel-buffering:
|
||||
- 'no'
|
||||
x-content-type-options:
|
||||
- X-CONTENT-TYPE-XXX
|
||||
x-ms-client-request-id:
|
||||
- X-MS-CLIENT-REQUEST-ID-XXX
|
||||
x-ms-deployment-name:
|
||||
- gpt-4o-mini
|
||||
x-ms-rai-invoked:
|
||||
- 'true'
|
||||
x-ms-region:
|
||||
- X-MS-REGION-XXX
|
||||
x-ratelimit-limit-requests:
|
||||
- X-RATELIMIT-LIMIT-REQUESTS-XXX
|
||||
x-ratelimit-limit-tokens:
|
||||
- X-RATELIMIT-LIMIT-TOKENS-XXX
|
||||
x-ratelimit-remaining-requests:
|
||||
- X-RATELIMIT-REMAINING-REQUESTS-XXX
|
||||
x-ratelimit-remaining-tokens:
|
||||
- X-RATELIMIT-REMAINING-TOKENS-XXX
|
||||
x-request-id:
|
||||
- X-REQUEST-ID-XXX
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
version: 1
|
||||
@@ -0,0 +1,88 @@
|
||||
interactions:
|
||||
- request:
|
||||
body: '{"messages": [{"role": "system", "content": "You are Analyst. You are an
|
||||
expert analyst who provides clear, structured insights.\nYour personal goal
|
||||
is: Provide structured analysis on topics"}, {"role": "user", "content": "\nCurrent
|
||||
Task: Analyze the benefits of remote work briefly. Keep it concise.\n\nProvide
|
||||
your complete response:"}], "stream": false, "response_format": {"type": "json_schema",
|
||||
"json_schema": {"name": "AnalysisResult", "schema": {"description": "Structured
|
||||
output for analysis results.", "properties": {"topic": {"description": "The
|
||||
topic analyzed", "title": "Topic", "type": "string"}, "key_points": {"description":
|
||||
"Key insights from the analysis", "items": {"type": "string"}, "title": "Key
|
||||
Points", "type": "array"}, "summary": {"description": "Brief summary of findings",
|
||||
"title": "Summary", "type": "string"}}, "required": ["topic", "key_points",
|
||||
"summary"], "title": "AnalysisResult", "type": "object", "additionalProperties":
|
||||
false}, "description": "Schema for AnalysisResult", "strict": true}}, "stop":
|
||||
["\nObservation:"]}'
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '1054'
|
||||
Content-Type:
|
||||
- application/json
|
||||
User-Agent:
|
||||
- X-USER-AGENT-XXX
|
||||
accept-encoding:
|
||||
- ACCEPT-ENCODING-XXX
|
||||
api-key:
|
||||
- X-API-KEY-XXX
|
||||
authorization:
|
||||
- AUTHORIZATION-XXX
|
||||
x-ms-client-request-id:
|
||||
- X-MS-CLIENT-REQUEST-ID-XXX
|
||||
method: POST
|
||||
uri: https://fake-azure-endpoint.openai.azure.com/openai/deployments/gpt-4o-mini/chat/completions?api-version=2024-12-01-preview
|
||||
response:
|
||||
body:
|
||||
string: '{"choices":[{"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"protected_material_code":{"filtered":false,"detected":false},"protected_material_text":{"filtered":false,"detected":false},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}},"finish_reason":"stop","index":0,"logprobs":null,"message":{"annotations":[],"content":"{\"topic\":\"Benefits
|
||||
of Remote Work\",\"key_points\":[\"Increased flexibility in work hours and
|
||||
location\",\"Reduced commuting time and costs\",\"Improved work-life balance
|
||||
for employees\",\"Access to a wider talent pool for employers\",\"Potential
|
||||
for increased productivity and job satisfaction\",\"Lower overhead costs for
|
||||
businesses\"],\"summary\":\"Remote work offers significant advantages including
|
||||
flexibility, cost savings, and improved employee well-being, making it an
|
||||
attractive option for both employees and employers.\"}","refusal":null,"role":"assistant"}}],"created":1769734376,"id":"chatcmpl-D3X2mCDjoZv5Da0NA7SH4XH2pvQo1","model":"gpt-4o-mini-2024-07-18","object":"chat.completion","prompt_filter_results":[{"prompt_index":0,"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"jailbreak":{"filtered":false,"detected":false},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}}}],"system_fingerprint":"fp_f97eff32c5","usage":{"completion_tokens":90,"completion_tokens_details":{"accepted_prediction_tokens":0,"audio_tokens":0,"reasoning_tokens":0,"rejected_prediction_tokens":0},"prompt_tokens":160,"prompt_tokens_details":{"audio_tokens":0,"cached_tokens":0},"total_tokens":250}}
|
||||
|
||||
'
|
||||
headers:
|
||||
Content-Length:
|
||||
- '1748'
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 30 Jan 2026 00:52:57 GMT
|
||||
Strict-Transport-Security:
|
||||
- STS-XXX
|
||||
apim-request-id:
|
||||
- APIM-REQUEST-ID-XXX
|
||||
azureml-model-session:
|
||||
- AZUREML-MODEL-SESSION-XXX
|
||||
x-accel-buffering:
|
||||
- 'no'
|
||||
x-content-type-options:
|
||||
- X-CONTENT-TYPE-XXX
|
||||
x-ms-client-request-id:
|
||||
- X-MS-CLIENT-REQUEST-ID-XXX
|
||||
x-ms-deployment-name:
|
||||
- gpt-4o-mini
|
||||
x-ms-rai-invoked:
|
||||
- 'true'
|
||||
x-ms-region:
|
||||
- X-MS-REGION-XXX
|
||||
x-ratelimit-limit-requests:
|
||||
- X-RATELIMIT-LIMIT-REQUESTS-XXX
|
||||
x-ratelimit-limit-tokens:
|
||||
- X-RATELIMIT-LIMIT-TOKENS-XXX
|
||||
x-ratelimit-remaining-requests:
|
||||
- X-RATELIMIT-REMAINING-REQUESTS-XXX
|
||||
x-ratelimit-remaining-tokens:
|
||||
- X-RATELIMIT-REMAINING-TOKENS-XXX
|
||||
x-request-id:
|
||||
- X-REQUEST-ID-XXX
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
version: 1
|
||||
@@ -0,0 +1,119 @@
|
||||
interactions:
|
||||
- request:
|
||||
body: '{"messages": [{"role": "user", "content": [{"text": "\nCurrent Task: Calculate
|
||||
15 + 27 using your add_numbers tool. Report the result."}]}], "inferenceConfig":
|
||||
{"stopSequences": ["\nObservation:"]}, "system": [{"text": "You are Calculator.
|
||||
You are a calculator assistant that uses tools to compute results.\nYour personal
|
||||
goal is: Perform calculations using available tools"}], "toolConfig": {"tools":
|
||||
[{"toolSpec": {"name": "add_numbers", "description": "Add two numbers together
|
||||
and return the sum.", "inputSchema": {"json": {"properties": {"a": {"title":
|
||||
"A", "type": "integer"}, "b": {"title": "B", "type": "integer"}}, "required":
|
||||
["a", "b"], "type": "object", "additionalProperties": false}}}}, {"toolSpec":
|
||||
{"name": "structured_output", "description": "Use this tool to provide your
|
||||
final structured response. Call this tool when you have gathered all necessary
|
||||
information and are ready to provide the final answer in the required format.",
|
||||
"inputSchema": {"json": {"description": "Structured output for calculation results.",
|
||||
"properties": {"operation": {"description": "The mathematical operation performed",
|
||||
"title": "Operation", "type": "string"}, "result": {"description": "The result
|
||||
of the calculation", "title": "Result", "type": "integer"}, "explanation": {"description":
|
||||
"Brief explanation of the calculation", "title": "Explanation", "type": "string"}},
|
||||
"required": ["operation", "result", "explanation"], "title": "CalculationResult",
|
||||
"type": "object", "additionalProperties": false}}}}]}}'
|
||||
headers:
|
||||
Content-Length:
|
||||
- '1509'
|
||||
Content-Type:
|
||||
- !!binary |
|
||||
YXBwbGljYXRpb24vanNvbg==
|
||||
User-Agent:
|
||||
- X-USER-AGENT-XXX
|
||||
amz-sdk-invocation-id:
|
||||
- AMZ-SDK-INVOCATION-ID-XXX
|
||||
amz-sdk-request:
|
||||
- !!binary |
|
||||
YXR0ZW1wdD0x
|
||||
authorization:
|
||||
- AUTHORIZATION-XXX
|
||||
x-amz-date:
|
||||
- X-AMZ-DATE-XXX
|
||||
method: POST
|
||||
uri: https://bedrock-runtime.us-east-1.amazonaws.com/model/anthropic.claude-3-sonnet-20240229-v1%3A0/converse
|
||||
response:
|
||||
body:
|
||||
string: '{"metrics":{"latencyMs":1161},"output":{"message":{"content":[{"text":"Okay,
|
||||
let''s calculate 15 + 27:"},{"toolUse":{"input":{"a":15,"b":27},"name":"add_numbers","toolUseId":"tooluse_Jv2zf5bNQ1i0SuxqO8Qk5A"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":488,"outputTokens":84,"serverToolUsage":{},"totalTokens":572}}'
|
||||
headers:
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '339'
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 30 Jan 2026 01:04:12 GMT
|
||||
x-amzn-RequestId:
|
||||
- X-AMZN-REQUESTID-XXX
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: '{"messages": [{"role": "user", "content": [{"text": "\nCurrent Task: Calculate
|
||||
15 + 27 using your add_numbers tool. Report the result."}]}, {"role": "assistant",
|
||||
"content": [{"toolUse": {"toolUseId": "tooluse_Jv2zf5bNQ1i0SuxqO8Qk5A", "name":
|
||||
"add_numbers", "input": {"a": 15, "b": 27}}}]}, {"role": "user", "content":
|
||||
[{"toolResult": {"toolUseId": "tooluse_Jv2zf5bNQ1i0SuxqO8Qk5A", "content": [{"text":
|
||||
"42"}]}}]}], "inferenceConfig": {"stopSequences": ["\nObservation:"]}, "system":
|
||||
[{"text": "You are Calculator. You are a calculator assistant that uses tools
|
||||
to compute results.\nYour personal goal is: Perform calculations using available
|
||||
tools"}], "toolConfig": {"tools": [{"toolSpec": {"name": "add_numbers", "description":
|
||||
"Add two numbers together and return the sum.", "inputSchema": {"json": {"properties":
|
||||
{"a": {"title": "A", "type": "integer"}, "b": {"title": "B", "type": "integer"}},
|
||||
"required": ["a", "b"], "type": "object", "additionalProperties": false}}}},
|
||||
{"toolSpec": {"name": "structured_output", "description": "Use this tool to
|
||||
provide your final structured response. Call this tool when you have gathered
|
||||
all necessary information and are ready to provide the final answer in the required
|
||||
format.", "inputSchema": {"json": {"description": "Structured output for calculation
|
||||
results.", "properties": {"operation": {"description": "The mathematical operation
|
||||
performed", "title": "Operation", "type": "string"}, "result": {"description":
|
||||
"The result of the calculation", "title": "Result", "type": "integer"}, "explanation":
|
||||
{"description": "Brief explanation of the calculation", "title": "Explanation",
|
||||
"type": "string"}}, "required": ["operation", "result", "explanation"], "title":
|
||||
"CalculationResult", "type": "object", "additionalProperties": false}}}}]}}'
|
||||
headers:
|
||||
Content-Length:
|
||||
- '1784'
|
||||
Content-Type:
|
||||
- !!binary |
|
||||
YXBwbGljYXRpb24vanNvbg==
|
||||
User-Agent:
|
||||
- X-USER-AGENT-XXX
|
||||
amz-sdk-invocation-id:
|
||||
- AMZ-SDK-INVOCATION-ID-XXX
|
||||
amz-sdk-request:
|
||||
- !!binary |
|
||||
YXR0ZW1wdD0x
|
||||
authorization:
|
||||
- AUTHORIZATION-XXX
|
||||
x-amz-date:
|
||||
- X-AMZ-DATE-XXX
|
||||
method: POST
|
||||
uri: https://bedrock-runtime.us-east-1.amazonaws.com/model/anthropic.claude-3-sonnet-20240229-v1%3A0/converse
|
||||
response:
|
||||
body:
|
||||
string: '{"metrics":{"latencyMs":1446},"output":{"message":{"content":[{"toolUse":{"input":{"operation":"Addition","result":42,"explanation":"I
|
||||
added the two numbers 15 and 27 using the add_numbers tool."},"name":"structured_output","toolUseId":"tooluse_oofqrd0wS2WH12IdXEOn3w"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":571,"outputTokens":105,"serverToolUsage":{},"totalTokens":676}}'
|
||||
headers:
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '403'
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 30 Jan 2026 01:04:14 GMT
|
||||
x-amzn-RequestId:
|
||||
- X-AMZN-REQUESTID-XXX
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
version: 1
|
||||
@@ -0,0 +1,64 @@
|
||||
interactions:
|
||||
- request:
|
||||
body: '{"messages": [{"role": "user", "content": [{"text": "\nCurrent Task: Analyze
|
||||
the benefits of remote work briefly. Keep it concise.\n\nProvide your complete
|
||||
response:"}]}], "inferenceConfig": {"stopSequences": ["\nObservation:"]}, "system":
|
||||
[{"text": "You are Analyst. You are an expert analyst who provides clear, structured
|
||||
insights.\nYour personal goal is: Provide structured analysis on topics"}],
|
||||
"toolConfig": {"tools": [{"toolSpec": {"name": "structured_output", "description":
|
||||
"Use this tool to provide your final structured response. Call this tool when
|
||||
you have gathered all necessary information and are ready to provide the final
|
||||
answer in the required format.", "inputSchema": {"json": {"description": "Structured
|
||||
output for analysis results.", "properties": {"topic": {"description": "The
|
||||
topic analyzed", "title": "Topic", "type": "string"}, "key_points": {"description":
|
||||
"Key insights from the analysis", "items": {"type": "string"}, "title": "Key
|
||||
Points", "type": "array"}, "summary": {"description": "Brief summary of findings",
|
||||
"title": "Summary", "type": "string"}}, "required": ["topic", "key_points",
|
||||
"summary"], "title": "AnalysisResult", "type": "object", "additionalProperties":
|
||||
false}}}}], "toolChoice": {"tool": {"name": "structured_output"}}}}'
|
||||
headers:
|
||||
Content-Length:
|
||||
- '1270'
|
||||
Content-Type:
|
||||
- !!binary |
|
||||
YXBwbGljYXRpb24vanNvbg==
|
||||
User-Agent:
|
||||
- X-USER-AGENT-XXX
|
||||
amz-sdk-invocation-id:
|
||||
- AMZ-SDK-INVOCATION-ID-XXX
|
||||
amz-sdk-request:
|
||||
- !!binary |
|
||||
YXR0ZW1wdD0x
|
||||
authorization:
|
||||
- AUTHORIZATION-XXX
|
||||
x-amz-date:
|
||||
- X-AMZ-DATE-XXX
|
||||
method: POST
|
||||
uri: https://bedrock-runtime.us-east-1.amazonaws.com/model/anthropic.claude-3-sonnet-20240229-v1%3A0/converse
|
||||
response:
|
||||
body:
|
||||
string: '{"metrics":{"latencyMs":3496},"output":{"message":{"content":[{"toolUse":{"input":{"topic":"Benefits
|
||||
of remote work","key_points":"- Increased flexibility and work-life balance\n-
|
||||
Reduced commute time and costs\n- Access to a wider talent pool for companies\n-
|
||||
Increased productivity for some employees\n- Environmental benefits from reduced
|
||||
commuting","summary":"Remote work offers several benefits including improved
|
||||
work-life balance, cost and time savings from eliminating commutes, access
|
||||
to a broader talent pool for employers, productivity gains, and environmental
|
||||
advantages from reduced transportation. However, it also presents challenges
|
||||
like social isolation, blurred work-life boundaries, and potential distractions
|
||||
at home that need to be managed effectively."},"name":"structured_output","toolUseId":"tooluse_Jfg8pUBaRxWkKwR_rp5mCw"}}],"role":"assistant"}},"stopReason":"tool_use","usage":{"inputTokens":512,"outputTokens":187,"serverToolUsage":{},"totalTokens":699}}'
|
||||
headers:
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '982'
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 30 Jan 2026 01:04:10 GMT
|
||||
x-amzn-RequestId:
|
||||
- X-AMZN-REQUESTID-XXX
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
version: 1
|
||||
@@ -0,0 +1,167 @@
|
||||
interactions:
|
||||
- request:
|
||||
body: '{"contents": [{"parts": [{"text": "\nCurrent Task: Calculate 15 + 27 using
|
||||
your add_numbers tool. Report the result."}], "role": "user"}], "systemInstruction":
|
||||
{"parts": [{"text": "You are Calculator. You are a calculator assistant that
|
||||
uses tools to compute results.\nYour personal goal is: Perform calculations
|
||||
using available tools"}], "role": "user"}, "tools": [{"functionDeclarations":
|
||||
[{"description": "Add two numbers together and return the sum.", "name": "add_numbers",
|
||||
"parameters_json_schema": {"properties": {"a": {"title": "A", "type": "integer"},
|
||||
"b": {"title": "B", "type": "integer"}}, "required": ["a", "b"], "type": "object",
|
||||
"additionalProperties": false}}, {"description": "Use this tool to provide your
|
||||
final structured response. Call this tool when you have gathered all necessary
|
||||
information and are ready to provide the final answer in the required format.",
|
||||
"name": "structured_output", "parameters_json_schema": {"description": "Structured
|
||||
output for calculation results.", "properties": {"operation": {"description":
|
||||
"The mathematical operation performed", "title": "Operation", "type": "string"},
|
||||
"result": {"description": "The result of the calculation", "title": "Result",
|
||||
"type": "integer"}, "explanation": {"description": "Brief explanation of the
|
||||
calculation", "title": "Explanation", "type": "string"}}, "required": ["operation",
|
||||
"result", "explanation"], "title": "CalculationResult", "type": "object", "additionalProperties":
|
||||
false, "propertyOrdering": ["operation", "result", "explanation"]}}]}], "generationConfig":
|
||||
{"stopSequences": ["\nObservation:"]}}'
|
||||
headers:
|
||||
User-Agent:
|
||||
- X-USER-AGENT-XXX
|
||||
accept:
|
||||
- '*/*'
|
||||
accept-encoding:
|
||||
- ACCEPT-ENCODING-XXX
|
||||
connection:
|
||||
- keep-alive
|
||||
content-length:
|
||||
- '1592'
|
||||
content-type:
|
||||
- application/json
|
||||
host:
|
||||
- generativelanguage.googleapis.com
|
||||
x-goog-api-client:
|
||||
- google-genai-sdk/1.49.0 gl-python/3.13.3
|
||||
x-goog-api-key:
|
||||
- X-GOOG-API-KEY-XXX
|
||||
method: POST
|
||||
uri: https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-001:generateContent
|
||||
response:
|
||||
body:
|
||||
string: "{\n \"candidates\": [\n {\n \"content\": {\n \"parts\":
|
||||
[\n {\n \"functionCall\": {\n \"name\": \"add_numbers\",\n
|
||||
\ \"args\": {\n \"b\": 27,\n \"a\":
|
||||
15\n }\n }\n }\n ],\n \"role\":
|
||||
\"model\"\n },\n \"finishReason\": \"STOP\",\n \"avgLogprobs\":
|
||||
-5.0267503995980534e-05\n }\n ],\n \"usageMetadata\": {\n \"promptTokenCount\":
|
||||
98,\n \"candidatesTokenCount\": 7,\n \"totalTokenCount\": 105,\n \"promptTokensDetails\":
|
||||
[\n {\n \"modality\": \"TEXT\",\n \"tokenCount\": 98\n
|
||||
\ }\n ],\n \"candidatesTokensDetails\": [\n {\n \"modality\":
|
||||
\"TEXT\",\n \"tokenCount\": 7\n }\n ]\n },\n \"modelVersion\":
|
||||
\"gemini-2.0-flash-001\",\n \"responseId\": \"0AV8acutBq6PjMcPkpfamQQ\"\n}\n"
|
||||
headers:
|
||||
Alt-Svc:
|
||||
- h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
|
||||
Content-Type:
|
||||
- application/json; charset=UTF-8
|
||||
Date:
|
||||
- Fri, 30 Jan 2026 01:13:52 GMT
|
||||
Server:
|
||||
- scaffolding on HTTPServer2
|
||||
Server-Timing:
|
||||
- gfet4t7; dur=555
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
Vary:
|
||||
- Origin
|
||||
- X-Origin
|
||||
- Referer
|
||||
X-Content-Type-Options:
|
||||
- X-CONTENT-TYPE-XXX
|
||||
X-Frame-Options:
|
||||
- X-FRAME-OPTIONS-XXX
|
||||
X-XSS-Protection:
|
||||
- '0'
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: '{"contents": [{"parts": [{"text": "\nCurrent Task: Calculate 15 + 27 using
|
||||
your add_numbers tool. Report the result."}], "role": "user"}, {"parts": [{"functionCall":
|
||||
{"args": {"b": 27, "a": 15}, "name": "add_numbers"}}], "role": "model"}, {"parts":
|
||||
[{"functionResponse": {"name": "add_numbers", "response": {"result": 42}}}],
|
||||
"role": "user"}], "systemInstruction": {"parts": [{"text": "You are Calculator.
|
||||
You are a calculator assistant that uses tools to compute results.\nYour personal
|
||||
goal is: Perform calculations using available tools"}], "role": "user"}, "tools":
|
||||
[{"functionDeclarations": [{"description": "Add two numbers together and return
|
||||
the sum.", "name": "add_numbers", "parameters_json_schema": {"properties": {"a":
|
||||
{"title": "A", "type": "integer"}, "b": {"title": "B", "type": "integer"}},
|
||||
"required": ["a", "b"], "type": "object", "additionalProperties": false}}, {"description":
|
||||
"Use this tool to provide your final structured response. Call this tool when
|
||||
you have gathered all necessary information and are ready to provide the final
|
||||
answer in the required format.", "name": "structured_output", "parameters_json_schema":
|
||||
{"description": "Structured output for calculation results.", "properties":
|
||||
{"operation": {"description": "The mathematical operation performed", "title":
|
||||
"Operation", "type": "string"}, "result": {"description": "The result of the
|
||||
calculation", "title": "Result", "type": "integer"}, "explanation": {"description":
|
||||
"Brief explanation of the calculation", "title": "Explanation", "type": "string"}},
|
||||
"required": ["operation", "result", "explanation"], "title": "CalculationResult",
|
||||
"type": "object", "additionalProperties": false, "propertyOrdering": ["operation",
|
||||
"result", "explanation"]}}]}], "generationConfig": {"stopSequences": ["\nObservation:"]}}'
|
||||
headers:
|
||||
User-Agent:
|
||||
- X-USER-AGENT-XXX
|
||||
accept:
|
||||
- '*/*'
|
||||
accept-encoding:
|
||||
- ACCEPT-ENCODING-XXX
|
||||
connection:
|
||||
- keep-alive
|
||||
content-length:
|
||||
- '1797'
|
||||
content-type:
|
||||
- application/json
|
||||
host:
|
||||
- generativelanguage.googleapis.com
|
||||
x-goog-api-client:
|
||||
- google-genai-sdk/1.49.0 gl-python/3.13.3
|
||||
x-goog-api-key:
|
||||
- X-GOOG-API-KEY-XXX
|
||||
method: POST
|
||||
uri: https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-001:generateContent
|
||||
response:
|
||||
body:
|
||||
string: "{\n \"candidates\": [\n {\n \"content\": {\n \"parts\":
|
||||
[\n {\n \"functionCall\": {\n \"name\": \"structured_output\",\n
|
||||
\ \"args\": {\n \"result\": 42,\n \"operation\":
|
||||
\"Addition\",\n \"explanation\": \"15 + 27 = 42\"\n }\n
|
||||
\ }\n }\n ],\n \"role\": \"model\"\n },\n
|
||||
\ \"finishReason\": \"STOP\",\n \"avgLogprobs\": -0.09667918417188856\n
|
||||
\ }\n ],\n \"usageMetadata\": {\n \"promptTokenCount\": 110,\n \"candidatesTokenCount\":
|
||||
18,\n \"totalTokenCount\": 128,\n \"promptTokensDetails\": [\n {\n
|
||||
\ \"modality\": \"TEXT\",\n \"tokenCount\": 110\n }\n ],\n
|
||||
\ \"candidatesTokensDetails\": [\n {\n \"modality\": \"TEXT\",\n
|
||||
\ \"tokenCount\": 18\n }\n ]\n },\n \"modelVersion\": \"gemini-2.0-flash-001\",\n
|
||||
\ \"responseId\": \"0AV8ac_4Kr_yjMcPg_a4gA0\"\n}\n"
|
||||
headers:
|
||||
Alt-Svc:
|
||||
- h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
|
||||
Content-Type:
|
||||
- application/json; charset=UTF-8
|
||||
Date:
|
||||
- Fri, 30 Jan 2026 01:13:53 GMT
|
||||
Server:
|
||||
- scaffolding on HTTPServer2
|
||||
Server-Timing:
|
||||
- gfet4t7; dur=936
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
Vary:
|
||||
- Origin
|
||||
- X-Origin
|
||||
- Referer
|
||||
X-Content-Type-Options:
|
||||
- X-CONTENT-TYPE-XXX
|
||||
X-Frame-Options:
|
||||
- X-FRAME-OPTIONS-XXX
|
||||
X-XSS-Protection:
|
||||
- '0'
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
version: 1
|
||||
@@ -0,0 +1,86 @@
|
||||
interactions:
|
||||
- request:
|
||||
body: '{"contents": [{"parts": [{"text": "\nCurrent Task: Analyze the benefits
|
||||
of remote work briefly. Keep it concise.\n\nProvide your complete response:"}],
|
||||
"role": "user"}], "systemInstruction": {"parts": [{"text": "You are Analyst.
|
||||
You are an expert analyst who provides clear, structured insights.\nYour personal
|
||||
goal is: Provide structured analysis on topics"}], "role": "user"}, "generationConfig":
|
||||
{"stopSequences": ["\nObservation:"], "responseMimeType": "application/json",
|
||||
"responseJsonSchema": {"description": "Structured output for analysis results.",
|
||||
"properties": {"topic": {"description": "The topic analyzed", "title": "Topic",
|
||||
"type": "string"}, "key_points": {"description": "Key insights from the analysis",
|
||||
"items": {"type": "string"}, "title": "Key Points", "type": "array"}, "summary":
|
||||
{"description": "Brief summary of findings", "title": "Summary", "type": "string"}},
|
||||
"required": ["topic", "key_points", "summary"], "title": "AnalysisResult", "type":
|
||||
"object", "additionalProperties": false, "propertyOrdering": ["topic", "key_points",
|
||||
"summary"]}}}'
|
||||
headers:
|
||||
User-Agent:
|
||||
- X-USER-AGENT-XXX
|
||||
accept:
|
||||
- '*/*'
|
||||
accept-encoding:
|
||||
- ACCEPT-ENCODING-XXX
|
||||
connection:
|
||||
- keep-alive
|
||||
content-length:
|
||||
- '1068'
|
||||
content-type:
|
||||
- application/json
|
||||
host:
|
||||
- generativelanguage.googleapis.com
|
||||
x-goog-api-client:
|
||||
- google-genai-sdk/1.49.0 gl-python/3.13.3
|
||||
x-goog-api-key:
|
||||
- X-GOOG-API-KEY-XXX
|
||||
method: POST
|
||||
uri: https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-001:generateContent
|
||||
response:
|
||||
body:
|
||||
string: "{\n \"candidates\": [\n {\n \"content\": {\n \"parts\":
|
||||
[\n {\n \"text\": \"{\\n \\\"topic\\\": \\\"Benefits
|
||||
of Remote Work\\\",\\n \\\"key_points\\\": [\\n \\\"Increased Flexibility:
|
||||
Employees can manage their schedules and work from anywhere.\\\",\\n \\\"Cost
|
||||
Savings: Reduced expenses for both employees (commuting, office attire) and
|
||||
employers (office space).\\\",\\n \\\"Improved Work-Life Balance: Better
|
||||
integration of personal and professional life can reduce stress.\\\",\\n \\\"Expanded
|
||||
Talent Pool: Companies can hire from a wider geographic area.\\\",\\n \\\"Higher
|
||||
Productivity: Studies suggest that remote workers can be more focused and
|
||||
productive.\\\"\\n ],\\n \\\"summary\\\": \\\"Remote work offers significant
|
||||
advantages, including increased flexibility, cost savings, better work-life
|
||||
balance, access to a broader talent pool, and potentially higher productivity
|
||||
for employees and employers.\\\"\\n}\"\n }\n ],\n \"role\":
|
||||
\"model\"\n },\n \"finishReason\": \"STOP\",\n \"avgLogprobs\":
|
||||
-0.17009115219116211\n }\n ],\n \"usageMetadata\": {\n \"promptTokenCount\":
|
||||
49,\n \"candidatesTokenCount\": 160,\n \"totalTokenCount\": 209,\n \"promptTokensDetails\":
|
||||
[\n {\n \"modality\": \"TEXT\",\n \"tokenCount\": 49\n
|
||||
\ }\n ],\n \"candidatesTokensDetails\": [\n {\n \"modality\":
|
||||
\"TEXT\",\n \"tokenCount\": 160\n }\n ]\n },\n \"modelVersion\":
|
||||
\"gemini-2.0-flash-001\",\n \"responseId\": \"0gV8ae20E67fjMcPodGM8Q4\"\n}\n"
|
||||
headers:
|
||||
Alt-Svc:
|
||||
- h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
|
||||
Content-Type:
|
||||
- application/json; charset=UTF-8
|
||||
Date:
|
||||
- Fri, 30 Jan 2026 01:13:55 GMT
|
||||
Server:
|
||||
- scaffolding on HTTPServer2
|
||||
Server-Timing:
|
||||
- gfet4t7; dur=1517
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
Vary:
|
||||
- Origin
|
||||
- X-Origin
|
||||
- Referer
|
||||
X-Content-Type-Options:
|
||||
- X-CONTENT-TYPE-XXX
|
||||
X-Frame-Options:
|
||||
- X-FRAME-OPTIONS-XXX
|
||||
X-XSS-Protection:
|
||||
- '0'
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
version: 1
|
||||
@@ -0,0 +1,347 @@
|
||||
interactions:
|
||||
- request:
|
||||
body: '{"messages":[{"role":"system","content":"You are Calculator. You are a
|
||||
calculator assistant that uses tools to compute results.\nYour personal goal
|
||||
is: Perform calculations using available tools"},{"role":"user","content":"\nCurrent
|
||||
Task: Calculate 15 + 27 using your add_numbers tool. Report the result."}],"model":"gpt-4o-mini","response_format":{"type":"json_schema","json_schema":{"schema":{"description":"Structured
|
||||
output for calculation results.","properties":{"operation":{"description":"The
|
||||
mathematical operation performed","title":"Operation","type":"string"},"result":{"description":"The
|
||||
result of the calculation","title":"Result","type":"integer"},"explanation":{"description":"Brief
|
||||
explanation of the calculation","title":"Explanation","type":"string"}},"required":["operation","result","explanation"],"title":"CalculationResult","type":"object","additionalProperties":false},"name":"CalculationResult","strict":true}},"stream":false,"tool_choice":"auto","tools":[{"type":"function","function":{"name":"add_numbers","description":"Add
|
||||
two numbers together and return the sum.","strict":true,"parameters":{"properties":{"a":{"title":"A","type":"integer"},"b":{"title":"B","type":"integer"}},"required":["a","b"],"type":"object","additionalProperties":false}}}]}'
|
||||
headers:
|
||||
User-Agent:
|
||||
- X-USER-AGENT-XXX
|
||||
accept:
|
||||
- application/json
|
||||
accept-encoding:
|
||||
- ACCEPT-ENCODING-XXX
|
||||
authorization:
|
||||
- AUTHORIZATION-XXX
|
||||
connection:
|
||||
- keep-alive
|
||||
content-length:
|
||||
- '1276'
|
||||
content-type:
|
||||
- application/json
|
||||
host:
|
||||
- api.openai.com
|
||||
x-stainless-arch:
|
||||
- X-STAINLESS-ARCH-XXX
|
||||
x-stainless-async:
|
||||
- 'false'
|
||||
x-stainless-helper-method:
|
||||
- beta.chat.completions.parse
|
||||
x-stainless-lang:
|
||||
- python
|
||||
x-stainless-os:
|
||||
- X-STAINLESS-OS-XXX
|
||||
x-stainless-package-version:
|
||||
- 1.83.0
|
||||
x-stainless-read-timeout:
|
||||
- X-STAINLESS-READ-TIMEOUT-XXX
|
||||
x-stainless-retry-count:
|
||||
- '0'
|
||||
x-stainless-runtime:
|
||||
- CPython
|
||||
x-stainless-runtime-version:
|
||||
- 3.13.3
|
||||
method: POST
|
||||
uri: https://api.openai.com/v1/chat/completions
|
||||
response:
|
||||
body:
|
||||
string: "{\n \"id\": \"chatcmpl-D3XAcQ6yX3jURhMDYL9VD2WlizLIR\",\n \"object\":
|
||||
\"chat.completion\",\n \"created\": 1769734862,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n
|
||||
\ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\":
|
||||
\"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n
|
||||
\ \"id\": \"call_YNBrEkgAyrj5R8aXizVVzumo\",\n \"type\":
|
||||
\"function\",\n \"function\": {\n \"name\": \"add_numbers\",\n
|
||||
\ \"arguments\": \"{\\\"a\\\":15,\\\"b\\\":27}\"\n }\n
|
||||
\ }\n ],\n \"refusal\": null,\n \"annotations\":
|
||||
[]\n },\n \"logprobs\": null,\n \"finish_reason\": \"tool_calls\"\n
|
||||
\ }\n ],\n \"usage\": {\n \"prompt_tokens\": 188,\n \"completion_tokens\":
|
||||
18,\n \"total_tokens\": 206,\n \"prompt_tokens_details\": {\n \"cached_tokens\":
|
||||
0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\":
|
||||
{\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\":
|
||||
0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\":
|
||||
\"default\",\n \"system_fingerprint\": \"fp_1590f93f9d\"\n}\n"
|
||||
headers:
|
||||
CF-RAY:
|
||||
- CF-RAY-XXX
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 30 Jan 2026 01:01:03 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- SET-COOKIE-XXX
|
||||
Strict-Transport-Security:
|
||||
- STS-XXX
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
X-Content-Type-Options:
|
||||
- X-CONTENT-TYPE-XXX
|
||||
access-control-expose-headers:
|
||||
- ACCESS-CONTROL-XXX
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
cf-cache-status:
|
||||
- DYNAMIC
|
||||
openai-organization:
|
||||
- OPENAI-ORG-XXX
|
||||
openai-processing-ms:
|
||||
- '922'
|
||||
openai-project:
|
||||
- OPENAI-PROJECT-XXX
|
||||
openai-version:
|
||||
- '2020-10-01'
|
||||
x-openai-proxy-wasm:
|
||||
- v0.1
|
||||
x-ratelimit-limit-requests:
|
||||
- X-RATELIMIT-LIMIT-REQUESTS-XXX
|
||||
x-ratelimit-limit-tokens:
|
||||
- X-RATELIMIT-LIMIT-TOKENS-XXX
|
||||
x-ratelimit-remaining-requests:
|
||||
- X-RATELIMIT-REMAINING-REQUESTS-XXX
|
||||
x-ratelimit-remaining-tokens:
|
||||
- X-RATELIMIT-REMAINING-TOKENS-XXX
|
||||
x-ratelimit-reset-requests:
|
||||
- X-RATELIMIT-RESET-REQUESTS-XXX
|
||||
x-ratelimit-reset-tokens:
|
||||
- X-RATELIMIT-RESET-TOKENS-XXX
|
||||
x-request-id:
|
||||
- X-REQUEST-ID-XXX
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: '{"messages":[{"role":"system","content":"You are Calculator. You are a
|
||||
calculator assistant that uses tools to compute results.\nYour personal goal
|
||||
is: Perform calculations using available tools"},{"role":"user","content":"\nCurrent
|
||||
Task: Calculate 15 + 27 using your add_numbers tool. Report the result."}],"model":"gpt-4o-mini","tool_choice":"auto","tools":[{"type":"function","function":{"name":"add_numbers","description":"Add
|
||||
two numbers together and return the sum.","strict":true,"parameters":{"properties":{"a":{"title":"A","type":"integer"},"b":{"title":"B","type":"integer"}},"required":["a","b"],"type":"object","additionalProperties":false}}}]}'
|
||||
headers:
|
||||
User-Agent:
|
||||
- X-USER-AGENT-XXX
|
||||
accept:
|
||||
- application/json
|
||||
accept-encoding:
|
||||
- ACCEPT-ENCODING-XXX
|
||||
authorization:
|
||||
- AUTHORIZATION-XXX
|
||||
connection:
|
||||
- keep-alive
|
||||
content-length:
|
||||
- '656'
|
||||
content-type:
|
||||
- application/json
|
||||
cookie:
|
||||
- COOKIE-XXX
|
||||
host:
|
||||
- api.openai.com
|
||||
x-stainless-arch:
|
||||
- X-STAINLESS-ARCH-XXX
|
||||
x-stainless-async:
|
||||
- 'false'
|
||||
x-stainless-lang:
|
||||
- python
|
||||
x-stainless-os:
|
||||
- X-STAINLESS-OS-XXX
|
||||
x-stainless-package-version:
|
||||
- 1.83.0
|
||||
x-stainless-read-timeout:
|
||||
- X-STAINLESS-READ-TIMEOUT-XXX
|
||||
x-stainless-retry-count:
|
||||
- '0'
|
||||
x-stainless-runtime:
|
||||
- CPython
|
||||
x-stainless-runtime-version:
|
||||
- 3.13.3
|
||||
method: POST
|
||||
uri: https://api.openai.com/v1/chat/completions
|
||||
response:
|
||||
body:
|
||||
string: "{\n \"id\": \"chatcmpl-D3XAerzCmf1qz9Wena1fHbaUMnhDy\",\n \"object\":
|
||||
\"chat.completion\",\n \"created\": 1769734864,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n
|
||||
\ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\":
|
||||
\"assistant\",\n \"content\": null,\n \"tool_calls\": [\n {\n
|
||||
\ \"id\": \"call_vrbKUMAGiPtatMe2ODg4qmfW\",\n \"type\":
|
||||
\"function\",\n \"function\": {\n \"name\": \"add_numbers\",\n
|
||||
\ \"arguments\": \"{\\\"a\\\":15,\\\"b\\\":27}\"\n }\n
|
||||
\ }\n ],\n \"refusal\": null,\n \"annotations\":
|
||||
[]\n },\n \"logprobs\": null,\n \"finish_reason\": \"tool_calls\"\n
|
||||
\ }\n ],\n \"usage\": {\n \"prompt_tokens\": 102,\n \"completion_tokens\":
|
||||
18,\n \"total_tokens\": 120,\n \"prompt_tokens_details\": {\n \"cached_tokens\":
|
||||
0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\":
|
||||
{\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\":
|
||||
0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\":
|
||||
\"default\",\n \"system_fingerprint\": \"fp_1590f93f9d\"\n}\n"
|
||||
headers:
|
||||
CF-RAY:
|
||||
- CF-RAY-XXX
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 30 Jan 2026 01:01:04 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Strict-Transport-Security:
|
||||
- STS-XXX
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
X-Content-Type-Options:
|
||||
- X-CONTENT-TYPE-XXX
|
||||
access-control-expose-headers:
|
||||
- ACCESS-CONTROL-XXX
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
cf-cache-status:
|
||||
- DYNAMIC
|
||||
openai-organization:
|
||||
- OPENAI-ORG-XXX
|
||||
openai-processing-ms:
|
||||
- '711'
|
||||
openai-project:
|
||||
- OPENAI-PROJECT-XXX
|
||||
openai-version:
|
||||
- '2020-10-01'
|
||||
x-openai-proxy-wasm:
|
||||
- v0.1
|
||||
x-ratelimit-limit-requests:
|
||||
- X-RATELIMIT-LIMIT-REQUESTS-XXX
|
||||
x-ratelimit-limit-tokens:
|
||||
- X-RATELIMIT-LIMIT-TOKENS-XXX
|
||||
x-ratelimit-remaining-requests:
|
||||
- X-RATELIMIT-REMAINING-REQUESTS-XXX
|
||||
x-ratelimit-remaining-tokens:
|
||||
- X-RATELIMIT-REMAINING-TOKENS-XXX
|
||||
x-ratelimit-reset-requests:
|
||||
- X-RATELIMIT-RESET-REQUESTS-XXX
|
||||
x-ratelimit-reset-tokens:
|
||||
- X-RATELIMIT-RESET-TOKENS-XXX
|
||||
x-request-id:
|
||||
- X-REQUEST-ID-XXX
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: '{"messages":[{"role":"system","content":"You are Calculator. You are a
|
||||
calculator assistant that uses tools to compute results.\nYour personal goal
|
||||
is: Perform calculations using available tools"},{"role":"user","content":"\nCurrent
|
||||
Task: Calculate 15 + 27 using your add_numbers tool. Report the result."},{"role":"assistant","content":null,"tool_calls":[{"id":"call_vrbKUMAGiPtatMe2ODg4qmfW","type":"function","function":{"name":"add_numbers","arguments":"{\"a\":15,\"b\":27}"}}]},{"role":"tool","tool_call_id":"call_vrbKUMAGiPtatMe2ODg4qmfW","name":"add_numbers","content":"42"}],"model":"gpt-4o-mini","response_format":{"type":"json_schema","json_schema":{"schema":{"description":"Structured
|
||||
output for calculation results.","properties":{"operation":{"description":"The
|
||||
mathematical operation performed","title":"Operation","type":"string"},"result":{"description":"The
|
||||
result of the calculation","title":"Result","type":"integer"},"explanation":{"description":"Brief
|
||||
explanation of the calculation","title":"Explanation","type":"string"}},"required":["operation","result","explanation"],"title":"CalculationResult","type":"object","additionalProperties":false},"name":"CalculationResult","strict":true}},"stream":false,"tool_choice":"auto","tools":[{"type":"function","function":{"name":"add_numbers","description":"Add
|
||||
two numbers together and return the sum.","strict":true,"parameters":{"properties":{"a":{"title":"A","type":"integer"},"b":{"title":"B","type":"integer"}},"required":["a","b"],"type":"object","additionalProperties":false}}}]}'
|
||||
headers:
|
||||
User-Agent:
|
||||
- X-USER-AGENT-XXX
|
||||
accept:
|
||||
- application/json
|
||||
accept-encoding:
|
||||
- ACCEPT-ENCODING-XXX
|
||||
authorization:
|
||||
- AUTHORIZATION-XXX
|
||||
connection:
|
||||
- keep-alive
|
||||
content-length:
|
||||
- '1551'
|
||||
content-type:
|
||||
- application/json
|
||||
cookie:
|
||||
- COOKIE-XXX
|
||||
host:
|
||||
- api.openai.com
|
||||
x-stainless-arch:
|
||||
- X-STAINLESS-ARCH-XXX
|
||||
x-stainless-async:
|
||||
- 'false'
|
||||
x-stainless-helper-method:
|
||||
- beta.chat.completions.parse
|
||||
x-stainless-lang:
|
||||
- python
|
||||
x-stainless-os:
|
||||
- X-STAINLESS-OS-XXX
|
||||
x-stainless-package-version:
|
||||
- 1.83.0
|
||||
x-stainless-read-timeout:
|
||||
- X-STAINLESS-READ-TIMEOUT-XXX
|
||||
x-stainless-retry-count:
|
||||
- '0'
|
||||
x-stainless-runtime:
|
||||
- CPython
|
||||
x-stainless-runtime-version:
|
||||
- 3.13.3
|
||||
method: POST
|
||||
uri: https://api.openai.com/v1/chat/completions
|
||||
response:
|
||||
body:
|
||||
string: "{\n \"id\": \"chatcmpl-D3XAfKiTG5RhuaUAQG4pelI9e6W7T\",\n \"object\":
|
||||
\"chat.completion\",\n \"created\": 1769734865,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n
|
||||
\ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\":
|
||||
\"assistant\",\n \"content\": \"{\\\"operation\\\":\\\"Addition\\\",\\\"result\\\":42,\\\"explanation\\\":\\\"The
|
||||
result of adding 15 and 27 is 42.\\\"}\",\n \"refusal\": null,\n \"annotations\":
|
||||
[]\n },\n \"logprobs\": null,\n \"finish_reason\": \"stop\"\n
|
||||
\ }\n ],\n \"usage\": {\n \"prompt_tokens\": 215,\n \"completion_tokens\":
|
||||
31,\n \"total_tokens\": 246,\n \"prompt_tokens_details\": {\n \"cached_tokens\":
|
||||
0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\":
|
||||
{\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\":
|
||||
0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\":
|
||||
\"default\",\n \"system_fingerprint\": \"fp_1590f93f9d\"\n}\n"
|
||||
headers:
|
||||
CF-RAY:
|
||||
- CF-RAY-XXX
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 30 Jan 2026 01:01:06 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Strict-Transport-Security:
|
||||
- STS-XXX
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
X-Content-Type-Options:
|
||||
- X-CONTENT-TYPE-XXX
|
||||
access-control-expose-headers:
|
||||
- ACCESS-CONTROL-XXX
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
cf-cache-status:
|
||||
- DYNAMIC
|
||||
openai-organization:
|
||||
- OPENAI-ORG-XXX
|
||||
openai-processing-ms:
|
||||
- '979'
|
||||
openai-project:
|
||||
- OPENAI-PROJECT-XXX
|
||||
openai-version:
|
||||
- '2020-10-01'
|
||||
x-openai-proxy-wasm:
|
||||
- v0.1
|
||||
x-ratelimit-limit-requests:
|
||||
- X-RATELIMIT-LIMIT-REQUESTS-XXX
|
||||
x-ratelimit-limit-tokens:
|
||||
- X-RATELIMIT-LIMIT-TOKENS-XXX
|
||||
x-ratelimit-remaining-requests:
|
||||
- X-RATELIMIT-REMAINING-REQUESTS-XXX
|
||||
x-ratelimit-remaining-tokens:
|
||||
- X-RATELIMIT-REMAINING-TOKENS-XXX
|
||||
x-ratelimit-reset-requests:
|
||||
- X-RATELIMIT-RESET-REQUESTS-XXX
|
||||
x-ratelimit-reset-tokens:
|
||||
- X-RATELIMIT-RESET-TOKENS-XXX
|
||||
x-request-id:
|
||||
- X-REQUEST-ID-XXX
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
version: 1
|
||||
@@ -0,0 +1,124 @@
|
||||
interactions:
|
||||
- request:
|
||||
body: '{"messages":[{"role":"system","content":"You are Analyst. You are an expert
|
||||
analyst who provides clear, structured insights.\nYour personal goal is: Provide
|
||||
structured analysis on topics"},{"role":"user","content":"\nCurrent Task: Analyze
|
||||
the benefits of remote work briefly. Keep it concise.\n\nProvide your complete
|
||||
response:"}],"model":"gpt-4o-mini","response_format":{"type":"json_schema","json_schema":{"schema":{"description":"Structured
|
||||
output for analysis results.","properties":{"topic":{"description":"The topic
|
||||
analyzed","title":"Topic","type":"string"},"key_points":{"description":"Key
|
||||
insights from the analysis","items":{"type":"string"},"title":"Key Points","type":"array"},"summary":{"description":"Brief
|
||||
summary of findings","title":"Summary","type":"string"}},"required":["topic","key_points","summary"],"title":"AnalysisResult","type":"object","additionalProperties":false},"name":"AnalysisResult","strict":true}},"stream":false}'
|
||||
headers:
|
||||
User-Agent:
|
||||
- X-USER-AGENT-XXX
|
||||
accept:
|
||||
- application/json
|
||||
accept-encoding:
|
||||
- ACCEPT-ENCODING-XXX
|
||||
authorization:
|
||||
- AUTHORIZATION-XXX
|
||||
connection:
|
||||
- keep-alive
|
||||
content-length:
|
||||
- '948'
|
||||
content-type:
|
||||
- application/json
|
||||
host:
|
||||
- api.openai.com
|
||||
x-stainless-arch:
|
||||
- X-STAINLESS-ARCH-XXX
|
||||
x-stainless-async:
|
||||
- 'false'
|
||||
x-stainless-helper-method:
|
||||
- beta.chat.completions.parse
|
||||
x-stainless-lang:
|
||||
- python
|
||||
x-stainless-os:
|
||||
- X-STAINLESS-OS-XXX
|
||||
x-stainless-package-version:
|
||||
- 1.83.0
|
||||
x-stainless-read-timeout:
|
||||
- X-STAINLESS-READ-TIMEOUT-XXX
|
||||
x-stainless-retry-count:
|
||||
- '0'
|
||||
x-stainless-runtime:
|
||||
- CPython
|
||||
x-stainless-runtime-version:
|
||||
- 3.13.3
|
||||
method: POST
|
||||
uri: https://api.openai.com/v1/chat/completions
|
||||
response:
|
||||
body:
|
||||
string: "{\n \"id\": \"chatcmpl-D3XAhbqz9oWLR9vacFT33oAOTIeeL\",\n \"object\":
|
||||
\"chat.completion\",\n \"created\": 1769734867,\n \"model\": \"gpt-4o-mini-2024-07-18\",\n
|
||||
\ \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\":
|
||||
\"assistant\",\n \"content\": \"{\\\"topic\\\":\\\"Benefits of Remote
|
||||
Work\\\",\\\"key_points\\\":[\\\"Increased flexibility in work hours allows
|
||||
for better work-life balance.\\\",\\\"Cost savings for both employers and
|
||||
employees (e.g., reduced commuting costs and office space).\\\",\\\"Access
|
||||
to a larger talent pool unrestricted by geographical boundaries.\\\",\\\"Improved
|
||||
productivity due to fewer office-related distractions.\\\",\\\"Reduction in
|
||||
environmental impact from decreased commuting.\\\"],\\\"summary\\\":\\\"Remote
|
||||
work offers significant advantages including flexibility, cost savings, broader
|
||||
hiring opportunities, enhanced productivity, and environmental benefits.\\\"}\",\n
|
||||
\ \"refusal\": null,\n \"annotations\": []\n },\n \"logprobs\":
|
||||
null,\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\":
|
||||
154,\n \"completion_tokens\": 98,\n \"total_tokens\": 252,\n \"prompt_tokens_details\":
|
||||
{\n \"cached_tokens\": 0,\n \"audio_tokens\": 0\n },\n \"completion_tokens_details\":
|
||||
{\n \"reasoning_tokens\": 0,\n \"audio_tokens\": 0,\n \"accepted_prediction_tokens\":
|
||||
0,\n \"rejected_prediction_tokens\": 0\n }\n },\n \"service_tier\":
|
||||
\"default\",\n \"system_fingerprint\": \"fp_1590f93f9d\"\n}\n"
|
||||
headers:
|
||||
CF-RAY:
|
||||
- CF-RAY-XXX
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 30 Jan 2026 01:01:10 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- SET-COOKIE-XXX
|
||||
Strict-Transport-Security:
|
||||
- STS-XXX
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
X-Content-Type-Options:
|
||||
- X-CONTENT-TYPE-XXX
|
||||
access-control-expose-headers:
|
||||
- ACCESS-CONTROL-XXX
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
cf-cache-status:
|
||||
- DYNAMIC
|
||||
openai-organization:
|
||||
- OPENAI-ORG-XXX
|
||||
openai-processing-ms:
|
||||
- '2849'
|
||||
openai-project:
|
||||
- OPENAI-PROJECT-XXX
|
||||
openai-version:
|
||||
- '2020-10-01'
|
||||
x-openai-proxy-wasm:
|
||||
- v0.1
|
||||
x-ratelimit-limit-requests:
|
||||
- X-RATELIMIT-LIMIT-REQUESTS-XXX
|
||||
x-ratelimit-limit-tokens:
|
||||
- X-RATELIMIT-LIMIT-TOKENS-XXX
|
||||
x-ratelimit-remaining-requests:
|
||||
- X-RATELIMIT-REMAINING-REQUESTS-XXX
|
||||
x-ratelimit-remaining-tokens:
|
||||
- X-RATELIMIT-REMAINING-TOKENS-XXX
|
||||
x-ratelimit-reset-requests:
|
||||
- X-RATELIMIT-RESET-REQUESTS-XXX
|
||||
x-ratelimit-reset-tokens:
|
||||
- X-RATELIMIT-RESET-TOKENS-XXX
|
||||
x-request-id:
|
||||
- X-REQUEST-ID-XXX
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
version: 1
|
||||
@@ -867,3 +867,86 @@ def test_anthropic_function_calling():
|
||||
assert len(result) > 0
|
||||
# Verify the response includes information about Tokyo's weather
|
||||
assert "tokyo" in result.lower() or "72" in result
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Agent Kickoff Structured Output Tests
|
||||
# =============================================================================
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
def test_anthropic_agent_kickoff_structured_output_without_tools():
|
||||
"""
|
||||
Test that agent kickoff returns structured output without tools.
|
||||
This tests native structured output handling for Anthropic models.
|
||||
"""
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
class AnalysisResult(BaseModel):
|
||||
"""Structured output for analysis results."""
|
||||
|
||||
topic: str = Field(description="The topic analyzed")
|
||||
key_points: list[str] = Field(description="Key insights from the analysis")
|
||||
summary: str = Field(description="Brief summary of findings")
|
||||
|
||||
agent = Agent(
|
||||
role="Analyst",
|
||||
goal="Provide structured analysis on topics",
|
||||
backstory="You are an expert analyst who provides clear, structured insights.",
|
||||
llm=LLM(model="anthropic/claude-3-5-haiku-20241022"),
|
||||
tools=[],
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
result = agent.kickoff(
|
||||
messages="Analyze the benefits of remote work briefly. Keep it concise.",
|
||||
response_format=AnalysisResult,
|
||||
)
|
||||
|
||||
assert result.pydantic is not None, "Expected pydantic output but got None"
|
||||
assert isinstance(result.pydantic, AnalysisResult), f"Expected AnalysisResult but got {type(result.pydantic)}"
|
||||
assert result.pydantic.topic, "Topic should not be empty"
|
||||
assert len(result.pydantic.key_points) > 0, "Should have at least one key point"
|
||||
assert result.pydantic.summary, "Summary should not be empty"
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
def test_anthropic_agent_kickoff_structured_output_with_tools():
|
||||
"""
|
||||
Test that agent kickoff returns structured output after using tools.
|
||||
This tests post-tool-call structured output handling for Anthropic models.
|
||||
"""
|
||||
from pydantic import BaseModel, Field
|
||||
from crewai.tools import tool
|
||||
|
||||
class CalculationResult(BaseModel):
|
||||
"""Structured output for calculation results."""
|
||||
|
||||
operation: str = Field(description="The mathematical operation performed")
|
||||
result: int = Field(description="The result of the calculation")
|
||||
explanation: str = Field(description="Brief explanation of the calculation")
|
||||
|
||||
@tool
|
||||
def add_numbers(a: int, b: int) -> int:
|
||||
"""Add two numbers together and return the sum."""
|
||||
return a + b
|
||||
|
||||
agent = Agent(
|
||||
role="Calculator",
|
||||
goal="Perform calculations using available tools",
|
||||
backstory="You are a calculator assistant that uses tools to compute results.",
|
||||
llm=LLM(model="anthropic/claude-3-5-haiku-20241022"),
|
||||
tools=[add_numbers],
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
result = agent.kickoff(
|
||||
messages="Calculate 15 + 27 using your add_numbers tool. Report the result.",
|
||||
response_format=CalculationResult,
|
||||
)
|
||||
|
||||
assert result.pydantic is not None, "Expected pydantic output but got None"
|
||||
assert isinstance(result.pydantic, CalculationResult), f"Expected CalculationResult but got {type(result.pydantic)}"
|
||||
assert result.pydantic.result == 42, f"Expected result 42 but got {result.pydantic.result}"
|
||||
assert result.pydantic.operation, "Operation should not be empty"
|
||||
assert result.pydantic.explanation, "Explanation should not be empty"
|
||||
|
||||
@@ -1215,3 +1215,86 @@ def test_azure_streaming_returns_usage_metrics():
|
||||
assert result.token_usage.prompt_tokens > 0
|
||||
assert result.token_usage.completion_tokens > 0
|
||||
assert result.token_usage.successful_requests >= 1
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Agent Kickoff Structured Output Tests
|
||||
# =============================================================================
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
def test_azure_agent_kickoff_structured_output_without_tools():
|
||||
"""
|
||||
Test that agent kickoff returns structured output without tools.
|
||||
This tests native structured output handling for Azure OpenAI models.
|
||||
"""
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
class AnalysisResult(BaseModel):
|
||||
"""Structured output for analysis results."""
|
||||
|
||||
topic: str = Field(description="The topic analyzed")
|
||||
key_points: list[str] = Field(description="Key insights from the analysis")
|
||||
summary: str = Field(description="Brief summary of findings")
|
||||
|
||||
agent = Agent(
|
||||
role="Analyst",
|
||||
goal="Provide structured analysis on topics",
|
||||
backstory="You are an expert analyst who provides clear, structured insights.",
|
||||
llm=LLM(model="azure/gpt-4o-mini"),
|
||||
tools=[],
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
result = agent.kickoff(
|
||||
messages="Analyze the benefits of remote work briefly. Keep it concise.",
|
||||
response_format=AnalysisResult,
|
||||
)
|
||||
|
||||
assert result.pydantic is not None, "Expected pydantic output but got None"
|
||||
assert isinstance(result.pydantic, AnalysisResult), f"Expected AnalysisResult but got {type(result.pydantic)}"
|
||||
assert result.pydantic.topic, "Topic should not be empty"
|
||||
assert len(result.pydantic.key_points) > 0, "Should have at least one key point"
|
||||
assert result.pydantic.summary, "Summary should not be empty"
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
def test_azure_agent_kickoff_structured_output_with_tools():
|
||||
"""
|
||||
Test that agent kickoff returns structured output after using tools.
|
||||
This tests post-tool-call structured output handling for Azure OpenAI models.
|
||||
"""
|
||||
from pydantic import BaseModel, Field
|
||||
from crewai.tools import tool
|
||||
|
||||
class CalculationResult(BaseModel):
|
||||
"""Structured output for calculation results."""
|
||||
|
||||
operation: str = Field(description="The mathematical operation performed")
|
||||
result: int = Field(description="The result of the calculation")
|
||||
explanation: str = Field(description="Brief explanation of the calculation")
|
||||
|
||||
@tool
|
||||
def add_numbers(a: int, b: int) -> int:
|
||||
"""Add two numbers together and return the sum."""
|
||||
return a + b
|
||||
|
||||
agent = Agent(
|
||||
role="Calculator",
|
||||
goal="Perform calculations using available tools",
|
||||
backstory="You are a calculator assistant that uses tools to compute results.",
|
||||
llm=LLM(model="azure/gpt-4o-mini"),
|
||||
tools=[add_numbers],
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
result = agent.kickoff(
|
||||
messages="Calculate 15 + 27 using your add_numbers tool. Report the result.",
|
||||
response_format=CalculationResult,
|
||||
)
|
||||
|
||||
assert result.pydantic is not None, "Expected pydantic output but got None"
|
||||
assert isinstance(result.pydantic, CalculationResult), f"Expected CalculationResult but got {type(result.pydantic)}"
|
||||
assert result.pydantic.result == 42, f"Expected result 42 but got {result.pydantic.result}"
|
||||
assert result.pydantic.operation, "Operation should not be empty"
|
||||
assert result.pydantic.explanation, "Explanation should not be empty"
|
||||
|
||||
@@ -12,7 +12,12 @@ from crewai.task import Task
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_aws_credentials():
|
||||
"""Automatically mock AWS credentials and boto3 Session for all tests in this module."""
|
||||
"""Mock AWS credentials and boto3 Session for tests only if real credentials are not set."""
|
||||
# If real AWS credentials exist, don't mock - allow real API calls
|
||||
if "AWS_ACCESS_KEY_ID" in os.environ and "AWS_SECRET_ACCESS_KEY" in os.environ:
|
||||
yield None, None
|
||||
return
|
||||
|
||||
with patch.dict(os.environ, {
|
||||
"AWS_ACCESS_KEY_ID": "test-access-key",
|
||||
"AWS_SECRET_ACCESS_KEY": "test-secret-key",
|
||||
|
||||
@@ -12,8 +12,11 @@ from crewai.task import Task
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_google_api_key():
|
||||
"""Automatically mock GOOGLE_API_KEY for all tests in this module."""
|
||||
with patch.dict(os.environ, {"GOOGLE_API_KEY": "test-key"}):
|
||||
"""Mock GOOGLE_API_KEY for tests only if real keys are not set."""
|
||||
if "GOOGLE_API_KEY" not in os.environ and "GEMINI_API_KEY" not in os.environ:
|
||||
with patch.dict(os.environ, {"GOOGLE_API_KEY": "test-key"}):
|
||||
yield
|
||||
else:
|
||||
yield
|
||||
|
||||
|
||||
@@ -927,3 +930,86 @@ def test_gemini_1_5_response_model_uses_response_schema():
|
||||
# For Gemini 1.5, response_schema should be the Pydantic model itself
|
||||
# The SDK handles conversion internally
|
||||
assert schema is TestResponse or isinstance(schema, type)
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Agent Kickoff Structured Output Tests
|
||||
# =============================================================================
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
def test_gemini_agent_kickoff_structured_output_without_tools():
|
||||
"""
|
||||
Test that agent kickoff returns structured output without tools.
|
||||
This tests native structured output handling for Gemini models.
|
||||
"""
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
class AnalysisResult(BaseModel):
|
||||
"""Structured output for analysis results."""
|
||||
|
||||
topic: str = Field(description="The topic analyzed")
|
||||
key_points: list[str] = Field(description="Key insights from the analysis")
|
||||
summary: str = Field(description="Brief summary of findings")
|
||||
|
||||
agent = Agent(
|
||||
role="Analyst",
|
||||
goal="Provide structured analysis on topics",
|
||||
backstory="You are an expert analyst who provides clear, structured insights.",
|
||||
llm=LLM(model="google/gemini-2.0-flash-001"),
|
||||
tools=[],
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
result = agent.kickoff(
|
||||
messages="Analyze the benefits of remote work briefly. Keep it concise.",
|
||||
response_format=AnalysisResult,
|
||||
)
|
||||
|
||||
assert result.pydantic is not None, "Expected pydantic output but got None"
|
||||
assert isinstance(result.pydantic, AnalysisResult), f"Expected AnalysisResult but got {type(result.pydantic)}"
|
||||
assert result.pydantic.topic, "Topic should not be empty"
|
||||
assert len(result.pydantic.key_points) > 0, "Should have at least one key point"
|
||||
assert result.pydantic.summary, "Summary should not be empty"
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
def test_gemini_agent_kickoff_structured_output_with_tools():
|
||||
"""
|
||||
Test that agent kickoff returns structured output after using tools.
|
||||
This tests post-tool-call structured output handling for Gemini models.
|
||||
"""
|
||||
from pydantic import BaseModel, Field
|
||||
from crewai.tools import tool
|
||||
|
||||
class CalculationResult(BaseModel):
|
||||
"""Structured output for calculation results."""
|
||||
|
||||
operation: str = Field(description="The mathematical operation performed")
|
||||
result: int = Field(description="The result of the calculation")
|
||||
explanation: str = Field(description="Brief explanation of the calculation")
|
||||
|
||||
@tool
|
||||
def add_numbers(a: int, b: int) -> int:
|
||||
"""Add two numbers together and return the sum."""
|
||||
return a + b
|
||||
|
||||
agent = Agent(
|
||||
role="Calculator",
|
||||
goal="Perform calculations using available tools",
|
||||
backstory="You are a calculator assistant that uses tools to compute results.",
|
||||
llm=LLM(model="google/gemini-2.0-flash-001"),
|
||||
tools=[add_numbers],
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
result = agent.kickoff(
|
||||
messages="Calculate 15 + 27 using your add_numbers tool. Report the result.",
|
||||
response_format=CalculationResult,
|
||||
)
|
||||
|
||||
assert result.pydantic is not None, "Expected pydantic output but got None"
|
||||
assert isinstance(result.pydantic, CalculationResult), f"Expected CalculationResult but got {type(result.pydantic)}"
|
||||
assert result.pydantic.result == 42, f"Expected result 42 but got {result.pydantic.result}"
|
||||
assert result.pydantic.operation, "Operation should not be empty"
|
||||
assert result.pydantic.explanation, "Explanation should not be empty"
|
||||
|
||||
@@ -1397,3 +1397,86 @@ def test_openai_responses_api_both_auto_chains_work_together():
|
||||
assert params.get("previous_response_id") == "resp_123"
|
||||
assert "reasoning.encrypted_content" in params["include"]
|
||||
assert len(params["input"]) == 2 # Reasoning item + message
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Agent Kickoff Structured Output Tests
|
||||
# =============================================================================
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
def test_openai_agent_kickoff_structured_output_without_tools():
|
||||
"""
|
||||
Test that agent kickoff returns structured output without tools.
|
||||
This tests native structured output handling for OpenAI models.
|
||||
"""
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
class AnalysisResult(BaseModel):
|
||||
"""Structured output for analysis results."""
|
||||
|
||||
topic: str = Field(description="The topic analyzed")
|
||||
key_points: list[str] = Field(description="Key insights from the analysis")
|
||||
summary: str = Field(description="Brief summary of findings")
|
||||
|
||||
agent = Agent(
|
||||
role="Analyst",
|
||||
goal="Provide structured analysis on topics",
|
||||
backstory="You are an expert analyst who provides clear, structured insights.",
|
||||
llm=LLM(model="gpt-4o-mini"),
|
||||
tools=[],
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
result = agent.kickoff(
|
||||
messages="Analyze the benefits of remote work briefly. Keep it concise.",
|
||||
response_format=AnalysisResult,
|
||||
)
|
||||
|
||||
assert result.pydantic is not None, "Expected pydantic output but got None"
|
||||
assert isinstance(result.pydantic, AnalysisResult), f"Expected AnalysisResult but got {type(result.pydantic)}"
|
||||
assert result.pydantic.topic, "Topic should not be empty"
|
||||
assert len(result.pydantic.key_points) > 0, "Should have at least one key point"
|
||||
assert result.pydantic.summary, "Summary should not be empty"
|
||||
|
||||
|
||||
@pytest.mark.vcr()
|
||||
def test_openai_agent_kickoff_structured_output_with_tools():
|
||||
"""
|
||||
Test that agent kickoff returns structured output after using tools.
|
||||
This tests post-tool-call structured output handling for OpenAI models.
|
||||
"""
|
||||
from pydantic import BaseModel, Field
|
||||
from crewai.tools import tool
|
||||
|
||||
class CalculationResult(BaseModel):
|
||||
"""Structured output for calculation results."""
|
||||
|
||||
operation: str = Field(description="The mathematical operation performed")
|
||||
result: int = Field(description="The result of the calculation")
|
||||
explanation: str = Field(description="Brief explanation of the calculation")
|
||||
|
||||
@tool
|
||||
def add_numbers(a: int, b: int) -> int:
|
||||
"""Add two numbers together and return the sum."""
|
||||
return a + b
|
||||
|
||||
agent = Agent(
|
||||
role="Calculator",
|
||||
goal="Perform calculations using available tools",
|
||||
backstory="You are a calculator assistant that uses tools to compute results.",
|
||||
llm=LLM(model="gpt-4o-mini"),
|
||||
tools=[add_numbers],
|
||||
verbose=True,
|
||||
)
|
||||
|
||||
result = agent.kickoff(
|
||||
messages="Calculate 15 + 27 using your add_numbers tool. Report the result.",
|
||||
response_format=CalculationResult,
|
||||
)
|
||||
|
||||
assert result.pydantic is not None, "Expected pydantic output but got None"
|
||||
assert isinstance(result.pydantic, CalculationResult), f"Expected CalculationResult but got {type(result.pydantic)}"
|
||||
assert result.pydantic.result == 42, f"Expected result 42 but got {result.pydantic.result}"
|
||||
assert result.pydantic.operation, "Operation should not be empty"
|
||||
assert result.pydantic.explanation, "Explanation should not be empty"
|
||||
|
||||
Reference in New Issue
Block a user