diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f391d416..a25092c4 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.6.0" + ".": "3.6.1" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index c961e232..062111e2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 118 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-ea23db36b0899cc715f56d0098956069b2d92880f448adff3a4ac1bb53cb2cec.yml -openapi_spec_hash: 36f76ea31297c9593bcfae453f6255cc +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-937fcfac8cbab692796cd9822b37e48a311e2220a8b103106ded0ee92a0b9484.yml +openapi_spec_hash: 74a0c58b5b8c4e06792d79b685e02a01 config_hash: 666d6bb4b564f0d9d431124b5d1a0665 diff --git a/CHANGELOG.md b/CHANGELOG.md index b4345851..c33fc5da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## 3.6.1 (2025-09-22) + +Full Changelog: [v3.6.0...v3.6.1](https://github.com/openai/openai-java/compare/v3.6.0...v3.6.1) + +### Bug Fixes + +* **api:** fix mcp tool name ([d2e947d](https://github.com/openai/openai-java/commit/d2e947dc5a8585f0200c6ff96d093fa0997a39e7)) + + +### Chores + +* **api:** openapi updates for conversations ([0dbcc0a](https://github.com/openai/openai-java/commit/0dbcc0a4c7cdd514a3405213fc173708ca1b5013)) +* improve example values ([109a350](https://github.com/openai/openai-java/commit/109a350313bb39d7d62d56020fdc458d798924ee)) +* improve formatter performance ([3fce946](https://github.com/openai/openai-java/commit/3fce946567568c0dc92b247c984c4dfcb34f603d)) + ## 3.6.0 (2025-09-19) Full Changelog: [v3.5.3...v3.6.0](https://github.com/openai/openai-java/compare/v3.5.3...v3.6.0) diff --git a/README.md b/README.md index 50bf0b89..1b006150 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/3.6.0) -[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/3.6.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/3.6.0) +[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/3.6.1) +[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/3.6.1/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/3.6.1) @@ -11,7 +11,7 @@ The OpenAI Java SDK provides convenient access to the [OpenAI REST API](https:// -The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.openai/openai-java/3.6.0). +The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.openai/openai-java/3.6.1). @@ -24,7 +24,7 @@ The REST API documentation can be found on [platform.openai.com](https://platfor ### Gradle ```kotlin -implementation("com.openai:openai-java:3.6.0") +implementation("com.openai:openai-java:3.6.1") ``` ### Maven @@ -33,7 +33,7 @@ implementation("com.openai:openai-java:3.6.0") com.openai openai-java - 3.6.0 + 3.6.1 ``` @@ -1342,7 +1342,7 @@ If you're using Spring Boot, then you can use the SDK's [Spring Boot starter](ht #### Gradle ```kotlin -implementation("com.openai:openai-java-spring-boot-starter:3.6.0") +implementation("com.openai:openai-java-spring-boot-starter:3.6.1") ``` #### Maven @@ -1351,7 +1351,7 @@ implementation("com.openai:openai-java-spring-boot-starter:3.6.0") com.openai openai-java-spring-boot-starter - 3.6.0 + 3.6.1 ``` diff --git a/build.gradle.kts b/build.gradle.kts index fd0c9dd3..ddaf9fa4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.openai" - version = "3.6.0" // x-release-please-version + version = "3.6.1" // x-release-please-version } subprojects { diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationCreateParams.kt index d837bbf6..b14bfdbf 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationCreateParams.kt @@ -438,7 +438,6 @@ private constructor( override fun _queryParams(): QueryParams = additionalQueryParams - /** Create a conversation */ class Body private constructor( private val items: JsonField>, diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationDeleteParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationDeleteParams.kt index 37d8342a..19d74808 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationDeleteParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationDeleteParams.kt @@ -11,7 +11,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Delete a conversation with the given ID. */ +/** Delete a conversation. Items in the conversation will not be deleted. */ class ConversationDeleteParams private constructor( private val conversationId: String?, diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationRetrieveParams.kt index 2898413a..0ae4d766 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationRetrieveParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationRetrieveParams.kt @@ -9,7 +9,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Get a conversation with the given ID. */ +/** Get a conversation */ class ConversationRetrieveParams private constructor( private val conversationId: String?, diff --git a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationUpdateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationUpdateParams.kt index 294a62f6..147764bc 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationUpdateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/conversations/ConversationUpdateParams.kt @@ -21,7 +21,7 @@ import java.util.Objects import java.util.Optional import kotlin.jvm.optionals.getOrNull -/** Update a conversation's metadata with the given ID. */ +/** Update a conversation */ class ConversationUpdateParams private constructor( private val conversationId: String?, @@ -35,13 +35,15 @@ private constructor( /** * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing * additional information about the object in a structured format, and querying for objects via - * API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are - * strings with a maximum length of 512 characters. + * API or the dashboard. * - * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * Keys are strings with a maximum length of 64 characters. Values are strings with a maximum + * length of 512 characters. + * + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun metadata(): Metadata = body.metadata() + fun metadata(): Optional = body.metadata() /** * Returns the raw JSON value of [metadata]. @@ -107,10 +109,15 @@ private constructor( /** * Set of 16 key-value pairs that can be attached to an object. This can be useful for * storing additional information about the object in a structured format, and querying for - * objects via API or the dashboard. Keys are strings with a maximum length of 64 - * characters. Values are strings with a maximum length of 512 characters. + * objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with a + * maximum length of 512 characters. */ - fun metadata(metadata: Metadata) = apply { body.metadata(metadata) } + fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) } + + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ + fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) /** * Sets [Builder.metadata] to an arbitrary JSON value. @@ -287,13 +294,15 @@ private constructor( /** * Set of 16 key-value pairs that can be attached to an object. This can be useful for * storing additional information about the object in a structured format, and querying for - * objects via API or the dashboard. Keys are strings with a maximum length of 64 - * characters. Values are strings with a maximum length of 512 characters. + * objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with a + * maximum length of 512 characters. * - * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). */ - fun metadata(): Metadata = metadata.getRequired("metadata") + fun metadata(): Optional = metadata.getOptional("metadata") /** * Returns the raw JSON value of [metadata]. @@ -342,10 +351,15 @@ private constructor( /** * Set of 16 key-value pairs that can be attached to an object. This can be useful for * storing additional information about the object in a structured format, and querying - * for objects via API or the dashboard. Keys are strings with a maximum length of 64 - * characters. Values are strings with a maximum length of 512 characters. + * for objects via API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with a + * maximum length of 512 characters. */ - fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata)) + fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata)) + + /** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */ + fun metadata(metadata: Optional) = metadata(metadata.getOrNull()) /** * Sets [Builder.metadata] to an arbitrary JSON value. @@ -398,7 +412,7 @@ private constructor( return@apply } - metadata().validate() + metadata().ifPresent { it.validate() } validated = true } @@ -440,8 +454,10 @@ private constructor( /** * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing * additional information about the object in a structured format, and querying for objects via - * API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are - * strings with a maximum length of 512 characters. + * API or the dashboard. + * + * Keys are strings with a maximum length of 64 characters. Values are strings with a maximum + * length of 512 characters. */ class Metadata @JsonCreator diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItem.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItem.kt index cc06d932..eddd6e5d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItem.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItem.kt @@ -34,7 +34,7 @@ private constructor( private val functionCallOutput: RealtimeConversationItemFunctionCallOutput? = null, private val mcpApprovalResponse: RealtimeMcpApprovalResponse? = null, private val mcpListTools: RealtimeMcpListTools? = null, - private val mcpToolCall: RealtimeMcpToolCall? = null, + private val mcpCall: RealtimeMcpToolCall? = null, private val mcpApprovalRequest: RealtimeMcpApprovalRequest? = null, private val _json: JsonValue? = null, ) { @@ -74,7 +74,7 @@ private constructor( fun mcpListTools(): Optional = Optional.ofNullable(mcpListTools) /** A Realtime item representing an invocation of a tool on an MCP server. */ - fun mcpToolCall(): Optional = Optional.ofNullable(mcpToolCall) + fun mcpCall(): Optional = Optional.ofNullable(mcpCall) /** A Realtime item requesting human approval of a tool invocation. */ fun mcpApprovalRequest(): Optional = @@ -97,7 +97,7 @@ private constructor( fun isMcpListTools(): Boolean = mcpListTools != null - fun isMcpToolCall(): Boolean = mcpToolCall != null + fun isMcpCall(): Boolean = mcpCall != null fun isMcpApprovalRequest(): Boolean = mcpApprovalRequest != null @@ -137,7 +137,7 @@ private constructor( fun asMcpListTools(): RealtimeMcpListTools = mcpListTools.getOrThrow("mcpListTools") /** A Realtime item representing an invocation of a tool on an MCP server. */ - fun asMcpToolCall(): RealtimeMcpToolCall = mcpToolCall.getOrThrow("mcpToolCall") + fun asMcpCall(): RealtimeMcpToolCall = mcpCall.getOrThrow("mcpCall") /** A Realtime item requesting human approval of a tool invocation. */ fun asMcpApprovalRequest(): RealtimeMcpApprovalRequest = @@ -163,7 +163,7 @@ private constructor( functionCallOutput != null -> visitor.visitFunctionCallOutput(functionCallOutput) mcpApprovalResponse != null -> visitor.visitMcpApprovalResponse(mcpApprovalResponse) mcpListTools != null -> visitor.visitMcpListTools(mcpListTools) - mcpToolCall != null -> visitor.visitMcpToolCall(mcpToolCall) + mcpCall != null -> visitor.visitMcpCall(mcpCall) mcpApprovalRequest != null -> visitor.visitMcpApprovalRequest(mcpApprovalRequest) else -> visitor.unknown(_json) } @@ -216,8 +216,8 @@ private constructor( mcpListTools.validate() } - override fun visitMcpToolCall(mcpToolCall: RealtimeMcpToolCall) { - mcpToolCall.validate() + override fun visitMcpCall(mcpCall: RealtimeMcpToolCall) { + mcpCall.validate() } override fun visitMcpApprovalRequest( @@ -274,8 +274,7 @@ private constructor( override fun visitMcpListTools(mcpListTools: RealtimeMcpListTools) = mcpListTools.validity() - override fun visitMcpToolCall(mcpToolCall: RealtimeMcpToolCall) = - mcpToolCall.validity() + override fun visitMcpCall(mcpCall: RealtimeMcpToolCall) = mcpCall.validity() override fun visitMcpApprovalRequest( mcpApprovalRequest: RealtimeMcpApprovalRequest @@ -299,7 +298,7 @@ private constructor( functionCallOutput == other.functionCallOutput && mcpApprovalResponse == other.mcpApprovalResponse && mcpListTools == other.mcpListTools && - mcpToolCall == other.mcpToolCall && + mcpCall == other.mcpCall && mcpApprovalRequest == other.mcpApprovalRequest } @@ -312,7 +311,7 @@ private constructor( functionCallOutput, mcpApprovalResponse, mcpListTools, - mcpToolCall, + mcpCall, mcpApprovalRequest, ) @@ -329,7 +328,7 @@ private constructor( mcpApprovalResponse != null -> "ConversationItem{mcpApprovalResponse=$mcpApprovalResponse}" mcpListTools != null -> "ConversationItem{mcpListTools=$mcpListTools}" - mcpToolCall != null -> "ConversationItem{mcpToolCall=$mcpToolCall}" + mcpCall != null -> "ConversationItem{mcpCall=$mcpCall}" mcpApprovalRequest != null -> "ConversationItem{mcpApprovalRequest=$mcpApprovalRequest}" _json != null -> "ConversationItem{_unknown=$_json}" else -> throw IllegalStateException("Invalid ConversationItem") @@ -392,9 +391,7 @@ private constructor( ConversationItem(mcpListTools = mcpListTools) /** A Realtime item representing an invocation of a tool on an MCP server. */ - @JvmStatic - fun ofMcpToolCall(mcpToolCall: RealtimeMcpToolCall) = - ConversationItem(mcpToolCall = mcpToolCall) + @JvmStatic fun ofMcpCall(mcpCall: RealtimeMcpToolCall) = ConversationItem(mcpCall = mcpCall) /** A Realtime item requesting human approval of a tool invocation. */ @JvmStatic @@ -445,7 +442,7 @@ private constructor( fun visitMcpListTools(mcpListTools: RealtimeMcpListTools): T /** A Realtime item representing an invocation of a tool on an MCP server. */ - fun visitMcpToolCall(mcpToolCall: RealtimeMcpToolCall): T + fun visitMcpCall(mcpCall: RealtimeMcpToolCall): T /** A Realtime item requesting human approval of a tool invocation. */ fun visitMcpApprovalRequest(mcpApprovalRequest: RealtimeMcpApprovalRequest): T @@ -546,9 +543,9 @@ private constructor( ConversationItem(mcpListTools = it, _json = json) } ?: ConversationItem(_json = json) } - "mcp_tool_call" -> { + "mcp_call" -> { return tryDeserialize(node, jacksonTypeRef())?.let { - ConversationItem(mcpToolCall = it, _json = json) + ConversationItem(mcpCall = it, _json = json) } ?: ConversationItem(_json = json) } "mcp_approval_request" -> { @@ -581,7 +578,7 @@ private constructor( value.mcpApprovalResponse != null -> generator.writeObject(value.mcpApprovalResponse) value.mcpListTools != null -> generator.writeObject(value.mcpListTools) - value.mcpToolCall != null -> generator.writeObject(value.mcpToolCall) + value.mcpCall != null -> generator.writeObject(value.mcpCall) value.mcpApprovalRequest != null -> generator.writeObject(value.mcpApprovalRequest) value._json != null -> generator.writeObject(value._json) else -> throw IllegalStateException("Invalid ConversationItem") diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemAdded.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemAdded.kt index 128b5499..9e5b71d6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemAdded.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemAdded.kt @@ -271,9 +271,8 @@ private constructor( fun item(mcpListTools: RealtimeMcpListTools) = item(ConversationItem.ofMcpListTools(mcpListTools)) - /** Alias for calling [item] with `ConversationItem.ofMcpToolCall(mcpToolCall)`. */ - fun item(mcpToolCall: RealtimeMcpToolCall) = - item(ConversationItem.ofMcpToolCall(mcpToolCall)) + /** Alias for calling [item] with `ConversationItem.ofMcpCall(mcpCall)`. */ + fun item(mcpCall: RealtimeMcpToolCall) = item(ConversationItem.ofMcpCall(mcpCall)) /** * Alias for calling [item] with diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemCreateEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemCreateEvent.kt index dadef720..bdb630f4 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemCreateEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemCreateEvent.kt @@ -257,9 +257,8 @@ private constructor( fun item(mcpListTools: RealtimeMcpListTools) = item(ConversationItem.ofMcpListTools(mcpListTools)) - /** Alias for calling [item] with `ConversationItem.ofMcpToolCall(mcpToolCall)`. */ - fun item(mcpToolCall: RealtimeMcpToolCall) = - item(ConversationItem.ofMcpToolCall(mcpToolCall)) + /** Alias for calling [item] with `ConversationItem.ofMcpCall(mcpCall)`. */ + fun item(mcpCall: RealtimeMcpToolCall) = item(ConversationItem.ofMcpCall(mcpCall)) /** * Alias for calling [item] with diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemCreatedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemCreatedEvent.kt index 50058d92..88f1db0f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemCreatedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemCreatedEvent.kt @@ -267,9 +267,8 @@ private constructor( fun item(mcpListTools: RealtimeMcpListTools) = item(ConversationItem.ofMcpListTools(mcpListTools)) - /** Alias for calling [item] with `ConversationItem.ofMcpToolCall(mcpToolCall)`. */ - fun item(mcpToolCall: RealtimeMcpToolCall) = - item(ConversationItem.ofMcpToolCall(mcpToolCall)) + /** Alias for calling [item] with `ConversationItem.ofMcpCall(mcpCall)`. */ + fun item(mcpCall: RealtimeMcpToolCall) = item(ConversationItem.ofMcpCall(mcpCall)) /** * Alias for calling [item] with diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemDone.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemDone.kt index 7c26e1da..c62acf39 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemDone.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ConversationItemDone.kt @@ -263,9 +263,8 @@ private constructor( fun item(mcpListTools: RealtimeMcpListTools) = item(ConversationItem.ofMcpListTools(mcpListTools)) - /** Alias for calling [item] with `ConversationItem.ofMcpToolCall(mcpToolCall)`. */ - fun item(mcpToolCall: RealtimeMcpToolCall) = - item(ConversationItem.ofMcpToolCall(mcpToolCall)) + /** Alias for calling [item] with `ConversationItem.ofMcpCall(mcpCall)`. */ + fun item(mcpCall: RealtimeMcpToolCall) = item(ConversationItem.ofMcpCall(mcpCall)) /** * Alias for calling [item] with diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpToolCall.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpToolCall.kt index 1a0cb6ab..d1dfc0cb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpToolCall.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeMcpToolCall.kt @@ -100,11 +100,11 @@ private constructor( fun serverLabel(): String = serverLabel.getRequired("server_label") /** - * The type of the item. Always `mcp_tool_call`. + * The type of the item. Always `mcp_call`. * * Expected to always return the following: * ```java - * JsonValue.from("mcp_tool_call") + * JsonValue.from("mcp_call") * ``` * * However, this method can be useful for debugging and logging (e.g. if the server responded @@ -225,7 +225,7 @@ private constructor( private var arguments: JsonField? = null private var name: JsonField? = null private var serverLabel: JsonField? = null - private var type: JsonValue = JsonValue.from("mcp_tool_call") + private var type: JsonValue = JsonValue.from("mcp_call") private var approvalRequestId: JsonField = JsonMissing.of() private var error: JsonField = JsonMissing.of() private var output: JsonField = JsonMissing.of() @@ -296,7 +296,7 @@ private constructor( * It is usually unnecessary to call this method because the field defaults to the * following: * ```java - * JsonValue.from("mcp_tool_call") + * JsonValue.from("mcp_call") * ``` * * This method is primarily for setting the field to an undocumented or not yet supported @@ -432,7 +432,7 @@ private constructor( name() serverLabel() _type().let { - if (it != JsonValue.from("mcp_tool_call")) { + if (it != JsonValue.from("mcp_call")) { throw OpenAIInvalidDataException("'type' is invalid, received $it") } } @@ -461,7 +461,7 @@ private constructor( (if (arguments.asKnown().isPresent) 1 else 0) + (if (name.asKnown().isPresent) 1 else 0) + (if (serverLabel.asKnown().isPresent) 1 else 0) + - type.let { if (it == JsonValue.from("mcp_tool_call")) 1 else 0 } + + type.let { if (it == JsonValue.from("mcp_call")) 1 else 0 } + (if (approvalRequestId.asKnown().isPresent) 1 else 0) + (error.asKnown().getOrNull()?.validity() ?: 0) + (if (output.asKnown().isPresent) 1 else 0) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponse.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponse.kt index f3c6ad0d..1d4ca909 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponse.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponse.kt @@ -553,9 +553,8 @@ private constructor( fun addOutput(mcpListTools: RealtimeMcpListTools) = addOutput(ConversationItem.ofMcpListTools(mcpListTools)) - /** Alias for calling [addOutput] with `ConversationItem.ofMcpToolCall(mcpToolCall)`. */ - fun addOutput(mcpToolCall: RealtimeMcpToolCall) = - addOutput(ConversationItem.ofMcpToolCall(mcpToolCall)) + /** Alias for calling [addOutput] with `ConversationItem.ofMcpCall(mcpCall)`. */ + fun addOutput(mcpCall: RealtimeMcpToolCall) = addOutput(ConversationItem.ofMcpCall(mcpCall)) /** * Alias for calling [addOutput] with diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateParams.kt index 7ab70379..3b2ea544 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeResponseCreateParams.kt @@ -498,9 +498,8 @@ private constructor( fun addInput(mcpListTools: RealtimeMcpListTools) = addInput(ConversationItem.ofMcpListTools(mcpListTools)) - /** Alias for calling [addInput] with `ConversationItem.ofMcpToolCall(mcpToolCall)`. */ - fun addInput(mcpToolCall: RealtimeMcpToolCall) = - addInput(ConversationItem.ofMcpToolCall(mcpToolCall)) + /** Alias for calling [addInput] with `ConversationItem.ofMcpCall(mcpCall)`. */ + fun addInput(mcpCall: RealtimeMcpToolCall) = addInput(ConversationItem.ofMcpCall(mcpCall)) /** * Alias for calling [addInput] with diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeServerEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeServerEvent.kt index a8a56aa9..315a7bab 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeServerEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/RealtimeServerEvent.kt @@ -3038,9 +3038,8 @@ private constructor( fun item(mcpListTools: RealtimeMcpListTools) = item(ConversationItem.ofMcpListTools(mcpListTools)) - /** Alias for calling [item] with `ConversationItem.ofMcpToolCall(mcpToolCall)`. */ - fun item(mcpToolCall: RealtimeMcpToolCall) = - item(ConversationItem.ofMcpToolCall(mcpToolCall)) + /** Alias for calling [item] with `ConversationItem.ofMcpCall(mcpCall)`. */ + fun item(mcpCall: RealtimeMcpToolCall) = item(ConversationItem.ofMcpCall(mcpCall)) /** * Alias for calling [item] with diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseOutputItemAddedEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseOutputItemAddedEvent.kt index d7038901..92f1fa93 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseOutputItemAddedEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseOutputItemAddedEvent.kt @@ -277,9 +277,8 @@ private constructor( fun item(mcpListTools: RealtimeMcpListTools) = item(ConversationItem.ofMcpListTools(mcpListTools)) - /** Alias for calling [item] with `ConversationItem.ofMcpToolCall(mcpToolCall)`. */ - fun item(mcpToolCall: RealtimeMcpToolCall) = - item(ConversationItem.ofMcpToolCall(mcpToolCall)) + /** Alias for calling [item] with `ConversationItem.ofMcpCall(mcpCall)`. */ + fun item(mcpCall: RealtimeMcpToolCall) = item(ConversationItem.ofMcpCall(mcpCall)) /** * Alias for calling [item] with diff --git a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseOutputItemDoneEvent.kt b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseOutputItemDoneEvent.kt index 0d746e19..d32425aa 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseOutputItemDoneEvent.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/realtime/ResponseOutputItemDoneEvent.kt @@ -280,9 +280,8 @@ private constructor( fun item(mcpListTools: RealtimeMcpListTools) = item(ConversationItem.ofMcpListTools(mcpListTools)) - /** Alias for calling [item] with `ConversationItem.ofMcpToolCall(mcpToolCall)`. */ - fun item(mcpToolCall: RealtimeMcpToolCall) = - item(ConversationItem.ofMcpToolCall(mcpToolCall)) + /** Alias for calling [item] with `ConversationItem.ofMcpCall(mcpCall)`. */ + fun item(mcpCall: RealtimeMcpToolCall) = item(ConversationItem.ofMcpCall(mcpCall)) /** * Alias for calling [item] with diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/ConversationServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/ConversationServiceAsync.kt index 343ce017..39c7d5e3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/ConversationServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/ConversationServiceAsync.kt @@ -49,7 +49,7 @@ interface ConversationServiceAsync { fun create(requestOptions: RequestOptions): CompletableFuture = create(ConversationCreateParams.none(), requestOptions) - /** Get a conversation with the given ID. */ + /** Get a conversation */ fun retrieve(conversationId: String): CompletableFuture = retrieve(conversationId, ConversationRetrieveParams.none()) @@ -84,7 +84,7 @@ interface ConversationServiceAsync { ): CompletableFuture = retrieve(conversationId, ConversationRetrieveParams.none(), requestOptions) - /** Update a conversation's metadata with the given ID. */ + /** Update a conversation */ fun update( conversationId: String, params: ConversationUpdateParams, @@ -108,7 +108,7 @@ interface ConversationServiceAsync { requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture - /** Delete a conversation with the given ID. */ + /** Delete a conversation. Items in the conversation will not be deleted. */ fun delete(conversationId: String): CompletableFuture = delete(conversationId, ConversationDeleteParams.none()) diff --git a/openai-java-core/src/main/kotlin/com/openai/services/blocking/ConversationService.kt b/openai-java-core/src/main/kotlin/com/openai/services/blocking/ConversationService.kt index 37a85455..d53ccf2c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/blocking/ConversationService.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/blocking/ConversationService.kt @@ -48,7 +48,7 @@ interface ConversationService { fun create(requestOptions: RequestOptions): Conversation = create(ConversationCreateParams.none(), requestOptions) - /** Get a conversation with the given ID. */ + /** Get a conversation */ fun retrieve(conversationId: String): Conversation = retrieve(conversationId, ConversationRetrieveParams.none()) @@ -80,7 +80,7 @@ interface ConversationService { fun retrieve(conversationId: String, requestOptions: RequestOptions): Conversation = retrieve(conversationId, ConversationRetrieveParams.none(), requestOptions) - /** Update a conversation's metadata with the given ID. */ + /** Update a conversation */ fun update(conversationId: String, params: ConversationUpdateParams): Conversation = update(conversationId, params, RequestOptions.none()) @@ -102,7 +102,7 @@ interface ConversationService { requestOptions: RequestOptions = RequestOptions.none(), ): Conversation - /** Delete a conversation with the given ID. */ + /** Delete a conversation. Items in the conversation will not be deleted. */ fun delete(conversationId: String): ConversationDeletedResource = delete(conversationId, ConversationDeleteParams.none()) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/conversations/ConversationUpdateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/conversations/ConversationUpdateParamsTest.kt index 23bae282..4d1acfb6 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/conversations/ConversationUpdateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/conversations/ConversationUpdateParamsTest.kt @@ -52,7 +52,7 @@ internal class ConversationUpdateParamsTest { val body = params._body() assertThat(body.metadata()) - .isEqualTo( + .contains( ConversationUpdateParams.Metadata.builder() .putAdditionalProperty("foo", JsonValue.from("string")) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ItemCreateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ItemCreateParamsTest.kt index 760c0914..ca1f73be 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ItemCreateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/conversations/items/ItemCreateParamsTest.kt @@ -35,6 +35,7 @@ internal class ItemCreateParamsTest { EasyInputMessage.builder() .content("string") .role(EasyInputMessage.Role.USER) + .type(EasyInputMessage.Type.MESSAGE) .build() ) .build() @@ -76,6 +77,7 @@ internal class ItemCreateParamsTest { EasyInputMessage.builder() .content("string") .role(EasyInputMessage.Role.USER) + .type(EasyInputMessage.Type.MESSAGE) .build() ) .build() @@ -123,6 +125,7 @@ internal class ItemCreateParamsTest { EasyInputMessage.builder() .content("string") .role(EasyInputMessage.Role.USER) + .type(EasyInputMessage.Type.MESSAGE) .build() ) .build() @@ -135,6 +138,7 @@ internal class ItemCreateParamsTest { EasyInputMessage.builder() .content("string") .role(EasyInputMessage.Role.USER) + .type(EasyInputMessage.Type.MESSAGE) .build() ) ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/realtime/ConversationItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/realtime/ConversationItemTest.kt index e7ce7e91..ad8c6bfd 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/realtime/ConversationItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/realtime/ConversationItemTest.kt @@ -42,7 +42,7 @@ internal class ConversationItemTest { assertThat(conversationItem.functionCallOutput()).isEmpty assertThat(conversationItem.mcpApprovalResponse()).isEmpty assertThat(conversationItem.mcpListTools()).isEmpty - assertThat(conversationItem.mcpToolCall()).isEmpty + assertThat(conversationItem.mcpCall()).isEmpty assertThat(conversationItem.mcpApprovalRequest()).isEmpty } @@ -105,7 +105,7 @@ internal class ConversationItemTest { assertThat(conversationItem.functionCallOutput()).isEmpty assertThat(conversationItem.mcpApprovalResponse()).isEmpty assertThat(conversationItem.mcpListTools()).isEmpty - assertThat(conversationItem.mcpToolCall()).isEmpty + assertThat(conversationItem.mcpCall()).isEmpty assertThat(conversationItem.mcpApprovalRequest()).isEmpty } @@ -170,7 +170,7 @@ internal class ConversationItemTest { assertThat(conversationItem.functionCallOutput()).isEmpty assertThat(conversationItem.mcpApprovalResponse()).isEmpty assertThat(conversationItem.mcpListTools()).isEmpty - assertThat(conversationItem.mcpToolCall()).isEmpty + assertThat(conversationItem.mcpCall()).isEmpty assertThat(conversationItem.mcpApprovalRequest()).isEmpty } @@ -224,7 +224,7 @@ internal class ConversationItemTest { assertThat(conversationItem.functionCallOutput()).isEmpty assertThat(conversationItem.mcpApprovalResponse()).isEmpty assertThat(conversationItem.mcpListTools()).isEmpty - assertThat(conversationItem.mcpToolCall()).isEmpty + assertThat(conversationItem.mcpCall()).isEmpty assertThat(conversationItem.mcpApprovalRequest()).isEmpty } @@ -272,7 +272,7 @@ internal class ConversationItemTest { assertThat(conversationItem.functionCallOutput()).contains(functionCallOutput) assertThat(conversationItem.mcpApprovalResponse()).isEmpty assertThat(conversationItem.mcpListTools()).isEmpty - assertThat(conversationItem.mcpToolCall()).isEmpty + assertThat(conversationItem.mcpCall()).isEmpty assertThat(conversationItem.mcpApprovalRequest()).isEmpty } @@ -318,7 +318,7 @@ internal class ConversationItemTest { assertThat(conversationItem.functionCallOutput()).isEmpty assertThat(conversationItem.mcpApprovalResponse()).contains(mcpApprovalResponse) assertThat(conversationItem.mcpListTools()).isEmpty - assertThat(conversationItem.mcpToolCall()).isEmpty + assertThat(conversationItem.mcpCall()).isEmpty assertThat(conversationItem.mcpApprovalRequest()).isEmpty } @@ -369,7 +369,7 @@ internal class ConversationItemTest { assertThat(conversationItem.functionCallOutput()).isEmpty assertThat(conversationItem.mcpApprovalResponse()).isEmpty assertThat(conversationItem.mcpListTools()).contains(mcpListTools) - assertThat(conversationItem.mcpToolCall()).isEmpty + assertThat(conversationItem.mcpCall()).isEmpty assertThat(conversationItem.mcpApprovalRequest()).isEmpty } @@ -402,8 +402,8 @@ internal class ConversationItemTest { } @Test - fun ofMcpToolCall() { - val mcpToolCall = + fun ofMcpCall() { + val mcpCall = RealtimeMcpToolCall.builder() .id("id") .arguments("arguments") @@ -414,7 +414,7 @@ internal class ConversationItemTest { .output("output") .build() - val conversationItem = ConversationItem.ofMcpToolCall(mcpToolCall) + val conversationItem = ConversationItem.ofMcpCall(mcpCall) assertThat(conversationItem.realtimeConversationItemSystemMessage()).isEmpty assertThat(conversationItem.realtimeConversationItemUserMessage()).isEmpty @@ -423,15 +423,15 @@ internal class ConversationItemTest { assertThat(conversationItem.functionCallOutput()).isEmpty assertThat(conversationItem.mcpApprovalResponse()).isEmpty assertThat(conversationItem.mcpListTools()).isEmpty - assertThat(conversationItem.mcpToolCall()).contains(mcpToolCall) + assertThat(conversationItem.mcpCall()).contains(mcpCall) assertThat(conversationItem.mcpApprovalRequest()).isEmpty } @Test - fun ofMcpToolCallRoundtrip() { + fun ofMcpCallRoundtrip() { val jsonMapper = jsonMapper() val conversationItem = - ConversationItem.ofMcpToolCall( + ConversationItem.ofMcpCall( RealtimeMcpToolCall.builder() .id("id") .arguments("arguments") @@ -471,7 +471,7 @@ internal class ConversationItemTest { assertThat(conversationItem.functionCallOutput()).isEmpty assertThat(conversationItem.mcpApprovalResponse()).isEmpty assertThat(conversationItem.mcpListTools()).isEmpty - assertThat(conversationItem.mcpToolCall()).isEmpty + assertThat(conversationItem.mcpCall()).isEmpty assertThat(conversationItem.mcpApprovalRequest()).contains(mcpApprovalRequest) } diff --git a/scripts/fast-format b/scripts/fast-format index e16bfc56..1b3bc473 100755 --- a/scripts/fast-format +++ b/scripts/fast-format @@ -2,7 +2,12 @@ set -euo pipefail +echo "Script started with $# arguments" +echo "Arguments: $*" +echo "Script location: $(dirname "$0")" + cd "$(dirname "$0")/.." +echo "Changed to directory: $(pwd)" if [ $# -eq 0 ]; then echo "Usage: $0 [additional-formatter-args...]" @@ -12,6 +17,8 @@ fi FILE_LIST="$1" +echo "Looking for file: $FILE_LIST" + if [ ! -f "$FILE_LIST" ]; then echo "Error: File '$FILE_LIST' not found" exit 1 @@ -23,9 +30,9 @@ if ! command -v ktfmt-fast-format &> /dev/null; then fi # Process Kotlin files -kt_files=$(grep -E '\.kt$' "$FILE_LIST" | grep -v './buildSrc/build/') -kt_files=$(grep -E '\.kt$' "$FILE_LIST" | grep -v './buildSrc/build/') -echo "==> Found $(echo "$kt_files" | wc -l) Kotlin files:" +echo "==> Looking for Kotlin files" +kt_files=$(grep -E '\.kt$' "$FILE_LIST" | grep -v './buildSrc/build/' || true) +echo "==> Done looking for Kotlin files" if [[ -n "$kt_files" ]]; then echo "==> will format Kotlin files"