Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.77.1"
".": "0.78.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 34
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic%2Fanthropic-4526612d12e919de063708c05d15b78902b5a52d33a6e3eb45708c562d338b18.yml
openapi_spec_hash: 346bef71688ca79b107cf84bc09249ac
config_hash: 0b96ef87fc0758bbc543ffa8435baa2a
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic%2Fanthropic-267f913f89364cb8df3a758335a974b43eb98019a8ceef0a9b0a94ef34c2a3b5.yml
openapi_spec_hash: aa708f3d3bc54992526cbf5894427446
config_hash: d56fbaeeb3934b1a3b374590c9837ddd
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.78.0 (2026-02-05)

Full Changelog: [v0.77.1...v0.78.0](https://github.com/anthropics/anthropic-sdk-python/compare/v0.77.1...v0.78.0)

### Features

* **api:** manual updates ([3ef1529](https://github.com/anthropics/anthropic-sdk-python/commit/3ef1529b45c55645646cc6043784f999fda088de))

## 0.77.1 (2026-02-03)

Full Changelog: [v0.77.0...v0.77.1](https://github.com/anthropics/anthropic-sdk-python/compare/v0.77.0...v0.77.1)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ message = client.messages.create(
"role": "user",
}
],
model="claude-sonnet-4-5-20250929",
model="claude-opus-4-6",
metadata={},
)
print(message.metadata)
Expand Down
9 changes: 9 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ from anthropic.types import (
TextDelta,
ThinkingBlock,
ThinkingBlockParam,
ThinkingConfigAdaptive,
ThinkingConfigDisabled,
ThinkingConfigEnabled,
ThinkingConfigParam,
Expand Down Expand Up @@ -247,6 +248,11 @@ from anthropic.types.beta import (
BetaCodeExecutionToolResultError,
BetaCodeExecutionToolResultErrorCode,
BetaCodeExecutionToolResultErrorParam,
BetaCompact20260112Edit,
BetaCompactionBlock,
BetaCompactionBlockParam,
BetaCompactionContentBlockDelta,
BetaCompactionIterationUsage,
BetaContainer,
BetaContainerParams,
BetaContainerUploadBlock,
Expand All @@ -266,6 +272,7 @@ from anthropic.types.beta import (
BetaInputJSONDelta,
BetaInputTokensClearAtLeast,
BetaInputTokensTrigger,
BetaIterationsUsage,
BetaJSONOutputFormat,
BetaMCPToolConfig,
BetaMCPToolDefaultConfig,
Expand All @@ -283,6 +290,7 @@ from anthropic.types.beta import (
BetaMemoryTool20250818ViewCommand,
BetaMessage,
BetaMessageDeltaUsage,
BetaMessageIterationUsage,
BetaMessageParam,
BetaMessageTokensCount,
BetaMetadata,
Expand Down Expand Up @@ -328,6 +336,7 @@ from anthropic.types.beta import (
BetaTextEditorCodeExecutionViewResultBlockParam,
BetaThinkingBlock,
BetaThinkingBlockParam,
BetaThinkingConfigAdaptive,
BetaThinkingConfigDisabled,
BetaThinkingConfigEnabled,
BetaThinkingConfigParam,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "anthropic"
version = "0.77.1"
version = "0.78.0"
description = "The official Python library for the anthropic API"
dynamic = ["readme"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion src/anthropic/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "anthropic"
__version__ = "0.77.1" # x-release-please-version
__version__ = "0.78.0" # x-release-please-version
15 changes: 15 additions & 0 deletions src/anthropic/lib/streaming/_beta_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
BetaThinkingEvent,
BetaInputJsonEvent,
BetaSignatureEvent,
BetaCompactionEvent,
ParsedBetaTextEvent,
ParsedBetaMessageStopEvent,
ParsedBetaMessageStreamEvent,
Expand Down Expand Up @@ -403,6 +404,15 @@ def build_events(
)
)
pass
elif event.delta.type == "compaction_delta":
if content_block.type == "compaction":
events_to_fire.append(
build(
BetaCompactionEvent,
type="compaction",
content=content_block.content,
)
)
else:
# we only want exhaustive checking for linters, not at runtime
if TYPE_CHECKING: # type: ignore[unreachable]
Expand Down Expand Up @@ -512,6 +522,9 @@ def accumulate_event(
elif event.delta.type == "signature_delta":
if content.type == "thinking":
content.signature = event.delta.signature
elif event.delta.type == "compaction_delta":
if content.type == "compaction":
content.content = event.delta.content
else:
# we only want exhaustive checking for linters, not at runtime
if TYPE_CHECKING: # type: ignore[unreachable]
Expand All @@ -536,5 +549,7 @@ def accumulate_event(
current_snapshot.usage.cache_read_input_tokens = event.usage.cache_read_input_tokens
if event.usage.server_tool_use is not None:
current_snapshot.usage.server_tool_use = event.usage.server_tool_use
if event.usage.iterations is not None:
current_snapshot.usage.iterations = event.usage.iterations

return current_snapshot
8 changes: 8 additions & 0 deletions src/anthropic/lib/streaming/_beta_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ class BetaInputJsonEvent(BaseModel):
"""


class BetaCompactionEvent(BaseModel):
type: Literal["compaction"]

content: Union[str, None]
"""The compaction content"""


class ParsedBetaMessageStopEvent(BetaRawMessageStopEvent, GenericModel, Generic[ResponseFormatT]):
type: Literal["message_stop"]

Expand All @@ -97,6 +104,7 @@ class ParsedBetaContentBlockStopEvent(BetaRawContentBlockStopEvent, GenericModel
BetaThinkingEvent,
BetaSignatureEvent,
BetaInputJsonEvent,
BetaCompactionEvent,
BetaRawMessageStartEvent,
BetaRawMessageDeltaEvent,
ParsedBetaMessageStopEvent[ResponseFormatT],
Expand Down
Loading