diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index bee3a52fc..e59f0b3e3 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "2.43.0"
+ ".": "2.44.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 09cef8716..e7f771c7e 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 116
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-2ecf157aa324d82fa8f3636a325aea5bd96ecab93193f6e37864ebe665c48685.yml
-openapi_spec_hash: 29873ea69a87e047c4f742a960648bf0
-config_hash: 48f7cbc6648bf7f1e6c68ad3dab477fc
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/anthropic/anthropic-a548d120cebb4d68d46c828028d51d04b4d4abb868a7bad21dad960cb72cbd18.yml
+openapi_spec_hash: 2b3214760a4e23a9704779ac99bce417
+config_hash: ce2cd5d2f03228adacf04ebcceb14465
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3cc51978c..de454f1e0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,25 @@
# Changelog
+## 2.44.0 (2026-06-24)
+
+Full Changelog: [v2.43.0...v2.44.0](https://github.com/anthropics/anthropic-sdk-java/compare/v2.43.0...v2.44.0)
+
+### Features
+
+* **client:** add support for system.message streaming events ([e27e961](https://github.com/anthropics/anthropic-sdk-java/commit/e27e9613a570ddd4981a175fa96617635cb353ca))
+
+
+### Chores
+
+* **api:** add support for new refusal category ([8c1bd29](https://github.com/anthropics/anthropic-sdk-java/commit/8c1bd29b53721182ec114f214c22eebc3475e2dc))
+* **api:** add support for sending User Profile ID in request headers ([8d69cbe](https://github.com/anthropics/anthropic-sdk-java/commit/8d69cbe7a7a5c733e80e0385a971a8f77d98a566))
+
+
+### Build System
+
+* enable warnings as errors ([#106](https://github.com/anthropics/anthropic-sdk-java/issues/106)) ([43f1430](https://github.com/anthropics/anthropic-sdk-java/commit/43f1430e3077d038a457127e303d7008806e1985))
+* fix lock file enforcement for IDEs ([#107](https://github.com/anthropics/anthropic-sdk-java/issues/107)) ([48940e3](https://github.com/anthropics/anthropic-sdk-java/commit/48940e34f71a711efec12bd5f1891129217999ed))
+
## 2.43.0 (2026-06-18)
Full Changelog: [v2.42.0...v2.43.0](https://github.com/anthropics/anthropic-sdk-java/compare/v2.42.0...v2.43.0)
diff --git a/README.md b/README.md
index ded12e0b7..ed51b55f7 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ Full documentation is available at **[platform.claude.com/docs/en/api/sdks/java]
### Gradle
```kotlin
-implementation("com.anthropic:anthropic-java:2.43.0")
+implementation("com.anthropic:anthropic-java:2.44.0")
```
### Maven
@@ -24,7 +24,7 @@ implementation("com.anthropic:anthropic-java:2.43.0")
com.anthropic
anthropic-java
- 2.43.0
+ 2.44.0
```
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/core/handlers/SseHandler.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/core/handlers/SseHandler.kt
index 39bfd54df..35c154fda 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/core/handlers/SseHandler.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/core/handlers/SseHandler.kt
@@ -65,7 +65,8 @@ internal fun sseHandler(jsonMapper: JsonMapper): Handler yield(message)
+ "session.thread_status_terminated",
+ "system.message" -> yield(message)
"ping" -> continue
"error" -> {
throw SseException.builder()
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/core/http/PhantomReachableClosingAsyncStreamResponse.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/core/http/PhantomReachableClosingAsyncStreamResponse.kt
index fc5d9374b..3f0966210 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/core/http/PhantomReachableClosingAsyncStreamResponse.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/core/http/PhantomReachableClosingAsyncStreamResponse.kt
@@ -19,7 +19,7 @@ internal class PhantomReachableClosingAsyncStreamResponse(
/**
* An object used for keeping `asyncStreamResponse` open while the object is still reachable.
*/
- private val reachabilityTracker = Object()
+ private val reachabilityTracker = Any()
init {
closeWhenPhantomReachable(reachabilityTracker, asyncStreamResponse::close)
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/helpers/MessageAccumulator.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/helpers/MessageAccumulator.kt
index 30211b37c..2766feba4 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/helpers/MessageAccumulator.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/helpers/MessageAccumulator.kt
@@ -214,8 +214,8 @@ class MessageAccumulator private constructor() {
) = TextCitation.ofContentBlockLocation(contentBlockLocation)
override fun visitWebSearchResultLocation(
- citationsWebSearchResultLocation: CitationsWebSearchResultLocation
- ) = TextCitation.ofWebSearchResultLocation(citationsWebSearchResultLocation)
+ webSearchResultLocation: CitationsWebSearchResultLocation
+ ) = TextCitation.ofWebSearchResultLocation(webSearchResultLocation)
override fun visitSearchResultLocation(
searchResultLocation: CitationsSearchResultLocation
@@ -263,18 +263,18 @@ class MessageAccumulator private constructor() {
event.accept(
object : RawMessageStreamEvent.Visitor {
- override fun visitMessageStart(start: RawMessageStartEvent) {
+ override fun visitMessageStart(messageStart: RawMessageStartEvent) {
if (messageBuilder != null) {
throw AnthropicInvalidDataException(
"'message_start' event already received."
)
}
- messageBuilder = start.message().toBuilder()
- messageUsage = start.message().usage()
+ messageBuilder = messageStart.message().toBuilder()
+ messageUsage = messageStart.message().usage()
}
- override fun visitMessageDelta(deltaEvent: RawMessageDeltaEvent) {
- val delta = deltaEvent.delta()
+ override fun visitMessageDelta(messageDelta: RawMessageDeltaEvent) {
+ val delta = messageDelta.delta()
// The Anthropic API allows that there may be "one or more `message_delta`
// events". Here, the interpretation is that if multiple `message_delta` events
@@ -302,10 +302,10 @@ class MessageAccumulator private constructor() {
}
// Ensure we properly update the usage information from the delta event
- messageUsage = mergeMessageUsage(requireMessageUsage(), deltaEvent.usage())
+ messageUsage = mergeMessageUsage(requireMessageUsage(), messageDelta.usage())
}
- override fun visitMessageStop(stop: RawMessageStopEvent) {
+ override fun visitMessageStop(messageStop: RawMessageStopEvent) {
message =
requireMessageBuilder()
// The indexed content block map is converted to a list with the blocks
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentCreateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentCreateParams.kt
index 61827888b..8a30b278b 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentCreateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentCreateParams.kt
@@ -75,7 +75,10 @@ private constructor(
fun description(): Optional = body.description()
/**
- * MCP servers this agent connects to. Maximum 20. Names must be unique within the array.
+ * MCP servers this agent connects to. Maximum 20. Names must be unique within the array. Every
+ * server must be referenced by an `mcp_toolset` in `tools`; unreferenced servers are rejected.
+ * See the
+ * [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).
*
* @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -320,6 +323,9 @@ private constructor(
/**
* MCP servers this agent connects to. Maximum 20. Names must be unique within the array.
+ * Every server must be referenced by an `mcp_toolset` in `tools`; unreferenced servers are
+ * rejected. See the
+ * [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).
*/
fun mcpServers(mcpServers: List) = apply {
body.mcpServers(mcpServers)
@@ -741,6 +747,9 @@ private constructor(
/**
* MCP servers this agent connects to. Maximum 20. Names must be unique within the array.
+ * Every server must be referenced by an `mcp_toolset` in `tools`; unreferenced servers are
+ * rejected. See the
+ * [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).
*
* @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
@@ -980,7 +989,9 @@ private constructor(
/**
* MCP servers this agent connects to. Maximum 20. Names must be unique within the
- * array.
+ * array. Every server must be referenced by an `mcp_toolset` in `tools`; unreferenced
+ * servers are rejected. See the
+ * [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).
*/
fun mcpServers(mcpServers: List) =
mcpServers(JsonField.of(mcpServers))
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentUpdateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentUpdateParams.kt
index 21f40fae4..31ae04060 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentUpdateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/agents/AgentUpdateParams.kt
@@ -70,8 +70,10 @@ private constructor(
fun description(): Optional = body.description()
/**
- * MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names
- * must be unique. Maximum 20.
+ * MCP servers. Full replacement. Omit to preserve; send empty array or `null` to clear. Names
+ * must be unique. Maximum 20. Every server must be referenced by an `mcp_toolset` in the
+ * agent's resulting `tools`; unreferenced servers are rejected. See the
+ * [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).
*
* @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -326,8 +328,10 @@ private constructor(
fun description(description: JsonField) = apply { body.description(description) }
/**
- * MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names
- * must be unique. Maximum 20.
+ * MCP servers. Full replacement. Omit to preserve; send empty array or `null` to clear.
+ * Names must be unique. Maximum 20. Every server must be referenced by an `mcp_toolset` in
+ * the agent's resulting `tools`; unreferenced servers are rejected. See the
+ * [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).
*/
fun mcpServers(mcpServers: List?) = apply {
body.mcpServers(mcpServers)
@@ -804,8 +808,10 @@ private constructor(
fun description(): Optional = description.getOptional("description")
/**
- * MCP servers. Full replacement. Omit to preserve; send empty array or null to clear. Names
- * must be unique. Maximum 20.
+ * MCP servers. Full replacement. Omit to preserve; send empty array or `null` to clear.
+ * Names must be unique. Maximum 20. Every server must be referenced by an `mcp_toolset` in
+ * the agent's resulting `tools`; unreferenced servers are rejected. See the
+ * [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).
*
* @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
@@ -1046,8 +1052,10 @@ private constructor(
}
/**
- * MCP servers. Full replacement. Omit to preserve; send empty array or null to clear.
- * Names must be unique. Maximum 20.
+ * MCP servers. Full replacement. Omit to preserve; send empty array or `null` to clear.
+ * Names must be unique. Maximum 20. Every server must be referenced by an `mcp_toolset`
+ * in the agent's resulting `tools`; unreferenced servers are rejected. See the
+ * [MCP connector guide](https://platform.claude.com/docs/en/managed-agents/mcp-connector).
*/
fun mcpServers(mcpServers: List?) =
mcpServers(JsonField.ofNullable(mcpServers))
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/BetaCacheControlEphemeral.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/BetaCacheControlEphemeral.kt
index d3974af1f..da585fa62 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/BetaCacheControlEphemeral.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/BetaCacheControlEphemeral.kt
@@ -49,7 +49,9 @@ private constructor(
* - `5m`: 5 minutes
* - `1h`: 1 hour
*
- * Defaults to `5m`.
+ * Defaults to `5m`. See
+ * [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching)
+ * for details.
*
* @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -118,7 +120,9 @@ private constructor(
* - `5m`: 5 minutes
* - `1h`: 1 hour
*
- * Defaults to `5m`.
+ * Defaults to `5m`. See
+ * [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching)
+ * for details.
*/
fun ttl(ttl: Ttl) = ttl(JsonField.of(ttl))
@@ -207,7 +211,9 @@ private constructor(
* - `5m`: 5 minutes
* - `1h`: 1 hour
*
- * Defaults to `5m`.
+ * Defaults to `5m`. See
+ * [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching)
+ * for details.
*/
class Ttl @JsonCreator private constructor(private val value: JsonField) : Enum {
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/BetaFallbackRefusalTrigger.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/BetaFallbackRefusalTrigger.kt
index 68b06c292..7cc0bc837 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/BetaFallbackRefusalTrigger.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/BetaFallbackRefusalTrigger.kt
@@ -231,6 +231,8 @@ private constructor(
@JvmField val REASONING_EXTRACTION = of("reasoning_extraction")
+ @JvmField val MILITARY_WEAPONS = of("military_weapons")
+
@JvmStatic fun of(value: String) = Category(JsonField.of(value))
}
@@ -240,6 +242,7 @@ private constructor(
BIO,
FRONTIER_LLM,
REASONING_EXTRACTION,
+ MILITARY_WEAPONS,
}
/**
@@ -256,6 +259,7 @@ private constructor(
BIO,
FRONTIER_LLM,
REASONING_EXTRACTION,
+ MILITARY_WEAPONS,
/** An enum member indicating that [Category] was instantiated with an unknown value. */
_UNKNOWN,
}
@@ -273,6 +277,7 @@ private constructor(
BIO -> Value.BIO
FRONTIER_LLM -> Value.FRONTIER_LLM
REASONING_EXTRACTION -> Value.REASONING_EXTRACTION
+ MILITARY_WEAPONS -> Value.MILITARY_WEAPONS
else -> Value._UNKNOWN
}
@@ -291,6 +296,7 @@ private constructor(
BIO -> Known.BIO
FRONTIER_LLM -> Known.FRONTIER_LLM
REASONING_EXTRACTION -> Known.REASONING_EXTRACTION
+ MILITARY_WEAPONS -> Known.MILITARY_WEAPONS
else -> throw AnthropicInvalidDataException("Unknown Category: $value")
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/BetaRefusalStopDetails.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/BetaRefusalStopDetails.kt
index ef4568ec1..7b7503da9 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/BetaRefusalStopDetails.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/BetaRefusalStopDetails.kt
@@ -520,6 +520,8 @@ private constructor(
@JvmField val REASONING_EXTRACTION = of("reasoning_extraction")
+ @JvmField val MILITARY_WEAPONS = of("military_weapons")
+
@JvmStatic fun of(value: String) = Category(JsonField.of(value))
}
@@ -529,6 +531,7 @@ private constructor(
BIO,
FRONTIER_LLM,
REASONING_EXTRACTION,
+ MILITARY_WEAPONS,
}
/**
@@ -545,6 +548,7 @@ private constructor(
BIO,
FRONTIER_LLM,
REASONING_EXTRACTION,
+ MILITARY_WEAPONS,
/** An enum member indicating that [Category] was instantiated with an unknown value. */
_UNKNOWN,
}
@@ -562,6 +566,7 @@ private constructor(
BIO -> Value.BIO
FRONTIER_LLM -> Value.FRONTIER_LLM
REASONING_EXTRACTION -> Value.REASONING_EXTRACTION
+ MILITARY_WEAPONS -> Value.MILITARY_WEAPONS
else -> Value._UNKNOWN
}
@@ -580,6 +585,7 @@ private constructor(
BIO -> Known.BIO
FRONTIER_LLM -> Known.FRONTIER_LLM
REASONING_EXTRACTION -> Known.REASONING_EXTRACTION
+ MILITARY_WEAPONS -> Known.MILITARY_WEAPONS
else -> throw AnthropicInvalidDataException("Unknown Category: $value")
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/MessageCreateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/MessageCreateParams.kt
index 7e6c9095a..d052c9d4c 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/MessageCreateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/MessageCreateParams.kt
@@ -90,6 +90,7 @@ class MessageCreateParams
private constructor(
private val runnableTools: List,
private val betas: List?,
+ private val userProfileId: String?,
private val body: Body,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
@@ -100,6 +101,12 @@ private constructor(
/** Optional header to specify the beta version(s) you want to use. */
fun betas(): Optional> = Optional.ofNullable(betas)
+ /**
+ * The user profile ID to attribute this request to. Use when acting on behalf of a party other
+ * than your organization. Requires the `user-profiles` beta header.
+ */
+ fun userProfileId(): Optional = Optional.ofNullable(userProfileId)
+
/**
* The maximum number of tokens to generate before stopping.
*
@@ -503,15 +510,6 @@ private constructor(
)
fun topP(): Optional = body.topP()
- /**
- * The user profile ID to attribute this request to. Use when acting on behalf of a party other
- * than your organization.
- *
- * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun userProfileId(): Optional = body.userProfileId()
-
/**
* Returns the raw JSON value of [maxTokens].
*
@@ -692,13 +690,6 @@ private constructor(
)
fun _topP(): JsonField = body._topP()
- /**
- * Returns the raw JSON value of [userProfileId].
- *
- * Unlike [userProfileId], this method doesn't throw if the JSON field has an unexpected type.
- */
- fun _userProfileId(): JsonField = body._userProfileId()
-
fun _additionalBodyProperties(): Map = body._additionalProperties()
/** Additional headers to send with the request. */
@@ -729,6 +720,7 @@ private constructor(
private var runnableTools: MutableList = mutableListOf()
private var betas: MutableList? = null
+ private var userProfileId: String? = null
private var body: Body.Builder = Body.builder()
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@@ -737,6 +729,7 @@ private constructor(
internal fun from(messageCreateParams: MessageCreateParams) = apply {
runnableTools = messageCreateParams.runnableTools.toMutableList()
betas = messageCreateParams.betas?.toMutableList()
+ userProfileId = messageCreateParams.userProfileId
body = messageCreateParams.body.toBuilder()
additionalHeaders = messageCreateParams.additionalHeaders.toBuilder()
additionalQueryParams = messageCreateParams.additionalQueryParams.toBuilder()
@@ -766,6 +759,16 @@ private constructor(
*/
fun addBeta(value: String) = addBeta(AnthropicBeta.of(value))
+ /**
+ * The user profile ID to attribute this request to. Use when acting on behalf of a party
+ * other than your organization. Requires the `user-profiles` beta header.
+ */
+ fun userProfileId(userProfileId: String?) = apply { this.userProfileId = userProfileId }
+
+ /** Alias for calling [Builder.userProfileId] with `userProfileId.orElse(null)`. */
+ fun userProfileId(userProfileId: Optional) =
+ userProfileId(userProfileId.getOrNull())
+
/**
* Sets the entire request body.
*
@@ -1856,27 +1859,6 @@ private constructor(
)
fun topP(topP: JsonField) = apply { body.topP(topP) }
- /**
- * The user profile ID to attribute this request to. Use when acting on behalf of a party
- * other than your organization.
- */
- fun userProfileId(userProfileId: String?) = apply { body.userProfileId(userProfileId) }
-
- /** Alias for calling [Builder.userProfileId] with `userProfileId.orElse(null)`. */
- fun userProfileId(userProfileId: Optional) =
- userProfileId(userProfileId.getOrNull())
-
- /**
- * Sets [Builder.userProfileId] to an arbitrary JSON value.
- *
- * You should usually call [Builder.userProfileId] with a well-typed [String] value instead.
- * This method is primarily for setting the field to an undocumented or not yet supported
- * value.
- */
- fun userProfileId(userProfileId: JsonField) = apply {
- body.userProfileId(userProfileId)
- }
-
fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
body.additionalProperties(additionalBodyProperties)
}
@@ -2012,6 +1994,7 @@ private constructor(
MessageCreateParams(
runnableTools.toImmutable(),
betas?.toImmutable(),
+ userProfileId,
body.build(),
additionalHeaders.build(),
additionalQueryParams.build(),
@@ -2024,6 +2007,7 @@ private constructor(
Headers.builder()
.apply {
betas?.forEach { put("anthropic-beta", it.toString()) }
+ userProfileId?.let { put("anthropic-user-profile-id", it) }
putAll(additionalHeaders)
}
.build()
@@ -2057,7 +2041,6 @@ private constructor(
private val tools: JsonField>,
private val topK: JsonField,
private val topP: JsonField,
- private val userProfileId: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -2125,9 +2108,6 @@ private constructor(
tools: JsonField> = JsonMissing.of(),
@JsonProperty("top_k") @ExcludeMissing topK: JsonField = JsonMissing.of(),
@JsonProperty("top_p") @ExcludeMissing topP: JsonField = JsonMissing.of(),
- @JsonProperty("user_profile_id")
- @ExcludeMissing
- userProfileId: JsonField = JsonMissing.of(),
) : this(
maxTokens,
messages,
@@ -2153,7 +2133,6 @@ private constructor(
tools,
topK,
topP,
- userProfileId,
mutableMapOf(),
)
@@ -2571,15 +2550,6 @@ private constructor(
)
fun topP(): Optional = topP.getOptional("top_p")
- /**
- * The user profile ID to attribute this request to. Use when acting on behalf of a party
- * other than your organization.
- *
- * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if
- * the server responded with an unexpected value).
- */
- fun userProfileId(): Optional = userProfileId.getOptional("user_profile_id")
-
/**
* Returns the raw JSON value of [maxTokens].
*
@@ -2803,16 +2773,6 @@ private constructor(
@ExcludeMissing
fun _topP(): JsonField = topP
- /**
- * Returns the raw JSON value of [userProfileId].
- *
- * Unlike [userProfileId], this method doesn't throw if the JSON field has an unexpected
- * type.
- */
- @JsonProperty("user_profile_id")
- @ExcludeMissing
- fun _userProfileId(): JsonField = userProfileId
-
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -2868,7 +2828,6 @@ private constructor(
private var tools: JsonField>? = null
private var topK: JsonField = JsonMissing.of()
private var topP: JsonField = JsonMissing.of()
- private var userProfileId: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -2899,7 +2858,6 @@ private constructor(
tools = body.tools.map { it.toMutableList() }.takeUnless { it.isMissing() }
topK = body.topK
topP = body.topP
- userProfileId = body.userProfileId
additionalProperties = body.additionalProperties.toMutableMap()
}
@@ -3939,28 +3897,6 @@ private constructor(
)
fun topP(topP: JsonField) = apply { this.topP = topP }
- /**
- * The user profile ID to attribute this request to. Use when acting on behalf of a
- * party other than your organization.
- */
- fun userProfileId(userProfileId: String?) =
- userProfileId(JsonField.ofNullable(userProfileId))
-
- /** Alias for calling [Builder.userProfileId] with `userProfileId.orElse(null)`. */
- fun userProfileId(userProfileId: Optional) =
- userProfileId(userProfileId.getOrNull())
-
- /**
- * Sets [Builder.userProfileId] to an arbitrary JSON value.
- *
- * You should usually call [Builder.userProfileId] with a well-typed [String] value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun userProfileId(userProfileId: JsonField) = apply {
- this.userProfileId = userProfileId
- }
-
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -4020,7 +3956,6 @@ private constructor(
(tools ?: JsonMissing.of()).map { it.toImmutable() },
topK,
topP,
- userProfileId,
additionalProperties.toMutableMap(),
)
}
@@ -4065,7 +4000,6 @@ private constructor(
tools().ifPresent { it.forEach { it.validate() } }
topK()
topP()
- userProfileId()
validated = true
}
@@ -4108,8 +4042,7 @@ private constructor(
(toolChoice.asKnown().getOrNull()?.validity() ?: 0) +
(tools.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(if (topK.asKnown().isPresent) 1 else 0) +
- (if (topP.asKnown().isPresent) 1 else 0) +
- (if (userProfileId.asKnown().isPresent) 1 else 0)
+ (if (topP.asKnown().isPresent) 1 else 0)
override fun equals(other: Any?): Boolean {
if (this === other) {
@@ -4141,7 +4074,6 @@ private constructor(
tools == other.tools &&
topK == other.topK &&
topP == other.topP &&
- userProfileId == other.userProfileId &&
additionalProperties == other.additionalProperties
}
@@ -4171,7 +4103,6 @@ private constructor(
tools,
topK,
topP,
- userProfileId,
additionalProperties,
)
}
@@ -4179,7 +4110,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "Body{maxTokens=$maxTokens, messages=$messages, model=$model, cacheControl=$cacheControl, container=$container, contextManagement=$contextManagement, diagnostics=$diagnostics, fallbackCreditToken=$fallbackCreditToken, fallbacks=$fallbacks, inferenceGeo=$inferenceGeo, mcpServers=$mcpServers, metadata=$metadata, outputConfig=$outputConfig, outputFormat=$outputFormat, serviceTier=$serviceTier, speed=$speed, stopSequences=$stopSequences, system=$system, temperature=$temperature, thinking=$thinking, toolChoice=$toolChoice, tools=$tools, topK=$topK, topP=$topP, userProfileId=$userProfileId, additionalProperties=$additionalProperties}"
+ "Body{maxTokens=$maxTokens, messages=$messages, model=$model, cacheControl=$cacheControl, container=$container, contextManagement=$contextManagement, diagnostics=$diagnostics, fallbackCreditToken=$fallbackCreditToken, fallbacks=$fallbacks, inferenceGeo=$inferenceGeo, mcpServers=$mcpServers, metadata=$metadata, outputConfig=$outputConfig, outputFormat=$outputFormat, serviceTier=$serviceTier, speed=$speed, stopSequences=$stopSequences, system=$system, temperature=$temperature, thinking=$thinking, toolChoice=$toolChoice, tools=$tools, topK=$topK, topP=$topP, additionalProperties=$additionalProperties}"
}
/** Container identifier for reuse across requests. */
@@ -4925,14 +4856,15 @@ private constructor(
return other is MessageCreateParams &&
betas == other.betas &&
+ userProfileId == other.userProfileId &&
body == other.body &&
additionalHeaders == other.additionalHeaders &&
additionalQueryParams == other.additionalQueryParams
}
override fun hashCode(): Int =
- Objects.hash(betas, body, additionalHeaders, additionalQueryParams)
+ Objects.hash(betas, userProfileId, body, additionalHeaders, additionalQueryParams)
override fun toString() =
- "MessageCreateParams{betas=$betas, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+ "MessageCreateParams{betas=$betas, userProfileId=$userProfileId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/StructuredMessageCreateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/StructuredMessageCreateParams.kt
index 504fd3234..64119a2f0 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/StructuredMessageCreateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/StructuredMessageCreateParams.kt
@@ -647,11 +647,6 @@ internal constructor(
paramsBuilder.userProfileId(userProfileId)
}
- /** @see MessageCreateParams.Builder.userProfileId */
- fun userProfileId(userProfileId: JsonField) = apply {
- paramsBuilder.userProfileId(userProfileId)
- }
-
/** @see MessageCreateParams.Builder.additionalBodyProperties */
fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
paramsBuilder.additionalBodyProperties(additionalBodyProperties)
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/batches/BatchCreateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/batches/BatchCreateParams.kt
index f3c29f638..4ea5577fd 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/batches/BatchCreateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/beta/messages/batches/BatchCreateParams.kt
@@ -96,6 +96,7 @@ import kotlin.jvm.optionals.getOrNull
class BatchCreateParams
private constructor(
private val betas: List?,
+ private val userProfileId: String?,
private val body: Body,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
@@ -104,6 +105,14 @@ private constructor(
/** Optional header to specify the beta version(s) you want to use. */
fun betas(): Optional> = Optional.ofNullable(betas)
+ /**
+ * The user profile ID to attribute the requests in this batch to. Use when acting on behalf of
+ * a party other than your organization. Requires the `user-profiles` beta header. Applies to
+ * every request in the batch; an individual request whose `user_profile_id` body field
+ * conflicts with this header is errored.
+ */
+ fun userProfileId(): Optional = Optional.ofNullable(userProfileId)
+
/**
* List of requests for prompt completion. Each is an individual request to create a Message.
*
@@ -146,6 +155,7 @@ private constructor(
class Builder internal constructor() {
private var betas: MutableList? = null
+ private var userProfileId: String? = null
private var body: Body.Builder = Body.builder()
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@@ -153,6 +163,7 @@ private constructor(
@JvmSynthetic
internal fun from(batchCreateParams: BatchCreateParams) = apply {
betas = batchCreateParams.betas?.toMutableList()
+ userProfileId = batchCreateParams.userProfileId
body = batchCreateParams.body.toBuilder()
additionalHeaders = batchCreateParams.additionalHeaders.toBuilder()
additionalQueryParams = batchCreateParams.additionalQueryParams.toBuilder()
@@ -182,6 +193,18 @@ private constructor(
*/
fun addBeta(value: String) = addBeta(AnthropicBeta.of(value))
+ /**
+ * The user profile ID to attribute the requests in this batch to. Use when acting on behalf
+ * of a party other than your organization. Requires the `user-profiles` beta header.
+ * Applies to every request in the batch; an individual request whose `user_profile_id` body
+ * field conflicts with this header is errored.
+ */
+ fun userProfileId(userProfileId: String?) = apply { this.userProfileId = userProfileId }
+
+ /** Alias for calling [Builder.userProfileId] with `userProfileId.orElse(null)`. */
+ fun userProfileId(userProfileId: Optional) =
+ userProfileId(userProfileId.getOrNull())
+
/**
* Sets the entire request body.
*
@@ -345,6 +368,7 @@ private constructor(
fun build(): BatchCreateParams =
BatchCreateParams(
betas?.toImmutable(),
+ userProfileId,
body.build(),
additionalHeaders.build(),
additionalQueryParams.build(),
@@ -357,6 +381,7 @@ private constructor(
Headers.builder()
.apply {
betas?.forEach { put("anthropic-beta", it.toString()) }
+ userProfileId?.let { put("anthropic-user-profile-id", it) }
putAll(additionalHeaders)
}
.build()
@@ -795,7 +820,6 @@ private constructor(
private val tools: JsonField>,
private val topK: JsonField,
private val topP: JsonField,
- private val userProfileId: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -868,9 +892,6 @@ private constructor(
tools: JsonField> = JsonMissing.of(),
@JsonProperty("top_k") @ExcludeMissing topK: JsonField = JsonMissing.of(),
@JsonProperty("top_p") @ExcludeMissing topP: JsonField = JsonMissing.of(),
- @JsonProperty("user_profile_id")
- @ExcludeMissing
- userProfileId: JsonField = JsonMissing.of(),
) : this(
maxTokens,
messages,
@@ -897,7 +918,6 @@ private constructor(
tools,
topK,
topP,
- userProfileId,
mutableMapOf(),
)
@@ -1333,15 +1353,6 @@ private constructor(
)
fun topP(): Optional = topP.getOptional("top_p")
- /**
- * The user profile ID to attribute this request to. Use when acting on behalf of a
- * party other than your organization.
- *
- * @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g.
- * if the server responded with an unexpected value).
- */
- fun userProfileId(): Optional = userProfileId.getOptional("user_profile_id")
-
/**
* Returns the raw JSON value of [maxTokens].
*
@@ -1587,16 +1598,6 @@ private constructor(
@ExcludeMissing
fun _topP(): JsonField = topP
- /**
- * Returns the raw JSON value of [userProfileId].
- *
- * Unlike [userProfileId], this method doesn't throw if the JSON field has an unexpected
- * type.
- */
- @JsonProperty("user_profile_id")
- @ExcludeMissing
- fun _userProfileId(): JsonField = userProfileId
-
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -1654,7 +1655,6 @@ private constructor(
private var tools: JsonField>? = null
private var topK: JsonField = JsonMissing.of()
private var topP: JsonField = JsonMissing.of()
- private var userProfileId: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -1690,7 +1690,6 @@ private constructor(
tools = params.tools.map { it.toMutableList() }.takeUnless { it.isMissing() }
topK = params.topK
topP = params.topP
- userProfileId = params.userProfileId
additionalProperties = params.additionalProperties.toMutableMap()
}
@@ -2765,28 +2764,6 @@ private constructor(
)
fun topP(topP: JsonField) = apply { this.topP = topP }
- /**
- * The user profile ID to attribute this request to. Use when acting on behalf of a
- * party other than your organization.
- */
- fun userProfileId(userProfileId: String?) =
- userProfileId(JsonField.ofNullable(userProfileId))
-
- /** Alias for calling [Builder.userProfileId] with `userProfileId.orElse(null)`. */
- fun userProfileId(userProfileId: Optional) =
- userProfileId(userProfileId.getOrNull())
-
- /**
- * Sets [Builder.userProfileId] to an arbitrary JSON value.
- *
- * You should usually call [Builder.userProfileId] with a well-typed [String] value
- * instead. This method is primarily for setting the field to an undocumented or not
- * yet supported value.
- */
- fun userProfileId(userProfileId: JsonField) = apply {
- this.userProfileId = userProfileId
- }
-
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -2850,7 +2827,6 @@ private constructor(
(tools ?: JsonMissing.of()).map { it.toImmutable() },
topK,
topP,
- userProfileId,
additionalProperties.toMutableMap(),
)
}
@@ -2897,7 +2873,6 @@ private constructor(
tools().ifPresent { it.forEach { it.validate() } }
topK()
topP()
- userProfileId()
validated = true
}
@@ -2941,8 +2916,7 @@ private constructor(
(toolChoice.asKnown().getOrNull()?.validity() ?: 0) +
(tools.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(if (topK.asKnown().isPresent) 1 else 0) +
- (if (topP.asKnown().isPresent) 1 else 0) +
- (if (userProfileId.asKnown().isPresent) 1 else 0)
+ (if (topP.asKnown().isPresent) 1 else 0)
/** Container identifier for reuse across requests. */
@JsonDeserialize(using = Container.Deserializer::class)
@@ -3731,7 +3705,6 @@ private constructor(
tools == other.tools &&
topK == other.topK &&
topP == other.topP &&
- userProfileId == other.userProfileId &&
additionalProperties == other.additionalProperties
}
@@ -3762,7 +3735,6 @@ private constructor(
tools,
topK,
topP,
- userProfileId,
additionalProperties,
)
}
@@ -3770,7 +3742,7 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "Params{maxTokens=$maxTokens, messages=$messages, model=$model, cacheControl=$cacheControl, container=$container, contextManagement=$contextManagement, diagnostics=$diagnostics, fallbackCreditToken=$fallbackCreditToken, fallbacks=$fallbacks, inferenceGeo=$inferenceGeo, mcpServers=$mcpServers, metadata=$metadata, outputConfig=$outputConfig, outputFormat=$outputFormat, serviceTier=$serviceTier, speed=$speed, stopSequences=$stopSequences, stream=$stream, system=$system, temperature=$temperature, thinking=$thinking, toolChoice=$toolChoice, tools=$tools, topK=$topK, topP=$topP, userProfileId=$userProfileId, additionalProperties=$additionalProperties}"
+ "Params{maxTokens=$maxTokens, messages=$messages, model=$model, cacheControl=$cacheControl, container=$container, contextManagement=$contextManagement, diagnostics=$diagnostics, fallbackCreditToken=$fallbackCreditToken, fallbacks=$fallbacks, inferenceGeo=$inferenceGeo, mcpServers=$mcpServers, metadata=$metadata, outputConfig=$outputConfig, outputFormat=$outputFormat, serviceTier=$serviceTier, speed=$speed, stopSequences=$stopSequences, stream=$stream, system=$system, temperature=$temperature, thinking=$thinking, toolChoice=$toolChoice, tools=$tools, topK=$topK, topP=$topP, additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
@@ -3799,14 +3771,15 @@ private constructor(
return other is BatchCreateParams &&
betas == other.betas &&
+ userProfileId == other.userProfileId &&
body == other.body &&
additionalHeaders == other.additionalHeaders &&
additionalQueryParams == other.additionalQueryParams
}
override fun hashCode(): Int =
- Objects.hash(betas, body, additionalHeaders, additionalQueryParams)
+ Objects.hash(betas, userProfileId, body, additionalHeaders, additionalQueryParams)
override fun toString() =
- "BatchCreateParams{betas=$betas, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+ "BatchCreateParams{betas=$betas, userProfileId=$userProfileId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/CacheControlEphemeral.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/CacheControlEphemeral.kt
index 6d4954161..9daefefb0 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/CacheControlEphemeral.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/CacheControlEphemeral.kt
@@ -49,7 +49,9 @@ private constructor(
* - `5m`: 5 minutes
* - `1h`: 1 hour
*
- * Defaults to `5m`.
+ * Defaults to `5m`. See
+ * [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching)
+ * for details.
*
* @throws AnthropicInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -116,7 +118,9 @@ private constructor(
* - `5m`: 5 minutes
* - `1h`: 1 hour
*
- * Defaults to `5m`.
+ * Defaults to `5m`. See
+ * [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching)
+ * for details.
*/
fun ttl(ttl: Ttl) = ttl(JsonField.of(ttl))
@@ -205,7 +209,9 @@ private constructor(
* - `5m`: 5 minutes
* - `1h`: 1 hour
*
- * Defaults to `5m`.
+ * Defaults to `5m`. See
+ * [prompt caching pricing](https://docs.claude.com/en/docs/build-with-claude/prompt-caching)
+ * for details.
*/
class Ttl @JsonCreator private constructor(private val value: JsonField) : Enum {
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/MessageCreateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/MessageCreateParams.kt
index 339ad9020..977d8f03c 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/MessageCreateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/MessageCreateParams.kt
@@ -46,11 +46,18 @@ import kotlin.jvm.optionals.getOrNull
*/
class MessageCreateParams
private constructor(
+ private val userProfileId: String?,
private val body: Body,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
) : Params {
+ /**
+ * The user profile ID to attribute this request to. Use when acting on behalf of a party other
+ * than your organization. Requires the `user-profiles` beta header.
+ */
+ fun userProfileId(): Optional = Optional.ofNullable(userProfileId)
+
/**
* The maximum number of tokens to generate before stopping.
*
@@ -526,17 +533,29 @@ private constructor(
/** A builder for [MessageCreateParams]. */
class Builder internal constructor() {
+ private var userProfileId: String? = null
private var body: Body.Builder = Body.builder()
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@JvmSynthetic
internal fun from(messageCreateParams: MessageCreateParams) = apply {
+ userProfileId = messageCreateParams.userProfileId
body = messageCreateParams.body.toBuilder()
additionalHeaders = messageCreateParams.additionalHeaders.toBuilder()
additionalQueryParams = messageCreateParams.additionalQueryParams.toBuilder()
}
+ /**
+ * The user profile ID to attribute this request to. Use when acting on behalf of a party
+ * other than your organization. Requires the `user-profiles` beta header.
+ */
+ fun userProfileId(userProfileId: String?) = apply { this.userProfileId = userProfileId }
+
+ /** Alias for calling [Builder.userProfileId] with `userProfileId.orElse(null)`. */
+ fun userProfileId(userProfileId: Optional) =
+ userProfileId(userProfileId.getOrNull())
+
/**
* Sets the entire request body.
*
@@ -1426,6 +1445,7 @@ private constructor(
*/
fun build(): MessageCreateParams =
MessageCreateParams(
+ userProfileId,
body.build(),
additionalHeaders.build(),
additionalQueryParams.build(),
@@ -1434,7 +1454,13 @@ private constructor(
fun _body(): Body = body
- override fun _headers(): Headers = additionalHeaders
+ override fun _headers(): Headers =
+ Headers.builder()
+ .apply {
+ userProfileId?.let { put("anthropic-user-profile-id", it) }
+ putAll(additionalHeaders)
+ }
+ .build()
override fun _queryParams(): QueryParams = additionalQueryParams
@@ -3391,13 +3417,15 @@ private constructor(
}
return other is MessageCreateParams &&
+ userProfileId == other.userProfileId &&
body == other.body &&
additionalHeaders == other.additionalHeaders &&
additionalQueryParams == other.additionalQueryParams
}
- override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams)
+ override fun hashCode(): Int =
+ Objects.hash(userProfileId, body, additionalHeaders, additionalQueryParams)
override fun toString() =
- "MessageCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+ "MessageCreateParams{userProfileId=$userProfileId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/RefusalStopDetails.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/RefusalStopDetails.kt
index f6ed962a0..bb29bc6e0 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/RefusalStopDetails.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/RefusalStopDetails.kt
@@ -280,6 +280,8 @@ private constructor(
@JvmField val REASONING_EXTRACTION = of("reasoning_extraction")
+ @JvmField val MILITARY_WEAPONS = of("military_weapons")
+
@JvmStatic fun of(value: String) = Category(JsonField.of(value))
}
@@ -289,6 +291,7 @@ private constructor(
BIO,
FRONTIER_LLM,
REASONING_EXTRACTION,
+ MILITARY_WEAPONS,
}
/**
@@ -305,6 +308,7 @@ private constructor(
BIO,
FRONTIER_LLM,
REASONING_EXTRACTION,
+ MILITARY_WEAPONS,
/** An enum member indicating that [Category] was instantiated with an unknown value. */
_UNKNOWN,
}
@@ -322,6 +326,7 @@ private constructor(
BIO -> Value.BIO
FRONTIER_LLM -> Value.FRONTIER_LLM
REASONING_EXTRACTION -> Value.REASONING_EXTRACTION
+ MILITARY_WEAPONS -> Value.MILITARY_WEAPONS
else -> Value._UNKNOWN
}
@@ -340,6 +345,7 @@ private constructor(
BIO -> Known.BIO
FRONTIER_LLM -> Known.FRONTIER_LLM
REASONING_EXTRACTION -> Known.REASONING_EXTRACTION
+ MILITARY_WEAPONS -> Known.MILITARY_WEAPONS
else -> throw AnthropicInvalidDataException("Unknown Category: $value")
}
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/StructuredMessageCreateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/StructuredMessageCreateParams.kt
index b03d46cb1..180a45bd2 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/StructuredMessageCreateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/StructuredMessageCreateParams.kt
@@ -414,6 +414,16 @@ internal constructor(
/** @see MessageCreateParams.Builder.topP */
fun topP(topP: JsonField) = apply { paramsBuilder.topP(topP) }
+ /** @see MessageCreateParams.Builder.userProfileId */
+ fun userProfileId(userProfileId: String?) = apply {
+ paramsBuilder.userProfileId(userProfileId)
+ }
+
+ /** @see MessageCreateParams.Builder.userProfileId */
+ fun userProfileId(userProfileId: Optional) = apply {
+ paramsBuilder.userProfileId(userProfileId)
+ }
+
/** @see MessageCreateParams.Builder.additionalBodyProperties */
fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
paramsBuilder.additionalBodyProperties(additionalBodyProperties)
diff --git a/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/batches/BatchCreateParams.kt b/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/batches/BatchCreateParams.kt
index 65c39cac0..3c47cddbc 100644
--- a/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/batches/BatchCreateParams.kt
+++ b/anthropic-java-core/src/main/kotlin/com/anthropic/models/messages/batches/BatchCreateParams.kt
@@ -81,11 +81,20 @@ import kotlin.jvm.optionals.getOrNull
*/
class BatchCreateParams
private constructor(
+ private val userProfileId: String?,
private val body: Body,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
) : Params {
+ /**
+ * The user profile ID to attribute the requests in this batch to. Use when acting on behalf of
+ * a party other than your organization. Requires the `user-profiles` beta header. Applies to
+ * every request in the batch; an individual request whose `user_profile_id` body field
+ * conflicts with this header is errored.
+ */
+ fun userProfileId(): Optional = Optional.ofNullable(userProfileId)
+
/**
* List of requests for prompt completion. Each is an individual request to create a Message.
*
@@ -127,17 +136,31 @@ private constructor(
/** A builder for [BatchCreateParams]. */
class Builder internal constructor() {
+ private var userProfileId: String? = null
private var body: Body.Builder = Body.builder()
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@JvmSynthetic
internal fun from(batchCreateParams: BatchCreateParams) = apply {
+ userProfileId = batchCreateParams.userProfileId
body = batchCreateParams.body.toBuilder()
additionalHeaders = batchCreateParams.additionalHeaders.toBuilder()
additionalQueryParams = batchCreateParams.additionalQueryParams.toBuilder()
}
+ /**
+ * The user profile ID to attribute the requests in this batch to. Use when acting on behalf
+ * of a party other than your organization. Requires the `user-profiles` beta header.
+ * Applies to every request in the batch; an individual request whose `user_profile_id` body
+ * field conflicts with this header is errored.
+ */
+ fun userProfileId(userProfileId: String?) = apply { this.userProfileId = userProfileId }
+
+ /** Alias for calling [Builder.userProfileId] with `userProfileId.orElse(null)`. */
+ fun userProfileId(userProfileId: Optional) =
+ userProfileId(userProfileId.getOrNull())
+
/**
* Sets the entire request body.
*
@@ -300,6 +323,7 @@ private constructor(
*/
fun build(): BatchCreateParams =
BatchCreateParams(
+ userProfileId,
body.build(),
additionalHeaders.build(),
additionalQueryParams.build(),
@@ -308,7 +332,13 @@ private constructor(
fun _body(): Body = body
- override fun _headers(): Headers = additionalHeaders
+ override fun _headers(): Headers =
+ Headers.builder()
+ .apply {
+ userProfileId?.let { put("anthropic-user-profile-id", it) }
+ putAll(additionalHeaders)
+ }
+ .build()
override fun _queryParams(): QueryParams = additionalQueryParams
@@ -2785,13 +2815,15 @@ private constructor(
}
return other is BatchCreateParams &&
+ userProfileId == other.userProfileId &&
body == other.body &&
additionalHeaders == other.additionalHeaders &&
additionalQueryParams == other.additionalQueryParams
}
- override fun hashCode(): Int = Objects.hash(body, additionalHeaders, additionalQueryParams)
+ override fun hashCode(): Int =
+ Objects.hash(userProfileId, body, additionalHeaders, additionalQueryParams)
override fun toString() =
- "BatchCreateParams{body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+ "BatchCreateParams{userProfileId=$userProfileId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/core/StructuredOutputsTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/core/StructuredOutputsTest.kt
index 4a4a41235..3920c7df7 100644
--- a/anthropic-java-core/src/test/kotlin/com/anthropic/core/StructuredOutputsTest.kt
+++ b/anthropic-java-core/src/test/kotlin/com/anthropic/core/StructuredOutputsTest.kt
@@ -112,7 +112,7 @@ internal class StructuredOutputsTest {
@Test
fun schemaTest_mapHasNoNamedProperties() {
- @Suppress("unused") class X(val m: Map)
+ @Suppress("unused") class X(val m: Map)
schema = extractSchema(X::class.java)
validator.validate(schema)
diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/core/StructuredOutputsTestUtils.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/core/StructuredOutputsTestUtils.kt
index 60558824d..d5374ef64 100644
--- a/anthropic-java-core/src/test/kotlin/com/anthropic/core/StructuredOutputsTestUtils.kt
+++ b/anthropic-java-core/src/test/kotlin/com/anthropic/core/StructuredOutputsTestUtils.kt
@@ -290,9 +290,9 @@ private fun findJavaMethod(
private fun toJavaType(type: Class<*>) =
when (type) {
// This only needs to cover the types used in the test cases.
- java.lang.Long::class.java -> java.lang.Long.TYPE
- java.lang.Boolean::class.java -> java.lang.Boolean.TYPE
- java.lang.Double::class.java -> java.lang.Double.TYPE
+ Long::class.javaObjectType -> Long::class.javaPrimitiveType!!
+ Boolean::class.javaObjectType -> Boolean::class.javaPrimitiveType!!
+ Double::class.javaObjectType -> Double::class.javaPrimitiveType!!
else -> type
}
diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/messages/MessageCreateParamsTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/messages/MessageCreateParamsTest.kt
index d932f67a1..a961e0cf5 100644
--- a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/messages/MessageCreateParamsTest.kt
+++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/messages/MessageCreateParamsTest.kt
@@ -16,6 +16,7 @@ internal class MessageCreateParamsTest {
fun create() {
MessageCreateParams.builder()
.addBeta(AnthropicBeta.MESSAGE_BATCHES_2024_09_24)
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -187,7 +188,6 @@ internal class MessageCreateParamsTest {
)
.topK(5L)
.topP(0.7)
- .userProfileId("user_profile_id")
.build()
}
@@ -196,6 +196,7 @@ internal class MessageCreateParamsTest {
val params =
MessageCreateParams.builder()
.addBeta(AnthropicBeta.MESSAGE_BATCHES_2024_09_24)
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -373,14 +374,16 @@ internal class MessageCreateParamsTest {
)
.topK(5L)
.topP(0.7)
- .userProfileId("user_profile_id")
.build()
val headers = params._headers()
assertThat(headers)
.isEqualTo(
- Headers.builder().put("anthropic-beta", "message-batches-2024-09-24").build()
+ Headers.builder()
+ .put("anthropic-beta", "message-batches-2024-09-24")
+ .put("anthropic-user-profile-id", "anthropic-user-profile-id")
+ .build()
)
}
@@ -403,6 +406,7 @@ internal class MessageCreateParamsTest {
val params =
MessageCreateParams.builder()
.addBeta(AnthropicBeta.MESSAGE_BATCHES_2024_09_24)
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -580,7 +584,6 @@ internal class MessageCreateParamsTest {
)
.topK(5L)
.topP(0.7)
- .userProfileId("user_profile_id")
.build()
val body = params._body()
@@ -787,7 +790,6 @@ internal class MessageCreateParamsTest {
)
assertThat(body.topK()).contains(5L)
assertThat(body.topP()).contains(0.7)
- assertThat(body.userProfileId()).contains("user_profile_id")
}
@Test
diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/messages/StructuredMessageCreateParamsTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/messages/StructuredMessageCreateParamsTest.kt
index 585061adf..5e6cdecf8 100644
--- a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/messages/StructuredMessageCreateParamsTest.kt
+++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/messages/StructuredMessageCreateParamsTest.kt
@@ -281,7 +281,6 @@ internal class StructuredMessageCreateParamsTest {
DelegationWriteTestCase("topP", JSON_FIELD),
DelegationWriteTestCase("userProfileId", STRING),
DelegationWriteTestCase("userProfileId", OPTIONAL),
- DelegationWriteTestCase("userProfileId", JSON_FIELD),
DelegationWriteTestCase("additionalBodyProperties", MAP),
DelegationWriteTestCase("putAdditionalBodyProperty", STRING, JSON_VALUE),
DelegationWriteTestCase("putAllAdditionalBodyProperties", MAP),
diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/messages/batches/BatchCreateParamsTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/messages/batches/BatchCreateParamsTest.kt
index 247b33845..adf87069d 100644
--- a/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/messages/batches/BatchCreateParamsTest.kt
+++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/beta/messages/batches/BatchCreateParamsTest.kt
@@ -36,6 +36,7 @@ internal class BatchCreateParamsTest {
fun create() {
BatchCreateParams.builder()
.addBeta(AnthropicBeta.MESSAGE_BATCHES_2024_09_24)
+ .userProfileId("anthropic-user-profile-id")
.addRequest(
BatchCreateParams.Request.builder()
.customId("my-custom-id-1")
@@ -174,7 +175,7 @@ internal class BatchCreateParamsTest {
.serviceTier(BatchCreateParams.Request.Params.ServiceTier.AUTO)
.speed(BatchCreateParams.Request.Params.Speed.STANDARD)
.addStopSequence("string")
- .stream(true)
+ .stream(false)
.systemOfBetaTextBlockParams(
listOf(
BetaTextBlockParam.builder()
@@ -245,7 +246,6 @@ internal class BatchCreateParamsTest {
)
.topK(5L)
.topP(0.7)
- .userProfileId("user_profile_id")
.build()
)
.build()
@@ -258,6 +258,7 @@ internal class BatchCreateParamsTest {
val params =
BatchCreateParams.builder()
.addBeta(AnthropicBeta.MESSAGE_BATCHES_2024_09_24)
+ .userProfileId("anthropic-user-profile-id")
.addRequest(
BatchCreateParams.Request.builder()
.customId("my-custom-id-1")
@@ -398,7 +399,7 @@ internal class BatchCreateParamsTest {
.serviceTier(BatchCreateParams.Request.Params.ServiceTier.AUTO)
.speed(BatchCreateParams.Request.Params.Speed.STANDARD)
.addStopSequence("string")
- .stream(true)
+ .stream(false)
.systemOfBetaTextBlockParams(
listOf(
BetaTextBlockParam.builder()
@@ -471,7 +472,6 @@ internal class BatchCreateParamsTest {
)
.topK(5L)
.topP(0.7)
- .userProfileId("user_profile_id")
.build()
)
.build()
@@ -482,7 +482,10 @@ internal class BatchCreateParamsTest {
assertThat(headers)
.isEqualTo(
- Headers.builder().put("anthropic-beta", "message-batches-2024-09-24").build()
+ Headers.builder()
+ .put("anthropic-beta", "message-batches-2024-09-24")
+ .put("anthropic-user-profile-id", "anthropic-user-profile-id")
+ .build()
)
}
@@ -514,6 +517,7 @@ internal class BatchCreateParamsTest {
val params =
BatchCreateParams.builder()
.addBeta(AnthropicBeta.MESSAGE_BATCHES_2024_09_24)
+ .userProfileId("anthropic-user-profile-id")
.addRequest(
BatchCreateParams.Request.builder()
.customId("my-custom-id-1")
@@ -654,7 +658,7 @@ internal class BatchCreateParamsTest {
.serviceTier(BatchCreateParams.Request.Params.ServiceTier.AUTO)
.speed(BatchCreateParams.Request.Params.Speed.STANDARD)
.addStopSequence("string")
- .stream(true)
+ .stream(false)
.systemOfBetaTextBlockParams(
listOf(
BetaTextBlockParam.builder()
@@ -727,7 +731,6 @@ internal class BatchCreateParamsTest {
)
.topK(5L)
.topP(0.7)
- .userProfileId("user_profile_id")
.build()
)
.build()
@@ -875,7 +878,7 @@ internal class BatchCreateParamsTest {
.serviceTier(BatchCreateParams.Request.Params.ServiceTier.AUTO)
.speed(BatchCreateParams.Request.Params.Speed.STANDARD)
.addStopSequence("string")
- .stream(true)
+ .stream(false)
.systemOfBetaTextBlockParams(
listOf(
BetaTextBlockParam.builder()
@@ -946,7 +949,6 @@ internal class BatchCreateParamsTest {
)
.topK(5L)
.topP(0.7)
- .userProfileId("user_profile_id")
.build()
)
.build()
diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/messages/MessageCreateParamsTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/messages/MessageCreateParamsTest.kt
index 615664c9a..1cabc5b83 100644
--- a/anthropic-java-core/src/test/kotlin/com/anthropic/models/messages/MessageCreateParamsTest.kt
+++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/messages/MessageCreateParamsTest.kt
@@ -3,6 +3,7 @@
package com.anthropic.models.messages
import com.anthropic.core.JsonValue
+import com.anthropic.core.http.Headers
import kotlin.jvm.optionals.getOrNull
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
@@ -12,6 +13,7 @@ internal class MessageCreateParamsTest {
@Test
fun create() {
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -102,10 +104,129 @@ internal class MessageCreateParamsTest {
.build()
}
+ @Test
+ fun headers() {
+ val params =
+ MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
+ .maxTokens(1024L)
+ .addUserMessage("Hello, world")
+ .model(Model.CLAUDE_OPUS_4_6)
+ .cacheControl(
+ CacheControlEphemeral.builder().ttl(CacheControlEphemeral.Ttl.TTL_5M).build()
+ )
+ .container("container")
+ .inferenceGeo("inference_geo")
+ .metadata(Metadata.builder().userId("13803d75-b4b5-4c3e-b2a2-6f21399b021b").build())
+ .outputConfig(
+ OutputConfig.builder()
+ .effort(OutputConfig.Effort.LOW)
+ .format(
+ JsonOutputFormat.builder()
+ .schema(
+ JsonOutputFormat.Schema.builder()
+ .putAdditionalProperty("foo", JsonValue.from("bar"))
+ .build()
+ )
+ .build()
+ )
+ .build()
+ )
+ .serviceTier(MessageCreateParams.ServiceTier.AUTO)
+ .addStopSequence("string")
+ .systemOfTextBlockParams(
+ listOf(
+ TextBlockParam.builder()
+ .text("Today's date is 2024-06-01.")
+ .cacheControl(
+ CacheControlEphemeral.builder()
+ .ttl(CacheControlEphemeral.Ttl.TTL_5M)
+ .build()
+ )
+ .addCitation(
+ CitationCharLocationParam.builder()
+ .citedText("cited_text")
+ .documentIndex(0L)
+ .documentTitle("x")
+ .endCharIndex(0L)
+ .startCharIndex(0L)
+ .build()
+ )
+ .build()
+ )
+ )
+ .temperature(1.0)
+ .thinking(
+ ThinkingConfigAdaptive.builder()
+ .display(ThinkingConfigAdaptive.Display.SUMMARIZED)
+ .build()
+ )
+ .toolChoice(ToolChoiceAuto.builder().disableParallelToolUse(true).build())
+ .addTool(
+ Tool.builder()
+ .inputSchema(
+ Tool.InputSchema.builder()
+ .properties(
+ Tool.InputSchema.Properties.builder()
+ .putAdditionalProperty("location", JsonValue.from("bar"))
+ .putAdditionalProperty("unit", JsonValue.from("bar"))
+ .build()
+ )
+ .addRequired("location")
+ .build()
+ )
+ .name("name")
+ .addAllowedCaller(Tool.AllowedCaller.DIRECT)
+ .cacheControl(
+ CacheControlEphemeral.builder()
+ .ttl(CacheControlEphemeral.Ttl.TTL_5M)
+ .build()
+ )
+ .deferLoading(true)
+ .description("Get the current weather in a given location")
+ .eagerInputStreaming(true)
+ .addInputExample(
+ Tool.InputExample.builder()
+ .putAdditionalProperty("foo", JsonValue.from("bar"))
+ .build()
+ )
+ .strict(true)
+ .type(Tool.Type.CUSTOM)
+ .build()
+ )
+ .topK(5L)
+ .topP(0.7)
+ .build()
+
+ val headers = params._headers()
+
+ assertThat(headers)
+ .isEqualTo(
+ Headers.builder()
+ .put("anthropic-user-profile-id", "anthropic-user-profile-id")
+ .build()
+ )
+ }
+
+ @Test
+ fun headersWithoutOptionalFields() {
+ val params =
+ MessageCreateParams.builder()
+ .maxTokens(1024L)
+ .addUserMessage("Hello, world")
+ .model(Model.CLAUDE_OPUS_4_6)
+ .build()
+
+ val headers = params._headers()
+
+ assertThat(headers).isEqualTo(Headers.builder().build())
+ }
+
@Test
fun body() {
val params =
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/messages/StructuredMessageCreateParamsTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/messages/StructuredMessageCreateParamsTest.kt
index d73703834..666586156 100644
--- a/anthropic-java-core/src/test/kotlin/com/anthropic/models/messages/StructuredMessageCreateParamsTest.kt
+++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/messages/StructuredMessageCreateParamsTest.kt
@@ -11,6 +11,7 @@ import com.anthropic.core.findDelegationMethod
import com.anthropic.core.http.Headers
import com.anthropic.core.http.QueryParams
import com.anthropic.core.outputFormatFromClass
+import java.util.Optional
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
import org.junit.jupiter.params.ParameterizedTest
@@ -214,6 +215,8 @@ internal class StructuredMessageCreateParamsTest {
DelegationWriteTestCase("topK", JsonField.of(10L)),
DelegationWriteTestCase("topP", 0.9),
DelegationWriteTestCase("topP", JsonField.of(0.9)),
+ DelegationWriteTestCase("userProfileId", "uprof_test"),
+ DelegationWriteTestCase("userProfileId", Optional.of("uprof_test")),
DelegationWriteTestCase(
"additionalBodyProperties",
mapOf("k" to JsonValue.from("v")),
diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/models/messages/batches/BatchCreateParamsTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/models/messages/batches/BatchCreateParamsTest.kt
index ad89b247a..6be703545 100644
--- a/anthropic-java-core/src/test/kotlin/com/anthropic/models/messages/batches/BatchCreateParamsTest.kt
+++ b/anthropic-java-core/src/test/kotlin/com/anthropic/models/messages/batches/BatchCreateParamsTest.kt
@@ -3,6 +3,7 @@
package com.anthropic.models.messages.batches
import com.anthropic.core.JsonValue
+import com.anthropic.core.http.Headers
import com.anthropic.models.messages.CacheControlEphemeral
import com.anthropic.models.messages.CitationCharLocationParam
import com.anthropic.models.messages.JsonOutputFormat
@@ -21,6 +22,7 @@ internal class BatchCreateParamsTest {
@Test
fun create() {
BatchCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.addRequest(
BatchCreateParams.Request.builder()
.customId("my-custom-id-1")
@@ -60,7 +62,7 @@ internal class BatchCreateParamsTest {
)
.serviceTier(BatchCreateParams.Request.Params.ServiceTier.AUTO)
.addStopSequence("string")
- .stream(true)
+ .stream(false)
.systemOfTextBlockParams(
listOf(
TextBlockParam.builder()
@@ -138,10 +140,165 @@ internal class BatchCreateParamsTest {
.build()
}
+ @Test
+ fun headers() {
+ val params =
+ BatchCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
+ .addRequest(
+ BatchCreateParams.Request.builder()
+ .customId("my-custom-id-1")
+ .params(
+ BatchCreateParams.Request.Params.builder()
+ .maxTokens(1024L)
+ .addUserMessage("Hello, world")
+ .model(Model.CLAUDE_OPUS_4_6)
+ .cacheControl(
+ CacheControlEphemeral.builder()
+ .ttl(CacheControlEphemeral.Ttl.TTL_5M)
+ .build()
+ )
+ .container("container")
+ .inferenceGeo("inference_geo")
+ .metadata(
+ Metadata.builder()
+ .userId("13803d75-b4b5-4c3e-b2a2-6f21399b021b")
+ .build()
+ )
+ .outputConfig(
+ OutputConfig.builder()
+ .effort(OutputConfig.Effort.LOW)
+ .format(
+ JsonOutputFormat.builder()
+ .schema(
+ JsonOutputFormat.Schema.builder()
+ .putAdditionalProperty(
+ "foo",
+ JsonValue.from("bar"),
+ )
+ .build()
+ )
+ .build()
+ )
+ .build()
+ )
+ .serviceTier(BatchCreateParams.Request.Params.ServiceTier.AUTO)
+ .addStopSequence("string")
+ .stream(false)
+ .systemOfTextBlockParams(
+ listOf(
+ TextBlockParam.builder()
+ .text("Today's date is 2024-06-01.")
+ .cacheControl(
+ CacheControlEphemeral.builder()
+ .ttl(CacheControlEphemeral.Ttl.TTL_5M)
+ .build()
+ )
+ .addCitation(
+ CitationCharLocationParam.builder()
+ .citedText("cited_text")
+ .documentIndex(0L)
+ .documentTitle("x")
+ .endCharIndex(0L)
+ .startCharIndex(0L)
+ .build()
+ )
+ .build()
+ )
+ )
+ .temperature(1.0)
+ .thinking(
+ ThinkingConfigAdaptive.builder()
+ .display(ThinkingConfigAdaptive.Display.SUMMARIZED)
+ .build()
+ )
+ .toolChoice(
+ ToolChoiceAuto.builder().disableParallelToolUse(true).build()
+ )
+ .addTool(
+ Tool.builder()
+ .inputSchema(
+ Tool.InputSchema.builder()
+ .properties(
+ Tool.InputSchema.Properties.builder()
+ .putAdditionalProperty(
+ "location",
+ JsonValue.from("bar"),
+ )
+ .putAdditionalProperty(
+ "unit",
+ JsonValue.from("bar"),
+ )
+ .build()
+ )
+ .addRequired("location")
+ .build()
+ )
+ .name("name")
+ .addAllowedCaller(Tool.AllowedCaller.DIRECT)
+ .cacheControl(
+ CacheControlEphemeral.builder()
+ .ttl(CacheControlEphemeral.Ttl.TTL_5M)
+ .build()
+ )
+ .deferLoading(true)
+ .description("Get the current weather in a given location")
+ .eagerInputStreaming(true)
+ .addInputExample(
+ Tool.InputExample.builder()
+ .putAdditionalProperty("foo", JsonValue.from("bar"))
+ .build()
+ )
+ .strict(true)
+ .type(Tool.Type.CUSTOM)
+ .build()
+ )
+ .topK(5L)
+ .topP(0.7)
+ .build()
+ )
+ .build()
+ )
+ .build()
+
+ val headers = params._headers()
+
+ assertThat(headers)
+ .isEqualTo(
+ Headers.builder()
+ .put("anthropic-user-profile-id", "anthropic-user-profile-id")
+ .build()
+ )
+ }
+
+ @Test
+ fun headersWithoutOptionalFields() {
+ val params =
+ BatchCreateParams.builder()
+ .addRequest(
+ BatchCreateParams.Request.builder()
+ .customId("my-custom-id-1")
+ .params(
+ BatchCreateParams.Request.Params.builder()
+ .maxTokens(1024L)
+ .addUserMessage("Hello, world")
+ .model(Model.CLAUDE_OPUS_4_6)
+ .build()
+ )
+ .build()
+ )
+ .build()
+
+ val headers = params._headers()
+
+ assertThat(headers).isEqualTo(Headers.builder().build())
+ }
+
@Test
fun body() {
val params =
BatchCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.addRequest(
BatchCreateParams.Request.builder()
.customId("my-custom-id-1")
@@ -181,7 +338,7 @@ internal class BatchCreateParamsTest {
)
.serviceTier(BatchCreateParams.Request.Params.ServiceTier.AUTO)
.addStopSequence("string")
- .stream(true)
+ .stream(false)
.systemOfTextBlockParams(
listOf(
TextBlockParam.builder()
@@ -300,7 +457,7 @@ internal class BatchCreateParamsTest {
)
.serviceTier(BatchCreateParams.Request.Params.ServiceTier.AUTO)
.addStopSequence("string")
- .stream(true)
+ .stream(false)
.systemOfTextBlockParams(
listOf(
TextBlockParam.builder()
diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/services/ErrorHandlingTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/services/ErrorHandlingTest.kt
index 0107f45d7..9282e2dc2 100644
--- a/anthropic-java-core/src/test/kotlin/com/anthropic/services/ErrorHandlingTest.kt
+++ b/anthropic-java-core/src/test/kotlin/com/anthropic/services/ErrorHandlingTest.kt
@@ -84,6 +84,7 @@ internal class ErrorHandlingTest {
assertThrows {
messageService.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -206,6 +207,7 @@ internal class ErrorHandlingTest {
assertThrows {
messageService.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -328,6 +330,7 @@ internal class ErrorHandlingTest {
assertThrows {
messageService.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -450,6 +453,7 @@ internal class ErrorHandlingTest {
assertThrows {
messageService.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -572,6 +576,7 @@ internal class ErrorHandlingTest {
assertThrows {
messageService.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -694,6 +699,7 @@ internal class ErrorHandlingTest {
assertThrows {
messageService.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -816,6 +822,7 @@ internal class ErrorHandlingTest {
assertThrows {
messageService.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -938,6 +945,7 @@ internal class ErrorHandlingTest {
assertThrows {
messageService.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -1060,6 +1068,7 @@ internal class ErrorHandlingTest {
assertThrows {
messageService.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -1182,6 +1191,7 @@ internal class ErrorHandlingTest {
assertThrows {
messageService.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -1304,6 +1314,7 @@ internal class ErrorHandlingTest {
assertThrows {
messageService.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -1426,6 +1437,7 @@ internal class ErrorHandlingTest {
assertThrows {
messageService.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -1548,6 +1560,7 @@ internal class ErrorHandlingTest {
assertThrows {
messageService.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -1670,6 +1683,7 @@ internal class ErrorHandlingTest {
assertThrows {
messageService.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -1792,6 +1806,7 @@ internal class ErrorHandlingTest {
assertThrows {
messageService.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -1914,6 +1929,7 @@ internal class ErrorHandlingTest {
assertThrows {
messageService.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -2034,6 +2050,7 @@ internal class ErrorHandlingTest {
assertThrows {
messageService.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/services/ServiceParamsTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/services/ServiceParamsTest.kt
index 4c85835f5..a7e4a50c4 100644
--- a/anthropic-java-core/src/test/kotlin/com/anthropic/services/ServiceParamsTest.kt
+++ b/anthropic-java-core/src/test/kotlin/com/anthropic/services/ServiceParamsTest.kt
@@ -52,6 +52,7 @@ internal class ServiceParamsTest {
messageService.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/MessageServiceAsyncTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/MessageServiceAsyncTest.kt
index ff3612299..e3615136b 100644
--- a/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/MessageServiceAsyncTest.kt
+++ b/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/MessageServiceAsyncTest.kt
@@ -35,6 +35,7 @@ internal class MessageServiceAsyncTest {
val messageFuture =
messageServiceAsync.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -148,6 +149,7 @@ internal class MessageServiceAsyncTest {
val messageStreamResponse =
messageServiceAsync.createStreaming(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/beta/MessageServiceAsyncTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/beta/MessageServiceAsyncTest.kt
index 70f58b0c5..89cdfa69f 100644
--- a/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/beta/MessageServiceAsyncTest.kt
+++ b/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/beta/MessageServiceAsyncTest.kt
@@ -49,6 +49,7 @@ internal class MessageServiceAsyncTest {
messageServiceAsync.create(
MessageCreateParams.builder()
.addBeta(AnthropicBeta.MESSAGE_BATCHES_2024_09_24)
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -239,7 +240,6 @@ internal class MessageServiceAsyncTest {
)
.topK(5L)
.topP(0.7)
- .userProfileId("user_profile_id")
.build()
)
@@ -260,6 +260,7 @@ internal class MessageServiceAsyncTest {
messageServiceAsync.createStreaming(
MessageCreateParams.builder()
.addBeta(AnthropicBeta.MESSAGE_BATCHES_2024_09_24)
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -450,7 +451,6 @@ internal class MessageServiceAsyncTest {
)
.topK(5L)
.topP(0.7)
- .userProfileId("user_profile_id")
.build()
)
diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/beta/messages/BatchServiceAsyncTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/beta/messages/BatchServiceAsyncTest.kt
index ad9b2ae63..654aef97c 100644
--- a/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/beta/messages/BatchServiceAsyncTest.kt
+++ b/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/beta/messages/BatchServiceAsyncTest.kt
@@ -52,6 +52,7 @@ internal class BatchServiceAsyncTest {
batchServiceAsync.create(
BatchCreateParams.builder()
.addBeta(AnthropicBeta.MESSAGE_BATCHES_2024_09_24)
+ .userProfileId("anthropic-user-profile-id")
.addRequest(
BatchCreateParams.Request.builder()
.customId("my-custom-id-1")
@@ -198,7 +199,7 @@ internal class BatchServiceAsyncTest {
.serviceTier(BatchCreateParams.Request.Params.ServiceTier.AUTO)
.speed(BatchCreateParams.Request.Params.Speed.STANDARD)
.addStopSequence("string")
- .stream(true)
+ .stream(false)
.systemOfBetaTextBlockParams(
listOf(
BetaTextBlockParam.builder()
@@ -276,7 +277,6 @@ internal class BatchServiceAsyncTest {
)
.topK(5L)
.topP(0.7)
- .userProfileId("user_profile_id")
.build()
)
.build()
diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/messages/BatchServiceAsyncTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/messages/BatchServiceAsyncTest.kt
index a9e307536..2a59fd217 100644
--- a/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/messages/BatchServiceAsyncTest.kt
+++ b/anthropic-java-core/src/test/kotlin/com/anthropic/services/async/messages/BatchServiceAsyncTest.kt
@@ -34,6 +34,7 @@ internal class BatchServiceAsyncTest {
val messageBatchFuture =
batchServiceAsync.create(
BatchCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.addRequest(
BatchCreateParams.Request.builder()
.customId("my-custom-id-1")
@@ -73,7 +74,7 @@ internal class BatchServiceAsyncTest {
)
.serviceTier(BatchCreateParams.Request.Params.ServiceTier.AUTO)
.addStopSequence("string")
- .stream(true)
+ .stream(false)
.systemOfTextBlockParams(
listOf(
TextBlockParam.builder()
diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/MessageServiceTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/MessageServiceTest.kt
index 542802dd3..32657b828 100644
--- a/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/MessageServiceTest.kt
+++ b/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/MessageServiceTest.kt
@@ -35,6 +35,7 @@ internal class MessageServiceTest {
val message =
messageService.create(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -147,6 +148,7 @@ internal class MessageServiceTest {
val messageStreamResponse =
messageService.createStreaming(
MessageCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/beta/MessageServiceTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/beta/MessageServiceTest.kt
index 9d55a74ba..d195d3b9a 100644
--- a/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/beta/MessageServiceTest.kt
+++ b/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/beta/MessageServiceTest.kt
@@ -49,6 +49,7 @@ internal class MessageServiceTest {
messageService.create(
MessageCreateParams.builder()
.addBeta(AnthropicBeta.MESSAGE_BATCHES_2024_09_24)
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -239,7 +240,6 @@ internal class MessageServiceTest {
)
.topK(5L)
.topP(0.7)
- .userProfileId("user_profile_id")
.build()
)
@@ -259,6 +259,7 @@ internal class MessageServiceTest {
messageService.createStreaming(
MessageCreateParams.builder()
.addBeta(AnthropicBeta.MESSAGE_BATCHES_2024_09_24)
+ .userProfileId("anthropic-user-profile-id")
.maxTokens(1024L)
.addUserMessage("Hello, world")
.model(Model.CLAUDE_OPUS_4_6)
@@ -449,7 +450,6 @@ internal class MessageServiceTest {
)
.topK(5L)
.topP(0.7)
- .userProfileId("user_profile_id")
.build()
)
diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/beta/messages/BatchServiceTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/beta/messages/BatchServiceTest.kt
index af9e5d9d3..727bb5f06 100644
--- a/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/beta/messages/BatchServiceTest.kt
+++ b/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/beta/messages/BatchServiceTest.kt
@@ -52,6 +52,7 @@ internal class BatchServiceTest {
batchService.create(
BatchCreateParams.builder()
.addBeta(AnthropicBeta.MESSAGE_BATCHES_2024_09_24)
+ .userProfileId("anthropic-user-profile-id")
.addRequest(
BatchCreateParams.Request.builder()
.customId("my-custom-id-1")
@@ -198,7 +199,7 @@ internal class BatchServiceTest {
.serviceTier(BatchCreateParams.Request.Params.ServiceTier.AUTO)
.speed(BatchCreateParams.Request.Params.Speed.STANDARD)
.addStopSequence("string")
- .stream(true)
+ .stream(false)
.systemOfBetaTextBlockParams(
listOf(
BetaTextBlockParam.builder()
@@ -276,7 +277,6 @@ internal class BatchServiceTest {
)
.topK(5L)
.topP(0.7)
- .userProfileId("user_profile_id")
.build()
)
.build()
diff --git a/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/messages/BatchServiceTest.kt b/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/messages/BatchServiceTest.kt
index bd2a4aa3b..9305a6a28 100644
--- a/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/messages/BatchServiceTest.kt
+++ b/anthropic-java-core/src/test/kotlin/com/anthropic/services/blocking/messages/BatchServiceTest.kt
@@ -34,6 +34,7 @@ internal class BatchServiceTest {
val messageBatch =
batchService.create(
BatchCreateParams.builder()
+ .userProfileId("anthropic-user-profile-id")
.addRequest(
BatchCreateParams.Request.builder()
.customId("my-custom-id-1")
@@ -73,7 +74,7 @@ internal class BatchServiceTest {
)
.serviceTier(BatchCreateParams.Request.Params.ServiceTier.AUTO)
.addStopSequence("string")
- .stream(true)
+ .stream(false)
.systemOfTextBlockParams(
listOf(
TextBlockParam.builder()
diff --git a/anthropic-java-mcp/build.gradle.kts b/anthropic-java-mcp/build.gradle.kts
index f7b5df274..5acc0da8e 100644
--- a/anthropic-java-mcp/build.gradle.kts
+++ b/anthropic-java-mcp/build.gradle.kts
@@ -29,12 +29,12 @@ tasks.withType().configureEach { options.release.set(17) }
kotlin {
compilerOptions {
- // Override the Java 8 settings inherited from `anthropic.kotlin` so we can reference MCP
- // SDK types that extend `java.lang.Record` (introduced in Java 16). This reassigns the
- // whole list, so the flags shared with `anthropic.kotlin` must be repeated here —
- // `-Xsuppress-version-warnings` in particular is still needed because we inherit
- // `languageVersion = 2.0`, whose deprecation notice `-nowarn` does not cover.
- freeCompilerArgs = listOf("-Xjdk-release=17", "-nowarn", "-Xsuppress-version-warnings")
+ // Override the Java 8 target inherited from `anthropic.kotlin` so we can reference MCP SDK
+ // types that extend `java.lang.Record` (Java 16+). Swap only `-Xjdk-release` rather than
+ // reassigning the list, so the convention plugin's warning-suppression flags stay in sync.
+ freeCompilerArgs.set(
+ freeCompilerArgs.get().map { if (it.startsWith("-Xjdk-release=")) "-Xjdk-release=17" else it }
+ )
jvmTarget.set(JvmTarget.JVM_17)
}
}
diff --git a/anthropic-java-mcp/src/main/kotlin/com/anthropic/mcp/BetaMcp.kt b/anthropic-java-mcp/src/main/kotlin/com/anthropic/mcp/BetaMcp.kt
index fdddee8cd..2c3bd49ad 100644
--- a/anthropic-java-mcp/src/main/kotlin/com/anthropic/mcp/BetaMcp.kt
+++ b/anthropic-java-mcp/src/main/kotlin/com/anthropic/mcp/BetaMcp.kt
@@ -94,10 +94,6 @@ object BetaMcp {
throw AnthropicInvalidDataException(
"MCP resource links must be resolved by the MCP client before conversion"
)
- else ->
- throw AnthropicInvalidDataException(
- "Unsupported MCP content type: ${content.type()}"
- )
}
/**
@@ -259,14 +255,12 @@ object BetaMcp {
is McpSchema.TextResourceContents -> item.text()
is McpSchema.BlobResourceContents ->
String(Base64.getDecoder().decode(item.blob()), StandardCharsets.UTF_8)
- else -> throw AnthropicInvalidDataException("Unsupported resource contents type")
}
private fun resourceContentsToBytes(item: McpSchema.ResourceContents): ByteArray =
when (item) {
is McpSchema.BlobResourceContents -> Base64.getDecoder().decode(item.blob())
is McpSchema.TextResourceContents -> item.text().toByteArray(StandardCharsets.UTF_8)
- else -> throw AnthropicInvalidDataException("Unsupported resource contents type")
}
private fun convertCallToolResult(
diff --git a/build.gradle.kts b/build.gradle.kts
index 135a99ad9..81a4d6901 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,4 +1,4 @@
allprojects {
group = "com.anthropic"
- version = "2.43.0" // x-release-please-version
+ version = "2.44.0" // x-release-please-version
}
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
index 97e2dc161..97bf6b411 100644
--- a/buildSrc/build.gradle.kts
+++ b/buildSrc/build.gradle.kts
@@ -15,6 +15,24 @@ dependencyLocking {
lockMode.set(LockMode.STRICT)
}
+// Mirrors `anthropic.java`'s task of the same name. A CLI build never resolves
+// `:buildSrc:runtimeClasspath`, so `--write-locks` alone omits it from the lockfile and STRICT
+// mode then rejects IntelliJ sync, which does resolve it.
+tasks.register("resolveAndLockAll") {
+ group = "Help"
+ description = "Resolves all configurations to write dependency lock state."
+ notCompatibleWithConfigurationCache("Resolves configurations at execution time")
+ val startParameter = project.gradle.startParameter
+ doFirst {
+ require(startParameter.isWriteDependencyLocks) {
+ "Run with --write-locks to update lock state"
+ }
+ }
+ doLast {
+ configurations.filter { it.isCanBeResolved }.forEach { it.resolve() }
+ }
+}
+
repositories {
gradlePluginPortal()
mavenCentral()
diff --git a/buildSrc/gradle.lockfile b/buildSrc/gradle.lockfile
index 3446e34dd..dd6124540 100644
--- a/buildSrc/gradle.lockfile
+++ b/buildSrc/gradle.lockfile
@@ -1,103 +1,109 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
-com.fasterxml.jackson.core:jackson-annotations:2.15.3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.fasterxml.jackson.core:jackson-core:2.15.3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.fasterxml.jackson.core:jackson-databind:2.15.3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.15.3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.fasterxml.jackson.module:jackson-module-kotlin:2.15.3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.fasterxml.jackson:jackson-bom:2.15.3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.fasterxml.woodstox:woodstox-core:7.1.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.github.zafarkhaja:java-semver:0.10.2=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.google.code.gson:gson:2.11.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.google.errorprone:error_prone_annotations:2.27.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.gradleup.shadow:shadow-gradle-plugin:8.3.8=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.guardsquare:proguard-base:7.9.1=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.guardsquare:proguard-core:9.3.2=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.guardsquare:proguard-gradle:7.9.1=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.squareup.moshi:moshi-kotlin:1.15.2=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.squareup.moshi:moshi:1.15.2=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.squareup.okhttp3:okhttp-jvm:5.1.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.squareup.okhttp3:okhttp:5.1.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.squareup.okio:okio-jvm:3.15.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.squareup.okio:okio:3.15.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.squareup.retrofit2:converter-moshi:3.0.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.squareup.retrofit2:converter-scalars:3.0.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.squareup.retrofit2:retrofit:3.0.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.vanniktech:central-portal:0.36.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-com.vanniktech:gradle-maven-publish-plugin:0.36.0=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-commons-io:commons-io:2.19.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.apache.ant:ant-launcher:1.10.15=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.apache.ant:ant:1.10.15=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.apache.logging.log4j:log4j-api:2.25.3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.apache.logging.log4j:log4j-core:2.25.3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.apache.maven:maven-api-annotations:4.0.0-rc-3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.apache.maven:maven-api-xml:4.0.0-rc-3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.apache.maven:maven-xml:4.0.0-rc-3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.codehaus.plexus:plexus-utils:4.0.2=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.codehaus.plexus:plexus-xml:4.1.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.codehaus.woodstox:stax2-api:4.2.2=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jdom:jdom2:2.0.6.1=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.dokka:dokka-core:2.2.0=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.dokka:dokka-gradle-plugin:2.2.0=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:abi-tools-api:2.3.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:fus-statistics-gradle-plugin:2.3.21=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-assignment-compiler-plugin-embeddable:2.3.20=kotlinCompilerPluginClasspathMain
-org.jetbrains.kotlin:kotlin-build-statistics:2.3.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-build-tools-api:2.3.20=kotlinBuildToolsApiClasspath
-org.jetbrains.kotlin:kotlin-build-tools-api:2.3.21=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-build-tools-compat:2.3.20=kotlinBuildToolsApiClasspath
-org.jetbrains.kotlin:kotlin-build-tools-cri-impl:2.3.20=kotlinBuildToolsApiClasspath
-org.jetbrains.kotlin:kotlin-build-tools-impl:2.3.20=kotlinBuildToolsApiClasspath
-org.jetbrains.kotlin:kotlin-compiler-embeddable:2.3.20=kotlinBuildToolsApiClasspath
-org.jetbrains.kotlin:kotlin-compiler-runner:2.3.20=kotlinBuildToolsApiClasspath
-org.jetbrains.kotlin:kotlin-compiler-runner:2.3.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-daemon-client:2.3.20=kotlinBuildToolsApiClasspath
-org.jetbrains.kotlin:kotlin-daemon-client:2.3.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-daemon-embeddable:2.3.20=kotlinBuildToolsApiClasspath
-org.jetbrains.kotlin:kotlin-gradle-plugin-annotations:2.3.21=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-gradle-plugin-api:2.3.21=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-gradle-plugin-idea-proto:2.3.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-gradle-plugin-idea:2.3.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-gradle-plugin:2.3.21=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-gradle-plugins-bom:2.3.21=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-klib-commonizer-api:2.3.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-metadata-jvm:2.3.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-native-utils:2.3.21=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-reflect:1.6.10=kotlinBuildToolsApiClasspath
-org.jetbrains.kotlin:kotlin-reflect:1.8.21=buildScriptClasspath
-org.jetbrains.kotlin:kotlin-reflect:2.3.20=compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-sam-with-receiver-compiler-plugin-embeddable:2.3.20=kotlinCompilerPluginClasspathMain
-org.jetbrains.kotlin:kotlin-script-runtime:2.3.20=compilePluginsBlocksPluginClasspathElements,kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathMain
-org.jetbrains.kotlin:kotlin-scripting-common:2.3.20=compilePluginsBlocksPluginClasspathElements,kotlinCompilerPluginClasspathMain
-org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:2.3.20=compilePluginsBlocksPluginClasspathElements,kotlinCompilerPluginClasspathMain
-org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:2.3.20=compilePluginsBlocksPluginClasspathElements,kotlinCompilerPluginClasspathMain
-org.jetbrains.kotlin:kotlin-scripting-jvm:2.3.20=compilePluginsBlocksPluginClasspathElements,kotlinCompilerPluginClasspathMain
-org.jetbrains.kotlin:kotlin-stdlib-common:2.3.0=buildScriptClasspath
-org.jetbrains.kotlin:kotlin-stdlib-common:2.3.20=precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-stdlib:2.3.0=buildScriptClasspath
-org.jetbrains.kotlin:kotlin-stdlib:2.3.20=compileClasspath,compilePluginsBlocksPluginClasspathElements,kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathMain,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-tooling-core:2.3.20=kotlinBuildToolsApiClasspath
-org.jetbrains.kotlin:kotlin-tooling-core:2.3.21=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-util-io:2.3.21=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-util-klib-metadata:2.3.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlin:kotlin-util-klib:2.3.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.8.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.8.0=buildScriptClasspath,kotlinBuildToolsApiClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlinx:kotlinx-serialization-bom:1.6.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.6.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.6.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.jetbrains:annotations:13.0=compileClasspath,compilePluginsBlocksPluginClasspathElements,kotlinBuildToolsApiClasspath,kotlinCompilerPluginClasspathMain
-org.jetbrains:annotations:26.0.1=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.json:json:20231013=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.ow2.asm:asm-commons:9.8=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.ow2.asm:asm-tree:9.8=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.ow2.asm:asm:9.8=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.slf4j:slf4j-api:1.7.36=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-org.vafer:jdependency:2.13=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath
-empty=kotlinScriptDefExtensions
+com.fasterxml.jackson.core:jackson-annotations:2.15.3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.fasterxml.jackson.core:jackson-core:2.15.3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.fasterxml.jackson.core:jackson-databind:2.15.3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.15.3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.fasterxml.jackson.module:jackson-module-kotlin:2.15.3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.fasterxml.jackson:jackson-bom:2.15.3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.fasterxml.woodstox:woodstox-core:7.1.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.github.zafarkhaja:java-semver:0.10.2=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.google.code.gson:gson:2.11.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.google.errorprone:error_prone_annotations:2.27.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.gradleup.shadow:shadow-gradle-plugin:8.3.8=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+com.guardsquare:proguard-base:7.9.1=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+com.guardsquare:proguard-core:9.3.2=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+com.guardsquare:proguard-gradle:7.9.1=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+com.squareup.moshi:moshi-kotlin:1.15.2=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.squareup.moshi:moshi:1.15.2=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.squareup.okhttp3:okhttp-jvm:5.1.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.squareup.okhttp3:okhttp:5.1.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.squareup.okio:okio-jvm:3.15.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.squareup.okio:okio:3.15.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.squareup.retrofit2:converter-moshi:3.0.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.squareup.retrofit2:converter-scalars:3.0.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.squareup.retrofit2:retrofit:3.0.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.vanniktech:central-portal:0.36.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+com.vanniktech:gradle-maven-publish-plugin:0.36.0=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+commons-io:commons-io:2.19.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+io.github.java-diff-utils:java-diff-utils:4.12=kotlinInternalAbiValidation
+org.apache.ant:ant-launcher:1.10.15=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.apache.ant:ant:1.10.15=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.apache.logging.log4j:log4j-api:2.25.3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.apache.logging.log4j:log4j-core:2.25.3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.apache.maven:maven-api-annotations:4.0.0-rc-3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.apache.maven:maven-api-xml:4.0.0-rc-3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.apache.maven:maven-xml:4.0.0-rc-3=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.codehaus.plexus:plexus-utils:4.0.2=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.codehaus.plexus:plexus-xml:4.1.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.codehaus.woodstox:stax2-api:4.2.2=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jdom:jdom2:2.0.6.1=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.dokka:dokka-core:2.2.0=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.dokka:dokka-gradle-plugin:2.2.0=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:abi-tools-api:2.3.20=kotlinInternalAbiValidation
+org.jetbrains.kotlin:abi-tools-api:2.3.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:abi-tools:2.3.20=kotlinInternalAbiValidation
+org.jetbrains.kotlin:fus-statistics-gradle-plugin:2.3.21=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-assignment-compiler-plugin-embeddable:2.3.20=kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
+org.jetbrains.kotlin:kotlin-build-statistics:2.3.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-build-tools-api:2.3.20=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath
+org.jetbrains.kotlin:kotlin-build-tools-api:2.3.21=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-build-tools-compat:2.3.20=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath
+org.jetbrains.kotlin:kotlin-build-tools-cri-impl:2.3.20=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath
+org.jetbrains.kotlin:kotlin-build-tools-impl:2.3.20=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath
+org.jetbrains.kotlin:kotlin-compiler-embeddable:2.3.20=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
+org.jetbrains.kotlin:kotlin-compiler-runner:2.3.20=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath
+org.jetbrains.kotlin:kotlin-compiler-runner:2.3.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-daemon-client:2.3.20=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath
+org.jetbrains.kotlin:kotlin-daemon-client:2.3.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-daemon-embeddable:2.3.20=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
+org.jetbrains.kotlin:kotlin-gradle-plugin-annotations:2.3.21=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-gradle-plugin-api:2.3.21=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-gradle-plugin-idea-proto:2.3.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-gradle-plugin-idea:2.3.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-gradle-plugin:2.3.21=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-gradle-plugins-bom:2.3.21=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-klib-abi-reader:2.3.20=kotlinInternalAbiValidation
+org.jetbrains.kotlin:kotlin-klib-commonizer-api:2.3.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-klib-commonizer-embeddable:2.3.20=kotlinKlibCommonizerClasspath
+org.jetbrains.kotlin:kotlin-metadata-jvm:2.3.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-metadata-jvm:2.3.20=kotlinInternalAbiValidation
+org.jetbrains.kotlin:kotlin-native-utils:2.3.21=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-reflect:1.6.10=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
+org.jetbrains.kotlin:kotlin-reflect:1.8.21=buildScriptClasspath,runtimeClasspath
+org.jetbrains.kotlin:kotlin-reflect:2.3.20=compileClasspath,embeddedKotlin,precompiledScriptPluginAccessorsGenerationClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-sam-with-receiver-compiler-plugin-embeddable:2.3.20=kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
+org.jetbrains.kotlin:kotlin-script-runtime:2.3.20=compilePluginsBlocksPluginClasspathElements,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinKlibCommonizerClasspath
+org.jetbrains.kotlin:kotlin-scripting-common:2.3.20=compilePluginsBlocksPluginClasspathElements,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
+org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:2.3.20=compilePluginsBlocksPluginClasspathElements,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
+org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:2.3.20=compilePluginsBlocksPluginClasspathElements,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
+org.jetbrains.kotlin:kotlin-scripting-jvm:2.3.20=compilePluginsBlocksPluginClasspathElements,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest
+org.jetbrains.kotlin:kotlin-stdlib-common:2.3.0=buildScriptClasspath,runtimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib-common:2.3.20=precompiledScriptPluginAccessorsGenerationClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib:2.3.0=buildScriptClasspath,runtimeClasspath
+org.jetbrains.kotlin:kotlin-stdlib:2.3.20=compileClasspath,compilePluginsBlocksPluginClasspathElements,embeddedKotlin,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinInternalAbiValidation,kotlinKlibCommonizerClasspath,precompiledScriptPluginAccessorsGenerationClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-tooling-core:2.3.20=kotlinBuildToolsApiClasspath,kotlinCompilerClasspath
+org.jetbrains.kotlin:kotlin-tooling-core:2.3.21=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-util-io:2.3.21=buildScriptClasspath,compileClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-util-klib-metadata:2.3.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlin:kotlin-util-klib:2.3.21=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.8.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.8.0=buildScriptClasspath,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinKlibCommonizerClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-serialization-bom:1.6.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.6.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.6.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.jetbrains:annotations:13.0=compileClasspath,compilePluginsBlocksPluginClasspathElements,embeddedKotlin,kotlinBuildToolsApiClasspath,kotlinCompilerClasspath,kotlinCompilerPluginClasspathMain,kotlinCompilerPluginClasspathTest,kotlinInternalAbiValidation,kotlinKlibCommonizerClasspath,testCompileClasspath
+org.jetbrains:annotations:26.0.1=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.json:json:20231013=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.ow2.asm:asm-commons:9.8=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.ow2.asm:asm-tree:9.8=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.ow2.asm:asm:9.8=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.slf4j:slf4j-api:1.7.36=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+org.vafer:jdependency:2.13=buildScriptClasspath,precompiledScriptPluginAccessorsGenerationClasspath,runtimeClasspath,testRuntimeClasspath
+empty=annotationProcessor,implementationDependenciesMetadata,kotlinCompilerPluginClasspath,kotlinNativeCompilerPluginClasspath,kotlinScriptDefExtensions,testAnnotationProcessor,testImplementationDependenciesMetadata,testKotlinScriptDefExtensions
diff --git a/buildSrc/settings-gradle.lockfile b/buildSrc/settings-gradle.lockfile
new file mode 100644
index 000000000..709a43f74
--- /dev/null
+++ b/buildSrc/settings-gradle.lockfile
@@ -0,0 +1,4 @@
+# This is a Gradle generated file for dependency locking.
+# Manual edits can break the build and are not advised.
+# This file is expected to be part of source control.
+empty=incomingCatalogForLibs0
diff --git a/buildSrc/src/main/kotlin/anthropic.kotlin.gradle.kts b/buildSrc/src/main/kotlin/anthropic.kotlin.gradle.kts
index 684774f29..f323e0ac8 100644
--- a/buildSrc/src/main/kotlin/anthropic.kotlin.gradle.kts
+++ b/buildSrc/src/main/kotlin/anthropic.kotlin.gradle.kts
@@ -17,14 +17,18 @@ kotlin {
}
compilerOptions {
+ allWarningsAsErrors = true
freeCompilerArgs = listOf(
"-Xjdk-release=1.8",
- // Suppress all warnings: generated code may reference and test deprecated members and
- // trigger style lints that we can't act on.
- "-nowarn",
- // `-nowarn` doesn't cover the "language version 2.0 is deprecated" notice. That comes
- // from the version-validation pass. We pin 2.0 deliberately (see `languageVersion`).
+ // The "language version 2.0 is deprecated" notice comes from the version-validation
+ // pass; we pin 2.0 deliberately (see `languageVersion`).
"-Xsuppress-version-warnings",
+ // The SDK necessarily references its own `@Deprecated` members (delegating overloads,
+ // `validate()`, tests), so deprecation can't be promoted to an error.
+ "-Xwarning-level=DEPRECATION:disabled",
+ // Generated `validity()` helpers emit `.toInt()` on `Int` values; harmless and not
+ // worth special-casing in the generator.
+ "-Xwarning-level=REDUNDANT_CALL_OF_CONVERSION_METHOD:disabled",
)
// Emit default interface methods for the JVM.
jvmDefault.set(JvmDefaultMode.NO_COMPATIBILITY)
diff --git a/scripts/lock b/scripts/lock
index 787b2d938..56b5e377e 100755
--- a/scripts/lock
+++ b/scripts/lock
@@ -9,3 +9,8 @@ echo "==> Updating dependency lockfiles"
# resolves every configuration in every module so `--write-locks` captures
# the full lock state in one pass; the flag also propagates to `buildSrc`.
./gradlew resolveAndLockAll --write-locks "$@"
+
+# The root invocation can't address `buildSrc` tasks (included build); run its
+# own `resolveAndLockAll` to lock `runtimeClasspath`, which only IntelliJ sync
+# resolves.
+./gradlew -p buildSrc resolveAndLockAll --write-locks "$@"