Skip to content

Commit 45ef4d0

Browse files
feat(client): adds support for code-execution-2025-08-26 tool
1 parent b176ad5 commit 45ef4d0

File tree

52 files changed

+2192
-493
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2192
-493
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 23
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic%2Fanthropic-0f40955413f5d04b30ecd6c2f5002ce36a85c320cc671911ff70902fed6e342c.yml
3-
openapi_spec_hash: 92a37231c475ddfec0093718cd24f7ab
4-
config_hash: 21a1f78a64f751cc59c36f88095511cc
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic%2Fanthropic-c150096acd4c91e98b0b888f5cb61e9c2d73c433f165f6fe343a8af50ff40daa.yml
3+
openapi_spec_hash: b0fc4933c9280be98c637752c5cb3acc
4+
config_hash: 6c2c7f9a9019f8299e3fa94c6ac190d1

src/Beta/BetaErrorResponse.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
/**
1212
* @phpstan-type beta_error_response = array{
1313
* error: BetaInvalidRequestError|BetaAuthenticationError|BetaBillingError|BetaPermissionError|BetaNotFoundError|BetaRateLimitError|BetaGatewayTimeoutError|BetaAPIError|BetaOverloadedError,
14+
* requestID: string|null,
1415
* type: string,
1516
* }
1617
*/
@@ -25,18 +26,21 @@ final class BetaErrorResponse implements BaseModel
2526
#[Api(union: BetaError::class)]
2627
public BetaInvalidRequestError|BetaAuthenticationError|BetaBillingError|BetaPermissionError|BetaNotFoundError|BetaRateLimitError|BetaGatewayTimeoutError|BetaAPIError|BetaOverloadedError $error;
2728

29+
#[Api('request_id')]
30+
public ?string $requestID;
31+
2832
/**
2933
* `new BetaErrorResponse()` is missing required properties by the API.
3034
*
3135
* To enforce required parameters use
3236
* ```
33-
* BetaErrorResponse::with(error: ...)
37+
* BetaErrorResponse::with(error: ..., requestID: ...)
3438
* ```
3539
*
3640
* Otherwise ensure the following setters are called
3741
*
3842
* ```
39-
* (new BetaErrorResponse)->withError(...)
43+
* (new BetaErrorResponse)->withError(...)->withRequestID(...)
4044
* ```
4145
*/
4246
public function __construct()
@@ -51,10 +55,12 @@ public function __construct()
5155
*/
5256
public static function with(
5357
BetaInvalidRequestError|BetaAuthenticationError|BetaBillingError|BetaPermissionError|BetaNotFoundError|BetaRateLimitError|BetaGatewayTimeoutError|BetaAPIError|BetaOverloadedError $error,
58+
?string $requestID,
5459
): self {
5560
$obj = new self;
5661

5762
$obj->error = $error;
63+
$obj->requestID = $requestID;
5864

5965
return $obj;
6066
}
@@ -67,4 +73,12 @@ public function withError(
6773

6874
return $obj;
6975
}
76+
77+
public function withRequestID(?string $requestID): self
78+
{
79+
$obj = clone $this;
80+
$obj->requestID = $requestID;
81+
82+
return $obj;
83+
}
7084
}

src/Beta/Messages/Batches/BatchCreateParams/Request/Params.php

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Anthropic\Beta\Messages\Batches\BatchCreateParams\Request\Params\ServiceTier;
88
use Anthropic\Beta\Messages\Batches\BatchCreateParams\Request\Params\System;
99
use Anthropic\Beta\Messages\BetaCodeExecutionTool20250522;
10+
use Anthropic\Beta\Messages\BetaCodeExecutionTool20250825;
1011
use Anthropic\Beta\Messages\BetaMessageParam;
1112
use Anthropic\Beta\Messages\BetaMetadata;
1213
use Anthropic\Beta\Messages\BetaRequestMCPServerURLDefinition;
@@ -54,7 +55,7 @@
5455
* temperature?: float|null,
5556
* thinking?: null|BetaThinkingConfigEnabled|BetaThinkingConfigDisabled,
5657
* toolChoice?: null|BetaToolChoiceAuto|BetaToolChoiceAny|BetaToolChoiceTool|BetaToolChoiceNone,
57-
* tools?: list<BetaTool|BetaToolBash20241022|BetaToolBash20250124|BetaCodeExecutionTool20250522|BetaToolComputerUse20241022|BetaToolComputerUse20250124|BetaToolTextEditor20241022|BetaToolTextEditor20250124|BetaToolTextEditor20250429|BetaToolTextEditor20250728|BetaWebSearchTool20250305>|null,
58+
* tools?: list<BetaTool|BetaToolBash20241022|BetaToolBash20250124|BetaCodeExecutionTool20250522|BetaCodeExecutionTool20250825|BetaToolComputerUse20241022|BetaToolComputerUse20250124|BetaToolTextEditor20241022|BetaToolTextEditor20250124|BetaToolTextEditor20250429|BetaToolTextEditor20250728|BetaWebSearchTool20250305>|null,
5859
* topK?: int|null,
5960
* topP?: float|null,
6061
* }
@@ -118,25 +119,7 @@ final class Params implements BaseModel
118119
* {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
119120
* ```
120121
*
121-
* Starting with Claude 3 models, you can also send image content blocks:
122-
*
123-
* ```json
124-
* {"role": "user", "content": [
125-
* {
126-
* "type": "image",
127-
* "source": {
128-
* "type": "base64",
129-
* "media_type": "image/jpeg",
130-
* "data": "/9j/4AAQSkZJRg...",
131-
* }
132-
* },
133-
* {"type": "text", "text": "What is in this image?"}
134-
* ]}
135-
* ```
136-
*
137-
* We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
138-
*
139-
* See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
122+
* See [input examples](https://docs.anthropic.com/en/api/messages-examples).
140123
*
141124
* Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API.
142125
*
@@ -308,7 +291,7 @@ final class Params implements BaseModel
308291
*
309292
* See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
310293
*
311-
* @var list<BetaTool|BetaToolBash20241022|BetaToolBash20250124|BetaCodeExecutionTool20250522|BetaToolComputerUse20241022|BetaToolComputerUse20250124|BetaToolTextEditor20241022|BetaToolTextEditor20250124|BetaToolTextEditor20250429|BetaToolTextEditor20250728|BetaWebSearchTool20250305>|null $tools
294+
* @var list<BetaTool|BetaToolBash20241022|BetaToolBash20250124|BetaCodeExecutionTool20250522|BetaCodeExecutionTool20250825|BetaToolComputerUse20241022|BetaToolComputerUse20250124|BetaToolTextEditor20241022|BetaToolTextEditor20250124|BetaToolTextEditor20250429|BetaToolTextEditor20250728|BetaWebSearchTool20250305>|null $tools
312295
*/
313296
#[Api(list: BetaToolUnion::class, optional: true)]
314297
public ?array $tools;
@@ -363,7 +346,7 @@ public function __construct()
363346
* @param ServiceTier::* $serviceTier
364347
* @param list<string> $stopSequences
365348
* @param string|list<BetaTextBlockParam> $system
366-
* @param list<BetaTool|BetaToolBash20241022|BetaToolBash20250124|BetaCodeExecutionTool20250522|BetaToolComputerUse20241022|BetaToolComputerUse20250124|BetaToolTextEditor20241022|BetaToolTextEditor20250124|BetaToolTextEditor20250429|BetaToolTextEditor20250728|BetaWebSearchTool20250305> $tools
349+
* @param list<BetaTool|BetaToolBash20241022|BetaToolBash20250124|BetaCodeExecutionTool20250522|BetaCodeExecutionTool20250825|BetaToolComputerUse20241022|BetaToolComputerUse20250124|BetaToolTextEditor20241022|BetaToolTextEditor20250124|BetaToolTextEditor20250429|BetaToolTextEditor20250728|BetaWebSearchTool20250305> $tools
367350
*/
368351
public static function with(
369352
int $maxTokens,
@@ -465,25 +448,7 @@ public function withMaxTokens(int $maxTokens): self
465448
* {"role": "user", "content": [{"type": "text", "text": "Hello, Claude"}]}
466449
* ```
467450
*
468-
* Starting with Claude 3 models, you can also send image content blocks:
469-
*
470-
* ```json
471-
* {"role": "user", "content": [
472-
* {
473-
* "type": "image",
474-
* "source": {
475-
* "type": "base64",
476-
* "media_type": "image/jpeg",
477-
* "data": "/9j/4AAQSkZJRg...",
478-
* }
479-
* },
480-
* {"type": "text", "text": "What is in this image?"}
481-
* ]}
482-
* ```
483-
*
484-
* We currently support the `base64` source type for images, and the `image/jpeg`, `image/png`, `image/gif`, and `image/webp` media types.
485-
*
486-
* See [examples](https://docs.anthropic.com/en/api/messages-examples#vision) for more input examples.
451+
* See [input examples](https://docs.anthropic.com/en/api/messages-examples).
487452
*
488453
* Note that if you want to include a [system prompt](https://docs.anthropic.com/en/docs/system-prompts), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API.
489454
*
@@ -713,7 +678,7 @@ public function withToolChoice(
713678
*
714679
* See our [guide](https://docs.anthropic.com/en/docs/tool-use) for more details.
715680
*
716-
* @param list<BetaTool|BetaToolBash20241022|BetaToolBash20250124|BetaCodeExecutionTool20250522|BetaToolComputerUse20241022|BetaToolComputerUse20250124|BetaToolTextEditor20241022|BetaToolTextEditor20250124|BetaToolTextEditor20250429|BetaToolTextEditor20250728|BetaWebSearchTool20250305> $tools
681+
* @param list<BetaTool|BetaToolBash20241022|BetaToolBash20250124|BetaCodeExecutionTool20250522|BetaCodeExecutionTool20250825|BetaToolComputerUse20241022|BetaToolComputerUse20250124|BetaToolTextEditor20241022|BetaToolTextEditor20250124|BetaToolTextEditor20250429|BetaToolTextEditor20250728|BetaWebSearchTool20250305> $tools
717682
*/
718683
public function withTools(array $tools): self
719684
{
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Anthropic\Beta\Messages;
6+
7+
use Anthropic\Core\Attributes\Api;
8+
use Anthropic\Core\Concerns\SdkModel;
9+
use Anthropic\Core\Contracts\BaseModel;
10+
11+
/**
12+
* @phpstan-type beta_bash_code_execution_output_block = array{
13+
* fileID: string, type: string
14+
* }
15+
*/
16+
final class BetaBashCodeExecutionOutputBlock implements BaseModel
17+
{
18+
/** @use SdkModel<beta_bash_code_execution_output_block> */
19+
use SdkModel;
20+
21+
#[Api]
22+
public string $type = 'bash_code_execution_output';
23+
24+
#[Api('file_id')]
25+
public string $fileID;
26+
27+
/**
28+
* `new BetaBashCodeExecutionOutputBlock()` is missing required properties by the API.
29+
*
30+
* To enforce required parameters use
31+
* ```
32+
* BetaBashCodeExecutionOutputBlock::with(fileID: ...)
33+
* ```
34+
*
35+
* Otherwise ensure the following setters are called
36+
*
37+
* ```
38+
* (new BetaBashCodeExecutionOutputBlock)->withFileID(...)
39+
* ```
40+
*/
41+
public function __construct()
42+
{
43+
$this->initialize();
44+
}
45+
46+
/**
47+
* Construct an instance from the required parameters.
48+
*
49+
* You must use named parameters to construct any parameters with a default value.
50+
*/
51+
public static function with(string $fileID): self
52+
{
53+
$obj = new self;
54+
55+
$obj->fileID = $fileID;
56+
57+
return $obj;
58+
}
59+
60+
public function withFileID(string $fileID): self
61+
{
62+
$obj = clone $this;
63+
$obj->fileID = $fileID;
64+
65+
return $obj;
66+
}
67+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Anthropic\Beta\Messages;
6+
7+
use Anthropic\Core\Attributes\Api;
8+
use Anthropic\Core\Concerns\SdkModel;
9+
use Anthropic\Core\Contracts\BaseModel;
10+
11+
/**
12+
* @phpstan-type beta_bash_code_execution_output_block_param = array{
13+
* fileID: string, type: string
14+
* }
15+
*/
16+
final class BetaBashCodeExecutionOutputBlockParam implements BaseModel
17+
{
18+
/** @use SdkModel<beta_bash_code_execution_output_block_param> */
19+
use SdkModel;
20+
21+
#[Api]
22+
public string $type = 'bash_code_execution_output';
23+
24+
#[Api('file_id')]
25+
public string $fileID;
26+
27+
/**
28+
* `new BetaBashCodeExecutionOutputBlockParam()` is missing required properties by the API.
29+
*
30+
* To enforce required parameters use
31+
* ```
32+
* BetaBashCodeExecutionOutputBlockParam::with(fileID: ...)
33+
* ```
34+
*
35+
* Otherwise ensure the following setters are called
36+
*
37+
* ```
38+
* (new BetaBashCodeExecutionOutputBlockParam)->withFileID(...)
39+
* ```
40+
*/
41+
public function __construct()
42+
{
43+
$this->initialize();
44+
}
45+
46+
/**
47+
* Construct an instance from the required parameters.
48+
*
49+
* You must use named parameters to construct any parameters with a default value.
50+
*/
51+
public static function with(string $fileID): self
52+
{
53+
$obj = new self;
54+
55+
$obj->fileID = $fileID;
56+
57+
return $obj;
58+
}
59+
60+
public function withFileID(string $fileID): self
61+
{
62+
$obj = clone $this;
63+
$obj->fileID = $fileID;
64+
65+
return $obj;
66+
}
67+
}

0 commit comments

Comments
 (0)