From 2c43d8b54ada7c36731e8bdf13b21ac44d7befed Mon Sep 17 00:00:00 2001 From: Mark Daoust Date: Thu, 20 Aug 2026 00:46:03 -0700 Subject: [PATCH] feat(java): regenerate Java GAOS SDK and support Java in OpenAPI generator PiperOrigin-RevId: 967639429 --- .../java/com/google/genai/gaos/Agents.java | 114 +- .../com/google/genai/gaos/AsyncAgents.java | 124 +- .../google/genai/gaos/AsyncEnvironments.java | 112 +- .../com/google/genai/gaos/AsyncGenAI.java | 30 +- .../google/genai/gaos/AsyncInteractions.java | 100 +- .../com/google/genai/gaos/AsyncTriggers.java | 170 +-- .../com/google/genai/gaos/AsyncWebhooks.java | 166 +-- .../com/google/genai/gaos/Environments.java | 104 +- .../java/com/google/genai/gaos/GenAI.java | 33 +- .../com/google/genai/gaos/Interactions.java | 76 +- .../google/genai/gaos/SDKConfiguration.java | 2 +- .../java/com/google/genai/gaos/Triggers.java | 154 +-- .../java/com/google/genai/gaos/Webhooks.java | 150 +-- .../models/interactions/AudioContent.java | 88 +- .../models/interactions/CodeExecution.java | 2 +- .../interactions/ContentTypeIdResolver.java | 4 +- .../interactions/CreateAgentInteraction.java | 594 +++++----- ...tInteractionAgentConfigTypeIdResolver.java | 6 +- .../CreateAgentInteractionEnvironment.java | 32 +- .../CreateAgentInteractionResponseFormat.java | 34 +- .../interactions/CreateModelInteraction.java | 644 +++++----- .../CreateModelInteractionEnvironment.java | 32 +- .../CreateModelInteractionResponseFormat.java | 34 +- .../models/interactions/DocumentContent.java | 76 +- .../gaos/models/interactions/Function.java | 2 +- .../FunctionResultDeltaResultUnion.java | 32 +- .../FunctionResultStepResultUnion.java | 32 +- .../models/interactions/GenerationConfig.java | 92 +- .../models/interactions/GoogleSearch.java | 2 +- .../models/interactions/ImageContent.java | 90 +- .../gaos/models/interactions/Interaction.java | 1036 ++++++++--------- .../InteractionAgentConfigTypeIdResolver.java | 6 +- .../InteractionCompletedEvent.java | 26 +- .../interactions/InteractionCreatedEvent.java | 26 +- .../interactions/InteractionEnvironment.java | 32 +- .../InteractionResponseFormat.java | 34 +- .../InteractionSSEEventTypeIdResolver.java | 6 +- .../InteractionSseEventInteraction.java | 280 ++--- .../interactions/InteractionsInput.java | 32 +- .../gaos/models/interactions/MCPServer.java | 2 +- .../MCPServerToolResultDeltaResultUnion.java | 32 +- .../MCPServerToolResultStepResultUnion.java | 40 +- .../interactions/StepTypeIdResolver.java | 24 +- .../gaos/models/interactions/TextContent.java | 2 +- .../interactions/TranscriptionConfig.java | 51 +- .../interactions/TranscriptionMode.java | 150 --- .../gaos/models/interactions/Transform.java | 32 +- .../gaos/models/interactions/URLContext.java | 2 +- .../models/interactions/VideoContent.java | 88 +- .../interactions/VideoDeltaMimeType.java | 6 +- .../CancelInteractionByIdRequest.java | 72 +- .../CancelInteractionByIdRequestBuilder.java | 8 +- .../CreateInteractionRequestBody.java | 32 +- .../operations/DeleteInteractionRequest.java | 72 +- .../DeleteInteractionRequestBuilder.java | 8 +- .../operations/GetInteractionByIdRequest.java | 184 +-- .../CancelInteractionByIdRequestBuilder.java | 8 +- .../DeleteInteractionRequestBuilder.java | 8 +- .../genai/gaos/models/shared/Security.java | 68 +- .../models/triggers/TriggerCreateParams.java | 214 ++-- .../java/com/google/genai/GaosClientTest.java | 2 +- 61 files changed, 2761 insertions(+), 2953 deletions(-) delete mode 100644 src/main/java/com/google/genai/gaos/models/interactions/TranscriptionMode.java diff --git a/src/main/java/com/google/genai/gaos/Agents.java b/src/main/java/com/google/genai/gaos/Agents.java index 01469775c54..b8fa56c777a 100644 --- a/src/main/java/com/google/genai/gaos/Agents.java +++ b/src/main/java/com/google/genai/gaos/Agents.java @@ -65,6 +65,49 @@ public AsyncAgents async() { return asyncSDK; } + /** + * Lists all Agents. + * + * @return The call builder + */ + public ListAgentsRequestBuilder list() { + return new ListAgentsRequestBuilder(sdkConfiguration); + } + + /** + * Lists all Agents. + * + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public ListAgentsResponse listDirect() { + return list(null, null, null, + null, null); + } + + /** + * Lists all Agents. + * + * @param apiVersion Which version of the API to use. + * @param pageSize + * @param pageToken + * @param parent + * @param options additional options + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public ListAgentsResponse list( + @Nullable String apiVersion, @Nullable Integer pageSize, + @Nullable String pageToken, @Nullable String parent, + @Nullable Options options) { + ListAgentsRequest request = new ListAgentsRequest( + apiVersion, pageSize, pageToken, + parent); + RequestOperation operation + = new ListAgents.Sync(sdkConfiguration, options, _headers); + return operation.handleResponse(operation.doRequest(request)); + } + /** * Creates a new Agent (Typed version for SDK). * @@ -122,45 +165,40 @@ public CreateAgentResponse create( } /** - * Lists all Agents. + * Deletes an Agent. * * @return The call builder */ - public ListAgentsRequestBuilder list() { - return new ListAgentsRequestBuilder(sdkConfiguration); + public DeleteAgentRequestBuilder delete() { + return new DeleteAgentRequestBuilder(sdkConfiguration); } /** - * Lists all Agents. + * Deletes an Agent. * + * @param id * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public ListAgentsResponse listDirect() { - return list(null, null, null, - null, null); + public DeleteAgentResponse delete(@Nonnull String id) { + return delete(null, id, null); } /** - * Lists all Agents. + * Deletes an Agent. * * @param apiVersion Which version of the API to use. - * @param pageSize - * @param pageToken - * @param parent + * @param id * @param options additional options * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public ListAgentsResponse list( - @Nullable String apiVersion, @Nullable Integer pageSize, - @Nullable String pageToken, @Nullable String parent, + public DeleteAgentResponse delete( + @Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { - ListAgentsRequest request = new ListAgentsRequest( - apiVersion, pageSize, pageToken, - parent); - RequestOperation operation - = new ListAgents.Sync(sdkConfiguration, options, _headers); + DeleteAgentRequest request = new DeleteAgentRequest(apiVersion, id); + RequestOperation operation + = new DeleteAgent.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } @@ -202,42 +240,4 @@ public GetAgentResponse get( return operation.handleResponse(operation.doRequest(request)); } - /** - * Deletes an Agent. - * - * @return The call builder - */ - public DeleteAgentRequestBuilder delete() { - return new DeleteAgentRequestBuilder(sdkConfiguration); - } - - /** - * Deletes an Agent. - * - * @param id - * @return The response from the API call - * @throws RuntimeException subclass if the API call fails - */ - public DeleteAgentResponse delete(@Nonnull String id) { - return delete(null, id, null); - } - - /** - * Deletes an Agent. - * - * @param apiVersion Which version of the API to use. - * @param id - * @param options additional options - * @return The response from the API call - * @throws RuntimeException subclass if the API call fails - */ - public DeleteAgentResponse delete( - @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { - DeleteAgentRequest request = new DeleteAgentRequest(apiVersion, id); - RequestOperation operation - = new DeleteAgent.Sync(sdkConfiguration, options, _headers); - return operation.handleResponse(operation.doRequest(request)); - } - } diff --git a/src/main/java/com/google/genai/gaos/AsyncAgents.java b/src/main/java/com/google/genai/gaos/AsyncAgents.java index 80f35a53b14..ca63dcfeaa0 100644 --- a/src/main/java/com/google/genai/gaos/AsyncAgents.java +++ b/src/main/java/com/google/genai/gaos/AsyncAgents.java @@ -68,6 +68,52 @@ public Agents sync() { } + /** + * Lists all Agents. + * + * @return The async call builder + */ + public ListAgentsRequestBuilder list() { + return new ListAgentsRequestBuilder(sdkConfiguration); + } + + /** + * Lists all Agents. + * + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture listDirect() { + return list( + null, null, null, + null, null); + } + + /** + * Lists all Agents. + * + * @param apiVersion Which version of the API to use. + * @param pageSize + * @param pageToken + * @param parent + * @param options additional options + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture list( + @Nullable String apiVersion, @Nullable Integer pageSize, + @Nullable String pageToken, @Nullable String parent, + @Nullable Options options) { + ListAgentsRequest request = new ListAgentsRequest( + apiVersion, pageSize, pageToken, + parent); + AsyncRequestOperation operation + = new ListAgents.Async( + sdkConfiguration, options, sdkConfiguration.retryScheduler(), + _headers); + return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), + operation::handleResponse), operation); + } + + /** * Creates a new Agent (Typed version for SDK). * @@ -127,44 +173,38 @@ public CompletableFuture create( /** - * Lists all Agents. + * Deletes an Agent. * * @return The async call builder */ - public ListAgentsRequestBuilder list() { - return new ListAgentsRequestBuilder(sdkConfiguration); + public DeleteAgentRequestBuilder delete() { + return new DeleteAgentRequestBuilder(sdkConfiguration); } /** - * Lists all Agents. + * Deletes an Agent. * - * @return {@code CompletableFuture} - The async response + * @param id + * @return {@code CompletableFuture} - The async response */ - public CompletableFuture listDirect() { - return list( - null, null, null, - null, null); + public CompletableFuture delete(@Nonnull String id) { + return delete(null, id, null); } /** - * Lists all Agents. + * Deletes an Agent. * * @param apiVersion Which version of the API to use. - * @param pageSize - * @param pageToken - * @param parent + * @param id * @param options additional options - * @return {@code CompletableFuture} - The async response + * @return {@code CompletableFuture} - The async response */ - public CompletableFuture list( - @Nullable String apiVersion, @Nullable Integer pageSize, - @Nullable String pageToken, @Nullable String parent, + public CompletableFuture delete( + @Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { - ListAgentsRequest request = new ListAgentsRequest( - apiVersion, pageSize, pageToken, - parent); - AsyncRequestOperation operation - = new ListAgents.Async( + DeleteAgentRequest request = new DeleteAgentRequest(apiVersion, id); + AsyncRequestOperation operation + = new DeleteAgent.Async( sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), @@ -211,44 +251,4 @@ public CompletableFuture get( operation::handleResponse), operation); } - - /** - * Deletes an Agent. - * - * @return The async call builder - */ - public DeleteAgentRequestBuilder delete() { - return new DeleteAgentRequestBuilder(sdkConfiguration); - } - - /** - * Deletes an Agent. - * - * @param id - * @return {@code CompletableFuture} - The async response - */ - public CompletableFuture delete(@Nonnull String id) { - return delete(null, id, null); - } - - /** - * Deletes an Agent. - * - * @param apiVersion Which version of the API to use. - * @param id - * @param options additional options - * @return {@code CompletableFuture} - The async response - */ - public CompletableFuture delete( - @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { - DeleteAgentRequest request = new DeleteAgentRequest(apiVersion, id); - AsyncRequestOperation operation - = new DeleteAgent.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); - } - } diff --git a/src/main/java/com/google/genai/gaos/AsyncEnvironments.java b/src/main/java/com/google/genai/gaos/AsyncEnvironments.java index c2fcad9db52..fdbbeb84cc0 100644 --- a/src/main/java/com/google/genai/gaos/AsyncEnvironments.java +++ b/src/main/java/com/google/genai/gaos/AsyncEnvironments.java @@ -67,46 +67,6 @@ public Environments sync() { } - /** - * Creates an environment. - * - * @return The async call builder - */ - public CreateEnvironmentRequestBuilder createEnvironment() { - return new CreateEnvironmentRequestBuilder(sdkConfiguration); - } - - /** - * Creates an environment. - * - * @param body Request for `CreateEnvironment`. - * @return {@code CompletableFuture} - The async response - */ - public CompletableFuture createEnvironment(@Nonnull CreateEnvironmentRequest body) { - return createEnvironment(null, body, null); - } - - /** - * Creates an environment. - * - * @param apiVersion Which version of the API to use. - * @param body Request for `CreateEnvironment`. - * @param options additional options - * @return {@code CompletableFuture} - The async response - */ - public CompletableFuture createEnvironment( - @Nullable String apiVersion, @Nonnull CreateEnvironmentRequest body, - @Nullable Options options) { - com.google.genai.gaos.models.operations.CreateEnvironmentRequest request = new com.google.genai.gaos.models.operations.CreateEnvironmentRequest(apiVersion, body); - AsyncRequestOperation operation - = new CreateEnvironment.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); - } - - /** * Lists environments. * @@ -150,38 +110,38 @@ public CompletableFuture listEnvironments( /** - * Gets an environment. + * Creates an environment. * * @return The async call builder */ - public GetEnvironmentRequestBuilder getEnvironment() { - return new GetEnvironmentRequestBuilder(sdkConfiguration); + public CreateEnvironmentRequestBuilder createEnvironment() { + return new CreateEnvironmentRequestBuilder(sdkConfiguration); } /** - * Gets an environment. + * Creates an environment. * - * @param id Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. - * @return {@code CompletableFuture} - The async response + * @param body Request for `CreateEnvironment`. + * @return {@code CompletableFuture} - The async response */ - public CompletableFuture getEnvironment(@Nonnull String id) { - return getEnvironment(null, id, null); + public CompletableFuture createEnvironment(@Nonnull CreateEnvironmentRequest body) { + return createEnvironment(null, body, null); } /** - * Gets an environment. + * Creates an environment. * * @param apiVersion Which version of the API to use. - * @param id Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. + * @param body Request for `CreateEnvironment`. * @param options additional options - * @return {@code CompletableFuture} - The async response + * @return {@code CompletableFuture} - The async response */ - public CompletableFuture getEnvironment( - @Nullable String apiVersion, @Nonnull String id, + public CompletableFuture createEnvironment( + @Nullable String apiVersion, @Nonnull CreateEnvironmentRequest body, @Nullable Options options) { - GetEnvironmentRequest request = new GetEnvironmentRequest(apiVersion, id); - AsyncRequestOperation operation - = new GetEnvironment.Async( + com.google.genai.gaos.models.operations.CreateEnvironmentRequest request = new com.google.genai.gaos.models.operations.CreateEnvironmentRequest(apiVersion, body); + AsyncRequestOperation operation + = new CreateEnvironment.Async( sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), @@ -228,4 +188,44 @@ public CompletableFuture deleteEnvironment( operation::handleResponse), operation); } + + /** + * Gets an environment. + * + * @return The async call builder + */ + public GetEnvironmentRequestBuilder getEnvironment() { + return new GetEnvironmentRequestBuilder(sdkConfiguration); + } + + /** + * Gets an environment. + * + * @param id Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getEnvironment(@Nonnull String id) { + return getEnvironment(null, id, null); + } + + /** + * Gets an environment. + * + * @param apiVersion Which version of the API to use. + * @param id Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. + * @param options additional options + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture getEnvironment( + @Nullable String apiVersion, @Nonnull String id, + @Nullable Options options) { + GetEnvironmentRequest request = new GetEnvironmentRequest(apiVersion, id); + AsyncRequestOperation operation + = new GetEnvironment.Async( + sdkConfiguration, options, sdkConfiguration.retryScheduler(), + _headers); + return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), + operation::handleResponse), operation); + } + } diff --git a/src/main/java/com/google/genai/gaos/AsyncGenAI.java b/src/main/java/com/google/genai/gaos/AsyncGenAI.java index 5d4b96bf82a..c5464405d67 100644 --- a/src/main/java/com/google/genai/gaos/AsyncGenAI.java +++ b/src/main/java/com/google/genai/gaos/AsyncGenAI.java @@ -33,34 +33,34 @@ public class AsyncGenAI implements java.lang.AutoCloseable { private static final Headers _headers = Headers.EMPTY; - private final AsyncInteractions interactions; + private final AsyncAgents agents; - private final AsyncWebhooks webhooks; + private final AsyncEnvironments environments; - private final AsyncAgents agents; + private final AsyncInteractions interactions; private final AsyncTriggers triggers; - private final AsyncEnvironments environments; + private final AsyncWebhooks webhooks; - public AsyncInteractions interactions() { - return interactions; + public AsyncAgents agents() { + return agents; } - public AsyncWebhooks webhooks() { - return webhooks; + public AsyncEnvironments environments() { + return environments; } - public AsyncAgents agents() { - return agents; + public AsyncInteractions interactions() { + return interactions; } public AsyncTriggers triggers() { return triggers; } - public AsyncEnvironments environments() { - return environments; + public AsyncWebhooks webhooks() { + return webhooks; } private SDKConfiguration sdkConfiguration; @@ -69,11 +69,11 @@ public AsyncEnvironments environments() { AsyncGenAI(GenAI syncSDK, SDKConfiguration sdkConfiguration) { this.syncSDK = syncSDK; this.sdkConfiguration = sdkConfiguration; - this.interactions = new AsyncInteractions(syncSDK.interactions(), sdkConfiguration); - this.webhooks = new AsyncWebhooks(syncSDK.webhooks(), sdkConfiguration); this.agents = new AsyncAgents(syncSDK.agents(), sdkConfiguration); - this.triggers = new AsyncTriggers(syncSDK.triggers(), sdkConfiguration); this.environments = new AsyncEnvironments(syncSDK.environments(), sdkConfiguration); + this.interactions = new AsyncInteractions(syncSDK.interactions(), sdkConfiguration); + this.triggers = new AsyncTriggers(syncSDK.triggers(), sdkConfiguration); + this.webhooks = new AsyncWebhooks(syncSDK.webhooks(), sdkConfiguration); } /** diff --git a/src/main/java/com/google/genai/gaos/AsyncInteractions.java b/src/main/java/com/google/genai/gaos/AsyncInteractions.java index 580346880f0..af28c79ac7f 100644 --- a/src/main/java/com/google/genai/gaos/AsyncInteractions.java +++ b/src/main/java/com/google/genai/gaos/AsyncInteractions.java @@ -125,6 +125,52 @@ public CompletableFuture> create( } + /** + * Deleting an interaction + * + *

Deletes the interaction by id. + * + * @return The async call builder + */ + public DeleteInteractionRequestBuilder delete() { + return new DeleteInteractionRequestBuilder(sdkConfiguration); + } + + /** + * Deleting an interaction + * + *

Deletes the interaction by id. + * + * @param id The unique identifier of the interaction to delete. + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture delete(@Nonnull String id) { + return delete(null, id, null); + } + + /** + * Deleting an interaction + * + *

Deletes the interaction by id. + * + * @param apiVersion Which version of the API to use. + * @param id The unique identifier of the interaction to delete. + * @param options additional options + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture delete( + @Nullable String apiVersion, @Nonnull String id, + @Nullable Options options) { + DeleteInteractionRequest request = new DeleteInteractionRequest(apiVersion, id); + AsyncRequestOperation operation + = new DeleteInteraction.Async( + sdkConfiguration, options, sdkConfiguration.retryScheduler(), + _headers); + return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), + operation::handleResponse), operation); + } + + /** * Retrieving an interaction * @@ -174,52 +220,6 @@ public CompletableFuture> get(@Nonnull Ge } - /** - * Deleting an interaction - * - *

Deletes the interaction by id. - * - * @return The async call builder - */ - public DeleteInteractionRequestBuilder delete() { - return new DeleteInteractionRequestBuilder(sdkConfiguration); - } - - /** - * Deleting an interaction - * - *

Deletes the interaction by id. - * - * @param id The unique identifier of the interaction to delete. - * @return {@code CompletableFuture} - The async response - */ - public CompletableFuture delete(@Nonnull String id) { - return delete(id, null, null); - } - - /** - * Deleting an interaction - * - *

Deletes the interaction by id. - * - * @param id The unique identifier of the interaction to delete. - * @param apiVersion Which version of the API to use. - * @param options additional options - * @return {@code CompletableFuture} - The async response - */ - public CompletableFuture delete( - @Nonnull String id, @Nullable String apiVersion, - @Nullable Options options) { - DeleteInteractionRequest request = new DeleteInteractionRequest(id, apiVersion); - AsyncRequestOperation operation - = new DeleteInteraction.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); - } - - /** * Canceling an interaction * @@ -240,7 +240,7 @@ public CancelInteractionByIdRequestBuilder cancel() { * @return {@code CompletableFuture} - The async response */ public CompletableFuture cancel(@Nonnull String id) { - return cancel(id, null, null); + return cancel(null, id, null); } /** @@ -248,15 +248,15 @@ public CompletableFuture cancel(@Nonnull String i * *

Cancels an interaction by id. This only applies to background interactions that are still running. * - * @param id The unique identifier of the interaction to cancel. * @param apiVersion Which version of the API to use. + * @param id The unique identifier of the interaction to cancel. * @param options additional options * @return {@code CompletableFuture} - The async response */ public CompletableFuture cancel( - @Nonnull String id, @Nullable String apiVersion, + @Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { - CancelInteractionByIdRequest request = new CancelInteractionByIdRequest(id, apiVersion); + CancelInteractionByIdRequest request = new CancelInteractionByIdRequest(apiVersion, id); AsyncRequestOperation operation = new CancelInteractionById.Async( sdkConfiguration, options, sdkConfiguration.retryScheduler(), diff --git a/src/main/java/com/google/genai/gaos/AsyncTriggers.java b/src/main/java/com/google/genai/gaos/AsyncTriggers.java index 01e8f2f631f..f250511b342 100644 --- a/src/main/java/com/google/genai/gaos/AsyncTriggers.java +++ b/src/main/java/com/google/genai/gaos/AsyncTriggers.java @@ -81,6 +81,52 @@ public Triggers sync() { } + /** + * Lists triggers for a project. + * + * @return The async call builder + */ + public ListTriggersRequestBuilder list() { + return new ListTriggersRequestBuilder(sdkConfiguration); + } + + /** + * Lists triggers for a project. + * + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture listDirect() { + return list( + null, null, null, + null, null); + } + + /** + * Lists triggers for a project. + * + * @param apiVersion Which version of the API to use. + * @param filter Optional. Filter expression (e.g., by state). + * @param pageSize Optional. The maximum number of triggers to return per page. + * @param pageToken Optional. A page token from a previous ListTriggers call. + * @param options additional options + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture list( + @Nullable String apiVersion, @Nullable String filter, + @Nullable Long pageSize, @Nullable String pageToken, + @Nullable Options options) { + ListTriggersRequest request = new ListTriggersRequest( + apiVersion, filter, pageSize, + pageToken); + AsyncRequestOperation operation + = new ListTriggers.Async( + sdkConfiguration, options, sdkConfiguration.retryScheduler(), + _headers); + return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), + operation::handleResponse), operation); + } + + /** * Creates a new trigger that will invoke the specified agent on the given cron schedule. * @@ -122,44 +168,38 @@ public CompletableFuture create( /** - * Lists triggers for a project. + * Deletes a trigger. * * @return The async call builder */ - public ListTriggersRequestBuilder list() { - return new ListTriggersRequestBuilder(sdkConfiguration); + public DeleteTriggerRequestBuilder delete() { + return new DeleteTriggerRequestBuilder(sdkConfiguration); } /** - * Lists triggers for a project. + * Deletes a trigger. * - * @return {@code CompletableFuture} - The async response + * @param id Resource name of the trigger. + * @return {@code CompletableFuture} - The async response */ - public CompletableFuture listDirect() { - return list( - null, null, null, - null, null); + public CompletableFuture delete(@Nonnull String id) { + return delete(null, id, null); } /** - * Lists triggers for a project. + * Deletes a trigger. * * @param apiVersion Which version of the API to use. - * @param filter Optional. Filter expression (e.g., by state). - * @param pageSize Optional. The maximum number of triggers to return per page. - * @param pageToken Optional. A page token from a previous ListTriggers call. + * @param id Resource name of the trigger. * @param options additional options - * @return {@code CompletableFuture} - The async response + * @return {@code CompletableFuture} - The async response */ - public CompletableFuture list( - @Nullable String apiVersion, @Nullable String filter, - @Nullable Long pageSize, @Nullable String pageToken, + public CompletableFuture delete( + @Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { - ListTriggersRequest request = new ListTriggersRequest( - apiVersion, filter, pageSize, - pageToken); - AsyncRequestOperation operation - = new ListTriggers.Async( + DeleteTriggerRequest request = new DeleteTriggerRequest(apiVersion, id); + AsyncRequestOperation operation + = new DeleteTrigger.Async( sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), @@ -252,38 +292,45 @@ public CompletableFuture update( /** - * Deletes a trigger. + * Lists executions for a trigger. * * @return The async call builder */ - public DeleteTriggerRequestBuilder delete() { - return new DeleteTriggerRequestBuilder(sdkConfiguration); + public ListTriggerExecutionsRequestBuilder listExecutions() { + return new ListTriggerExecutionsRequestBuilder(sdkConfiguration); } /** - * Deletes a trigger. + * Lists executions for a trigger. * - * @param id Resource name of the trigger. - * @return {@code CompletableFuture} - The async response + * @param triggerId Resource name of the trigger. + * @return {@code CompletableFuture} - The async response */ - public CompletableFuture delete(@Nonnull String id) { - return delete(null, id, null); + public CompletableFuture listExecutions(@Nonnull String triggerId) { + return listExecutions( + null, triggerId, null, + null, null); } /** - * Deletes a trigger. + * Lists executions for a trigger. * * @param apiVersion Which version of the API to use. - * @param id Resource name of the trigger. + * @param triggerId Resource name of the trigger. + * @param pageSize Optional. The maximum number of executions to return per page. + * @param pageToken Optional. A page token from a previous ListTriggerExecutions call. * @param options additional options - * @return {@code CompletableFuture} - The async response + * @return {@code CompletableFuture} - The async response */ - public CompletableFuture delete( - @Nullable String apiVersion, @Nonnull String id, + public CompletableFuture listExecutions( + @Nullable String apiVersion, @Nonnull String triggerId, + @Nullable Long pageSize, @Nullable String pageToken, @Nullable Options options) { - DeleteTriggerRequest request = new DeleteTriggerRequest(apiVersion, id); - AsyncRequestOperation operation - = new DeleteTrigger.Async( + ListTriggerExecutionsRequest request = new ListTriggerExecutionsRequest( + apiVersion, triggerId, pageSize, + pageToken); + AsyncRequestOperation operation + = new ListTriggerExecutions.Async( sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), @@ -330,51 +377,4 @@ public CompletableFuture run( operation::handleResponse), operation); } - - /** - * Lists executions for a trigger. - * - * @return The async call builder - */ - public ListTriggerExecutionsRequestBuilder listExecutions() { - return new ListTriggerExecutionsRequestBuilder(sdkConfiguration); - } - - /** - * Lists executions for a trigger. - * - * @param triggerId Resource name of the trigger. - * @return {@code CompletableFuture} - The async response - */ - public CompletableFuture listExecutions(@Nonnull String triggerId) { - return listExecutions( - null, triggerId, null, - null, null); - } - - /** - * Lists executions for a trigger. - * - * @param apiVersion Which version of the API to use. - * @param triggerId Resource name of the trigger. - * @param pageSize Optional. The maximum number of executions to return per page. - * @param pageToken Optional. A page token from a previous ListTriggerExecutions call. - * @param options additional options - * @return {@code CompletableFuture} - The async response - */ - public CompletableFuture listExecutions( - @Nullable String apiVersion, @Nonnull String triggerId, - @Nullable Long pageSize, @Nullable String pageToken, - @Nullable Options options) { - ListTriggerExecutionsRequest request = new ListTriggerExecutionsRequest( - apiVersion, triggerId, pageSize, - pageToken); - AsyncRequestOperation operation - = new ListTriggerExecutions.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); - } - } diff --git a/src/main/java/com/google/genai/gaos/AsyncWebhooks.java b/src/main/java/com/google/genai/gaos/AsyncWebhooks.java index e761dd8db53..f5c298fcf30 100644 --- a/src/main/java/com/google/genai/gaos/AsyncWebhooks.java +++ b/src/main/java/com/google/genai/gaos/AsyncWebhooks.java @@ -81,6 +81,51 @@ public Webhooks sync() { } + /** + * Lists all Webhooks. + * + * @return The async call builder + */ + public ListWebhooksRequestBuilder list() { + return new ListWebhooksRequestBuilder(sdkConfiguration); + } + + /** + * Lists all Webhooks. + * + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture listDirect() { + return list( + null, null, null, + null); + } + + /** + * Lists all Webhooks. + * + * @param apiVersion Which version of the API to use. + * @param pageSize Optional. The maximum number of webhooks to return. The service may return fewer than + * this value. If unspecified, at most 50 webhooks will be returned. + * The maximum value is 1000. + * @param pageToken Optional. A page token, received from a previous `ListWebhooks` call. + * Provide this to retrieve the subsequent page. + * @param options additional options + * @return {@code CompletableFuture} - The async response + */ + public CompletableFuture list( + @Nullable String apiVersion, @Nullable Integer pageSize, + @Nullable String pageToken, @Nullable Options options) { + ListWebhooksRequest request = new ListWebhooksRequest(apiVersion, pageSize, pageToken); + AsyncRequestOperation operation + = new ListWebhooks.Async( + sdkConfiguration, options, sdkConfiguration.retryScheduler(), + _headers); + return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), + operation::handleResponse), operation); + } + + /** * Creates a new Webhook. * @@ -122,43 +167,40 @@ public CompletableFuture create( /** - * Lists all Webhooks. + * Deletes a Webhook. * * @return The async call builder */ - public ListWebhooksRequestBuilder list() { - return new ListWebhooksRequestBuilder(sdkConfiguration); + public DeleteWebhookRequestBuilder delete() { + return new DeleteWebhookRequestBuilder(sdkConfiguration); } /** - * Lists all Webhooks. + * Deletes a Webhook. * - * @return {@code CompletableFuture} - The async response + * @param id Required. The ID of the webhook to delete. + * Format: `{webhook_id}` + * @return {@code CompletableFuture} - The async response */ - public CompletableFuture listDirect() { - return list( - null, null, null, - null); + public CompletableFuture delete(@Nonnull String id) { + return delete(null, id, null); } /** - * Lists all Webhooks. + * Deletes a Webhook. * * @param apiVersion Which version of the API to use. - * @param pageSize Optional. The maximum number of webhooks to return. The service may return fewer than - * this value. If unspecified, at most 50 webhooks will be returned. - * The maximum value is 1000. - * @param pageToken Optional. A page token, received from a previous `ListWebhooks` call. - * Provide this to retrieve the subsequent page. + * @param id Required. The ID of the webhook to delete. + * Format: `{webhook_id}` * @param options additional options - * @return {@code CompletableFuture} - The async response + * @return {@code CompletableFuture} - The async response */ - public CompletableFuture list( - @Nullable String apiVersion, @Nullable Integer pageSize, - @Nullable String pageToken, @Nullable Options options) { - ListWebhooksRequest request = new ListWebhooksRequest(apiVersion, pageSize, pageToken); - AsyncRequestOperation operation - = new ListWebhooks.Async( + public CompletableFuture delete( + @Nullable String apiVersion, @Nonnull String id, + @Nullable Options options) { + DeleteWebhookRequest request = new DeleteWebhookRequest(apiVersion, id); + AsyncRequestOperation operation + = new DeleteWebhook.Async( sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), @@ -254,40 +296,43 @@ public CompletableFuture update( /** - * Deletes a Webhook. + * Sends a ping event to a Webhook. * * @return The async call builder */ - public DeleteWebhookRequestBuilder delete() { - return new DeleteWebhookRequestBuilder(sdkConfiguration); + public PingWebhookRequestBuilder ping() { + return new PingWebhookRequestBuilder(sdkConfiguration); } /** - * Deletes a Webhook. + * Sends a ping event to a Webhook. * - * @param id Required. The ID of the webhook to delete. + * @param id Required. The ID of the webhook to ping. * Format: `{webhook_id}` - * @return {@code CompletableFuture} - The async response + * @return {@code CompletableFuture} - The async response */ - public CompletableFuture delete(@Nonnull String id) { - return delete(null, id, null); + public CompletableFuture ping(@Nonnull String id) { + return ping( + null, id, null, + null); } /** - * Deletes a Webhook. + * Sends a ping event to a Webhook. * * @param apiVersion Which version of the API to use. - * @param id Required. The ID of the webhook to delete. + * @param id Required. The ID of the webhook to ping. * Format: `{webhook_id}` + * @param body Request message for WebhookService.PingWebhook. * @param options additional options - * @return {@code CompletableFuture} - The async response + * @return {@code CompletableFuture} - The async response */ - public CompletableFuture delete( + public CompletableFuture ping( @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { - DeleteWebhookRequest request = new DeleteWebhookRequest(apiVersion, id); - AsyncRequestOperation operation - = new DeleteWebhook.Async( + @Nullable PingWebhookRequest body, @Nullable Options options) { + com.google.genai.gaos.models.operations.PingWebhookRequest request = new com.google.genai.gaos.models.operations.PingWebhookRequest(apiVersion, id, body); + AsyncRequestOperation operation + = new PingWebhook.Async( sdkConfiguration, options, sdkConfiguration.retryScheduler(), _headers); return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), @@ -339,49 +384,4 @@ public CompletableFuture rotateSigningSecret( operation::handleResponse), operation); } - - /** - * Sends a ping event to a Webhook. - * - * @return The async call builder - */ - public PingWebhookRequestBuilder ping() { - return new PingWebhookRequestBuilder(sdkConfiguration); - } - - /** - * Sends a ping event to a Webhook. - * - * @param id Required. The ID of the webhook to ping. - * Format: `{webhook_id}` - * @return {@code CompletableFuture} - The async response - */ - public CompletableFuture ping(@Nonnull String id) { - return ping( - null, id, null, - null); - } - - /** - * Sends a ping event to a Webhook. - * - * @param apiVersion Which version of the API to use. - * @param id Required. The ID of the webhook to ping. - * Format: `{webhook_id}` - * @param body Request message for WebhookService.PingWebhook. - * @param options additional options - * @return {@code CompletableFuture} - The async response - */ - public CompletableFuture ping( - @Nullable String apiVersion, @Nonnull String id, - @Nullable PingWebhookRequest body, @Nullable Options options) { - com.google.genai.gaos.models.operations.PingWebhookRequest request = new com.google.genai.gaos.models.operations.PingWebhookRequest(apiVersion, id, body); - AsyncRequestOperation operation - = new PingWebhook.Async( - sdkConfiguration, options, sdkConfiguration.retryScheduler(), - _headers); - return Operations.relayCancel(Operations.applyBodyReadAsync(operation.doRequest(request), - operation::handleResponse), operation); - } - } diff --git a/src/main/java/com/google/genai/gaos/Environments.java b/src/main/java/com/google/genai/gaos/Environments.java index d1dcc7e6b5c..cef7afcd15b 100644 --- a/src/main/java/com/google/genai/gaos/Environments.java +++ b/src/main/java/com/google/genai/gaos/Environments.java @@ -64,44 +64,6 @@ public AsyncEnvironments async() { return asyncSDK; } - /** - * Creates an environment. - * - * @return The call builder - */ - public CreateEnvironmentRequestBuilder createEnvironment() { - return new CreateEnvironmentRequestBuilder(sdkConfiguration); - } - - /** - * Creates an environment. - * - * @param body Request for `CreateEnvironment`. - * @return The response from the API call - * @throws RuntimeException subclass if the API call fails - */ - public CreateEnvironmentResponse createEnvironment(@Nonnull CreateEnvironmentRequest body) { - return createEnvironment(null, body, null); - } - - /** - * Creates an environment. - * - * @param apiVersion Which version of the API to use. - * @param body Request for `CreateEnvironment`. - * @param options additional options - * @return The response from the API call - * @throws RuntimeException subclass if the API call fails - */ - public CreateEnvironmentResponse createEnvironment( - @Nullable String apiVersion, @Nonnull CreateEnvironmentRequest body, - @Nullable Options options) { - com.google.genai.gaos.models.operations.CreateEnvironmentRequest request = new com.google.genai.gaos.models.operations.CreateEnvironmentRequest(apiVersion, body); - RequestOperation operation - = new CreateEnvironment.Sync(sdkConfiguration, options, _headers); - return operation.handleResponse(operation.doRequest(request)); - } - /** * Lists environments. * @@ -142,40 +104,40 @@ public ListEnvironmentsResponse listEnvironments( } /** - * Gets an environment. + * Creates an environment. * * @return The call builder */ - public GetEnvironmentRequestBuilder getEnvironment() { - return new GetEnvironmentRequestBuilder(sdkConfiguration); + public CreateEnvironmentRequestBuilder createEnvironment() { + return new CreateEnvironmentRequestBuilder(sdkConfiguration); } /** - * Gets an environment. + * Creates an environment. * - * @param id Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. + * @param body Request for `CreateEnvironment`. * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public GetEnvironmentResponse getEnvironment(@Nonnull String id) { - return getEnvironment(null, id, null); + public CreateEnvironmentResponse createEnvironment(@Nonnull CreateEnvironmentRequest body) { + return createEnvironment(null, body, null); } /** - * Gets an environment. + * Creates an environment. * * @param apiVersion Which version of the API to use. - * @param id Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. + * @param body Request for `CreateEnvironment`. * @param options additional options * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public GetEnvironmentResponse getEnvironment( - @Nullable String apiVersion, @Nonnull String id, + public CreateEnvironmentResponse createEnvironment( + @Nullable String apiVersion, @Nonnull CreateEnvironmentRequest body, @Nullable Options options) { - GetEnvironmentRequest request = new GetEnvironmentRequest(apiVersion, id); - RequestOperation operation - = new GetEnvironment.Sync(sdkConfiguration, options, _headers); + com.google.genai.gaos.models.operations.CreateEnvironmentRequest request = new com.google.genai.gaos.models.operations.CreateEnvironmentRequest(apiVersion, body); + RequestOperation operation + = new CreateEnvironment.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } @@ -217,4 +179,42 @@ public DeleteEnvironmentResponse deleteEnvironment( return operation.handleResponse(operation.doRequest(request)); } + /** + * Gets an environment. + * + * @return The call builder + */ + public GetEnvironmentRequestBuilder getEnvironment() { + return new GetEnvironmentRequestBuilder(sdkConfiguration); + } + + /** + * Gets an environment. + * + * @param id Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public GetEnvironmentResponse getEnvironment(@Nonnull String id) { + return getEnvironment(null, id, null); + } + + /** + * Gets an environment. + * + * @param apiVersion Which version of the API to use. + * @param id Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122. + * @param options additional options + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public GetEnvironmentResponse getEnvironment( + @Nullable String apiVersion, @Nonnull String id, + @Nullable Options options) { + GetEnvironmentRequest request = new GetEnvironmentRequest(apiVersion, id); + RequestOperation operation + = new GetEnvironment.Sync(sdkConfiguration, options, _headers); + return operation.handleResponse(operation.doRequest(request)); + } + } diff --git a/src/main/java/com/google/genai/gaos/GenAI.java b/src/main/java/com/google/genai/gaos/GenAI.java index fb60d9676b8..fa2eb9fef0d 100644 --- a/src/main/java/com/google/genai/gaos/GenAI.java +++ b/src/main/java/com/google/genai/gaos/GenAI.java @@ -55,33 +55,33 @@ public class GenAI implements java.lang.AutoCloseable { }; - private final Interactions interactions; + private final Agents agents; - private final Webhooks webhooks; + private final Environments environments; - private final Agents agents; + private final Interactions interactions; private final Triggers triggers; - private final Environments environments; + private final Webhooks webhooks; - public Interactions interactions() { - return interactions; + public Agents agents() { + return agents; } - public Webhooks webhooks() { - return webhooks; + public Environments environments() { + return environments; } - public Agents agents() { - return agents; + public Interactions interactions() { + return interactions; } @@ -90,10 +90,9 @@ public Triggers triggers() { } - public Environments environments() { - return environments; - } - private SDKConfiguration sdkConfiguration; + public Webhooks webhooks() { + return webhooks; + }private SDKConfiguration sdkConfiguration; private final AsyncGenAI asyncSDK; /** @@ -276,11 +275,11 @@ public static Builder builder() { private GenAI(SDKConfiguration sdkConfiguration) { sdkConfiguration.initialize(); sdkConfiguration = sdkConfiguration.hooks().sdkInit(sdkConfiguration); - this.interactions = new Interactions(sdkConfiguration); - this.webhooks = new Webhooks(sdkConfiguration); this.agents = new Agents(sdkConfiguration); - this.triggers = new Triggers(sdkConfiguration); this.environments = new Environments(sdkConfiguration); + this.interactions = new Interactions(sdkConfiguration); + this.triggers = new Triggers(sdkConfiguration); + this.webhooks = new Webhooks(sdkConfiguration); this.asyncSDK = new AsyncGenAI(this, sdkConfiguration); this.sdkConfiguration = sdkConfiguration; } diff --git a/src/main/java/com/google/genai/gaos/Interactions.java b/src/main/java/com/google/genai/gaos/Interactions.java index e1cbd26b2fd..ac38fe2197e 100644 --- a/src/main/java/com/google/genai/gaos/Interactions.java +++ b/src/main/java/com/google/genai/gaos/Interactions.java @@ -109,86 +109,86 @@ public CreateInteractionResponse create( } /** - * Retrieving an interaction + * Deleting an interaction * - *

Retrieves the full details of a single interaction based on its `Interaction.id`. + *

Deletes the interaction by id. * * @return The call builder */ - public GetInteractionByIdRequestBuilder get() { - return new GetInteractionByIdRequestBuilder(sdkConfiguration); + public DeleteInteractionRequestBuilder delete() { + return new DeleteInteractionRequestBuilder(sdkConfiguration); } /** - * Retrieving an interaction + * Deleting an interaction * - *

Retrieves the full details of a single interaction based on its `Interaction.id`. + *

Deletes the interaction by id. * - * @param request The request object containing all the parameters for the API call. + * @param id The unique identifier of the interaction to delete. * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public GetInteractionByIdResponse get(@Nonnull GetInteractionByIdRequest request) { - return get(request, null); + public DeleteInteractionResponse delete(@Nonnull String id) { + return delete(null, id, null); } /** - * Retrieving an interaction + * Deleting an interaction * - *

Retrieves the full details of a single interaction based on its `Interaction.id`. + *

Deletes the interaction by id. * - * @param request The request object containing all the parameters for the API call. + * @param apiVersion Which version of the API to use. + * @param id The unique identifier of the interaction to delete. * @param options additional options * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public GetInteractionByIdResponse get(@Nonnull GetInteractionByIdRequest request, @Nullable Options options) { - RequestOperation operation - = new GetInteractionById.Sync(sdkConfiguration, options, _headers); + public DeleteInteractionResponse delete( + @Nullable String apiVersion, @Nonnull String id, + @Nullable Options options) { + DeleteInteractionRequest request = new DeleteInteractionRequest(apiVersion, id); + RequestOperation operation + = new DeleteInteraction.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } /** - * Deleting an interaction + * Retrieving an interaction * - *

Deletes the interaction by id. + *

Retrieves the full details of a single interaction based on its `Interaction.id`. * * @return The call builder */ - public DeleteInteractionRequestBuilder delete() { - return new DeleteInteractionRequestBuilder(sdkConfiguration); + public GetInteractionByIdRequestBuilder get() { + return new GetInteractionByIdRequestBuilder(sdkConfiguration); } /** - * Deleting an interaction + * Retrieving an interaction * - *

Deletes the interaction by id. + *

Retrieves the full details of a single interaction based on its `Interaction.id`. * - * @param id The unique identifier of the interaction to delete. + * @param request The request object containing all the parameters for the API call. * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public DeleteInteractionResponse delete(@Nonnull String id) { - return delete(id, null, null); + public GetInteractionByIdResponse get(@Nonnull GetInteractionByIdRequest request) { + return get(request, null); } /** - * Deleting an interaction + * Retrieving an interaction * - *

Deletes the interaction by id. + *

Retrieves the full details of a single interaction based on its `Interaction.id`. * - * @param id The unique identifier of the interaction to delete. - * @param apiVersion Which version of the API to use. + * @param request The request object containing all the parameters for the API call. * @param options additional options * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public DeleteInteractionResponse delete( - @Nonnull String id, @Nullable String apiVersion, - @Nullable Options options) { - DeleteInteractionRequest request = new DeleteInteractionRequest(id, apiVersion); - RequestOperation operation - = new DeleteInteraction.Sync(sdkConfiguration, options, _headers); + public GetInteractionByIdResponse get(@Nonnull GetInteractionByIdRequest request, @Nullable Options options) { + RequestOperation operation + = new GetInteractionById.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } @@ -213,7 +213,7 @@ public CancelInteractionByIdRequestBuilder cancel() { * @throws RuntimeException subclass if the API call fails */ public CancelInteractionByIdResponse cancel(@Nonnull String id) { - return cancel(id, null, null); + return cancel(null, id, null); } /** @@ -221,16 +221,16 @@ public CancelInteractionByIdResponse cancel(@Nonnull String id) { * *

Cancels an interaction by id. This only applies to background interactions that are still running. * - * @param id The unique identifier of the interaction to cancel. * @param apiVersion Which version of the API to use. + * @param id The unique identifier of the interaction to cancel. * @param options additional options * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ public CancelInteractionByIdResponse cancel( - @Nonnull String id, @Nullable String apiVersion, + @Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { - CancelInteractionByIdRequest request = new CancelInteractionByIdRequest(id, apiVersion); + CancelInteractionByIdRequest request = new CancelInteractionByIdRequest(apiVersion, id); RequestOperation operation = new CancelInteractionById.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); diff --git a/src/main/java/com/google/genai/gaos/SDKConfiguration.java b/src/main/java/com/google/genai/gaos/SDKConfiguration.java index 9250f64bdd0..83b9ae8186b 100644 --- a/src/main/java/com/google/genai/gaos/SDKConfiguration.java +++ b/src/main/java/com/google/genai/gaos/SDKConfiguration.java @@ -37,7 +37,7 @@ public class SDKConfiguration { private static final String LANGUAGE = "java"; public static final String OPENAPI_DOC_VERSION = "v1beta"; public static final String SDK_VERSION = "0.1.0"; - public static final String GEN_VERSION = "2.930.0"; + public static final String GEN_VERSION = "internal"; private static final String BASE_PACKAGE = "com.google.genai.gaos"; public static final String USER_AGENT = String.format("speakeasy-sdk/%s %s %s %s %s", diff --git a/src/main/java/com/google/genai/gaos/Triggers.java b/src/main/java/com/google/genai/gaos/Triggers.java index a40dbffa311..788a5782e71 100644 --- a/src/main/java/com/google/genai/gaos/Triggers.java +++ b/src/main/java/com/google/genai/gaos/Triggers.java @@ -78,6 +78,49 @@ public AsyncTriggers async() { return asyncSDK; } + /** + * Lists triggers for a project. + * + * @return The call builder + */ + public ListTriggersRequestBuilder list() { + return new ListTriggersRequestBuilder(sdkConfiguration); + } + + /** + * Lists triggers for a project. + * + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public ListTriggersResponse listDirect() { + return list(null, null, null, + null, null); + } + + /** + * Lists triggers for a project. + * + * @param apiVersion Which version of the API to use. + * @param filter Optional. Filter expression (e.g., by state). + * @param pageSize Optional. The maximum number of triggers to return per page. + * @param pageToken Optional. A page token from a previous ListTriggers call. + * @param options additional options + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public ListTriggersResponse list( + @Nullable String apiVersion, @Nullable String filter, + @Nullable Long pageSize, @Nullable String pageToken, + @Nullable Options options) { + ListTriggersRequest request = new ListTriggersRequest( + apiVersion, filter, pageSize, + pageToken); + RequestOperation operation + = new ListTriggers.Sync(sdkConfiguration, options, _headers); + return operation.handleResponse(operation.doRequest(request)); + } + /** * Creates a new trigger that will invoke the specified agent on the given cron schedule. * @@ -117,45 +160,40 @@ public CreateTriggerResponse create( } /** - * Lists triggers for a project. + * Deletes a trigger. * * @return The call builder */ - public ListTriggersRequestBuilder list() { - return new ListTriggersRequestBuilder(sdkConfiguration); + public DeleteTriggerRequestBuilder delete() { + return new DeleteTriggerRequestBuilder(sdkConfiguration); } /** - * Lists triggers for a project. + * Deletes a trigger. * + * @param id Resource name of the trigger. * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public ListTriggersResponse listDirect() { - return list(null, null, null, - null, null); + public DeleteTriggerResponse delete(@Nonnull String id) { + return delete(null, id, null); } /** - * Lists triggers for a project. + * Deletes a trigger. * * @param apiVersion Which version of the API to use. - * @param filter Optional. Filter expression (e.g., by state). - * @param pageSize Optional. The maximum number of triggers to return per page. - * @param pageToken Optional. A page token from a previous ListTriggers call. + * @param id Resource name of the trigger. * @param options additional options * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public ListTriggersResponse list( - @Nullable String apiVersion, @Nullable String filter, - @Nullable Long pageSize, @Nullable String pageToken, + public DeleteTriggerResponse delete( + @Nullable String apiVersion, @Nonnull String id, @Nullable Options options) { - ListTriggersRequest request = new ListTriggersRequest( - apiVersion, filter, pageSize, - pageToken); - RequestOperation operation - = new ListTriggers.Sync(sdkConfiguration, options, _headers); + DeleteTriggerRequest request = new DeleteTriggerRequest(apiVersion, id); + RequestOperation operation + = new DeleteTrigger.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } @@ -239,40 +277,46 @@ public UpdateTriggerResponse update( } /** - * Deletes a trigger. + * Lists executions for a trigger. * * @return The call builder */ - public DeleteTriggerRequestBuilder delete() { - return new DeleteTriggerRequestBuilder(sdkConfiguration); + public ListTriggerExecutionsRequestBuilder listExecutions() { + return new ListTriggerExecutionsRequestBuilder(sdkConfiguration); } /** - * Deletes a trigger. + * Lists executions for a trigger. * - * @param id Resource name of the trigger. + * @param triggerId Resource name of the trigger. * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public DeleteTriggerResponse delete(@Nonnull String id) { - return delete(null, id, null); + public ListTriggerExecutionsResponse listExecutions(@Nonnull String triggerId) { + return listExecutions(null, triggerId, null, + null, null); } /** - * Deletes a trigger. + * Lists executions for a trigger. * * @param apiVersion Which version of the API to use. - * @param id Resource name of the trigger. + * @param triggerId Resource name of the trigger. + * @param pageSize Optional. The maximum number of executions to return per page. + * @param pageToken Optional. A page token from a previous ListTriggerExecutions call. * @param options additional options * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public DeleteTriggerResponse delete( - @Nullable String apiVersion, @Nonnull String id, + public ListTriggerExecutionsResponse listExecutions( + @Nullable String apiVersion, @Nonnull String triggerId, + @Nullable Long pageSize, @Nullable String pageToken, @Nullable Options options) { - DeleteTriggerRequest request = new DeleteTriggerRequest(apiVersion, id); - RequestOperation operation - = new DeleteTrigger.Sync(sdkConfiguration, options, _headers); + ListTriggerExecutionsRequest request = new ListTriggerExecutionsRequest( + apiVersion, triggerId, pageSize, + pageToken); + RequestOperation operation + = new ListTriggerExecutions.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } @@ -314,48 +358,4 @@ public RunTriggerResponse run( return operation.handleResponse(operation.doRequest(request)); } - /** - * Lists executions for a trigger. - * - * @return The call builder - */ - public ListTriggerExecutionsRequestBuilder listExecutions() { - return new ListTriggerExecutionsRequestBuilder(sdkConfiguration); - } - - /** - * Lists executions for a trigger. - * - * @param triggerId Resource name of the trigger. - * @return The response from the API call - * @throws RuntimeException subclass if the API call fails - */ - public ListTriggerExecutionsResponse listExecutions(@Nonnull String triggerId) { - return listExecutions(null, triggerId, null, - null, null); - } - - /** - * Lists executions for a trigger. - * - * @param apiVersion Which version of the API to use. - * @param triggerId Resource name of the trigger. - * @param pageSize Optional. The maximum number of executions to return per page. - * @param pageToken Optional. A page token from a previous ListTriggerExecutions call. - * @param options additional options - * @return The response from the API call - * @throws RuntimeException subclass if the API call fails - */ - public ListTriggerExecutionsResponse listExecutions( - @Nullable String apiVersion, @Nonnull String triggerId, - @Nullable Long pageSize, @Nullable String pageToken, - @Nullable Options options) { - ListTriggerExecutionsRequest request = new ListTriggerExecutionsRequest( - apiVersion, triggerId, pageSize, - pageToken); - RequestOperation operation - = new ListTriggerExecutions.Sync(sdkConfiguration, options, _headers); - return operation.handleResponse(operation.doRequest(request)); - } - } diff --git a/src/main/java/com/google/genai/gaos/Webhooks.java b/src/main/java/com/google/genai/gaos/Webhooks.java index ba88b0afa21..ab4edbf0e7c 100644 --- a/src/main/java/com/google/genai/gaos/Webhooks.java +++ b/src/main/java/com/google/genai/gaos/Webhooks.java @@ -78,6 +78,48 @@ public AsyncWebhooks async() { return asyncSDK; } + /** + * Lists all Webhooks. + * + * @return The call builder + */ + public ListWebhooksRequestBuilder list() { + return new ListWebhooksRequestBuilder(sdkConfiguration); + } + + /** + * Lists all Webhooks. + * + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public ListWebhooksResponse listDirect() { + return list(null, null, null, + null); + } + + /** + * Lists all Webhooks. + * + * @param apiVersion Which version of the API to use. + * @param pageSize Optional. The maximum number of webhooks to return. The service may return fewer than + * this value. If unspecified, at most 50 webhooks will be returned. + * The maximum value is 1000. + * @param pageToken Optional. A page token, received from a previous `ListWebhooks` call. + * Provide this to retrieve the subsequent page. + * @param options additional options + * @return The response from the API call + * @throws RuntimeException subclass if the API call fails + */ + public ListWebhooksResponse list( + @Nullable String apiVersion, @Nullable Integer pageSize, + @Nullable String pageToken, @Nullable Options options) { + ListWebhooksRequest request = new ListWebhooksRequest(apiVersion, pageSize, pageToken); + RequestOperation operation + = new ListWebhooks.Sync(sdkConfiguration, options, _headers); + return operation.handleResponse(operation.doRequest(request)); + } + /** * Creates a new Webhook. * @@ -117,44 +159,42 @@ public CreateWebhookResponse create( } /** - * Lists all Webhooks. + * Deletes a Webhook. * * @return The call builder */ - public ListWebhooksRequestBuilder list() { - return new ListWebhooksRequestBuilder(sdkConfiguration); + public DeleteWebhookRequestBuilder delete() { + return new DeleteWebhookRequestBuilder(sdkConfiguration); } /** - * Lists all Webhooks. + * Deletes a Webhook. * + * @param id Required. The ID of the webhook to delete. + * Format: `{webhook_id}` * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public ListWebhooksResponse listDirect() { - return list(null, null, null, - null); + public DeleteWebhookResponse delete(@Nonnull String id) { + return delete(null, id, null); } /** - * Lists all Webhooks. + * Deletes a Webhook. * * @param apiVersion Which version of the API to use. - * @param pageSize Optional. The maximum number of webhooks to return. The service may return fewer than - * this value. If unspecified, at most 50 webhooks will be returned. - * The maximum value is 1000. - * @param pageToken Optional. A page token, received from a previous `ListWebhooks` call. - * Provide this to retrieve the subsequent page. + * @param id Required. The ID of the webhook to delete. + * Format: `{webhook_id}` * @param options additional options * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public ListWebhooksResponse list( - @Nullable String apiVersion, @Nullable Integer pageSize, - @Nullable String pageToken, @Nullable Options options) { - ListWebhooksRequest request = new ListWebhooksRequest(apiVersion, pageSize, pageToken); - RequestOperation operation - = new ListWebhooks.Sync(sdkConfiguration, options, _headers); + public DeleteWebhookResponse delete( + @Nullable String apiVersion, @Nonnull String id, + @Nullable Options options) { + DeleteWebhookRequest request = new DeleteWebhookRequest(apiVersion, id); + RequestOperation operation + = new DeleteWebhook.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } @@ -241,42 +281,44 @@ public UpdateWebhookResponse update( } /** - * Deletes a Webhook. + * Sends a ping event to a Webhook. * * @return The call builder */ - public DeleteWebhookRequestBuilder delete() { - return new DeleteWebhookRequestBuilder(sdkConfiguration); + public PingWebhookRequestBuilder ping() { + return new PingWebhookRequestBuilder(sdkConfiguration); } /** - * Deletes a Webhook. + * Sends a ping event to a Webhook. * - * @param id Required. The ID of the webhook to delete. + * @param id Required. The ID of the webhook to ping. * Format: `{webhook_id}` * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public DeleteWebhookResponse delete(@Nonnull String id) { - return delete(null, id, null); + public PingWebhookResponse ping(@Nonnull String id) { + return ping(null, id, null, + null); } /** - * Deletes a Webhook. + * Sends a ping event to a Webhook. * * @param apiVersion Which version of the API to use. - * @param id Required. The ID of the webhook to delete. + * @param id Required. The ID of the webhook to ping. * Format: `{webhook_id}` + * @param body Request message for WebhookService.PingWebhook. * @param options additional options * @return The response from the API call * @throws RuntimeException subclass if the API call fails */ - public DeleteWebhookResponse delete( + public PingWebhookResponse ping( @Nullable String apiVersion, @Nonnull String id, - @Nullable Options options) { - DeleteWebhookRequest request = new DeleteWebhookRequest(apiVersion, id); - RequestOperation operation - = new DeleteWebhook.Sync(sdkConfiguration, options, _headers); + @Nullable PingWebhookRequest body, @Nullable Options options) { + com.google.genai.gaos.models.operations.PingWebhookRequest request = new com.google.genai.gaos.models.operations.PingWebhookRequest(apiVersion, id, body); + RequestOperation operation + = new PingWebhook.Sync(sdkConfiguration, options, _headers); return operation.handleResponse(operation.doRequest(request)); } @@ -322,46 +364,4 @@ public RotateSigningSecretResponse rotateSigningSecret( return operation.handleResponse(operation.doRequest(request)); } - /** - * Sends a ping event to a Webhook. - * - * @return The call builder - */ - public PingWebhookRequestBuilder ping() { - return new PingWebhookRequestBuilder(sdkConfiguration); - } - - /** - * Sends a ping event to a Webhook. - * - * @param id Required. The ID of the webhook to ping. - * Format: `{webhook_id}` - * @return The response from the API call - * @throws RuntimeException subclass if the API call fails - */ - public PingWebhookResponse ping(@Nonnull String id) { - return ping(null, id, null, - null); - } - - /** - * Sends a ping event to a Webhook. - * - * @param apiVersion Which version of the API to use. - * @param id Required. The ID of the webhook to ping. - * Format: `{webhook_id}` - * @param body Request message for WebhookService.PingWebhook. - * @param options additional options - * @return The response from the API call - * @throws RuntimeException subclass if the API call fails - */ - public PingWebhookResponse ping( - @Nullable String apiVersion, @Nonnull String id, - @Nullable PingWebhookRequest body, @Nullable Options options) { - com.google.genai.gaos.models.operations.PingWebhookRequest request = new com.google.genai.gaos.models.operations.PingWebhookRequest(apiVersion, id, body); - RequestOperation operation - = new PingWebhook.Sync(sdkConfiguration, options, _headers); - return operation.handleResponse(operation.doRequest(request)); - } - } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/AudioContent.java b/src/main/java/com/google/genai/gaos/models/interactions/AudioContent.java index bba50dc9be3..1a71f943e80 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/AudioContent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/AudioContent.java @@ -52,6 +52,13 @@ public class AudioContent implements Content { @JsonProperty("data") private String data; + /** + * The mime type of the audio. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("mime_type") + private AudioContentMimeType mimeType; + /** * The sample rate of the audio. */ @@ -70,26 +77,19 @@ public class AudioContent implements Content { @JsonProperty("uri") private String uri; - /** - * The mime type of the audio. - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("mime_type") - private AudioContentMimeType mimeType; - @JsonCreator public AudioContent( @JsonProperty("channels") @Nullable Integer channels, @JsonProperty("data") @Nullable String data, + @JsonProperty("mime_type") @Nullable AudioContentMimeType mimeType, @JsonProperty("sample_rate") @Nullable Integer sampleRate, - @JsonProperty("uri") @Nullable String uri, - @JsonProperty("mime_type") @Nullable AudioContentMimeType mimeType) { + @JsonProperty("uri") @Nullable String uri) { this.channels = channels; this.data = data; + this.mimeType = mimeType; this.sampleRate = sampleRate; this.type = Builder._SINGLETON_VALUE_Type.value(); this.uri = uri; - this.mimeType = mimeType; } public AudioContent() { @@ -111,6 +111,13 @@ public Optional data() { return Optional.ofNullable(this.data); } + /** + * The mime type of the audio. + */ + public Optional mimeType() { + return Optional.ofNullable(this.mimeType); + } + /** * The sample rate of the audio. */ @@ -130,13 +137,6 @@ public Optional uri() { return Optional.ofNullable(this.uri); } - /** - * The mime type of the audio. - */ - public Optional mimeType() { - return Optional.ofNullable(this.mimeType); - } - public static Builder builder() { return new Builder(); } @@ -161,28 +161,28 @@ public AudioContent withData(@Nullable String data) { /** - * The sample rate of the audio. + * The mime type of the audio. */ - public AudioContent withSampleRate(@Nullable Integer sampleRate) { - this.sampleRate = sampleRate; + public AudioContent withMimeType(@Nullable AudioContentMimeType mimeType) { + this.mimeType = mimeType; return this; } /** - * The URI of the audio. + * The sample rate of the audio. */ - public AudioContent withUri(@Nullable String uri) { - this.uri = uri; + public AudioContent withSampleRate(@Nullable Integer sampleRate) { + this.sampleRate = sampleRate; return this; } /** - * The mime type of the audio. + * The URI of the audio. */ - public AudioContent withMimeType(@Nullable AudioContentMimeType mimeType) { - this.mimeType = mimeType; + public AudioContent withUri(@Nullable String uri) { + this.uri = uri; return this; } @@ -199,17 +199,17 @@ public boolean equals(java.lang.Object o) { return Utils.enhancedDeepEquals(this.channels, other.channels) && Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.mimeType, other.mimeType) && Utils.enhancedDeepEquals(this.sampleRate, other.sampleRate) && Utils.enhancedDeepEquals(this.type, other.type) && - Utils.enhancedDeepEquals(this.uri, other.uri) && - Utils.enhancedDeepEquals(this.mimeType, other.mimeType); + Utils.enhancedDeepEquals(this.uri, other.uri); } @Override public int hashCode() { return Utils.enhancedHash( - channels, data, sampleRate, - type, uri, mimeType); + channels, data, mimeType, + sampleRate, type, uri); } @Override @@ -217,10 +217,10 @@ public String toString() { return Utils.toString(AudioContent.class, "channels", channels, "data", data, + "mimeType", mimeType, "sampleRate", sampleRate, "type", type, - "uri", uri, - "mimeType", mimeType); + "uri", uri); } @SuppressWarnings("UnusedReturnValue") @@ -230,12 +230,12 @@ public final static class Builder { private String data; + private AudioContentMimeType mimeType; + private Integer sampleRate; private String uri; - private AudioContentMimeType mimeType; - private Builder() { // force use of static builder() method } @@ -256,6 +256,14 @@ public Builder data(@Nullable String data) { return this; } + /** + * The mime type of the audio. + */ + public Builder mimeType(@Nullable AudioContentMimeType mimeType) { + this.mimeType = mimeType; + return this; + } + /** * The sample rate of the audio. */ @@ -272,18 +280,10 @@ public Builder uri(@Nullable String uri) { return this; } - /** - * The mime type of the audio. - */ - public Builder mimeType(@Nullable AudioContentMimeType mimeType) { - this.mimeType = mimeType; - return this; - } - public AudioContent build() { return new AudioContent( - channels, data, sampleRate, - uri, mimeType); + channels, data, mimeType, + sampleRate, uri); } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CodeExecution.java b/src/main/java/com/google/genai/gaos/models/interactions/CodeExecution.java index 6e3ce7ad03e..a1cc4f01b8b 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CodeExecution.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CodeExecution.java @@ -33,7 +33,7 @@ * *

A tool that can be used by the model to execute code. */ -public class CodeExecution implements Tool, AgentTool { +public class CodeExecution implements AgentTool, Tool { @JsonProperty("type") private String type; diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ContentTypeIdResolver.java b/src/main/java/com/google/genai/gaos/models/interactions/ContentTypeIdResolver.java index f4fdef1dc73..5512f9585f2 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ContentTypeIdResolver.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ContentTypeIdResolver.java @@ -40,10 +40,10 @@ public ContentTypeIdResolver() { } private void initializeTypeMap() { - registerType("text", TextContent.class); - registerType("image", ImageContent.class); registerType("audio", AudioContent.class); registerType("document", DocumentContent.class); + registerType("image", ImageContent.class); + registerType("text", TextContent.class); registerType("video", VideoContent.class); } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteraction.java b/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteraction.java index 254ac45bb0a..3a97ffc7d59 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteraction.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteraction.java @@ -47,49 +47,54 @@ public class CreateAgentInteraction { private AgentOption agent; /** - * Input only. Whether the interaction will be streamed. + * Configuration parameters for the agent interaction. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("stream") - private Boolean stream; + @JsonProperty("agent_config") + private CreateAgentInteractionAgentConfig agentConfig; /** - * Input only. Whether to store the response and request for later retrieval. + * Input only. Whether to run the model interaction in the background. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("store") - private Boolean store; + @JsonProperty("background") + private Boolean background; /** - * Input only. Whether to run the model interaction in the background. + * The environment configuration for the interaction. Can be an object specifying remote environment + * sources or a string referencing an existing environment ID. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("background") - private Boolean background; + @JsonProperty("environment") + private CreateAgentInteractionEnvironment environment; /** - * System instruction for the interaction. + * The input for the interaction. + */ + @JsonProperty("input") + private InteractionsInput input; + + /** + * The labels with user-defined metadata for the request. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("system_instruction") - private String systemInstruction; + @JsonProperty("labels") + private Map labels; /** - * A list of tool declarations the model may call during interaction. + * The ID of the previous interaction, if any. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("tools") - private List tools; + @JsonProperty("previous_interaction_id") + private String previousInteractionId; /** - * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + * Enforces that the generated response is a JSON object that complies with the JSON schema specified + * in this field. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("response_modalities") - @Deprecated - private List responseModalities; + @JsonProperty("response_format") + private CreateAgentInteractionResponseFormat responseFormat; /** * The mime type of the response. This is required if response_format is set. @@ -102,116 +107,111 @@ public class CreateAgentInteraction { private String responseMimeType; /** - * The ID of the previous interaction, if any. + * The requested modalities of the response (TEXT, IMAGE, AUDIO). + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("previous_interaction_id") - private String previousInteractionId; - - - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("service_tier") - private ServiceTier serviceTier; + @JsonProperty("response_modalities") + @Deprecated + private List responseModalities; /** - * Message for configuring webhook events for a request. + * Safety settings for the interaction. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("webhook_config") - private WebhookConfig webhookConfig; + @JsonProperty("safety_settings") + private List safetySettings; + - /** - * Enforces that the generated response is a JSON object that complies with the JSON schema specified - * in this field. - */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("response_format") - private CreateAgentInteractionResponseFormat responseFormat; + @JsonProperty("service_tier") + private ServiceTier serviceTier; /** - * The environment configuration for the interaction. Can be an object specifying remote environment - * sources or a string referencing an existing environment ID. + * Input only. Whether to store the response and request for later retrieval. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("environment") - private CreateAgentInteractionEnvironment environment; + @JsonProperty("store") + private Boolean store; /** - * Configuration parameters for the agent interaction. + * Input only. Whether the interaction will be streamed. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("agent_config") - private CreateAgentInteractionAgentConfig agentConfig; + @JsonProperty("stream") + private Boolean stream; /** - * Safety settings for the interaction. + * System instruction for the interaction. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("safety_settings") - private List safetySettings; + @JsonProperty("system_instruction") + private String systemInstruction; /** - * The labels with user-defined metadata for the request. + * A list of tool declarations the model may call during interaction. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("labels") - private Map labels; + @JsonProperty("tools") + private List tools; /** - * The input for the interaction. + * Message for configuring webhook events for a request. */ - @JsonProperty("input") - private InteractionsInput input; + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("webhook_config") + private WebhookConfig webhookConfig; @JsonCreator public CreateAgentInteraction( @JsonProperty("agent") @Nonnull AgentOption agent, - @JsonProperty("stream") @Nullable Boolean stream, - @JsonProperty("store") @Nullable Boolean store, + @JsonProperty("agent_config") @Nullable CreateAgentInteractionAgentConfig agentConfig, @JsonProperty("background") @Nullable Boolean background, - @JsonProperty("system_instruction") @Nullable String systemInstruction, - @JsonProperty("tools") @Nullable List tools, - @JsonProperty("response_modalities") @Nullable List responseModalities, - @JsonProperty("response_mime_type") @Nullable String responseMimeType, + @JsonProperty("environment") @Nullable CreateAgentInteractionEnvironment environment, + @JsonProperty("input") @Nonnull InteractionsInput input, + @JsonProperty("labels") @Nullable Map labels, @JsonProperty("previous_interaction_id") @Nullable String previousInteractionId, - @JsonProperty("service_tier") @Nullable ServiceTier serviceTier, - @JsonProperty("webhook_config") @Nullable WebhookConfig webhookConfig, @JsonProperty("response_format") @Nullable CreateAgentInteractionResponseFormat responseFormat, - @JsonProperty("environment") @Nullable CreateAgentInteractionEnvironment environment, - @JsonProperty("agent_config") @Nullable CreateAgentInteractionAgentConfig agentConfig, + @JsonProperty("response_mime_type") @Nullable String responseMimeType, + @JsonProperty("response_modalities") @Nullable List responseModalities, @JsonProperty("safety_settings") @Nullable List safetySettings, - @JsonProperty("labels") @Nullable Map labels, - @JsonProperty("input") @Nonnull InteractionsInput input) { + @JsonProperty("service_tier") @Nullable ServiceTier serviceTier, + @JsonProperty("store") @Nullable Boolean store, + @JsonProperty("stream") @Nullable Boolean stream, + @JsonProperty("system_instruction") @Nullable String systemInstruction, + @JsonProperty("tools") @Nullable List tools, + @JsonProperty("webhook_config") @Nullable WebhookConfig webhookConfig) { this.agent = Optional.ofNullable(agent) .orElseThrow(() -> new IllegalArgumentException("agent cannot be null")); - this.stream = stream; - this.store = store; + this.agentConfig = agentConfig; this.background = background; - this.systemInstruction = systemInstruction; - this.tools = tools; - this.responseModalities = responseModalities; - this.responseMimeType = responseMimeType; - this.previousInteractionId = previousInteractionId; - this.serviceTier = serviceTier; - this.webhookConfig = webhookConfig; - this.responseFormat = responseFormat; this.environment = environment; - this.agentConfig = agentConfig; - this.safetySettings = safetySettings; - this.labels = labels; this.input = Optional.ofNullable(input) .orElseThrow(() -> new IllegalArgumentException("input cannot be null")); + this.labels = labels; + this.previousInteractionId = previousInteractionId; + this.responseFormat = responseFormat; + this.responseMimeType = responseMimeType; + this.responseModalities = responseModalities; + this.safetySettings = safetySettings; + this.serviceTier = serviceTier; + this.store = store; + this.stream = stream; + this.systemInstruction = systemInstruction; + this.tools = tools; + this.webhookConfig = webhookConfig; } public CreateAgentInteraction( @Nonnull AgentOption agent, @Nonnull InteractionsInput input) { this(agent, null, null, + null, input, null, null, null, null, null, null, null, null, null, null, - null, null, null, - null, input); + null, null); } /** @@ -222,48 +222,54 @@ public Optional agent() { } /** - * Input only. Whether the interaction will be streamed. + * Configuration parameters for the agent interaction. */ - public Optional stream() { - return Optional.ofNullable(this.stream); + public Optional agentConfig() { + return Optional.ofNullable(this.agentConfig); } /** - * Input only. Whether to store the response and request for later retrieval. + * Input only. Whether to run the model interaction in the background. */ - public Optional store() { - return Optional.ofNullable(this.store); + public Optional background() { + return Optional.ofNullable(this.background); } /** - * Input only. Whether to run the model interaction in the background. + * The environment configuration for the interaction. Can be an object specifying remote environment + * sources or a string referencing an existing environment ID. */ - public Optional background() { - return Optional.ofNullable(this.background); + public Optional environment() { + return Optional.ofNullable(this.environment); } /** - * System instruction for the interaction. + * The input for the interaction. */ - public Optional systemInstruction() { - return Optional.ofNullable(this.systemInstruction); + public Optional input() { + return Optional.ofNullable(this.input); } /** - * A list of tool declarations the model may call during interaction. + * The labels with user-defined metadata for the request. */ - public Optional> tools() { - return Optional.ofNullable(this.tools); + public Optional> labels() { + return Optional.ofNullable(this.labels); } /** - * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + * The ID of the previous interaction, if any. */ - @Deprecated - public Optional> responseModalities() { - return Optional.ofNullable(this.responseModalities); + public Optional previousInteractionId() { + return Optional.ofNullable(this.previousInteractionId); + } + + /** + * Enforces that the generated response is a JSON object that complies with the JSON schema specified + * in this field. + */ + public Optional responseFormat() { + return Optional.ofNullable(this.responseFormat); } /** @@ -277,65 +283,59 @@ public Optional responseMimeType() { } /** - * The ID of the previous interaction, if any. + * The requested modalities of the response (TEXT, IMAGE, AUDIO). + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ - public Optional previousInteractionId() { - return Optional.ofNullable(this.previousInteractionId); - } - - public Optional serviceTier() { - return Optional.ofNullable(this.serviceTier); + @Deprecated + public Optional> responseModalities() { + return Optional.ofNullable(this.responseModalities); } /** - * Message for configuring webhook events for a request. + * Safety settings for the interaction. */ - public Optional webhookConfig() { - return Optional.ofNullable(this.webhookConfig); + public Optional> safetySettings() { + return Optional.ofNullable(this.safetySettings); } - /** - * Enforces that the generated response is a JSON object that complies with the JSON schema specified - * in this field. - */ - public Optional responseFormat() { - return Optional.ofNullable(this.responseFormat); + public Optional serviceTier() { + return Optional.ofNullable(this.serviceTier); } /** - * The environment configuration for the interaction. Can be an object specifying remote environment - * sources or a string referencing an existing environment ID. + * Input only. Whether to store the response and request for later retrieval. */ - public Optional environment() { - return Optional.ofNullable(this.environment); + public Optional store() { + return Optional.ofNullable(this.store); } /** - * Configuration parameters for the agent interaction. + * Input only. Whether the interaction will be streamed. */ - public Optional agentConfig() { - return Optional.ofNullable(this.agentConfig); + public Optional stream() { + return Optional.ofNullable(this.stream); } /** - * Safety settings for the interaction. + * System instruction for the interaction. */ - public Optional> safetySettings() { - return Optional.ofNullable(this.safetySettings); + public Optional systemInstruction() { + return Optional.ofNullable(this.systemInstruction); } /** - * The labels with user-defined metadata for the request. + * A list of tool declarations the model may call during interaction. */ - public Optional> labels() { - return Optional.ofNullable(this.labels); + public Optional> tools() { + return Optional.ofNullable(this.tools); } /** - * The input for the interaction. + * Message for configuring webhook events for a request. */ - public Optional input() { - return Optional.ofNullable(this.input); + public Optional webhookConfig() { + return Optional.ofNullable(this.webhookConfig); } public static Builder builder() { @@ -353,58 +353,66 @@ public CreateAgentInteraction withAgent(@Nonnull AgentOption agent) { /** - * Input only. Whether the interaction will be streamed. + * Configuration parameters for the agent interaction. */ - public CreateAgentInteraction withStream(@Nullable Boolean stream) { - this.stream = stream; + public CreateAgentInteraction withAgentConfig(@Nullable CreateAgentInteractionAgentConfig agentConfig) { + this.agentConfig = agentConfig; return this; } /** - * Input only. Whether to store the response and request for later retrieval. + * Input only. Whether to run the model interaction in the background. */ - public CreateAgentInteraction withStore(@Nullable Boolean store) { - this.store = store; + public CreateAgentInteraction withBackground(@Nullable Boolean background) { + this.background = background; return this; } /** - * Input only. Whether to run the model interaction in the background. + * The environment configuration for the interaction. Can be an object specifying remote environment + * sources or a string referencing an existing environment ID. */ - public CreateAgentInteraction withBackground(@Nullable Boolean background) { - this.background = background; + public CreateAgentInteraction withEnvironment(@Nullable CreateAgentInteractionEnvironment environment) { + this.environment = environment; return this; } /** - * System instruction for the interaction. + * The input for the interaction. */ - public CreateAgentInteraction withSystemInstruction(@Nullable String systemInstruction) { - this.systemInstruction = systemInstruction; + public CreateAgentInteraction withInput(@Nonnull InteractionsInput input) { + this.input = Utils.checkNotNull(input, "input"); return this; } /** - * A list of tool declarations the model may call during interaction. + * The labels with user-defined metadata for the request. */ - public CreateAgentInteraction withTools(@Nullable List tools) { - this.tools = tools; + public CreateAgentInteraction withLabels(@Nullable Map labels) { + this.labels = labels; + return this; + } + + + /** + * The ID of the previous interaction, if any. + */ + public CreateAgentInteraction withPreviousInteractionId(@Nullable String previousInteractionId) { + this.previousInteractionId = previousInteractionId; return this; } /** - * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + * Enforces that the generated response is a JSON object that complies with the JSON schema specified + * in this field. */ - @Deprecated - public CreateAgentInteraction withResponseModalities(@Nullable List responseModalities) { - this.responseModalities = responseModalities; + public CreateAgentInteraction withResponseFormat(@Nullable CreateAgentInteractionResponseFormat responseFormat) { + this.responseFormat = responseFormat; return this; } @@ -422,81 +430,73 @@ public CreateAgentInteraction withResponseMimeType(@Nullable String responseMime /** - * The ID of the previous interaction, if any. + * The requested modalities of the response (TEXT, IMAGE, AUDIO). + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ - public CreateAgentInteraction withPreviousInteractionId(@Nullable String previousInteractionId) { - this.previousInteractionId = previousInteractionId; - return this; - } - - - public CreateAgentInteraction withServiceTier(@Nullable ServiceTier serviceTier) { - this.serviceTier = serviceTier; + @Deprecated + public CreateAgentInteraction withResponseModalities(@Nullable List responseModalities) { + this.responseModalities = responseModalities; return this; } /** - * Message for configuring webhook events for a request. + * Safety settings for the interaction. */ - public CreateAgentInteraction withWebhookConfig(@Nullable WebhookConfig webhookConfig) { - this.webhookConfig = webhookConfig; + public CreateAgentInteraction withSafetySettings(@Nullable List safetySettings) { + this.safetySettings = safetySettings; return this; } - /** - * Enforces that the generated response is a JSON object that complies with the JSON schema specified - * in this field. - */ - public CreateAgentInteraction withResponseFormat(@Nullable CreateAgentInteractionResponseFormat responseFormat) { - this.responseFormat = responseFormat; + public CreateAgentInteraction withServiceTier(@Nullable ServiceTier serviceTier) { + this.serviceTier = serviceTier; return this; } /** - * The environment configuration for the interaction. Can be an object specifying remote environment - * sources or a string referencing an existing environment ID. + * Input only. Whether to store the response and request for later retrieval. */ - public CreateAgentInteraction withEnvironment(@Nullable CreateAgentInteractionEnvironment environment) { - this.environment = environment; + public CreateAgentInteraction withStore(@Nullable Boolean store) { + this.store = store; return this; } /** - * Configuration parameters for the agent interaction. + * Input only. Whether the interaction will be streamed. */ - public CreateAgentInteraction withAgentConfig(@Nullable CreateAgentInteractionAgentConfig agentConfig) { - this.agentConfig = agentConfig; + public CreateAgentInteraction withStream(@Nullable Boolean stream) { + this.stream = stream; return this; } /** - * Safety settings for the interaction. + * System instruction for the interaction. */ - public CreateAgentInteraction withSafetySettings(@Nullable List safetySettings) { - this.safetySettings = safetySettings; + public CreateAgentInteraction withSystemInstruction(@Nullable String systemInstruction) { + this.systemInstruction = systemInstruction; return this; } /** - * The labels with user-defined metadata for the request. + * A list of tool declarations the model may call during interaction. */ - public CreateAgentInteraction withLabels(@Nullable Map labels) { - this.labels = labels; + public CreateAgentInteraction withTools(@Nullable List tools) { + this.tools = tools; return this; } /** - * The input for the interaction. + * Message for configuring webhook events for a request. */ - public CreateAgentInteraction withInput(@Nonnull InteractionsInput input) { - this.input = Utils.checkNotNull(input, "input"); + public CreateAgentInteraction withWebhookConfig(@Nullable WebhookConfig webhookConfig) { + this.webhookConfig = webhookConfig; return this; } @@ -512,55 +512,55 @@ public boolean equals(java.lang.Object o) { CreateAgentInteraction other = (CreateAgentInteraction) o; return Utils.enhancedDeepEquals(this.agent, other.agent) && - Utils.enhancedDeepEquals(this.stream, other.stream) && - Utils.enhancedDeepEquals(this.store, other.store) && + Utils.enhancedDeepEquals(this.agentConfig, other.agentConfig) && Utils.enhancedDeepEquals(this.background, other.background) && - Utils.enhancedDeepEquals(this.systemInstruction, other.systemInstruction) && - Utils.enhancedDeepEquals(this.tools, other.tools) && - Utils.enhancedDeepEquals(this.responseModalities, other.responseModalities) && - Utils.enhancedDeepEquals(this.responseMimeType, other.responseMimeType) && + Utils.enhancedDeepEquals(this.environment, other.environment) && + Utils.enhancedDeepEquals(this.input, other.input) && + Utils.enhancedDeepEquals(this.labels, other.labels) && Utils.enhancedDeepEquals(this.previousInteractionId, other.previousInteractionId) && - Utils.enhancedDeepEquals(this.serviceTier, other.serviceTier) && - Utils.enhancedDeepEquals(this.webhookConfig, other.webhookConfig) && Utils.enhancedDeepEquals(this.responseFormat, other.responseFormat) && - Utils.enhancedDeepEquals(this.environment, other.environment) && - Utils.enhancedDeepEquals(this.agentConfig, other.agentConfig) && + Utils.enhancedDeepEquals(this.responseMimeType, other.responseMimeType) && + Utils.enhancedDeepEquals(this.responseModalities, other.responseModalities) && Utils.enhancedDeepEquals(this.safetySettings, other.safetySettings) && - Utils.enhancedDeepEquals(this.labels, other.labels) && - Utils.enhancedDeepEquals(this.input, other.input); + Utils.enhancedDeepEquals(this.serviceTier, other.serviceTier) && + Utils.enhancedDeepEquals(this.store, other.store) && + Utils.enhancedDeepEquals(this.stream, other.stream) && + Utils.enhancedDeepEquals(this.systemInstruction, other.systemInstruction) && + Utils.enhancedDeepEquals(this.tools, other.tools) && + Utils.enhancedDeepEquals(this.webhookConfig, other.webhookConfig); } @Override public int hashCode() { return Utils.enhancedHash( - agent, stream, store, - background, systemInstruction, tools, - responseModalities, responseMimeType, previousInteractionId, - serviceTier, webhookConfig, responseFormat, - environment, agentConfig, safetySettings, - labels, input); + agent, agentConfig, background, + environment, input, labels, + previousInteractionId, responseFormat, responseMimeType, + responseModalities, safetySettings, serviceTier, + store, stream, systemInstruction, + tools, webhookConfig); } @Override public String toString() { return Utils.toString(CreateAgentInteraction.class, "agent", agent, - "stream", stream, - "store", store, + "agentConfig", agentConfig, "background", background, - "systemInstruction", systemInstruction, - "tools", tools, - "responseModalities", responseModalities, - "responseMimeType", responseMimeType, + "environment", environment, + "input", input, + "labels", labels, "previousInteractionId", previousInteractionId, - "serviceTier", serviceTier, - "webhookConfig", webhookConfig, "responseFormat", responseFormat, - "environment", environment, - "agentConfig", agentConfig, + "responseMimeType", responseMimeType, + "responseModalities", responseModalities, "safetySettings", safetySettings, - "labels", labels, - "input", input); + "serviceTier", serviceTier, + "store", store, + "stream", stream, + "systemInstruction", systemInstruction, + "tools", tools, + "webhookConfig", webhookConfig); } @SuppressWarnings("UnusedReturnValue") @@ -568,39 +568,39 @@ public final static class Builder { private AgentOption agent; - private Boolean stream; - - private Boolean store; + private CreateAgentInteractionAgentConfig agentConfig; private Boolean background; - private String systemInstruction; + private CreateAgentInteractionEnvironment environment; - private List tools; + private InteractionsInput input; - @Deprecated - private List responseModalities; + private Map labels; + + private String previousInteractionId; + + private CreateAgentInteractionResponseFormat responseFormat; @Deprecated private String responseMimeType; - private String previousInteractionId; - - private ServiceTier serviceTier; + @Deprecated + private List responseModalities; - private WebhookConfig webhookConfig; + private List safetySettings; - private CreateAgentInteractionResponseFormat responseFormat; + private ServiceTier serviceTier; - private CreateAgentInteractionEnvironment environment; + private Boolean store; - private CreateAgentInteractionAgentConfig agentConfig; + private Boolean stream; - private List safetySettings; + private String systemInstruction; - private Map labels; + private List tools; - private InteractionsInput input; + private WebhookConfig webhookConfig; private Builder() { // force use of static builder() method @@ -614,59 +614,61 @@ public Builder agent(@Nonnull AgentOption agent) { return this; } - public Builder agent(@Nonnull String agent) { - this.agent = AgentOption.of(Utils.checkNotNull(agent, "agent")); + /** + * Configuration parameters for the agent interaction. + */ + public Builder agentConfig(@Nullable CreateAgentInteractionAgentConfig agentConfig) { + this.agentConfig = agentConfig; return this; } /** - * Input only. Whether the interaction will be streamed. + * Input only. Whether to run the model interaction in the background. */ - public Builder stream(@Nullable Boolean stream) { - this.stream = stream; + public Builder background(@Nullable Boolean background) { + this.background = background; return this; } /** - * Input only. Whether to store the response and request for later retrieval. + * The environment configuration for the interaction. Can be an object specifying remote environment + * sources or a string referencing an existing environment ID. */ - public Builder store(@Nullable Boolean store) { - this.store = store; + public Builder environment(@Nullable CreateAgentInteractionEnvironment environment) { + this.environment = environment; return this; } /** - * Input only. Whether to run the model interaction in the background. + * The input for the interaction. */ - public Builder background(@Nullable Boolean background) { - this.background = background; + public Builder input(@Nonnull InteractionsInput input) { + this.input = Utils.checkNotNull(input, "input"); return this; } /** - * System instruction for the interaction. + * The labels with user-defined metadata for the request. */ - public Builder systemInstruction(@Nullable String systemInstruction) { - this.systemInstruction = systemInstruction; + public Builder labels(@Nullable Map labels) { + this.labels = labels; return this; } /** - * A list of tool declarations the model may call during interaction. + * The ID of the previous interaction, if any. */ - public Builder tools(@Nullable List tools) { - this.tools = tools; + public Builder previousInteractionId(@Nullable String previousInteractionId) { + this.previousInteractionId = previousInteractionId; return this; } /** - * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + * Enforces that the generated response is a JSON object that complies with the JSON schema specified + * in this field. */ - @Deprecated - public Builder responseModalities(@Nullable List responseModalities) { - this.responseModalities = responseModalities; + public Builder responseFormat(@Nullable CreateAgentInteractionResponseFormat responseFormat) { + this.responseFormat = responseFormat; return this; } @@ -682,84 +684,82 @@ public Builder responseMimeType(@Nullable String responseMimeType) { } /** - * The ID of the previous interaction, if any. + * The requested modalities of the response (TEXT, IMAGE, AUDIO). + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ - public Builder previousInteractionId(@Nullable String previousInteractionId) { - this.previousInteractionId = previousInteractionId; + @Deprecated + public Builder responseModalities(@Nullable List responseModalities) { + this.responseModalities = responseModalities; return this; } - public Builder serviceTier(@Nullable ServiceTier serviceTier) { - this.serviceTier = serviceTier; + /** + * Safety settings for the interaction. + */ + public Builder safetySettings(@Nullable List safetySettings) { + this.safetySettings = safetySettings; return this; } - /** - * Message for configuring webhook events for a request. - */ - public Builder webhookConfig(@Nullable WebhookConfig webhookConfig) { - this.webhookConfig = webhookConfig; + public Builder serviceTier(@Nullable ServiceTier serviceTier) { + this.serviceTier = serviceTier; return this; } /** - * Enforces that the generated response is a JSON object that complies with the JSON schema specified - * in this field. + * Input only. Whether to store the response and request for later retrieval. */ - public Builder responseFormat(@Nullable CreateAgentInteractionResponseFormat responseFormat) { - this.responseFormat = responseFormat; + public Builder store(@Nullable Boolean store) { + this.store = store; return this; } - /** - * The environment configuration for the interaction. Can be an object specifying remote environment - * sources or a string referencing an existing environment ID. - */ - public Builder environment(@Nullable CreateAgentInteractionEnvironment environment) { - this.environment = environment; + public Builder agent(@Nonnull String agent) { + this.agent = AgentOption.of(Utils.checkNotNull(agent, "agent")); return this; } /** - * Configuration parameters for the agent interaction. + * Input only. Whether the interaction will be streamed. */ - public Builder agentConfig(@Nullable CreateAgentInteractionAgentConfig agentConfig) { - this.agentConfig = agentConfig; + public Builder stream(@Nullable Boolean stream) { + this.stream = stream; return this; } /** - * Safety settings for the interaction. + * System instruction for the interaction. */ - public Builder safetySettings(@Nullable List safetySettings) { - this.safetySettings = safetySettings; + public Builder systemInstruction(@Nullable String systemInstruction) { + this.systemInstruction = systemInstruction; return this; } /** - * The labels with user-defined metadata for the request. + * A list of tool declarations the model may call during interaction. */ - public Builder labels(@Nullable Map labels) { - this.labels = labels; + public Builder tools(@Nullable List tools) { + this.tools = tools; return this; } /** - * The input for the interaction. + * Message for configuring webhook events for a request. */ - public Builder input(@Nonnull InteractionsInput input) { - this.input = Utils.checkNotNull(input, "input"); + public Builder webhookConfig(@Nullable WebhookConfig webhookConfig) { + this.webhookConfig = webhookConfig; return this; } public CreateAgentInteraction build() { return new CreateAgentInteraction( - agent, stream, store, - background, systemInstruction, tools, - responseModalities, responseMimeType, previousInteractionId, - serviceTier, webhookConfig, responseFormat, - environment, agentConfig, safetySettings, - labels, input); + agent, agentConfig, background, + environment, input, labels, + previousInteractionId, responseFormat, responseMimeType, + responseModalities, safetySettings, serviceTier, + store, stream, systemInstruction, + tools, webhookConfig); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionAgentConfigTypeIdResolver.java b/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionAgentConfigTypeIdResolver.java index c03634e78fa..ec4a369167c 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionAgentConfigTypeIdResolver.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionAgentConfigTypeIdResolver.java @@ -40,10 +40,10 @@ public CreateAgentInteractionAgentConfigTypeIdResolver() { } private void initializeTypeMap() { - registerType("dynamic", DynamicAgentConfig.class); - registerType("deep-research", DeepResearchAgentConfig.class); - registerType("code-mender", CodeMenderAgentConfig.class); registerType("antigravity", AntigravityAgentConfig.class); + registerType("code-mender", CodeMenderAgentConfig.class); + registerType("deep-research", DeepResearchAgentConfig.class); + registerType("dynamic", DynamicAgentConfig.class); } @Override diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionEnvironment.java b/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionEnvironment.java index 914a614bf76..dd7abce6c51 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionEnvironment.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionEnvironment.java @@ -49,38 +49,38 @@ private CreateAgentInteractionEnvironment(TypedObject value) { this.value = value; } - public static CreateAgentInteractionEnvironment of(String value) { + public static CreateAgentInteractionEnvironment of(Environment value) { Utils.checkNotNull(value, "value"); - return new CreateAgentInteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateAgentInteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); } - public static CreateAgentInteractionEnvironment of(Environment value) { + public static CreateAgentInteractionEnvironment of(String value) { Utils.checkNotNull(value, "value"); - return new CreateAgentInteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateAgentInteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); } /** - * Returns an {@link Optional} containing the value if it is of type {@code String}, + * Returns an {@link Optional} containing the value if it is of type {@code Environment}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code String} value, or empty if not of this type + * @return an {@link Optional} containing the {@code Environment} value, or empty if not of this type */ - public Optional string() { - if (value.value() instanceof String) { - return Optional.of((String) value.value()); + public Optional environment() { + if (value.value() instanceof Environment) { + return Optional.of((Environment) value.value()); } return Optional.empty(); } /** - * Returns an {@link Optional} containing the value if it is of type {@code Environment}, + * Returns an {@link Optional} containing the value if it is of type {@code String}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code Environment} value, or empty if not of this type + * @return an {@link Optional} containing the {@code String} value, or empty if not of this type */ - public Optional environment() { - if (value.value() instanceof Environment) { - return Optional.of((Environment) value.value()); + public Optional string() { + if (value.value() instanceof String) { + return Optional.of((String) value.value()); } return Optional.empty(); } @@ -119,8 +119,8 @@ public static final class _Deserializer extends OneOfDeserializer() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionResponseFormat.java b/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionResponseFormat.java index cc1c46b0263..78cdad3a4af 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionResponseFormat.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CreateAgentInteractionResponseFormat.java @@ -50,39 +50,39 @@ private CreateAgentInteractionResponseFormat(TypedObject value) { this.value = value; } - public static CreateAgentInteractionResponseFormat of(List value) { + public static CreateAgentInteractionResponseFormat of(ResponseFormat value) { Utils.checkNotNull(value, "value"); - return new CreateAgentInteractionResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + return new CreateAgentInteractionResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); } - public static CreateAgentInteractionResponseFormat of(ResponseFormat value) { + public static CreateAgentInteractionResponseFormat of(List value) { Utils.checkNotNull(value, "value"); - return new CreateAgentInteractionResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateAgentInteractionResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); } /** - * Returns an {@link Optional} containing the value if it is of type {@code List}, + * Returns an {@link Optional} containing the value if it is of type {@code ResponseFormat}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code List} value, or empty if not of this type + * @return an {@link Optional} containing the {@code ResponseFormat} value, or empty if not of this type */ - @SuppressWarnings("unchecked") - public Optional> arrayOfResponseFormat() { - if (value.value() instanceof List) { - return Optional.of((List) value.value()); + public Optional responseFormat() { + if (value.value() instanceof ResponseFormat) { + return Optional.of((ResponseFormat) value.value()); } return Optional.empty(); } /** - * Returns an {@link Optional} containing the value if it is of type {@code ResponseFormat}, + * Returns an {@link Optional} containing the value if it is of type {@code List}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code ResponseFormat} value, or empty if not of this type + * @return an {@link Optional} containing the {@code List} value, or empty if not of this type */ - public Optional responseFormat() { - if (value.value() instanceof ResponseFormat) { - return Optional.of((ResponseFormat) value.value()); + @SuppressWarnings("unchecked") + public Optional> arrayOfResponseFormat() { + if (value.value() instanceof List) { + return Optional.of((List) value.value()); } return Optional.empty(); } @@ -121,8 +121,8 @@ public static final class _Deserializer extends OneOfDeserializer>() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT)); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteraction.java b/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteraction.java index b9b93501d68..71becdeaddd 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteraction.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteraction.java @@ -41,73 +41,88 @@ */ public class CreateModelInteraction { /** - * The model that will complete your prompt.\n\nSee - * [models](https://ai.google.dev/gemini-api/docs/models) for additional details. + * Input only. Whether to run the model interaction in the background. */ - @JsonProperty("model") - private Model model; + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("background") + private Boolean background; /** - * Input only. Whether the interaction will be streamed. + * The environment configuration for the interaction. Can be an object specifying remote environment + * sources or a string referencing an existing environment ID. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("stream") - private Boolean stream; + @JsonProperty("environment") + private CreateModelInteractionEnvironment environment; /** - * Input only. Whether to store the response and request for later retrieval. + * Configuration parameters for model interactions. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("store") - private Boolean store; + @JsonProperty("generation_config") + private GenerationConfig generationConfig; /** - * Input only. Whether to run the model interaction in the background. + * The input for the interaction. + */ + @JsonProperty("input") + private InteractionsInput input; + + /** + * The labels with user-defined metadata for the request. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("background") - private Boolean background; + @JsonProperty("labels") + private Map labels; /** - * System instruction for the interaction. + * The model that will complete your prompt.\n\nSee + * [models](https://ai.google.dev/gemini-api/docs/models) for additional details. + */ + @JsonProperty("model") + private Model model; + + /** + * The ID of the previous interaction, if any. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("system_instruction") - private String systemInstruction; + @JsonProperty("previous_interaction_id") + private String previousInteractionId; /** - * A list of tool declarations the model may call during interaction. + * Enforces that the generated response is a JSON object that complies with the JSON schema specified + * in this field. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("tools") - private List tools; + @JsonProperty("response_format") + private CreateModelInteractionResponseFormat responseFormat; /** - * The requested modalities of the response (TEXT, IMAGE, AUDIO). + * The mime type of the response. This is required if response_format is set. * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("response_modalities") + @JsonProperty("response_mime_type") @Deprecated - private List responseModalities; + private String responseMimeType; /** - * The mime type of the response. This is required if response_format is set. + * The requested modalities of the response (TEXT, IMAGE, AUDIO). * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("response_mime_type") + @JsonProperty("response_modalities") @Deprecated - private String responseMimeType; + private List responseModalities; /** - * The ID of the previous interaction, if any. + * Safety settings for the interaction. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("previous_interaction_id") - private String previousInteractionId; + @JsonProperty("safety_settings") + private List safetySettings; @JsonInclude(Include.NON_ABSENT) @@ -115,157 +130,148 @@ public class CreateModelInteraction { private ServiceTier serviceTier; /** - * Message for configuring webhook events for a request. - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("webhook_config") - private WebhookConfig webhookConfig; - - /** - * Enforces that the generated response is a JSON object that complies with the JSON schema specified - * in this field. + * Input only. Whether to store the response and request for later retrieval. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("response_format") - private CreateModelInteractionResponseFormat responseFormat; + @JsonProperty("store") + private Boolean store; /** - * The environment configuration for the interaction. Can be an object specifying remote environment - * sources or a string referencing an existing environment ID. + * Input only. Whether the interaction will be streamed. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("environment") - private CreateModelInteractionEnvironment environment; + @JsonProperty("stream") + private Boolean stream; /** - * Configuration parameters for model interactions. + * System instruction for the interaction. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("generation_config") - private GenerationConfig generationConfig; + @JsonProperty("system_instruction") + private String systemInstruction; /** - * Safety settings for the interaction. + * A list of tool declarations the model may call during interaction. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("safety_settings") - private List safetySettings; + @JsonProperty("tools") + private List tools; /** - * The labels with user-defined metadata for the request. + * Message for configuring webhook events for a request. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("labels") - private Map labels; - - /** - * The input for the interaction. - */ - @JsonProperty("input") - private InteractionsInput input; + @JsonProperty("webhook_config") + private WebhookConfig webhookConfig; @JsonCreator public CreateModelInteraction( - @JsonProperty("model") @Nonnull Model model, - @JsonProperty("stream") @Nullable Boolean stream, - @JsonProperty("store") @Nullable Boolean store, @JsonProperty("background") @Nullable Boolean background, - @JsonProperty("system_instruction") @Nullable String systemInstruction, - @JsonProperty("tools") @Nullable List tools, - @JsonProperty("response_modalities") @Nullable List responseModalities, - @JsonProperty("response_mime_type") @Nullable String responseMimeType, - @JsonProperty("previous_interaction_id") @Nullable String previousInteractionId, - @JsonProperty("service_tier") @Nullable ServiceTier serviceTier, - @JsonProperty("webhook_config") @Nullable WebhookConfig webhookConfig, - @JsonProperty("response_format") @Nullable CreateModelInteractionResponseFormat responseFormat, @JsonProperty("environment") @Nullable CreateModelInteractionEnvironment environment, @JsonProperty("generation_config") @Nullable GenerationConfig generationConfig, - @JsonProperty("safety_settings") @Nullable List safetySettings, + @JsonProperty("input") @Nonnull InteractionsInput input, @JsonProperty("labels") @Nullable Map labels, - @JsonProperty("input") @Nonnull InteractionsInput input) { + @JsonProperty("model") @Nonnull Model model, + @JsonProperty("previous_interaction_id") @Nullable String previousInteractionId, + @JsonProperty("response_format") @Nullable CreateModelInteractionResponseFormat responseFormat, + @JsonProperty("response_mime_type") @Nullable String responseMimeType, + @JsonProperty("response_modalities") @Nullable List responseModalities, + @JsonProperty("safety_settings") @Nullable List safetySettings, + @JsonProperty("service_tier") @Nullable ServiceTier serviceTier, + @JsonProperty("store") @Nullable Boolean store, + @JsonProperty("stream") @Nullable Boolean stream, + @JsonProperty("system_instruction") @Nullable String systemInstruction, + @JsonProperty("tools") @Nullable List tools, + @JsonProperty("webhook_config") @Nullable WebhookConfig webhookConfig) { + this.background = background; + this.environment = environment; + this.generationConfig = generationConfig; + this.input = Optional.ofNullable(input) + .orElseThrow(() -> new IllegalArgumentException("input cannot be null")); + this.labels = labels; this.model = Optional.ofNullable(model) .orElseThrow(() -> new IllegalArgumentException("model cannot be null")); - this.stream = stream; + this.previousInteractionId = previousInteractionId; + this.responseFormat = responseFormat; + this.responseMimeType = responseMimeType; + this.responseModalities = responseModalities; + this.safetySettings = safetySettings; + this.serviceTier = serviceTier; this.store = store; - this.background = background; + this.stream = stream; this.systemInstruction = systemInstruction; this.tools = tools; - this.responseModalities = responseModalities; - this.responseMimeType = responseMimeType; - this.previousInteractionId = previousInteractionId; - this.serviceTier = serviceTier; this.webhookConfig = webhookConfig; - this.responseFormat = responseFormat; - this.environment = environment; - this.generationConfig = generationConfig; - this.safetySettings = safetySettings; - this.labels = labels; - this.input = Optional.ofNullable(input) - .orElseThrow(() -> new IllegalArgumentException("input cannot be null")); } public CreateModelInteraction( - @Nonnull Model model, - @Nonnull InteractionsInput input) { - this(model, null, null, - null, null, null, + @Nonnull InteractionsInput input, + @Nonnull Model model) { + this(null, null, null, + input, null, model, null, null, null, null, null, null, null, null, null, - null, input); + null, null); } /** - * The model that will complete your prompt.\n\nSee - * [models](https://ai.google.dev/gemini-api/docs/models) for additional details. + * Input only. Whether to run the model interaction in the background. */ - public Optional model() { - return Optional.ofNullable(this.model); + public Optional background() { + return Optional.ofNullable(this.background); } /** - * Input only. Whether the interaction will be streamed. + * The environment configuration for the interaction. Can be an object specifying remote environment + * sources or a string referencing an existing environment ID. */ - public Optional stream() { - return Optional.ofNullable(this.stream); + public Optional environment() { + return Optional.ofNullable(this.environment); } /** - * Input only. Whether to store the response and request for later retrieval. + * Configuration parameters for model interactions. */ - public Optional store() { - return Optional.ofNullable(this.store); + public Optional generationConfig() { + return Optional.ofNullable(this.generationConfig); } /** - * Input only. Whether to run the model interaction in the background. + * The input for the interaction. */ - public Optional background() { - return Optional.ofNullable(this.background); + public Optional input() { + return Optional.ofNullable(this.input); } /** - * System instruction for the interaction. + * The labels with user-defined metadata for the request. */ - public Optional systemInstruction() { - return Optional.ofNullable(this.systemInstruction); + public Optional> labels() { + return Optional.ofNullable(this.labels); } /** - * A list of tool declarations the model may call during interaction. + * The model that will complete your prompt.\n\nSee + * [models](https://ai.google.dev/gemini-api/docs/models) for additional details. */ - public Optional> tools() { - return Optional.ofNullable(this.tools); + public Optional model() { + return Optional.ofNullable(this.model); } /** - * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + * The ID of the previous interaction, if any. */ - @Deprecated - public Optional> responseModalities() { - return Optional.ofNullable(this.responseModalities); + public Optional previousInteractionId() { + return Optional.ofNullable(this.previousInteractionId); + } + + /** + * Enforces that the generated response is a JSON object that complies with the JSON schema specified + * in this field. + */ + public Optional responseFormat() { + return Optional.ofNullable(this.responseFormat); } /** @@ -279,65 +285,59 @@ public Optional responseMimeType() { } /** - * The ID of the previous interaction, if any. + * The requested modalities of the response (TEXT, IMAGE, AUDIO). + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ - public Optional previousInteractionId() { - return Optional.ofNullable(this.previousInteractionId); - } - - public Optional serviceTier() { - return Optional.ofNullable(this.serviceTier); + @Deprecated + public Optional> responseModalities() { + return Optional.ofNullable(this.responseModalities); } /** - * Message for configuring webhook events for a request. + * Safety settings for the interaction. */ - public Optional webhookConfig() { - return Optional.ofNullable(this.webhookConfig); + public Optional> safetySettings() { + return Optional.ofNullable(this.safetySettings); } - /** - * Enforces that the generated response is a JSON object that complies with the JSON schema specified - * in this field. - */ - public Optional responseFormat() { - return Optional.ofNullable(this.responseFormat); + public Optional serviceTier() { + return Optional.ofNullable(this.serviceTier); } /** - * The environment configuration for the interaction. Can be an object specifying remote environment - * sources or a string referencing an existing environment ID. + * Input only. Whether to store the response and request for later retrieval. */ - public Optional environment() { - return Optional.ofNullable(this.environment); + public Optional store() { + return Optional.ofNullable(this.store); } /** - * Configuration parameters for model interactions. + * Input only. Whether the interaction will be streamed. */ - public Optional generationConfig() { - return Optional.ofNullable(this.generationConfig); + public Optional stream() { + return Optional.ofNullable(this.stream); } /** - * Safety settings for the interaction. + * System instruction for the interaction. */ - public Optional> safetySettings() { - return Optional.ofNullable(this.safetySettings); + public Optional systemInstruction() { + return Optional.ofNullable(this.systemInstruction); } /** - * The labels with user-defined metadata for the request. + * A list of tool declarations the model may call during interaction. */ - public Optional> labels() { - return Optional.ofNullable(this.labels); + public Optional> tools() { + return Optional.ofNullable(this.tools); } /** - * The input for the interaction. + * Message for configuring webhook events for a request. */ - public Optional input() { - return Optional.ofNullable(this.input); + public Optional webhookConfig() { + return Optional.ofNullable(this.webhookConfig); } public static Builder builder() { @@ -346,160 +346,160 @@ public static Builder builder() { /** - * The model that will complete your prompt.\n\nSee - * [models](https://ai.google.dev/gemini-api/docs/models) for additional details. + * Input only. Whether to run the model interaction in the background. */ - public CreateModelInteraction withModel(@Nonnull Model model) { - this.model = Utils.checkNotNull(model, "model"); + public CreateModelInteraction withBackground(@Nullable Boolean background) { + this.background = background; return this; } /** - * Input only. Whether the interaction will be streamed. + * The environment configuration for the interaction. Can be an object specifying remote environment + * sources or a string referencing an existing environment ID. */ - public CreateModelInteraction withStream(@Nullable Boolean stream) { - this.stream = stream; + public CreateModelInteraction withEnvironment(@Nullable CreateModelInteractionEnvironment environment) { + this.environment = environment; return this; } /** - * Input only. Whether to store the response and request for later retrieval. + * Configuration parameters for model interactions. */ - public CreateModelInteraction withStore(@Nullable Boolean store) { - this.store = store; + public CreateModelInteraction withGenerationConfig(@Nullable GenerationConfig generationConfig) { + this.generationConfig = generationConfig; return this; } /** - * Input only. Whether to run the model interaction in the background. + * The input for the interaction. */ - public CreateModelInteraction withBackground(@Nullable Boolean background) { - this.background = background; + public CreateModelInteraction withInput(@Nonnull InteractionsInput input) { + this.input = Utils.checkNotNull(input, "input"); return this; } /** - * System instruction for the interaction. + * The labels with user-defined metadata for the request. */ - public CreateModelInteraction withSystemInstruction(@Nullable String systemInstruction) { - this.systemInstruction = systemInstruction; + public CreateModelInteraction withLabels(@Nullable Map labels) { + this.labels = labels; return this; } /** - * A list of tool declarations the model may call during interaction. + * The model that will complete your prompt.\n\nSee + * [models](https://ai.google.dev/gemini-api/docs/models) for additional details. */ - public CreateModelInteraction withTools(@Nullable List tools) { - this.tools = tools; + public CreateModelInteraction withModel(@Nonnull Model model) { + this.model = Utils.checkNotNull(model, "model"); return this; } /** - * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + * The ID of the previous interaction, if any. */ - @Deprecated - public CreateModelInteraction withResponseModalities(@Nullable List responseModalities) { - this.responseModalities = responseModalities; + public CreateModelInteraction withPreviousInteractionId(@Nullable String previousInteractionId) { + this.previousInteractionId = previousInteractionId; return this; } /** - * The mime type of the response. This is required if response_format is set. - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + * Enforces that the generated response is a JSON object that complies with the JSON schema specified + * in this field. */ - @Deprecated - public CreateModelInteraction withResponseMimeType(@Nullable String responseMimeType) { - this.responseMimeType = responseMimeType; + public CreateModelInteraction withResponseFormat(@Nullable CreateModelInteractionResponseFormat responseFormat) { + this.responseFormat = responseFormat; return this; } /** - * The ID of the previous interaction, if any. + * The mime type of the response. This is required if response_format is set. + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ - public CreateModelInteraction withPreviousInteractionId(@Nullable String previousInteractionId) { - this.previousInteractionId = previousInteractionId; + @Deprecated + public CreateModelInteraction withResponseMimeType(@Nullable String responseMimeType) { + this.responseMimeType = responseMimeType; return this; } - public CreateModelInteraction withServiceTier(@Nullable ServiceTier serviceTier) { - this.serviceTier = serviceTier; + /** + * The requested modalities of the response (TEXT, IMAGE, AUDIO). + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + */ + @Deprecated + public CreateModelInteraction withResponseModalities(@Nullable List responseModalities) { + this.responseModalities = responseModalities; return this; } /** - * Message for configuring webhook events for a request. + * Safety settings for the interaction. */ - public CreateModelInteraction withWebhookConfig(@Nullable WebhookConfig webhookConfig) { - this.webhookConfig = webhookConfig; + public CreateModelInteraction withSafetySettings(@Nullable List safetySettings) { + this.safetySettings = safetySettings; return this; } - /** - * Enforces that the generated response is a JSON object that complies with the JSON schema specified - * in this field. - */ - public CreateModelInteraction withResponseFormat(@Nullable CreateModelInteractionResponseFormat responseFormat) { - this.responseFormat = responseFormat; + public CreateModelInteraction withServiceTier(@Nullable ServiceTier serviceTier) { + this.serviceTier = serviceTier; return this; } /** - * The environment configuration for the interaction. Can be an object specifying remote environment - * sources or a string referencing an existing environment ID. + * Input only. Whether to store the response and request for later retrieval. */ - public CreateModelInteraction withEnvironment(@Nullable CreateModelInteractionEnvironment environment) { - this.environment = environment; + public CreateModelInteraction withStore(@Nullable Boolean store) { + this.store = store; return this; } /** - * Configuration parameters for model interactions. + * Input only. Whether the interaction will be streamed. */ - public CreateModelInteraction withGenerationConfig(@Nullable GenerationConfig generationConfig) { - this.generationConfig = generationConfig; + public CreateModelInteraction withStream(@Nullable Boolean stream) { + this.stream = stream; return this; } /** - * Safety settings for the interaction. + * System instruction for the interaction. */ - public CreateModelInteraction withSafetySettings(@Nullable List safetySettings) { - this.safetySettings = safetySettings; + public CreateModelInteraction withSystemInstruction(@Nullable String systemInstruction) { + this.systemInstruction = systemInstruction; return this; } /** - * The labels with user-defined metadata for the request. + * A list of tool declarations the model may call during interaction. */ - public CreateModelInteraction withLabels(@Nullable Map labels) { - this.labels = labels; + public CreateModelInteraction withTools(@Nullable List tools) { + this.tools = tools; return this; } /** - * The input for the interaction. + * Message for configuring webhook events for a request. */ - public CreateModelInteraction withInput(@Nonnull InteractionsInput input) { - this.input = Utils.checkNotNull(input, "input"); + public CreateModelInteraction withWebhookConfig(@Nullable WebhookConfig webhookConfig) { + this.webhookConfig = webhookConfig; return this; } @@ -514,163 +514,165 @@ public boolean equals(java.lang.Object o) { } CreateModelInteraction other = (CreateModelInteraction) o; return - Utils.enhancedDeepEquals(this.model, other.model) && - Utils.enhancedDeepEquals(this.stream, other.stream) && - Utils.enhancedDeepEquals(this.store, other.store) && Utils.enhancedDeepEquals(this.background, other.background) && - Utils.enhancedDeepEquals(this.systemInstruction, other.systemInstruction) && - Utils.enhancedDeepEquals(this.tools, other.tools) && - Utils.enhancedDeepEquals(this.responseModalities, other.responseModalities) && - Utils.enhancedDeepEquals(this.responseMimeType, other.responseMimeType) && - Utils.enhancedDeepEquals(this.previousInteractionId, other.previousInteractionId) && - Utils.enhancedDeepEquals(this.serviceTier, other.serviceTier) && - Utils.enhancedDeepEquals(this.webhookConfig, other.webhookConfig) && - Utils.enhancedDeepEquals(this.responseFormat, other.responseFormat) && Utils.enhancedDeepEquals(this.environment, other.environment) && Utils.enhancedDeepEquals(this.generationConfig, other.generationConfig) && - Utils.enhancedDeepEquals(this.safetySettings, other.safetySettings) && + Utils.enhancedDeepEquals(this.input, other.input) && Utils.enhancedDeepEquals(this.labels, other.labels) && - Utils.enhancedDeepEquals(this.input, other.input); + Utils.enhancedDeepEquals(this.model, other.model) && + Utils.enhancedDeepEquals(this.previousInteractionId, other.previousInteractionId) && + Utils.enhancedDeepEquals(this.responseFormat, other.responseFormat) && + Utils.enhancedDeepEquals(this.responseMimeType, other.responseMimeType) && + Utils.enhancedDeepEquals(this.responseModalities, other.responseModalities) && + Utils.enhancedDeepEquals(this.safetySettings, other.safetySettings) && + Utils.enhancedDeepEquals(this.serviceTier, other.serviceTier) && + Utils.enhancedDeepEquals(this.store, other.store) && + Utils.enhancedDeepEquals(this.stream, other.stream) && + Utils.enhancedDeepEquals(this.systemInstruction, other.systemInstruction) && + Utils.enhancedDeepEquals(this.tools, other.tools) && + Utils.enhancedDeepEquals(this.webhookConfig, other.webhookConfig); } @Override public int hashCode() { return Utils.enhancedHash( - model, stream, store, - background, systemInstruction, tools, - responseModalities, responseMimeType, previousInteractionId, - serviceTier, webhookConfig, responseFormat, - environment, generationConfig, safetySettings, - labels, input); + background, environment, generationConfig, + input, labels, model, + previousInteractionId, responseFormat, responseMimeType, + responseModalities, safetySettings, serviceTier, + store, stream, systemInstruction, + tools, webhookConfig); } @Override public String toString() { return Utils.toString(CreateModelInteraction.class, - "model", model, - "stream", stream, - "store", store, "background", background, - "systemInstruction", systemInstruction, - "tools", tools, - "responseModalities", responseModalities, - "responseMimeType", responseMimeType, - "previousInteractionId", previousInteractionId, - "serviceTier", serviceTier, - "webhookConfig", webhookConfig, - "responseFormat", responseFormat, "environment", environment, "generationConfig", generationConfig, - "safetySettings", safetySettings, + "input", input, "labels", labels, - "input", input); + "model", model, + "previousInteractionId", previousInteractionId, + "responseFormat", responseFormat, + "responseMimeType", responseMimeType, + "responseModalities", responseModalities, + "safetySettings", safetySettings, + "serviceTier", serviceTier, + "store", store, + "stream", stream, + "systemInstruction", systemInstruction, + "tools", tools, + "webhookConfig", webhookConfig); } @SuppressWarnings("UnusedReturnValue") public final static class Builder { - private Model model; + private Boolean background; - private Boolean stream; + private CreateModelInteractionEnvironment environment; - private Boolean store; + private GenerationConfig generationConfig; - private Boolean background; + private InteractionsInput input; - private String systemInstruction; + private Map labels; - private List tools; + private Model model; - @Deprecated - private List responseModalities; + private String previousInteractionId; + + private CreateModelInteractionResponseFormat responseFormat; @Deprecated private String responseMimeType; - private String previousInteractionId; - - private ServiceTier serviceTier; + @Deprecated + private List responseModalities; - private WebhookConfig webhookConfig; + private List safetySettings; - private CreateModelInteractionResponseFormat responseFormat; + private ServiceTier serviceTier; - private CreateModelInteractionEnvironment environment; + private Boolean store; - private GenerationConfig generationConfig; + private Boolean stream; - private List safetySettings; + private String systemInstruction; - private Map labels; + private List tools; - private InteractionsInput input; + private WebhookConfig webhookConfig; private Builder() { // force use of static builder() method } /** - * The model that will complete your prompt.\n\nSee - * [models](https://ai.google.dev/gemini-api/docs/models) for additional details. + * Input only. Whether to run the model interaction in the background. */ - public Builder model(@Nonnull Model model) { - this.model = Utils.checkNotNull(model, "model"); + public Builder background(@Nullable Boolean background) { + this.background = background; return this; } - public Builder model(@Nonnull String model) { - this.model = Model.of(Utils.checkNotNull(model, "model")); + /** + * The environment configuration for the interaction. Can be an object specifying remote environment + * sources or a string referencing an existing environment ID. + */ + public Builder environment(@Nullable CreateModelInteractionEnvironment environment) { + this.environment = environment; return this; } /** - * Input only. Whether the interaction will be streamed. + * Configuration parameters for model interactions. */ - public Builder stream(@Nullable Boolean stream) { - this.stream = stream; + public Builder generationConfig(@Nullable GenerationConfig generationConfig) { + this.generationConfig = generationConfig; return this; } /** - * Input only. Whether to store the response and request for later retrieval. + * The input for the interaction. */ - public Builder store(@Nullable Boolean store) { - this.store = store; + public Builder input(@Nonnull InteractionsInput input) { + this.input = Utils.checkNotNull(input, "input"); return this; } /** - * Input only. Whether to run the model interaction in the background. + * The labels with user-defined metadata for the request. */ - public Builder background(@Nullable Boolean background) { - this.background = background; + public Builder labels(@Nullable Map labels) { + this.labels = labels; return this; } /** - * System instruction for the interaction. + * The model that will complete your prompt.\n\nSee + * [models](https://ai.google.dev/gemini-api/docs/models) for additional details. */ - public Builder systemInstruction(@Nullable String systemInstruction) { - this.systemInstruction = systemInstruction; + public Builder model(@Nonnull Model model) { + this.model = Utils.checkNotNull(model, "model"); return this; } /** - * A list of tool declarations the model may call during interaction. + * The ID of the previous interaction, if any. */ - public Builder tools(@Nullable List tools) { - this.tools = tools; + public Builder previousInteractionId(@Nullable String previousInteractionId) { + this.previousInteractionId = previousInteractionId; return this; } /** - * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + * Enforces that the generated response is a JSON object that complies with the JSON schema specified + * in this field. */ - @Deprecated - public Builder responseModalities(@Nullable List responseModalities) { - this.responseModalities = responseModalities; + public Builder responseFormat(@Nullable CreateModelInteractionResponseFormat responseFormat) { + this.responseFormat = responseFormat; return this; } @@ -686,84 +688,82 @@ public Builder responseMimeType(@Nullable String responseMimeType) { } /** - * The ID of the previous interaction, if any. + * The requested modalities of the response (TEXT, IMAGE, AUDIO). + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ - public Builder previousInteractionId(@Nullable String previousInteractionId) { - this.previousInteractionId = previousInteractionId; + @Deprecated + public Builder responseModalities(@Nullable List responseModalities) { + this.responseModalities = responseModalities; return this; } - public Builder serviceTier(@Nullable ServiceTier serviceTier) { - this.serviceTier = serviceTier; + /** + * Safety settings for the interaction. + */ + public Builder safetySettings(@Nullable List safetySettings) { + this.safetySettings = safetySettings; return this; } - /** - * Message for configuring webhook events for a request. - */ - public Builder webhookConfig(@Nullable WebhookConfig webhookConfig) { - this.webhookConfig = webhookConfig; + public Builder serviceTier(@Nullable ServiceTier serviceTier) { + this.serviceTier = serviceTier; return this; } /** - * Enforces that the generated response is a JSON object that complies with the JSON schema specified - * in this field. + * Input only. Whether to store the response and request for later retrieval. */ - public Builder responseFormat(@Nullable CreateModelInteractionResponseFormat responseFormat) { - this.responseFormat = responseFormat; + public Builder store(@Nullable Boolean store) { + this.store = store; return this; } - /** - * The environment configuration for the interaction. Can be an object specifying remote environment - * sources or a string referencing an existing environment ID. - */ - public Builder environment(@Nullable CreateModelInteractionEnvironment environment) { - this.environment = environment; + public Builder model(@Nonnull String model) { + this.model = Model.of(Utils.checkNotNull(model, "model")); return this; } /** - * Configuration parameters for model interactions. + * Input only. Whether the interaction will be streamed. */ - public Builder generationConfig(@Nullable GenerationConfig generationConfig) { - this.generationConfig = generationConfig; + public Builder stream(@Nullable Boolean stream) { + this.stream = stream; return this; } /** - * Safety settings for the interaction. + * System instruction for the interaction. */ - public Builder safetySettings(@Nullable List safetySettings) { - this.safetySettings = safetySettings; + public Builder systemInstruction(@Nullable String systemInstruction) { + this.systemInstruction = systemInstruction; return this; } /** - * The labels with user-defined metadata for the request. + * A list of tool declarations the model may call during interaction. */ - public Builder labels(@Nullable Map labels) { - this.labels = labels; + public Builder tools(@Nullable List tools) { + this.tools = tools; return this; } /** - * The input for the interaction. + * Message for configuring webhook events for a request. */ - public Builder input(@Nonnull InteractionsInput input) { - this.input = Utils.checkNotNull(input, "input"); + public Builder webhookConfig(@Nullable WebhookConfig webhookConfig) { + this.webhookConfig = webhookConfig; return this; } public CreateModelInteraction build() { return new CreateModelInteraction( - model, stream, store, - background, systemInstruction, tools, - responseModalities, responseMimeType, previousInteractionId, - serviceTier, webhookConfig, responseFormat, - environment, generationConfig, safetySettings, - labels, input); + background, environment, generationConfig, + input, labels, model, + previousInteractionId, responseFormat, responseMimeType, + responseModalities, safetySettings, serviceTier, + store, stream, systemInstruction, + tools, webhookConfig); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteractionEnvironment.java b/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteractionEnvironment.java index f6f8a8b8efb..ecc50072323 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteractionEnvironment.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteractionEnvironment.java @@ -49,38 +49,38 @@ private CreateModelInteractionEnvironment(TypedObject value) { this.value = value; } - public static CreateModelInteractionEnvironment of(String value) { + public static CreateModelInteractionEnvironment of(Environment value) { Utils.checkNotNull(value, "value"); - return new CreateModelInteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateModelInteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); } - public static CreateModelInteractionEnvironment of(Environment value) { + public static CreateModelInteractionEnvironment of(String value) { Utils.checkNotNull(value, "value"); - return new CreateModelInteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateModelInteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); } /** - * Returns an {@link Optional} containing the value if it is of type {@code String}, + * Returns an {@link Optional} containing the value if it is of type {@code Environment}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code String} value, or empty if not of this type + * @return an {@link Optional} containing the {@code Environment} value, or empty if not of this type */ - public Optional string() { - if (value.value() instanceof String) { - return Optional.of((String) value.value()); + public Optional environment() { + if (value.value() instanceof Environment) { + return Optional.of((Environment) value.value()); } return Optional.empty(); } /** - * Returns an {@link Optional} containing the value if it is of type {@code Environment}, + * Returns an {@link Optional} containing the value if it is of type {@code String}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code Environment} value, or empty if not of this type + * @return an {@link Optional} containing the {@code String} value, or empty if not of this type */ - public Optional environment() { - if (value.value() instanceof Environment) { - return Optional.of((Environment) value.value()); + public Optional string() { + if (value.value() instanceof String) { + return Optional.of((String) value.value()); } return Optional.empty(); } @@ -119,8 +119,8 @@ public static final class _Deserializer extends OneOfDeserializer() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteractionResponseFormat.java b/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteractionResponseFormat.java index 441cbfd26c0..001ef025049 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteractionResponseFormat.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/CreateModelInteractionResponseFormat.java @@ -50,39 +50,39 @@ private CreateModelInteractionResponseFormat(TypedObject value) { this.value = value; } - public static CreateModelInteractionResponseFormat of(List value) { + public static CreateModelInteractionResponseFormat of(ResponseFormat value) { Utils.checkNotNull(value, "value"); - return new CreateModelInteractionResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + return new CreateModelInteractionResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); } - public static CreateModelInteractionResponseFormat of(ResponseFormat value) { + public static CreateModelInteractionResponseFormat of(List value) { Utils.checkNotNull(value, "value"); - return new CreateModelInteractionResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateModelInteractionResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); } /** - * Returns an {@link Optional} containing the value if it is of type {@code List}, + * Returns an {@link Optional} containing the value if it is of type {@code ResponseFormat}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code List} value, or empty if not of this type + * @return an {@link Optional} containing the {@code ResponseFormat} value, or empty if not of this type */ - @SuppressWarnings("unchecked") - public Optional> arrayOfResponseFormat() { - if (value.value() instanceof List) { - return Optional.of((List) value.value()); + public Optional responseFormat() { + if (value.value() instanceof ResponseFormat) { + return Optional.of((ResponseFormat) value.value()); } return Optional.empty(); } /** - * Returns an {@link Optional} containing the value if it is of type {@code ResponseFormat}, + * Returns an {@link Optional} containing the value if it is of type {@code List}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code ResponseFormat} value, or empty if not of this type + * @return an {@link Optional} containing the {@code List} value, or empty if not of this type */ - public Optional responseFormat() { - if (value.value() instanceof ResponseFormat) { - return Optional.of((ResponseFormat) value.value()); + @SuppressWarnings("unchecked") + public Optional> arrayOfResponseFormat() { + if (value.value() instanceof List) { + return Optional.of((List) value.value()); } return Optional.empty(); } @@ -121,8 +121,8 @@ public static final class _Deserializer extends OneOfDeserializer>() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT)); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/DocumentContent.java b/src/main/java/com/google/genai/gaos/models/interactions/DocumentContent.java index fc703bc0135..b7e52f7e6b8 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/DocumentContent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/DocumentContent.java @@ -44,6 +44,13 @@ public class DocumentContent implements Content { @JsonProperty("data") private String data; + /** + * The mime type of the document. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("mime_type") + private DocumentContentMimeType mimeType; + @JsonProperty("type") private String type; @@ -55,22 +62,15 @@ public class DocumentContent implements Content { @JsonProperty("uri") private String uri; - /** - * The mime type of the document. - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("mime_type") - private DocumentContentMimeType mimeType; - @JsonCreator public DocumentContent( @JsonProperty("data") @Nullable String data, - @JsonProperty("uri") @Nullable String uri, - @JsonProperty("mime_type") @Nullable DocumentContentMimeType mimeType) { + @JsonProperty("mime_type") @Nullable DocumentContentMimeType mimeType, + @JsonProperty("uri") @Nullable String uri) { this.data = data; + this.mimeType = mimeType; this.type = Builder._SINGLETON_VALUE_Type.value(); this.uri = uri; - this.mimeType = mimeType; } public DocumentContent() { @@ -84,6 +84,13 @@ public Optional data() { return Optional.ofNullable(this.data); } + /** + * The mime type of the document. + */ + public Optional mimeType() { + return Optional.ofNullable(this.mimeType); + } + @Override public String type() { return Utils.discriminatorToString(type); @@ -96,13 +103,6 @@ public Optional uri() { return Optional.ofNullable(this.uri); } - /** - * The mime type of the document. - */ - public Optional mimeType() { - return Optional.ofNullable(this.mimeType); - } - public static Builder builder() { return new Builder(); } @@ -118,19 +118,19 @@ public DocumentContent withData(@Nullable String data) { /** - * The URI of the document. + * The mime type of the document. */ - public DocumentContent withUri(@Nullable String uri) { - this.uri = uri; + public DocumentContent withMimeType(@Nullable DocumentContentMimeType mimeType) { + this.mimeType = mimeType; return this; } /** - * The mime type of the document. + * The URI of the document. */ - public DocumentContent withMimeType(@Nullable DocumentContentMimeType mimeType) { - this.mimeType = mimeType; + public DocumentContent withUri(@Nullable String uri) { + this.uri = uri; return this; } @@ -146,25 +146,25 @@ public boolean equals(java.lang.Object o) { DocumentContent other = (DocumentContent) o; return Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.mimeType, other.mimeType) && Utils.enhancedDeepEquals(this.type, other.type) && - Utils.enhancedDeepEquals(this.uri, other.uri) && - Utils.enhancedDeepEquals(this.mimeType, other.mimeType); + Utils.enhancedDeepEquals(this.uri, other.uri); } @Override public int hashCode() { return Utils.enhancedHash( - data, type, uri, - mimeType); + data, mimeType, type, + uri); } @Override public String toString() { return Utils.toString(DocumentContent.class, "data", data, + "mimeType", mimeType, "type", type, - "uri", uri, - "mimeType", mimeType); + "uri", uri); } @SuppressWarnings("UnusedReturnValue") @@ -172,10 +172,10 @@ public final static class Builder { private String data; - private String uri; - private DocumentContentMimeType mimeType; + private String uri; + private Builder() { // force use of static builder() method } @@ -189,24 +189,24 @@ public Builder data(@Nullable String data) { } /** - * The URI of the document. + * The mime type of the document. */ - public Builder uri(@Nullable String uri) { - this.uri = uri; + public Builder mimeType(@Nullable DocumentContentMimeType mimeType) { + this.mimeType = mimeType; return this; } /** - * The mime type of the document. + * The URI of the document. */ - public Builder mimeType(@Nullable DocumentContentMimeType mimeType) { - this.mimeType = mimeType; + public Builder uri(@Nullable String uri) { + this.uri = uri; return this; } public DocumentContent build() { return new DocumentContent( - data, uri, mimeType); + data, mimeType, uri); } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Function.java b/src/main/java/com/google/genai/gaos/models/interactions/Function.java index df2a523d1f5..62647e144aa 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Function.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Function.java @@ -38,7 +38,7 @@ * *

A tool that can be used by the model. */ -public class Function implements Tool, AgentTool { +public class Function implements AgentTool, Tool { /** * A description of the function. */ diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultDeltaResultUnion.java b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultDeltaResultUnion.java index e4fc1f257af..a6bd157ef27 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultDeltaResultUnion.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultDeltaResultUnion.java @@ -44,14 +44,14 @@ private FunctionResultDeltaResultUnion(TypedObject value) { this.value = value; } - public static FunctionResultDeltaResultUnion of(FunctionResultDeltaResult value) { + public static FunctionResultDeltaResultUnion of(List value) { Utils.checkNotNull(value, "value"); - return new FunctionResultDeltaResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new FunctionResultDeltaResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); } - public static FunctionResultDeltaResultUnion of(List value) { + public static FunctionResultDeltaResultUnion of(FunctionResultDeltaResult value) { Utils.checkNotNull(value, "value"); - return new FunctionResultDeltaResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + return new FunctionResultDeltaResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); } public static FunctionResultDeltaResultUnion of(String value) { @@ -60,28 +60,28 @@ public static FunctionResultDeltaResultUnion of(String value) { } /** - * Returns an {@link Optional} containing the value if it is of type {@code FunctionResultDeltaResult}, + * Returns an {@link Optional} containing the value if it is of type {@code List}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code FunctionResultDeltaResult} value, or empty if not of this type + * @return an {@link Optional} containing the {@code List} value, or empty if not of this type */ - public Optional functionResultDeltaResult() { - if (value.value() instanceof FunctionResultDeltaResult) { - return Optional.of((FunctionResultDeltaResult) value.value()); + @SuppressWarnings("unchecked") + public Optional> arrayOfFunctionResultSubcontent() { + if (value.value() instanceof List) { + return Optional.of((List) value.value()); } return Optional.empty(); } /** - * Returns an {@link Optional} containing the value if it is of type {@code List}, + * Returns an {@link Optional} containing the value if it is of type {@code FunctionResultDeltaResult}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code List} value, or empty if not of this type + * @return an {@link Optional} containing the {@code FunctionResultDeltaResult} value, or empty if not of this type */ - @SuppressWarnings("unchecked") - public Optional> arrayOfFunctionResultSubcontent() { - if (value.value() instanceof List) { - return Optional.of((List) value.value()); + public Optional functionResultDeltaResult() { + if (value.value() instanceof FunctionResultDeltaResult) { + return Optional.of((FunctionResultDeltaResult) value.value()); } return Optional.empty(); } @@ -133,8 +133,8 @@ public static final class _Deserializer extends OneOfDeserializer() {}, JsonShape.DEFAULT), TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultStepResultUnion.java b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultStepResultUnion.java index b1195389bf4..a436f3b807a 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultStepResultUnion.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/FunctionResultStepResultUnion.java @@ -49,14 +49,14 @@ private FunctionResultStepResultUnion(TypedObject value) { this.value = value; } - public static FunctionResultStepResultUnion of(FunctionResultStepResult value) { + public static FunctionResultStepResultUnion of(List value) { Utils.checkNotNull(value, "value"); - return new FunctionResultStepResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new FunctionResultStepResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); } - public static FunctionResultStepResultUnion of(List value) { + public static FunctionResultStepResultUnion of(FunctionResultStepResult value) { Utils.checkNotNull(value, "value"); - return new FunctionResultStepResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + return new FunctionResultStepResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); } public static FunctionResultStepResultUnion of(String value) { @@ -65,28 +65,28 @@ public static FunctionResultStepResultUnion of(String value) { } /** - * Returns an {@link Optional} containing the value if it is of type {@code FunctionResultStepResult}, + * Returns an {@link Optional} containing the value if it is of type {@code List}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code FunctionResultStepResult} value, or empty if not of this type + * @return an {@link Optional} containing the {@code List} value, or empty if not of this type */ - public Optional functionResultStepResult() { - if (value.value() instanceof FunctionResultStepResult) { - return Optional.of((FunctionResultStepResult) value.value()); + @SuppressWarnings("unchecked") + public Optional> arrayOfFunctionResultSubcontent() { + if (value.value() instanceof List) { + return Optional.of((List) value.value()); } return Optional.empty(); } /** - * Returns an {@link Optional} containing the value if it is of type {@code List}, + * Returns an {@link Optional} containing the value if it is of type {@code FunctionResultStepResult}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code List} value, or empty if not of this type + * @return an {@link Optional} containing the {@code FunctionResultStepResult} value, or empty if not of this type */ - @SuppressWarnings("unchecked") - public Optional> arrayOfFunctionResultSubcontent() { - if (value.value() instanceof List) { - return Optional.of((List) value.value()); + public Optional functionResultStepResult() { + if (value.value() instanceof FunctionResultStepResult) { + return Optional.of((FunctionResultStepResult) value.value()); } return Optional.empty(); } @@ -138,8 +138,8 @@ public static final class _Deserializer extends OneOfDeserializer() {}, JsonShape.DEFAULT), TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GenerationConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/GenerationConfig.java index e7fcfbf6a4e..f5d6bd1ec4e 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GenerationConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GenerationConfig.java @@ -62,6 +62,13 @@ public class GenerationConfig { @JsonProperty("seed") private Integer seed; + /** + * Optional. Speech and multi-speaker configuration. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("speech_config") + private SpeechConfigUnion speechConfig; + /** * A list of character sequences that will stop output interaction. */ @@ -100,35 +107,28 @@ public class GenerationConfig { @JsonProperty("video_config") private VideoConfig videoConfig; - /** - * Optional. Speech and multi-speaker configuration. - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("speech_config") - private SpeechConfigUnion speechConfig; - @JsonCreator public GenerationConfig( @JsonProperty("image_config") @Nullable ImageConfig imageConfig, @JsonProperty("max_output_tokens") @Nullable Integer maxOutputTokens, @JsonProperty("seed") @Nullable Integer seed, + @JsonProperty("speech_config") @Nullable SpeechConfigUnion speechConfig, @JsonProperty("stop_sequences") @Nullable List stopSequences, @JsonProperty("thinking_level") @Nullable ThinkingLevel thinkingLevel, @JsonProperty("thinking_summaries") @Nullable ThinkingSummaries thinkingSummaries, @JsonProperty("tool_choice") @Nullable ToolChoice toolChoice, @JsonProperty("transcription_config") @Nullable TranscriptionConfig transcriptionConfig, - @JsonProperty("video_config") @Nullable VideoConfig videoConfig, - @JsonProperty("speech_config") @Nullable SpeechConfigUnion speechConfig) { + @JsonProperty("video_config") @Nullable VideoConfig videoConfig) { this.imageConfig = imageConfig; this.maxOutputTokens = maxOutputTokens; this.seed = seed; + this.speechConfig = speechConfig; this.stopSequences = stopSequences; this.thinkingLevel = thinkingLevel; this.thinkingSummaries = thinkingSummaries; this.toolChoice = toolChoice; this.transcriptionConfig = transcriptionConfig; this.videoConfig = videoConfig; - this.speechConfig = speechConfig; } public GenerationConfig() { @@ -162,6 +162,13 @@ public Optional seed() { return Optional.ofNullable(this.seed); } + /** + * Optional. Speech and multi-speaker configuration. + */ + public Optional speechConfig() { + return Optional.ofNullable(this.speechConfig); + } + /** * A list of character sequences that will stop output interaction. */ @@ -198,13 +205,6 @@ public Optional videoConfig() { return Optional.ofNullable(this.videoConfig); } - /** - * Optional. Speech and multi-speaker configuration. - */ - public Optional speechConfig() { - return Optional.ofNullable(this.speechConfig); - } - public static Builder builder() { return new Builder(); } @@ -240,6 +240,15 @@ public GenerationConfig withSeed(@Nullable Integer seed) { } + /** + * Optional. Speech and multi-speaker configuration. + */ + public GenerationConfig withSpeechConfig(@Nullable SpeechConfigUnion speechConfig) { + this.speechConfig = speechConfig; + return this; + } + + /** * A list of character sequences that will stop output interaction. */ @@ -288,15 +297,6 @@ public GenerationConfig withVideoConfig(@Nullable VideoConfig videoConfig) { } - /** - * Optional. Speech and multi-speaker configuration. - */ - public GenerationConfig withSpeechConfig(@Nullable SpeechConfigUnion speechConfig) { - this.speechConfig = speechConfig; - return this; - } - - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -310,22 +310,22 @@ public boolean equals(java.lang.Object o) { Utils.enhancedDeepEquals(this.imageConfig, other.imageConfig) && Utils.enhancedDeepEquals(this.maxOutputTokens, other.maxOutputTokens) && Utils.enhancedDeepEquals(this.seed, other.seed) && + Utils.enhancedDeepEquals(this.speechConfig, other.speechConfig) && Utils.enhancedDeepEquals(this.stopSequences, other.stopSequences) && Utils.enhancedDeepEquals(this.thinkingLevel, other.thinkingLevel) && Utils.enhancedDeepEquals(this.thinkingSummaries, other.thinkingSummaries) && Utils.enhancedDeepEquals(this.toolChoice, other.toolChoice) && Utils.enhancedDeepEquals(this.transcriptionConfig, other.transcriptionConfig) && - Utils.enhancedDeepEquals(this.videoConfig, other.videoConfig) && - Utils.enhancedDeepEquals(this.speechConfig, other.speechConfig); + Utils.enhancedDeepEquals(this.videoConfig, other.videoConfig); } @Override public int hashCode() { return Utils.enhancedHash( imageConfig, maxOutputTokens, seed, - stopSequences, thinkingLevel, thinkingSummaries, - toolChoice, transcriptionConfig, videoConfig, - speechConfig); + speechConfig, stopSequences, thinkingLevel, + thinkingSummaries, toolChoice, transcriptionConfig, + videoConfig); } @Override @@ -334,13 +334,13 @@ public String toString() { "imageConfig", imageConfig, "maxOutputTokens", maxOutputTokens, "seed", seed, + "speechConfig", speechConfig, "stopSequences", stopSequences, "thinkingLevel", thinkingLevel, "thinkingSummaries", thinkingSummaries, "toolChoice", toolChoice, "transcriptionConfig", transcriptionConfig, - "videoConfig", videoConfig, - "speechConfig", speechConfig); + "videoConfig", videoConfig); } @SuppressWarnings("UnusedReturnValue") @@ -353,6 +353,8 @@ public final static class Builder { private Integer seed; + private SpeechConfigUnion speechConfig; + private List stopSequences; private ThinkingLevel thinkingLevel; @@ -365,8 +367,6 @@ public final static class Builder { private VideoConfig videoConfig; - private SpeechConfigUnion speechConfig; - private Builder() { // force use of static builder() method } @@ -398,6 +398,14 @@ public Builder seed(@Nullable Integer seed) { return this; } + /** + * Optional. Speech and multi-speaker configuration. + */ + public Builder speechConfig(@Nullable SpeechConfigUnion speechConfig) { + this.speechConfig = speechConfig; + return this; + } + /** * A list of character sequences that will stop output interaction. */ @@ -440,20 +448,12 @@ public Builder videoConfig(@Nullable VideoConfig videoConfig) { return this; } - /** - * Optional. Speech and multi-speaker configuration. - */ - public Builder speechConfig(@Nullable SpeechConfigUnion speechConfig) { - this.speechConfig = speechConfig; - return this; - } - public GenerationConfig build() { return new GenerationConfig( imageConfig, maxOutputTokens, seed, - stopSequences, thinkingLevel, thinkingSummaries, - toolChoice, transcriptionConfig, videoConfig, - speechConfig); + speechConfig, stopSequences, thinkingLevel, + thinkingSummaries, toolChoice, transcriptionConfig, + videoConfig); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearch.java b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearch.java index b14de7a9aba..42f4617ef4b 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearch.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/GoogleSearch.java @@ -38,7 +38,7 @@ * *

A tool that can be used by the model to search Google. */ -public class GoogleSearch implements Tool, AgentTool { +public class GoogleSearch implements AgentTool, Tool { /** * The types of search grounding to enable. */ diff --git a/src/main/java/com/google/genai/gaos/models/interactions/ImageContent.java b/src/main/java/com/google/genai/gaos/models/interactions/ImageContent.java index cdf85c1cd5e..a61413cc1a3 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/ImageContent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/ImageContent.java @@ -36,7 +36,7 @@ * *

An image content block. */ -public class ImageContent implements Content, ThoughtSummaryContent, FunctionResultSubcontent { +public class ImageContent implements FunctionResultSubcontent, Content, ThoughtSummaryContent { /** * The image content. */ @@ -44,6 +44,13 @@ public class ImageContent implements Content, ThoughtSummaryContent, FunctionRes @JsonProperty("data") private String data; + /** + * The mime type of the image. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("mime_type") + private ImageContentMimeType mimeType; + @JsonInclude(Include.NON_ABSENT) @JsonProperty("resolution") @@ -60,24 +67,17 @@ public class ImageContent implements Content, ThoughtSummaryContent, FunctionRes @JsonProperty("uri") private String uri; - /** - * The mime type of the image. - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("mime_type") - private ImageContentMimeType mimeType; - @JsonCreator public ImageContent( @JsonProperty("data") @Nullable String data, + @JsonProperty("mime_type") @Nullable ImageContentMimeType mimeType, @JsonProperty("resolution") @Nullable MediaResolution resolution, - @JsonProperty("uri") @Nullable String uri, - @JsonProperty("mime_type") @Nullable ImageContentMimeType mimeType) { + @JsonProperty("uri") @Nullable String uri) { this.data = data; + this.mimeType = mimeType; this.resolution = resolution; this.type = Builder._SINGLETON_VALUE_Type.value(); this.uri = uri; - this.mimeType = mimeType; } public ImageContent() { @@ -92,6 +92,13 @@ public Optional data() { return Optional.ofNullable(this.data); } + /** + * The mime type of the image. + */ + public Optional mimeType() { + return Optional.ofNullable(this.mimeType); + } + public Optional resolution() { return Optional.ofNullable(this.resolution); } @@ -108,13 +115,6 @@ public Optional uri() { return Optional.ofNullable(this.uri); } - /** - * The mime type of the image. - */ - public Optional mimeType() { - return Optional.ofNullable(this.mimeType); - } - public static Builder builder() { return new Builder(); } @@ -129,6 +129,15 @@ public ImageContent withData(@Nullable String data) { } + /** + * The mime type of the image. + */ + public ImageContent withMimeType(@Nullable ImageContentMimeType mimeType) { + this.mimeType = mimeType; + return this; + } + + public ImageContent withResolution(@Nullable MediaResolution resolution) { this.resolution = resolution; return this; @@ -144,15 +153,6 @@ public ImageContent withUri(@Nullable String uri) { } - /** - * The mime type of the image. - */ - public ImageContent withMimeType(@Nullable ImageContentMimeType mimeType) { - this.mimeType = mimeType; - return this; - } - - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -164,27 +164,27 @@ public boolean equals(java.lang.Object o) { ImageContent other = (ImageContent) o; return Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.mimeType, other.mimeType) && Utils.enhancedDeepEquals(this.resolution, other.resolution) && Utils.enhancedDeepEquals(this.type, other.type) && - Utils.enhancedDeepEquals(this.uri, other.uri) && - Utils.enhancedDeepEquals(this.mimeType, other.mimeType); + Utils.enhancedDeepEquals(this.uri, other.uri); } @Override public int hashCode() { return Utils.enhancedHash( - data, resolution, type, - uri, mimeType); + data, mimeType, resolution, + type, uri); } @Override public String toString() { return Utils.toString(ImageContent.class, "data", data, + "mimeType", mimeType, "resolution", resolution, "type", type, - "uri", uri, - "mimeType", mimeType); + "uri", uri); } @SuppressWarnings("UnusedReturnValue") @@ -192,12 +192,12 @@ public final static class Builder { private String data; + private ImageContentMimeType mimeType; + private MediaResolution resolution; private String uri; - private ImageContentMimeType mimeType; - private Builder() { // force use of static builder() method } @@ -210,6 +210,14 @@ public Builder data(@Nullable String data) { return this; } + /** + * The mime type of the image. + */ + public Builder mimeType(@Nullable ImageContentMimeType mimeType) { + this.mimeType = mimeType; + return this; + } + public Builder resolution(@Nullable MediaResolution resolution) { this.resolution = resolution; return this; @@ -223,18 +231,10 @@ public Builder uri(@Nullable String uri) { return this; } - /** - * The mime type of the image. - */ - public Builder mimeType(@Nullable ImageContentMimeType mimeType) { - this.mimeType = mimeType; - return this; - } - public ImageContent build() { return new ImageContent( - data, resolution, uri, - mimeType); + data, mimeType, resolution, + uri); } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Interaction.java b/src/main/java/com/google/genai/gaos/models/interactions/Interaction.java index cc6eeda22ab..c9170e222df 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Interaction.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Interaction.java @@ -41,14 +41,6 @@ *

The Interaction resource. */ public class Interaction { - /** - * The model that will complete your prompt.\n\nSee - * [models](https://ai.google.dev/gemini-api/docs/models) for additional details. - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("model") - private Model model; - /** * The agent to interact with. */ @@ -57,17 +49,11 @@ public class Interaction { private AgentOption agent; /** - * Required. Output only. A unique identifier for the interaction completion. + * Configuration parameters for the agent interaction. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("id") - private String id; - - /** - * Required. Output only. The status of the interaction. - */ - @JsonProperty("status") - private InteractionStatus status; + @JsonProperty("agent_config") + private InteractionAgentConfig agentConfig; /** * Output only. The time at which the response was created in ISO 8601 format @@ -78,94 +64,100 @@ public class Interaction { private String created; /** - * Output only. The time at which the response was last updated in ISO 8601 format - * (YYYY-MM-DDThh:mm:ssZ). + * The environment configuration for the interaction. Can be an object specifying remote environment + * sources or a string referencing an existing environment ID. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("updated") - private String updated; + @JsonProperty("environment") + private InteractionEnvironment environment; /** - * System instruction for the interaction. + * Output only. The environment ID for the interaction. Only populated if environment + * config is set in the request. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("system_instruction") - private String systemInstruction; + @JsonProperty("environment_id") + private String environmentId; /** - * A list of tool declarations the model may call during interaction. + * Output only. Diagnostic faults / platform errors recorded on the interaction. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("tools") - private List tools; + @JsonProperty("errors") + private List errors; /** - * Output only. Diagnostic faults / platform errors recorded on the interaction. + * Configuration parameters for model interactions. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("errors") - private List errors; + @JsonProperty("generation_config") + private GenerationConfig generationConfig; /** - * Statistics on the interaction request's token usage. + * Required. Output only. A unique identifier for the interaction completion. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("usage") - private Usage usage; + @JsonProperty("id") + private String id; /** - * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + * The input for the interaction. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("response_modalities") - @Deprecated - private List responseModalities; + @JsonProperty("input") + private InteractionsInput input; /** - * The mime type of the response. This is required if response_format is set. - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + * The labels with user-defined metadata for the request. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("response_mime_type") - @Deprecated - private String responseMimeType; + @JsonProperty("labels") + private Map labels; /** - * The ID of the previous interaction, if any. + * The model that will complete your prompt.\n\nSee + * [models](https://ai.google.dev/gemini-api/docs/models) for additional details. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("previous_interaction_id") - private String previousInteractionId; + @JsonProperty("model") + private Model model; /** - * Output only. The environment ID for the interaction. Only populated if environment - * config is set in the request. + * An audio content block. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("environment_id") - private String environmentId; + @JsonProperty("output_audio") + private AudioContent outputAudio; + /** + * An image content block. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("output_image") + private ImageContent outputImage; + /** + * Concatenated text from the last model output in response to the current request. + * + *

Note: this is added by the SDK. + */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("service_tier") - private ServiceTier serviceTier; + @JsonProperty("output_text") + private String outputText; /** - * Message for configuring webhook events for a request. + * A video content block. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("webhook_config") - private WebhookConfig webhookConfig; + @JsonProperty("output_video") + private VideoContent outputVideo; /** - * Output only. The steps that make up the interaction, when included in the response. + * The ID of the previous interaction, if any. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("steps") - private List steps; + @JsonProperty("previous_interaction_id") + private String previousInteractionId; /** * Enforces that the generated response is a JSON object that complies with the JSON schema specified @@ -176,26 +168,24 @@ public class Interaction { private InteractionResponseFormat responseFormat; /** - * The environment configuration for the interaction. Can be an object specifying remote environment - * sources or a string referencing an existing environment ID. - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("environment") - private InteractionEnvironment environment; - - /** - * Configuration parameters for model interactions. + * The mime type of the response. This is required if response_format is set. + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("generation_config") - private GenerationConfig generationConfig; + @JsonProperty("response_mime_type") + @Deprecated + private String responseMimeType; /** - * Configuration parameters for the agent interaction. + * The requested modalities of the response (TEXT, IMAGE, AUDIO). + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("agent_config") - private InteractionAgentConfig agentConfig; + @JsonProperty("response_modalities") + @Deprecated + private List responseModalities; /** * Safety settings for the interaction. @@ -204,134 +194,136 @@ public class Interaction { @JsonProperty("safety_settings") private List safetySettings; + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("service_tier") + private ServiceTier serviceTier; + /** - * The labels with user-defined metadata for the request. + * Required. Output only. The status of the interaction. + */ + @JsonProperty("status") + private InteractionStatus status; + + /** + * Output only. The steps that make up the interaction, when included in the response. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("labels") - private Map labels; + @JsonProperty("steps") + private List steps; /** - * The input for the interaction. + * System instruction for the interaction. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("input") - private InteractionsInput input; + @JsonProperty("system_instruction") + private String systemInstruction; /** - * Concatenated text from the last model output in response to the current request. - * - *

Note: this is added by the SDK. + * A list of tool declarations the model may call during interaction. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("output_text") - private String outputText; + @JsonProperty("tools") + private List tools; /** - * An image content block. + * Output only. The time at which the response was last updated in ISO 8601 format + * (YYYY-MM-DDThh:mm:ssZ). */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("output_image") - private ImageContent outputImage; + @JsonProperty("updated") + private String updated; /** - * An audio content block. + * Statistics on the interaction request's token usage. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("output_audio") - private AudioContent outputAudio; + @JsonProperty("usage") + private Usage usage; /** - * A video content block. + * Message for configuring webhook events for a request. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("output_video") - private VideoContent outputVideo; + @JsonProperty("webhook_config") + private WebhookConfig webhookConfig; @JsonCreator public Interaction( - @JsonProperty("model") @Nullable Model model, @JsonProperty("agent") @Nullable AgentOption agent, - @JsonProperty("id") @Nullable String id, - @JsonProperty("status") @Nonnull InteractionStatus status, + @JsonProperty("agent_config") @Nullable InteractionAgentConfig agentConfig, @JsonProperty("created") @Nullable String created, - @JsonProperty("updated") @Nullable String updated, - @JsonProperty("system_instruction") @Nullable String systemInstruction, - @JsonProperty("tools") @Nullable List tools, - @JsonProperty("errors") @Nullable List errors, - @JsonProperty("usage") @Nullable Usage usage, - @JsonProperty("response_modalities") @Nullable List responseModalities, - @JsonProperty("response_mime_type") @Nullable String responseMimeType, - @JsonProperty("previous_interaction_id") @Nullable String previousInteractionId, - @JsonProperty("environment_id") @Nullable String environmentId, - @JsonProperty("service_tier") @Nullable ServiceTier serviceTier, - @JsonProperty("webhook_config") @Nullable WebhookConfig webhookConfig, - @JsonProperty("steps") @Nullable List steps, - @JsonProperty("response_format") @Nullable InteractionResponseFormat responseFormat, @JsonProperty("environment") @Nullable InteractionEnvironment environment, + @JsonProperty("environment_id") @Nullable String environmentId, + @JsonProperty("errors") @Nullable List errors, @JsonProperty("generation_config") @Nullable GenerationConfig generationConfig, - @JsonProperty("agent_config") @Nullable InteractionAgentConfig agentConfig, - @JsonProperty("safety_settings") @Nullable List safetySettings, - @JsonProperty("labels") @Nullable Map labels, + @JsonProperty("id") @Nullable String id, @JsonProperty("input") @Nullable InteractionsInput input, - @JsonProperty("output_text") @Nullable String outputText, - @JsonProperty("output_image") @Nullable ImageContent outputImage, + @JsonProperty("labels") @Nullable Map labels, + @JsonProperty("model") @Nullable Model model, @JsonProperty("output_audio") @Nullable AudioContent outputAudio, - @JsonProperty("output_video") @Nullable VideoContent outputVideo) { - this.model = model; + @JsonProperty("output_image") @Nullable ImageContent outputImage, + @JsonProperty("output_text") @Nullable String outputText, + @JsonProperty("output_video") @Nullable VideoContent outputVideo, + @JsonProperty("previous_interaction_id") @Nullable String previousInteractionId, + @JsonProperty("response_format") @Nullable InteractionResponseFormat responseFormat, + @JsonProperty("response_mime_type") @Nullable String responseMimeType, + @JsonProperty("response_modalities") @Nullable List responseModalities, + @JsonProperty("safety_settings") @Nullable List safetySettings, + @JsonProperty("service_tier") @Nullable ServiceTier serviceTier, + @JsonProperty("status") @Nonnull InteractionStatus status, + @JsonProperty("steps") @Nullable List steps, + @JsonProperty("system_instruction") @Nullable String systemInstruction, + @JsonProperty("tools") @Nullable List tools, + @JsonProperty("updated") @Nullable String updated, + @JsonProperty("usage") @Nullable Usage usage, + @JsonProperty("webhook_config") @Nullable WebhookConfig webhookConfig) { this.agent = agent; + this.agentConfig = agentConfig; + this.created = created; + this.environment = environment; + this.environmentId = environmentId; + this.errors = errors; + this.generationConfig = generationConfig; this.id = Optional.ofNullable(id) .orElse(Builder._SINGLETON_VALUE_Id.value()); + this.input = input; + this.labels = labels; + this.model = model; + this.outputAudio = outputAudio; + this.outputImage = outputImage; + this.outputText = outputText; + this.outputVideo = outputVideo; + this.previousInteractionId = previousInteractionId; + this.responseFormat = responseFormat; + this.responseMimeType = responseMimeType; + this.responseModalities = responseModalities; + this.safetySettings = safetySettings; + this.serviceTier = serviceTier; this.status = Optional.ofNullable(status) .orElseThrow(() -> new IllegalArgumentException("status cannot be null")); - this.created = created; - this.updated = updated; + this.steps = steps; this.systemInstruction = systemInstruction; this.tools = tools; - this.errors = errors; + this.updated = updated; this.usage = usage; - this.responseModalities = responseModalities; - this.responseMimeType = responseMimeType; - this.previousInteractionId = previousInteractionId; - this.environmentId = environmentId; - this.serviceTier = serviceTier; this.webhookConfig = webhookConfig; - this.steps = steps; - this.responseFormat = responseFormat; - this.environment = environment; - this.generationConfig = generationConfig; - this.agentConfig = agentConfig; - this.safetySettings = safetySettings; - this.labels = labels; - this.input = input; - this.outputText = outputText; - this.outputImage = outputImage; - this.outputAudio = outputAudio; - this.outputVideo = outputVideo; } public Interaction( @Nonnull InteractionStatus status) { this(null, null, null, - status, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, + status, null, null, null, null, null, null); } - /** - * The model that will complete your prompt.\n\nSee - * [models](https://ai.google.dev/gemini-api/docs/models) for additional details. - */ - public Optional model() { - return Optional.ofNullable(this.model); - } - /** * The agent to interact with. */ @@ -340,17 +332,10 @@ public Optional agent() { } /** - * Required. Output only. A unique identifier for the interaction completion. - */ - public Optional id() { - return Optional.ofNullable(this.id); - } - - /** - * Required. Output only. The status of the interaction. + * Configuration parameters for the agent interaction. */ - public Optional status() { - return Optional.ofNullable(this.status); + public Optional agentConfig() { + return Optional.ofNullable(this.agentConfig); } /** @@ -362,92 +347,99 @@ public Optional created() { } /** - * Output only. The time at which the response was last updated in ISO 8601 format - * (YYYY-MM-DDThh:mm:ssZ). + * The environment configuration for the interaction. Can be an object specifying remote environment + * sources or a string referencing an existing environment ID. */ - public Optional updated() { - return Optional.ofNullable(this.updated); + public Optional environment() { + return Optional.ofNullable(this.environment); } /** - * System instruction for the interaction. + * Output only. The environment ID for the interaction. Only populated if environment + * config is set in the request. */ - public Optional systemInstruction() { - return Optional.ofNullable(this.systemInstruction); + public Optional environmentId() { + return Optional.ofNullable(this.environmentId); } /** - * A list of tool declarations the model may call during interaction. + * Output only. Diagnostic faults / platform errors recorded on the interaction. */ - public Optional> tools() { - return Optional.ofNullable(this.tools); + public Optional> errors() { + return Optional.ofNullable(this.errors); } /** - * Output only. Diagnostic faults / platform errors recorded on the interaction. + * Configuration parameters for model interactions. */ - public Optional> errors() { - return Optional.ofNullable(this.errors); + public Optional generationConfig() { + return Optional.ofNullable(this.generationConfig); } /** - * Statistics on the interaction request's token usage. + * Required. Output only. A unique identifier for the interaction completion. */ - public Optional usage() { - return Optional.ofNullable(this.usage); + public Optional id() { + return Optional.ofNullable(this.id); } /** - * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + * The input for the interaction. */ - @Deprecated - public Optional> responseModalities() { - return Optional.ofNullable(this.responseModalities); + public Optional input() { + return Optional.ofNullable(this.input); } /** - * The mime type of the response. This is required if response_format is set. - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + * The labels with user-defined metadata for the request. */ - @Deprecated - public Optional responseMimeType() { - return Optional.ofNullable(this.responseMimeType); + public Optional> labels() { + return Optional.ofNullable(this.labels); } /** - * The ID of the previous interaction, if any. + * The model that will complete your prompt.\n\nSee + * [models](https://ai.google.dev/gemini-api/docs/models) for additional details. */ - public Optional previousInteractionId() { - return Optional.ofNullable(this.previousInteractionId); + public Optional model() { + return Optional.ofNullable(this.model); } /** - * Output only. The environment ID for the interaction. Only populated if environment - * config is set in the request. + * An audio content block. */ - public Optional environmentId() { - return Optional.ofNullable(this.environmentId); + public Optional outputAudio() { + return Optional.ofNullable(this.outputAudio); } - public Optional serviceTier() { - return Optional.ofNullable(this.serviceTier); + /** + * An image content block. + */ + public Optional outputImage() { + return Optional.ofNullable(this.outputImage); } /** - * Message for configuring webhook events for a request. + * Concatenated text from the last model output in response to the current request. + * + *

Note: this is added by the SDK. */ - public Optional webhookConfig() { - return Optional.ofNullable(this.webhookConfig); + public Optional outputText() { + return Optional.ofNullable(this.outputText); } /** - * Output only. The steps that make up the interaction, when included in the response. + * A video content block. */ - public Optional> steps() { - return Optional.ofNullable(this.steps); + public Optional outputVideo() { + return Optional.ofNullable(this.outputVideo); + } + + /** + * The ID of the previous interaction, if any. + */ + public Optional previousInteractionId() { + return Optional.ofNullable(this.previousInteractionId); } /** @@ -459,76 +451,84 @@ public Optional responseFormat() { } /** - * The environment configuration for the interaction. Can be an object specifying remote environment - * sources or a string referencing an existing environment ID. + * The mime type of the response. This is required if response_format is set. + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ - public Optional environment() { - return Optional.ofNullable(this.environment); + @Deprecated + public Optional responseMimeType() { + return Optional.ofNullable(this.responseMimeType); } /** - * Configuration parameters for model interactions. + * The requested modalities of the response (TEXT, IMAGE, AUDIO). + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ - public Optional generationConfig() { - return Optional.ofNullable(this.generationConfig); + @Deprecated + public Optional> responseModalities() { + return Optional.ofNullable(this.responseModalities); } /** - * Configuration parameters for the agent interaction. + * Safety settings for the interaction. */ - public Optional agentConfig() { - return Optional.ofNullable(this.agentConfig); + public Optional> safetySettings() { + return Optional.ofNullable(this.safetySettings); + } + + public Optional serviceTier() { + return Optional.ofNullable(this.serviceTier); } /** - * Safety settings for the interaction. + * Required. Output only. The status of the interaction. */ - public Optional> safetySettings() { - return Optional.ofNullable(this.safetySettings); + public Optional status() { + return Optional.ofNullable(this.status); } /** - * The labels with user-defined metadata for the request. + * Output only. The steps that make up the interaction, when included in the response. */ - public Optional> labels() { - return Optional.ofNullable(this.labels); + public Optional> steps() { + return Optional.ofNullable(this.steps); } /** - * The input for the interaction. + * System instruction for the interaction. */ - public Optional input() { - return Optional.ofNullable(this.input); + public Optional systemInstruction() { + return Optional.ofNullable(this.systemInstruction); } /** - * Concatenated text from the last model output in response to the current request. - * - *

Note: this is added by the SDK. + * A list of tool declarations the model may call during interaction. */ - public Optional outputText() { - return Optional.ofNullable(this.outputText); + public Optional> tools() { + return Optional.ofNullable(this.tools); } /** - * An image content block. + * Output only. The time at which the response was last updated in ISO 8601 format + * (YYYY-MM-DDThh:mm:ssZ). */ - public Optional outputImage() { - return Optional.ofNullable(this.outputImage); + public Optional updated() { + return Optional.ofNullable(this.updated); } /** - * An audio content block. + * Statistics on the interaction request's token usage. */ - public Optional outputAudio() { - return Optional.ofNullable(this.outputAudio); + public Optional usage() { + return Optional.ofNullable(this.usage); } /** - * A video content block. + * Message for configuring webhook events for a request. */ - public Optional outputVideo() { - return Optional.ofNullable(this.outputVideo); + public Optional webhookConfig() { + return Optional.ofNullable(this.webhookConfig); } @JsonProperty("outputs") @@ -542,18 +542,8 @@ public void setOutputs(List outputs) { } } - public static Builder builder() { - return new Builder(); - } - - - /** - * The model that will complete your prompt.\n\nSee - * [models](https://ai.google.dev/gemini-api/docs/models) for additional details. - */ - public Interaction withModel(@Nullable Model model) { - this.model = model; - return this; + public static Builder builder() { + return new Builder(); } @@ -567,142 +557,142 @@ public Interaction withAgent(@Nullable AgentOption agent) { /** - * Required. Output only. A unique identifier for the interaction completion. + * Configuration parameters for the agent interaction. */ - public Interaction withId(@Nullable String id) { - this.id = id; + public Interaction withAgentConfig(@Nullable InteractionAgentConfig agentConfig) { + this.agentConfig = agentConfig; return this; } /** - * Required. Output only. The status of the interaction. + * Output only. The time at which the response was created in ISO 8601 format + * (YYYY-MM-DDThh:mm:ssZ). */ - public Interaction withStatus(@Nonnull InteractionStatus status) { - this.status = Utils.checkNotNull(status, "status"); + public Interaction withCreated(@Nullable String created) { + this.created = created; return this; } /** - * Output only. The time at which the response was created in ISO 8601 format - * (YYYY-MM-DDThh:mm:ssZ). + * The environment configuration for the interaction. Can be an object specifying remote environment + * sources or a string referencing an existing environment ID. */ - public Interaction withCreated(@Nullable String created) { - this.created = created; + public Interaction withEnvironment(@Nullable InteractionEnvironment environment) { + this.environment = environment; return this; } /** - * Output only. The time at which the response was last updated in ISO 8601 format - * (YYYY-MM-DDThh:mm:ssZ). + * Output only. The environment ID for the interaction. Only populated if environment + * config is set in the request. */ - public Interaction withUpdated(@Nullable String updated) { - this.updated = updated; + public Interaction withEnvironmentId(@Nullable String environmentId) { + this.environmentId = environmentId; return this; } /** - * System instruction for the interaction. + * Output only. Diagnostic faults / platform errors recorded on the interaction. */ - public Interaction withSystemInstruction(@Nullable String systemInstruction) { - this.systemInstruction = systemInstruction; + public Interaction withErrors(@Nullable List errors) { + this.errors = errors; return this; } /** - * A list of tool declarations the model may call during interaction. + * Configuration parameters for model interactions. */ - public Interaction withTools(@Nullable List tools) { - this.tools = tools; + public Interaction withGenerationConfig(@Nullable GenerationConfig generationConfig) { + this.generationConfig = generationConfig; return this; } /** - * Output only. Diagnostic faults / platform errors recorded on the interaction. + * Required. Output only. A unique identifier for the interaction completion. */ - public Interaction withErrors(@Nullable List errors) { - this.errors = errors; + public Interaction withId(@Nullable String id) { + this.id = id; return this; } /** - * Statistics on the interaction request's token usage. + * The input for the interaction. */ - public Interaction withUsage(@Nullable Usage usage) { - this.usage = usage; + public Interaction withInput(@Nullable InteractionsInput input) { + this.input = input; return this; } /** - * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + * The labels with user-defined metadata for the request. */ - @Deprecated - public Interaction withResponseModalities(@Nullable List responseModalities) { - this.responseModalities = responseModalities; + public Interaction withLabels(@Nullable Map labels) { + this.labels = labels; return this; } /** - * The mime type of the response. This is required if response_format is set. - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + * The model that will complete your prompt.\n\nSee + * [models](https://ai.google.dev/gemini-api/docs/models) for additional details. */ - @Deprecated - public Interaction withResponseMimeType(@Nullable String responseMimeType) { - this.responseMimeType = responseMimeType; + public Interaction withModel(@Nullable Model model) { + this.model = model; return this; } /** - * The ID of the previous interaction, if any. + * An audio content block. */ - public Interaction withPreviousInteractionId(@Nullable String previousInteractionId) { - this.previousInteractionId = previousInteractionId; + public Interaction withOutputAudio(@Nullable AudioContent outputAudio) { + this.outputAudio = outputAudio; return this; } /** - * Output only. The environment ID for the interaction. Only populated if environment - * config is set in the request. + * An image content block. */ - public Interaction withEnvironmentId(@Nullable String environmentId) { - this.environmentId = environmentId; + public Interaction withOutputImage(@Nullable ImageContent outputImage) { + this.outputImage = outputImage; return this; } - public Interaction withServiceTier(@Nullable ServiceTier serviceTier) { - this.serviceTier = serviceTier; + /** + * Concatenated text from the last model output in response to the current request. + * + *

Note: this is added by the SDK. + */ + public Interaction withOutputText(@Nullable String outputText) { + this.outputText = outputText; return this; } /** - * Message for configuring webhook events for a request. + * A video content block. */ - public Interaction withWebhookConfig(@Nullable WebhookConfig webhookConfig) { - this.webhookConfig = webhookConfig; + public Interaction withOutputVideo(@Nullable VideoContent outputVideo) { + this.outputVideo = outputVideo; return this; } /** - * Output only. The steps that make up the interaction, when included in the response. + * The ID of the previous interaction, if any. */ - public Interaction withSteps(@Nullable List steps) { - this.steps = steps; + public Interaction withPreviousInteractionId(@Nullable String previousInteractionId) { + this.previousInteractionId = previousInteractionId; return this; } @@ -718,94 +708,104 @@ public Interaction withResponseFormat(@Nullable InteractionResponseFormat respon /** - * The environment configuration for the interaction. Can be an object specifying remote environment - * sources or a string referencing an existing environment ID. + * The mime type of the response. This is required if response_format is set. + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ - public Interaction withEnvironment(@Nullable InteractionEnvironment environment) { - this.environment = environment; + @Deprecated + public Interaction withResponseMimeType(@Nullable String responseMimeType) { + this.responseMimeType = responseMimeType; return this; } /** - * Configuration parameters for model interactions. + * The requested modalities of the response (TEXT, IMAGE, AUDIO). + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ - public Interaction withGenerationConfig(@Nullable GenerationConfig generationConfig) { - this.generationConfig = generationConfig; + @Deprecated + public Interaction withResponseModalities(@Nullable List responseModalities) { + this.responseModalities = responseModalities; return this; } /** - * Configuration parameters for the agent interaction. + * Safety settings for the interaction. */ - public Interaction withAgentConfig(@Nullable InteractionAgentConfig agentConfig) { - this.agentConfig = agentConfig; + public Interaction withSafetySettings(@Nullable List safetySettings) { + this.safetySettings = safetySettings; + return this; + } + + + public Interaction withServiceTier(@Nullable ServiceTier serviceTier) { + this.serviceTier = serviceTier; return this; } /** - * Safety settings for the interaction. + * Required. Output only. The status of the interaction. */ - public Interaction withSafetySettings(@Nullable List safetySettings) { - this.safetySettings = safetySettings; + public Interaction withStatus(@Nonnull InteractionStatus status) { + this.status = Utils.checkNotNull(status, "status"); return this; } /** - * The labels with user-defined metadata for the request. + * Output only. The steps that make up the interaction, when included in the response. */ - public Interaction withLabels(@Nullable Map labels) { - this.labels = labels; + public Interaction withSteps(@Nullable List steps) { + this.steps = steps; return this; } /** - * The input for the interaction. + * System instruction for the interaction. */ - public Interaction withInput(@Nullable InteractionsInput input) { - this.input = input; + public Interaction withSystemInstruction(@Nullable String systemInstruction) { + this.systemInstruction = systemInstruction; return this; } /** - * Concatenated text from the last model output in response to the current request. - * - *

Note: this is added by the SDK. + * A list of tool declarations the model may call during interaction. */ - public Interaction withOutputText(@Nullable String outputText) { - this.outputText = outputText; + public Interaction withTools(@Nullable List tools) { + this.tools = tools; return this; } /** - * An image content block. + * Output only. The time at which the response was last updated in ISO 8601 format + * (YYYY-MM-DDThh:mm:ssZ). */ - public Interaction withOutputImage(@Nullable ImageContent outputImage) { - this.outputImage = outputImage; + public Interaction withUpdated(@Nullable String updated) { + this.updated = updated; return this; } /** - * An audio content block. + * Statistics on the interaction request's token usage. */ - public Interaction withOutputAudio(@Nullable AudioContent outputAudio) { - this.outputAudio = outputAudio; + public Interaction withUsage(@Nullable Usage usage) { + this.usage = usage; return this; } /** - * A video content block. + * Message for configuring webhook events for a request. */ - public Interaction withOutputVideo(@Nullable VideoContent outputVideo) { - this.outputVideo = outputVideo; + public Interaction withWebhookConfig(@Nullable WebhookConfig webhookConfig) { + this.webhookConfig = webhookConfig; return this; } @@ -820,158 +820,149 @@ public boolean equals(java.lang.Object o) { } Interaction other = (Interaction) o; return - Utils.enhancedDeepEquals(this.model, other.model) && Utils.enhancedDeepEquals(this.agent, other.agent) && - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.status, other.status) && + Utils.enhancedDeepEquals(this.agentConfig, other.agentConfig) && Utils.enhancedDeepEquals(this.created, other.created) && - Utils.enhancedDeepEquals(this.updated, other.updated) && - Utils.enhancedDeepEquals(this.systemInstruction, other.systemInstruction) && - Utils.enhancedDeepEquals(this.tools, other.tools) && - Utils.enhancedDeepEquals(this.errors, other.errors) && - Utils.enhancedDeepEquals(this.usage, other.usage) && - Utils.enhancedDeepEquals(this.responseModalities, other.responseModalities) && - Utils.enhancedDeepEquals(this.responseMimeType, other.responseMimeType) && - Utils.enhancedDeepEquals(this.previousInteractionId, other.previousInteractionId) && - Utils.enhancedDeepEquals(this.environmentId, other.environmentId) && - Utils.enhancedDeepEquals(this.serviceTier, other.serviceTier) && - Utils.enhancedDeepEquals(this.webhookConfig, other.webhookConfig) && - Utils.enhancedDeepEquals(this.steps, other.steps) && - Utils.enhancedDeepEquals(this.responseFormat, other.responseFormat) && Utils.enhancedDeepEquals(this.environment, other.environment) && + Utils.enhancedDeepEquals(this.environmentId, other.environmentId) && + Utils.enhancedDeepEquals(this.errors, other.errors) && Utils.enhancedDeepEquals(this.generationConfig, other.generationConfig) && - Utils.enhancedDeepEquals(this.agentConfig, other.agentConfig) && - Utils.enhancedDeepEquals(this.safetySettings, other.safetySettings) && - Utils.enhancedDeepEquals(this.labels, other.labels) && + Utils.enhancedDeepEquals(this.id, other.id) && Utils.enhancedDeepEquals(this.input, other.input) && - Utils.enhancedDeepEquals(this.outputText, other.outputText) && - Utils.enhancedDeepEquals(this.outputImage, other.outputImage) && + Utils.enhancedDeepEquals(this.labels, other.labels) && + Utils.enhancedDeepEquals(this.model, other.model) && Utils.enhancedDeepEquals(this.outputAudio, other.outputAudio) && - Utils.enhancedDeepEquals(this.outputVideo, other.outputVideo); + Utils.enhancedDeepEquals(this.outputImage, other.outputImage) && + Utils.enhancedDeepEquals(this.outputText, other.outputText) && + Utils.enhancedDeepEquals(this.outputVideo, other.outputVideo) && + Utils.enhancedDeepEquals(this.previousInteractionId, other.previousInteractionId) && + Utils.enhancedDeepEquals(this.responseFormat, other.responseFormat) && + Utils.enhancedDeepEquals(this.responseMimeType, other.responseMimeType) && + Utils.enhancedDeepEquals(this.responseModalities, other.responseModalities) && + Utils.enhancedDeepEquals(this.safetySettings, other.safetySettings) && + Utils.enhancedDeepEquals(this.serviceTier, other.serviceTier) && + Utils.enhancedDeepEquals(this.status, other.status) && + Utils.enhancedDeepEquals(this.steps, other.steps) && + Utils.enhancedDeepEquals(this.systemInstruction, other.systemInstruction) && + Utils.enhancedDeepEquals(this.tools, other.tools) && + Utils.enhancedDeepEquals(this.updated, other.updated) && + Utils.enhancedDeepEquals(this.usage, other.usage) && + Utils.enhancedDeepEquals(this.webhookConfig, other.webhookConfig); } @Override public int hashCode() { return Utils.enhancedHash( - model, agent, id, - status, created, updated, - systemInstruction, tools, errors, - usage, responseModalities, responseMimeType, - previousInteractionId, environmentId, serviceTier, - webhookConfig, steps, responseFormat, - environment, generationConfig, agentConfig, - safetySettings, labels, input, - outputText, outputImage, outputAudio, - outputVideo); + agent, agentConfig, created, + environment, environmentId, errors, + generationConfig, id, input, + labels, model, outputAudio, + outputImage, outputText, outputVideo, + previousInteractionId, responseFormat, responseMimeType, + responseModalities, safetySettings, serviceTier, + status, steps, systemInstruction, + tools, updated, usage, + webhookConfig); } @Override public String toString() { return Utils.toString(Interaction.class, - "model", model, "agent", agent, - "id", id, - "status", status, + "agentConfig", agentConfig, "created", created, - "updated", updated, - "systemInstruction", systemInstruction, - "tools", tools, - "errors", errors, - "usage", usage, - "responseModalities", responseModalities, - "responseMimeType", responseMimeType, - "previousInteractionId", previousInteractionId, - "environmentId", environmentId, - "serviceTier", serviceTier, - "webhookConfig", webhookConfig, - "steps", steps, - "responseFormat", responseFormat, "environment", environment, + "environmentId", environmentId, + "errors", errors, "generationConfig", generationConfig, - "agentConfig", agentConfig, - "safetySettings", safetySettings, - "labels", labels, + "id", id, "input", input, - "outputText", outputText, - "outputImage", outputImage, + "labels", labels, + "model", model, "outputAudio", outputAudio, - "outputVideo", outputVideo); + "outputImage", outputImage, + "outputText", outputText, + "outputVideo", outputVideo, + "previousInteractionId", previousInteractionId, + "responseFormat", responseFormat, + "responseMimeType", responseMimeType, + "responseModalities", responseModalities, + "safetySettings", safetySettings, + "serviceTier", serviceTier, + "status", status, + "steps", steps, + "systemInstruction", systemInstruction, + "tools", tools, + "updated", updated, + "usage", usage, + "webhookConfig", webhookConfig); } @SuppressWarnings("UnusedReturnValue") public final static class Builder { - private Model model; - private AgentOption agent; - private String id; - - private InteractionStatus status; + private InteractionAgentConfig agentConfig; private String created; - private String updated; - - private String systemInstruction; + private InteractionEnvironment environment; - private List tools; + private String environmentId; private List errors; - private Usage usage; + private GenerationConfig generationConfig; - @Deprecated - private List responseModalities; + private String id; - @Deprecated - private String responseMimeType; + private InteractionsInput input; - private String previousInteractionId; + private Map labels; - private String environmentId; + private Model model; - private ServiceTier serviceTier; + private AudioContent outputAudio; - private WebhookConfig webhookConfig; + private ImageContent outputImage; - private List steps; + private String outputText; - private InteractionResponseFormat responseFormat; + private VideoContent outputVideo; - private InteractionEnvironment environment; + private String previousInteractionId; - private GenerationConfig generationConfig; + private InteractionResponseFormat responseFormat; - private InteractionAgentConfig agentConfig; + @Deprecated + private String responseMimeType; + + @Deprecated + private List responseModalities; private List safetySettings; - private Map labels; + private ServiceTier serviceTier; - private InteractionsInput input; + private InteractionStatus status; - private String outputText; + private List steps; - private ImageContent outputImage; + private String systemInstruction; - private AudioContent outputAudio; + private List tools; - private VideoContent outputVideo; + private String updated; + + private Usage usage; + + private WebhookConfig webhookConfig; private Builder() { // force use of static builder() method } - /** - * The model that will complete your prompt.\n\nSee - * [models](https://ai.google.dev/gemini-api/docs/models) for additional details. - */ - public Builder model(@Nullable Model model) { - this.model = model; - return this; - } - /** * The agent to interact with. */ @@ -981,128 +972,128 @@ public Builder agent(@Nullable AgentOption agent) { } /** - * Required. Output only. A unique identifier for the interaction completion. + * Configuration parameters for the agent interaction. */ - public Builder id(@Nullable String id) { - this.id = id; + public Builder agentConfig(@Nullable InteractionAgentConfig agentConfig) { + this.agentConfig = agentConfig; return this; } /** - * Required. Output only. The status of the interaction. + * Output only. The time at which the response was created in ISO 8601 format + * (YYYY-MM-DDThh:mm:ssZ). */ - public Builder status(@Nonnull InteractionStatus status) { - this.status = Utils.checkNotNull(status, "status"); + public Builder created(@Nullable String created) { + this.created = created; return this; } /** - * Output only. The time at which the response was created in ISO 8601 format - * (YYYY-MM-DDThh:mm:ssZ). + * The environment configuration for the interaction. Can be an object specifying remote environment + * sources or a string referencing an existing environment ID. */ - public Builder created(@Nullable String created) { - this.created = created; + public Builder environment(@Nullable InteractionEnvironment environment) { + this.environment = environment; return this; } /** - * Output only. The time at which the response was last updated in ISO 8601 format - * (YYYY-MM-DDThh:mm:ssZ). + * Output only. The environment ID for the interaction. Only populated if environment + * config is set in the request. */ - public Builder updated(@Nullable String updated) { - this.updated = updated; + public Builder environmentId(@Nullable String environmentId) { + this.environmentId = environmentId; return this; } /** - * System instruction for the interaction. + * Output only. Diagnostic faults / platform errors recorded on the interaction. */ - public Builder systemInstruction(@Nullable String systemInstruction) { - this.systemInstruction = systemInstruction; + public Builder errors(@Nullable List errors) { + this.errors = errors; return this; } /** - * A list of tool declarations the model may call during interaction. + * Configuration parameters for model interactions. */ - public Builder tools(@Nullable List tools) { - this.tools = tools; + public Builder generationConfig(@Nullable GenerationConfig generationConfig) { + this.generationConfig = generationConfig; return this; } /** - * Output only. Diagnostic faults / platform errors recorded on the interaction. + * Required. Output only. A unique identifier for the interaction completion. */ - public Builder errors(@Nullable List errors) { - this.errors = errors; + public Builder id(@Nullable String id) { + this.id = id; return this; } /** - * Statistics on the interaction request's token usage. + * The input for the interaction. */ - public Builder usage(@Nullable Usage usage) { - this.usage = usage; + public Builder input(@Nullable InteractionsInput input) { + this.input = input; return this; } /** - * The requested modalities of the response (TEXT, IMAGE, AUDIO). - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + * The labels with user-defined metadata for the request. */ - @Deprecated - public Builder responseModalities(@Nullable List responseModalities) { - this.responseModalities = responseModalities; + public Builder labels(@Nullable Map labels) { + this.labels = labels; return this; } /** - * The mime type of the response. This is required if response_format is set. - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + * The model that will complete your prompt.\n\nSee + * [models](https://ai.google.dev/gemini-api/docs/models) for additional details. */ - @Deprecated - public Builder responseMimeType(@Nullable String responseMimeType) { - this.responseMimeType = responseMimeType; + public Builder model(@Nullable Model model) { + this.model = model; return this; } /** - * The ID of the previous interaction, if any. + * An audio content block. */ - public Builder previousInteractionId(@Nullable String previousInteractionId) { - this.previousInteractionId = previousInteractionId; + public Builder outputAudio(@Nullable AudioContent outputAudio) { + this.outputAudio = outputAudio; return this; } /** - * Output only. The environment ID for the interaction. Only populated if environment - * config is set in the request. + * An image content block. */ - public Builder environmentId(@Nullable String environmentId) { - this.environmentId = environmentId; + public Builder outputImage(@Nullable ImageContent outputImage) { + this.outputImage = outputImage; return this; } - public Builder serviceTier(@Nullable ServiceTier serviceTier) { - this.serviceTier = serviceTier; + /** + * Concatenated text from the last model output in response to the current request. + * + *

Note: this is added by the SDK. + */ + public Builder outputText(@Nullable String outputText) { + this.outputText = outputText; return this; } /** - * Message for configuring webhook events for a request. + * A video content block. */ - public Builder webhookConfig(@Nullable WebhookConfig webhookConfig) { - this.webhookConfig = webhookConfig; + public Builder outputVideo(@Nullable VideoContent outputVideo) { + this.outputVideo = outputVideo; return this; } /** - * Output only. The steps that make up the interaction, when included in the response. + * The ID of the previous interaction, if any. */ - public Builder steps(@Nullable List steps) { - this.steps = steps; + public Builder previousInteractionId(@Nullable String previousInteractionId) { + this.previousInteractionId = previousInteractionId; return this; } @@ -1116,100 +1107,109 @@ public Builder responseFormat(@Nullable InteractionResponseFormat responseFormat } /** - * The environment configuration for the interaction. Can be an object specifying remote environment - * sources or a string referencing an existing environment ID. + * The mime type of the response. This is required if response_format is set. + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ - public Builder environment(@Nullable InteractionEnvironment environment) { - this.environment = environment; + @Deprecated + public Builder responseMimeType(@Nullable String responseMimeType) { + this.responseMimeType = responseMimeType; return this; } /** - * Configuration parameters for model interactions. + * The requested modalities of the response (TEXT, IMAGE, AUDIO). + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ - public Builder generationConfig(@Nullable GenerationConfig generationConfig) { - this.generationConfig = generationConfig; + @Deprecated + public Builder responseModalities(@Nullable List responseModalities) { + this.responseModalities = responseModalities; return this; } /** - * Configuration parameters for the agent interaction. + * Safety settings for the interaction. */ - public Builder agentConfig(@Nullable InteractionAgentConfig agentConfig) { - this.agentConfig = agentConfig; + public Builder safetySettings(@Nullable List safetySettings) { + this.safetySettings = safetySettings; + return this; + } + + public Builder serviceTier(@Nullable ServiceTier serviceTier) { + this.serviceTier = serviceTier; return this; } /** - * Safety settings for the interaction. + * Required. Output only. The status of the interaction. */ - public Builder safetySettings(@Nullable List safetySettings) { - this.safetySettings = safetySettings; + public Builder status(@Nonnull InteractionStatus status) { + this.status = Utils.checkNotNull(status, "status"); return this; } /** - * The labels with user-defined metadata for the request. + * Output only. The steps that make up the interaction, when included in the response. */ - public Builder labels(@Nullable Map labels) { - this.labels = labels; + public Builder steps(@Nullable List steps) { + this.steps = steps; return this; } /** - * The input for the interaction. + * System instruction for the interaction. */ - public Builder input(@Nullable InteractionsInput input) { - this.input = input; + public Builder systemInstruction(@Nullable String systemInstruction) { + this.systemInstruction = systemInstruction; return this; } /** - * Concatenated text from the last model output in response to the current request. - * - *

Note: this is added by the SDK. + * A list of tool declarations the model may call during interaction. */ - public Builder outputText(@Nullable String outputText) { - this.outputText = outputText; + public Builder tools(@Nullable List tools) { + this.tools = tools; return this; } /** - * An image content block. + * Output only. The time at which the response was last updated in ISO 8601 format + * (YYYY-MM-DDThh:mm:ssZ). */ - public Builder outputImage(@Nullable ImageContent outputImage) { - this.outputImage = outputImage; + public Builder updated(@Nullable String updated) { + this.updated = updated; return this; } /** - * An audio content block. + * Statistics on the interaction request's token usage. */ - public Builder outputAudio(@Nullable AudioContent outputAudio) { - this.outputAudio = outputAudio; + public Builder usage(@Nullable Usage usage) { + this.usage = usage; return this; } /** - * A video content block. + * Message for configuring webhook events for a request. */ - public Builder outputVideo(@Nullable VideoContent outputVideo) { - this.outputVideo = outputVideo; + public Builder webhookConfig(@Nullable WebhookConfig webhookConfig) { + this.webhookConfig = webhookConfig; return this; } public Interaction build() { return new Interaction( - model, agent, id, - status, created, updated, - systemInstruction, tools, errors, - usage, responseModalities, responseMimeType, - previousInteractionId, environmentId, serviceTier, - webhookConfig, steps, responseFormat, - environment, generationConfig, agentConfig, - safetySettings, labels, input, - outputText, outputImage, outputAudio, - outputVideo); + agent, agentConfig, created, + environment, environmentId, errors, + generationConfig, id, input, + labels, model, outputAudio, + outputImage, outputText, outputVideo, + previousInteractionId, responseFormat, responseMimeType, + responseModalities, safetySettings, serviceTier, + status, steps, systemInstruction, + tools, updated, usage, + webhookConfig); } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionAgentConfigTypeIdResolver.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionAgentConfigTypeIdResolver.java index 08c2b016423..65dbe7d2c9e 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionAgentConfigTypeIdResolver.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionAgentConfigTypeIdResolver.java @@ -40,10 +40,10 @@ public InteractionAgentConfigTypeIdResolver() { } private void initializeTypeMap() { - registerType("dynamic", DynamicAgentConfig.class); - registerType("deep-research", DeepResearchAgentConfig.class); - registerType("code-mender", CodeMenderAgentConfig.class); registerType("antigravity", AntigravityAgentConfig.class); + registerType("code-mender", CodeMenderAgentConfig.class); + registerType("deep-research", DeepResearchAgentConfig.class); + registerType("dynamic", DynamicAgentConfig.class); } @Override diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionCompletedEvent.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionCompletedEvent.java index 875426c90bd..09c9c990ec8 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionCompletedEvent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionCompletedEvent.java @@ -34,10 +34,6 @@ public class InteractionCompletedEvent implements InteractionSSEEvent { - - @JsonProperty("event_type") - private String eventType; - /** * The event_id token to be used to resume the interaction stream, from * this event. @@ -46,6 +42,10 @@ public class InteractionCompletedEvent implements InteractionSSEEvent { @JsonProperty("event_id") private String eventId; + + @JsonProperty("event_type") + private String eventType; + /** * Partial interaction resource emitted by interaction lifecycle SSE events. * Streaming lifecycle payloads may omit fields that are only available on @@ -58,8 +58,8 @@ public class InteractionCompletedEvent implements InteractionSSEEvent { public InteractionCompletedEvent( @JsonProperty("event_id") @Nullable String eventId, @JsonProperty("interaction") @Nonnull InteractionSseEventInteraction interaction) { - this.eventType = Builder._SINGLETON_VALUE_EventType.value(); this.eventId = eventId; + this.eventType = Builder._SINGLETON_VALUE_EventType.value(); this.interaction = Optional.ofNullable(interaction) .orElseThrow(() -> new IllegalArgumentException("interaction cannot be null")); } @@ -69,11 +69,6 @@ public InteractionCompletedEvent( this(null, interaction); } - @Override - public String eventType() { - return Utils.discriminatorToString(eventType); - } - /** * The event_id token to be used to resume the interaction stream, from * this event. @@ -82,6 +77,11 @@ public Optional eventId() { return Optional.ofNullable(this.eventId); } + @Override + public String eventType() { + return Utils.discriminatorToString(eventType); + } + /** * Partial interaction resource emitted by interaction lifecycle SSE events. * Streaming lifecycle payloads may omit fields that are only available on @@ -127,22 +127,22 @@ public boolean equals(java.lang.Object o) { } InteractionCompletedEvent other = (InteractionCompletedEvent) o; return - Utils.enhancedDeepEquals(this.eventType, other.eventType) && Utils.enhancedDeepEquals(this.eventId, other.eventId) && + Utils.enhancedDeepEquals(this.eventType, other.eventType) && Utils.enhancedDeepEquals(this.interaction, other.interaction); } @Override public int hashCode() { return Utils.enhancedHash( - eventType, eventId, interaction); + eventId, eventType, interaction); } @Override public String toString() { return Utils.toString(InteractionCompletedEvent.class, - "eventType", eventType, "eventId", eventId, + "eventType", eventType, "interaction", interaction); } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionCreatedEvent.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionCreatedEvent.java index 09883df7044..24539b74e09 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionCreatedEvent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionCreatedEvent.java @@ -34,10 +34,6 @@ public class InteractionCreatedEvent implements InteractionSSEEvent { - - @JsonProperty("event_type") - private String eventType; - /** * The event_id token to be used to resume the interaction stream, from * this event. @@ -46,6 +42,10 @@ public class InteractionCreatedEvent implements InteractionSSEEvent { @JsonProperty("event_id") private String eventId; + + @JsonProperty("event_type") + private String eventType; + /** * Partial interaction resource emitted by interaction lifecycle SSE events. * Streaming lifecycle payloads may omit fields that are only available on @@ -58,8 +58,8 @@ public class InteractionCreatedEvent implements InteractionSSEEvent { public InteractionCreatedEvent( @JsonProperty("event_id") @Nullable String eventId, @JsonProperty("interaction") @Nonnull InteractionSseEventInteraction interaction) { - this.eventType = Builder._SINGLETON_VALUE_EventType.value(); this.eventId = eventId; + this.eventType = Builder._SINGLETON_VALUE_EventType.value(); this.interaction = Optional.ofNullable(interaction) .orElseThrow(() -> new IllegalArgumentException("interaction cannot be null")); } @@ -69,11 +69,6 @@ public InteractionCreatedEvent( this(null, interaction); } - @Override - public String eventType() { - return Utils.discriminatorToString(eventType); - } - /** * The event_id token to be used to resume the interaction stream, from * this event. @@ -82,6 +77,11 @@ public Optional eventId() { return Optional.ofNullable(this.eventId); } + @Override + public String eventType() { + return Utils.discriminatorToString(eventType); + } + /** * Partial interaction resource emitted by interaction lifecycle SSE events. * Streaming lifecycle payloads may omit fields that are only available on @@ -127,22 +127,22 @@ public boolean equals(java.lang.Object o) { } InteractionCreatedEvent other = (InteractionCreatedEvent) o; return - Utils.enhancedDeepEquals(this.eventType, other.eventType) && Utils.enhancedDeepEquals(this.eventId, other.eventId) && + Utils.enhancedDeepEquals(this.eventType, other.eventType) && Utils.enhancedDeepEquals(this.interaction, other.interaction); } @Override public int hashCode() { return Utils.enhancedHash( - eventType, eventId, interaction); + eventId, eventType, interaction); } @Override public String toString() { return Utils.toString(InteractionCreatedEvent.class, - "eventType", eventType, "eventId", eventId, + "eventType", eventType, "interaction", interaction); } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionEnvironment.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionEnvironment.java index 5a27bb344e4..c4d03459867 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionEnvironment.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionEnvironment.java @@ -49,38 +49,38 @@ private InteractionEnvironment(TypedObject value) { this.value = value; } - public static InteractionEnvironment of(String value) { + public static InteractionEnvironment of(Environment value) { Utils.checkNotNull(value, "value"); - return new InteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new InteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); } - public static InteractionEnvironment of(Environment value) { + public static InteractionEnvironment of(String value) { Utils.checkNotNull(value, "value"); - return new InteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new InteractionEnvironment(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); } /** - * Returns an {@link Optional} containing the value if it is of type {@code String}, + * Returns an {@link Optional} containing the value if it is of type {@code Environment}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code String} value, or empty if not of this type + * @return an {@link Optional} containing the {@code Environment} value, or empty if not of this type */ - public Optional string() { - if (value.value() instanceof String) { - return Optional.of((String) value.value()); + public Optional environment() { + if (value.value() instanceof Environment) { + return Optional.of((Environment) value.value()); } return Optional.empty(); } /** - * Returns an {@link Optional} containing the value if it is of type {@code Environment}, + * Returns an {@link Optional} containing the value if it is of type {@code String}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code Environment} value, or empty if not of this type + * @return an {@link Optional} containing the {@code String} value, or empty if not of this type */ - public Optional environment() { - if (value.value() instanceof Environment) { - return Optional.of((Environment) value.value()); + public Optional string() { + if (value.value() instanceof String) { + return Optional.of((String) value.value()); } return Optional.empty(); } @@ -119,8 +119,8 @@ public static final class _Deserializer extends OneOfDeserializer() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionResponseFormat.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionResponseFormat.java index e5fb29b09cb..f629e1ff1c8 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionResponseFormat.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionResponseFormat.java @@ -50,39 +50,39 @@ private InteractionResponseFormat(TypedObject value) { this.value = value; } - public static InteractionResponseFormat of(List value) { + public static InteractionResponseFormat of(ResponseFormat value) { Utils.checkNotNull(value, "value"); - return new InteractionResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + return new InteractionResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); } - public static InteractionResponseFormat of(ResponseFormat value) { + public static InteractionResponseFormat of(List value) { Utils.checkNotNull(value, "value"); - return new InteractionResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new InteractionResponseFormat(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); } /** - * Returns an {@link Optional} containing the value if it is of type {@code List}, + * Returns an {@link Optional} containing the value if it is of type {@code ResponseFormat}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code List} value, or empty if not of this type + * @return an {@link Optional} containing the {@code ResponseFormat} value, or empty if not of this type */ - @SuppressWarnings("unchecked") - public Optional> arrayOfResponseFormat() { - if (value.value() instanceof List) { - return Optional.of((List) value.value()); + public Optional responseFormat() { + if (value.value() instanceof ResponseFormat) { + return Optional.of((ResponseFormat) value.value()); } return Optional.empty(); } /** - * Returns an {@link Optional} containing the value if it is of type {@code ResponseFormat}, + * Returns an {@link Optional} containing the value if it is of type {@code List}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code ResponseFormat} value, or empty if not of this type + * @return an {@link Optional} containing the {@code List} value, or empty if not of this type */ - public Optional responseFormat() { - if (value.value() instanceof ResponseFormat) { - return Optional.of((ResponseFormat) value.value()); + @SuppressWarnings("unchecked") + public Optional> arrayOfResponseFormat() { + if (value.value() instanceof List) { + return Optional.of((List) value.value()); } return Optional.empty(); } @@ -121,8 +121,8 @@ public static final class _Deserializer extends OneOfDeserializer>() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT)); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionSSEEventTypeIdResolver.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionSSEEventTypeIdResolver.java index 0eea3aeac6c..714558db2ea 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionSSEEventTypeIdResolver.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionSSEEventTypeIdResolver.java @@ -35,12 +35,12 @@ public InteractionSSEEventTypeIdResolver() { } private void initializeTypeMap() { - registerType("interaction.created", InteractionCreatedEvent.class); + registerType("error", ErrorEvent.class); registerType("interaction.completed", InteractionCompletedEvent.class); + registerType("interaction.created", InteractionCreatedEvent.class); registerType("interaction.status_update", InteractionStatusUpdate.class); - registerType("error", ErrorEvent.class); - registerType("step.start", StepStart.class); registerType("step.delta", StepDelta.class); + registerType("step.start", StepStart.class); registerType("step.stop", StepStop.class); } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionSseEventInteraction.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionSseEventInteraction.java index caf4c4e5aec..5d05cde28d4 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionSseEventInteraction.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionSseEventInteraction.java @@ -40,17 +40,24 @@ */ public class InteractionSseEventInteraction { /** - * Required. Output only. A unique identifier for the interaction completion. + * The agent to interact with. */ - @JsonProperty("id") - private String id; + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("agent") + private String agent; /** - * Output only. The resource type. + * Output only. The time at which the response was created in ISO 8601 format. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("object") - private String object; + @JsonProperty("created") + private String created; + + /** + * Required. Output only. A unique identifier for the interaction completion. + */ + @JsonProperty("id") + private String id; /** * The model that will complete your prompt. @@ -60,11 +67,16 @@ public class InteractionSseEventInteraction { private String model; /** - * The agent to interact with. + * Output only. The resource type. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("agent") - private String agent; + @JsonProperty("object") + private String object; + + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("service_tier") + private ServiceTier serviceTier; /** * Required. Output only. The status of the interaction. @@ -73,11 +85,11 @@ public class InteractionSseEventInteraction { private InteractionSseEventInteractionStatus status; /** - * Output only. The time at which the response was created in ISO 8601 format. + * Output only. The steps that make up the interaction, if included in this event. */ @JsonInclude(Include.NON_ABSENT) - @JsonProperty("created") - private String created; + @JsonProperty("steps") + private List steps; /** * Output only. The time at which the response was last updated in ISO 8601 format. @@ -86,11 +98,6 @@ public class InteractionSseEventInteraction { @JsonProperty("updated") private String updated; - - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("service_tier") - private ServiceTier serviceTier; - /** * Statistics on the interaction request's token usage. */ @@ -98,60 +105,60 @@ public class InteractionSseEventInteraction { @JsonProperty("usage") private Usage usage; - /** - * Output only. The steps that make up the interaction, if included in this event. - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("steps") - private List steps; - @JsonCreator public InteractionSseEventInteraction( + @JsonProperty("agent") @Nullable String agent, + @JsonProperty("created") @Nullable String created, @JsonProperty("id") @Nonnull String id, - @JsonProperty("object") @Nullable String object, @JsonProperty("model") @Nullable String model, - @JsonProperty("agent") @Nullable String agent, + @JsonProperty("object") @Nullable String object, + @JsonProperty("service_tier") @Nullable ServiceTier serviceTier, @JsonProperty("status") @Nonnull InteractionSseEventInteractionStatus status, - @JsonProperty("created") @Nullable String created, + @JsonProperty("steps") @Nullable List steps, @JsonProperty("updated") @Nullable String updated, - @JsonProperty("service_tier") @Nullable ServiceTier serviceTier, - @JsonProperty("usage") @Nullable Usage usage, - @JsonProperty("steps") @Nullable List steps) { + @JsonProperty("usage") @Nullable Usage usage) { + this.agent = agent; + this.created = created; this.id = Optional.ofNullable(id) .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); - this.object = object; this.model = model; - this.agent = agent; + this.object = object; + this.serviceTier = serviceTier; this.status = Optional.ofNullable(status) .orElseThrow(() -> new IllegalArgumentException("status cannot be null")); - this.created = created; + this.steps = steps; this.updated = updated; - this.serviceTier = serviceTier; this.usage = usage; - this.steps = steps; } public InteractionSseEventInteraction( @Nonnull String id, @Nonnull InteractionSseEventInteractionStatus status) { - this(id, null, null, - null, status, null, + this(null, null, id, null, null, null, + status, null, null, null); } /** - * Required. Output only. A unique identifier for the interaction completion. + * The agent to interact with. */ - public Optional id() { - return Optional.ofNullable(this.id); + public Optional agent() { + return Optional.ofNullable(this.agent); } /** - * Output only. The resource type. + * Output only. The time at which the response was created in ISO 8601 format. */ - public Optional object() { - return Optional.ofNullable(this.object); + public Optional created() { + return Optional.ofNullable(this.created); + } + + /** + * Required. Output only. A unique identifier for the interaction completion. + */ + public Optional id() { + return Optional.ofNullable(this.id); } /** @@ -162,10 +169,14 @@ public Optional model() { } /** - * The agent to interact with. + * Output only. The resource type. */ - public Optional agent() { - return Optional.ofNullable(this.agent); + public Optional object() { + return Optional.ofNullable(this.object); + } + + public Optional serviceTier() { + return Optional.ofNullable(this.serviceTier); } /** @@ -176,10 +187,10 @@ public Optional status() { } /** - * Output only. The time at which the response was created in ISO 8601 format. + * Output only. The steps that make up the interaction, if included in this event. */ - public Optional created() { - return Optional.ofNullable(this.created); + public Optional> steps() { + return Optional.ofNullable(this.steps); } /** @@ -189,10 +200,6 @@ public Optional updated() { return Optional.ofNullable(this.updated); } - public Optional serviceTier() { - return Optional.ofNullable(this.serviceTier); - } - /** * Statistics on the interaction request's token usage. */ @@ -200,32 +207,34 @@ public Optional usage() { return Optional.ofNullable(this.usage); } - /** - * Output only. The steps that make up the interaction, if included in this event. - */ - public Optional> steps() { - return Optional.ofNullable(this.steps); - } - public static Builder builder() { return new Builder(); } /** - * Required. Output only. A unique identifier for the interaction completion. + * The agent to interact with. */ - public InteractionSseEventInteraction withId(@Nonnull String id) { - this.id = Utils.checkNotNull(id, "id"); + public InteractionSseEventInteraction withAgent(@Nullable String agent) { + this.agent = agent; return this; } /** - * Output only. The resource type. + * Output only. The time at which the response was created in ISO 8601 format. */ - public InteractionSseEventInteraction withObject(@Nullable String object) { - this.object = object; + public InteractionSseEventInteraction withCreated(@Nullable String created) { + this.created = created; + return this; + } + + + /** + * Required. Output only. A unique identifier for the interaction completion. + */ + public InteractionSseEventInteraction withId(@Nonnull String id) { + this.id = Utils.checkNotNull(id, "id"); return this; } @@ -240,10 +249,16 @@ public InteractionSseEventInteraction withModel(@Nullable String model) { /** - * The agent to interact with. + * Output only. The resource type. */ - public InteractionSseEventInteraction withAgent(@Nullable String agent) { - this.agent = agent; + public InteractionSseEventInteraction withObject(@Nullable String object) { + this.object = object; + return this; + } + + + public InteractionSseEventInteraction withServiceTier(@Nullable ServiceTier serviceTier) { + this.serviceTier = serviceTier; return this; } @@ -258,10 +273,10 @@ public InteractionSseEventInteraction withStatus(@Nonnull InteractionSseEventInt /** - * Output only. The time at which the response was created in ISO 8601 format. + * Output only. The steps that make up the interaction, if included in this event. */ - public InteractionSseEventInteraction withCreated(@Nullable String created) { - this.created = created; + public InteractionSseEventInteraction withSteps(@Nullable List steps) { + this.steps = steps; return this; } @@ -275,12 +290,6 @@ public InteractionSseEventInteraction withUpdated(@Nullable String updated) { } - public InteractionSseEventInteraction withServiceTier(@Nullable ServiceTier serviceTier) { - this.serviceTier = serviceTier; - return this; - } - - /** * Statistics on the interaction request's token usage. */ @@ -290,15 +299,6 @@ public InteractionSseEventInteraction withUsage(@Nullable Usage usage) { } - /** - * Output only. The steps that make up the interaction, if included in this event. - */ - public InteractionSseEventInteraction withSteps(@Nullable List steps) { - this.steps = steps; - return this; - } - - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -309,82 +309,90 @@ public boolean equals(java.lang.Object o) { } InteractionSseEventInteraction other = (InteractionSseEventInteraction) o; return + Utils.enhancedDeepEquals(this.agent, other.agent) && + Utils.enhancedDeepEquals(this.created, other.created) && Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.object, other.object) && Utils.enhancedDeepEquals(this.model, other.model) && - Utils.enhancedDeepEquals(this.agent, other.agent) && + Utils.enhancedDeepEquals(this.object, other.object) && + Utils.enhancedDeepEquals(this.serviceTier, other.serviceTier) && Utils.enhancedDeepEquals(this.status, other.status) && - Utils.enhancedDeepEquals(this.created, other.created) && + Utils.enhancedDeepEquals(this.steps, other.steps) && Utils.enhancedDeepEquals(this.updated, other.updated) && - Utils.enhancedDeepEquals(this.serviceTier, other.serviceTier) && - Utils.enhancedDeepEquals(this.usage, other.usage) && - Utils.enhancedDeepEquals(this.steps, other.steps); + Utils.enhancedDeepEquals(this.usage, other.usage); } @Override public int hashCode() { return Utils.enhancedHash( - id, object, model, - agent, status, created, - updated, serviceTier, usage, - steps); + agent, created, id, + model, object, serviceTier, + status, steps, updated, + usage); } @Override public String toString() { return Utils.toString(InteractionSseEventInteraction.class, + "agent", agent, + "created", created, "id", id, - "object", object, "model", model, - "agent", agent, + "object", object, + "serviceTier", serviceTier, "status", status, - "created", created, + "steps", steps, "updated", updated, - "serviceTier", serviceTier, - "usage", usage, - "steps", steps); + "usage", usage); } @SuppressWarnings("UnusedReturnValue") public final static class Builder { - private String id; + private String agent; - private String object; + private String created; + + private String id; private String model; - private String agent; + private String object; + + private ServiceTier serviceTier; private InteractionSseEventInteractionStatus status; - private String created; + private List steps; private String updated; - private ServiceTier serviceTier; - private Usage usage; - private List steps; - private Builder() { // force use of static builder() method } /** - * Required. Output only. A unique identifier for the interaction completion. + * The agent to interact with. */ - public Builder id(@Nonnull String id) { - this.id = Utils.checkNotNull(id, "id"); + public Builder agent(@Nullable String agent) { + this.agent = agent; return this; } /** - * Output only. The resource type. + * Output only. The time at which the response was created in ISO 8601 format. */ - public Builder object(@Nullable String object) { - this.object = object; + public Builder created(@Nullable String created) { + this.created = created; + return this; + } + + /** + * Required. Output only. A unique identifier for the interaction completion. + */ + public Builder id(@Nonnull String id) { + this.id = Utils.checkNotNull(id, "id"); return this; } @@ -397,10 +405,15 @@ public Builder model(@Nullable String model) { } /** - * The agent to interact with. + * Output only. The resource type. */ - public Builder agent(@Nullable String agent) { - this.agent = agent; + public Builder object(@Nullable String object) { + this.object = object; + return this; + } + + public Builder serviceTier(@Nullable ServiceTier serviceTier) { + this.serviceTier = serviceTier; return this; } @@ -413,10 +426,10 @@ public Builder status(@Nonnull InteractionSseEventInteractionStatus status) { } /** - * Output only. The time at which the response was created in ISO 8601 format. + * Output only. The steps that make up the interaction, if included in this event. */ - public Builder created(@Nullable String created) { - this.created = created; + public Builder steps(@Nullable List steps) { + this.steps = steps; return this; } @@ -428,11 +441,6 @@ public Builder updated(@Nullable String updated) { return this; } - public Builder serviceTier(@Nullable ServiceTier serviceTier) { - this.serviceTier = serviceTier; - return this; - } - /** * Statistics on the interaction request's token usage. */ @@ -441,20 +449,12 @@ public Builder usage(@Nullable Usage usage) { return this; } - /** - * Output only. The steps that make up the interaction, if included in this event. - */ - public Builder steps(@Nullable List steps) { - this.steps = steps; - return this; - } - public InteractionSseEventInteraction build() { return new InteractionSseEventInteraction( - id, object, model, - agent, status, created, - updated, serviceTier, usage, - steps); + agent, created, id, + model, object, serviceTier, + status, steps, updated, + usage); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/InteractionsInput.java b/src/main/java/com/google/genai/gaos/models/interactions/InteractionsInput.java index 9baeca4aa82..4c3583e6a31 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/InteractionsInput.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/InteractionsInput.java @@ -49,9 +49,9 @@ private InteractionsInput(TypedObject value) { this.value = value; } - public static InteractionsInput of(String value) { + public static InteractionsInput of(Content value) { Utils.checkNotNull(value, "value"); - return new InteractionsInput(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new InteractionsInput(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); } public static InteractionsInput ofStep(List value) { @@ -64,20 +64,20 @@ public static InteractionsInput ofContent(List value) { return new InteractionsInput(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); } - public static InteractionsInput of(Content value) { + public static InteractionsInput of(String value) { Utils.checkNotNull(value, "value"); - return new InteractionsInput(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new InteractionsInput(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); } /** - * Returns an {@link Optional} containing the value if it is of type {@code String}, + * Returns an {@link Optional} containing the value if it is of type {@code Content}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code String} value, or empty if not of this type + * @return an {@link Optional} containing the {@code Content} value, or empty if not of this type */ - public Optional string() { - if (value.value() instanceof String) { - return Optional.of((String) value.value()); + public Optional content() { + if (value.value() instanceof Content) { + return Optional.of((Content) value.value()); } return Optional.empty(); } @@ -111,14 +111,14 @@ public Optional> arrayOfContent() { } /** - * Returns an {@link Optional} containing the value if it is of type {@code Content}, + * Returns an {@link Optional} containing the value if it is of type {@code String}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code Content} value, or empty if not of this type + * @return an {@link Optional} containing the {@code String} value, or empty if not of this type */ - public Optional content() { - if (value.value() instanceof Content) { - return Optional.of((Content) value.value()); + public Optional string() { + if (value.value() instanceof String) { + return Optional.of((String) value.value()); } return Optional.empty(); } @@ -157,10 +157,10 @@ public static final class _Deserializer extends OneOfDeserializer() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/MCPServer.java b/src/main/java/com/google/genai/gaos/models/interactions/MCPServer.java index f0b55db24c5..6661bb7c319 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/MCPServer.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/MCPServer.java @@ -39,7 +39,7 @@ * *

A MCPServer is a server that can be called by the model to perform actions. */ -public class MCPServer implements Tool, AgentTool { +public class MCPServer implements AgentTool, Tool { /** * The allowed tools. */ diff --git a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultDeltaResultUnion.java b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultDeltaResultUnion.java index 1c53921d13c..e081bfc1f2e 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultDeltaResultUnion.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultDeltaResultUnion.java @@ -44,14 +44,14 @@ private MCPServerToolResultDeltaResultUnion(TypedObject value) { this.value = value; } - public static MCPServerToolResultDeltaResultUnion of(MCPServerToolResultDeltaResult value) { + public static MCPServerToolResultDeltaResultUnion of(List value) { Utils.checkNotNull(value, "value"); - return new MCPServerToolResultDeltaResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new MCPServerToolResultDeltaResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); } - public static MCPServerToolResultDeltaResultUnion of(List value) { + public static MCPServerToolResultDeltaResultUnion of(MCPServerToolResultDeltaResult value) { Utils.checkNotNull(value, "value"); - return new MCPServerToolResultDeltaResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + return new MCPServerToolResultDeltaResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); } public static MCPServerToolResultDeltaResultUnion of(String value) { @@ -60,28 +60,28 @@ public static MCPServerToolResultDeltaResultUnion of(String value) { } /** - * Returns an {@link Optional} containing the value if it is of type {@code MCPServerToolResultDeltaResult}, + * Returns an {@link Optional} containing the value if it is of type {@code List}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code MCPServerToolResultDeltaResult} value, or empty if not of this type + * @return an {@link Optional} containing the {@code List} value, or empty if not of this type */ - public Optional mcpServerToolResultDeltaResult() { - if (value.value() instanceof MCPServerToolResultDeltaResult) { - return Optional.of((MCPServerToolResultDeltaResult) value.value()); + @SuppressWarnings("unchecked") + public Optional> arrayOfFunctionResultSubcontent() { + if (value.value() instanceof List) { + return Optional.of((List) value.value()); } return Optional.empty(); } /** - * Returns an {@link Optional} containing the value if it is of type {@code List}, + * Returns an {@link Optional} containing the value if it is of type {@code MCPServerToolResultDeltaResult}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code List} value, or empty if not of this type + * @return an {@link Optional} containing the {@code MCPServerToolResultDeltaResult} value, or empty if not of this type */ - @SuppressWarnings("unchecked") - public Optional> arrayOfFunctionResultSubcontent() { - if (value.value() instanceof List) { - return Optional.of((List) value.value()); + public Optional mcpServerToolResultDeltaResult() { + if (value.value() instanceof MCPServerToolResultDeltaResult) { + return Optional.of((MCPServerToolResultDeltaResult) value.value()); } return Optional.empty(); } @@ -133,8 +133,8 @@ public static final class _Deserializer extends OneOfDeserializer() {}, JsonShape.DEFAULT), TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultStepResultUnion.java b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultStepResultUnion.java index 70aa7daa0e2..6822cf88e90 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultStepResultUnion.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/MCPServerToolResultStepResultUnion.java @@ -49,6 +49,11 @@ private MCPServerToolResultStepResultUnion(TypedObject value) { this.value = value; } + public static MCPServerToolResultStepResultUnion of(List value) { + Utils.checkNotNull(value, "value"); + return new MCPServerToolResultStepResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + } + public static MCPServerToolResultStepResultUnion of(MCPServerToolResultStepResult value) { Utils.checkNotNull(value, "value"); return new MCPServerToolResultStepResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); @@ -58,10 +63,19 @@ public static MCPServerToolResultStepResultUnion of(String value) { Utils.checkNotNull(value, "value"); return new MCPServerToolResultStepResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); } - - public static MCPServerToolResultStepResultUnion of(List value) { - Utils.checkNotNull(value, "value"); - return new MCPServerToolResultStepResultUnion(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + + /** + * Returns an {@link Optional} containing the value if it is of type {@code List}, + * otherwise returns an empty {@link Optional}. + * + * @return an {@link Optional} containing the {@code List} value, or empty if not of this type + */ + @SuppressWarnings("unchecked") + public Optional> arrayOfFunctionResultSubcontent() { + if (value.value() instanceof List) { + return Optional.of((List) value.value()); + } + return Optional.empty(); } /** @@ -89,20 +103,6 @@ public Optional string() { } return Optional.empty(); } - - /** - * Returns an {@link Optional} containing the value if it is of type {@code List}, - * otherwise returns an empty {@link Optional}. - * - * @return an {@link Optional} containing the {@code List} value, or empty if not of this type - */ - @SuppressWarnings("unchecked") - public Optional> arrayOfFunctionResultSubcontent() { - if (value.value() instanceof List) { - return Optional.of((List) value.value()); - } - return Optional.empty(); - } /** * Returns an {@link Optional} containing the value as a {@code JsonNode}. * This accessor returns the raw JSON when the value doesn't match any of the defined union types. @@ -138,9 +138,9 @@ public static final class _Deserializer extends OneOfDeserializer>() {}, JsonShape.DEFAULT), TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/StepTypeIdResolver.java b/src/main/java/com/google/genai/gaos/models/interactions/StepTypeIdResolver.java index 7af5bf920a2..ea0eab3c3d4 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/StepTypeIdResolver.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/StepTypeIdResolver.java @@ -40,23 +40,23 @@ public StepTypeIdResolver() { } private void initializeTypeMap() { - registerType("user_input", UserInputStep.class); - registerType("model_output", ModelOutputStep.class); - registerType("thought", ThoughtStep.class); - registerType("function_call", FunctionCallStep.class); registerType("code_execution_call", CodeExecutionCallStep.class); - registerType("url_context_call", URLContextCallStep.class); - registerType("mcp_server_tool_call", MCPServerToolCallStep.class); - registerType("google_search_call", GoogleSearchCallStep.class); + registerType("code_execution_result", CodeExecutionResultStep.class); registerType("file_search_call", FileSearchCallStep.class); - registerType("google_maps_call", GoogleMapsCallStep.class); + registerType("file_search_result", FileSearchResultStep.class); + registerType("function_call", FunctionCallStep.class); registerType("function_result", FunctionResultStep.class); - registerType("code_execution_result", CodeExecutionResultStep.class); - registerType("url_context_result", URLContextResultStep.class); + registerType("google_maps_call", GoogleMapsCallStep.class); + registerType("google_maps_result", GoogleMapsResultStep.class); + registerType("google_search_call", GoogleSearchCallStep.class); registerType("google_search_result", GoogleSearchResultStep.class); + registerType("mcp_server_tool_call", MCPServerToolCallStep.class); registerType("mcp_server_tool_result", MCPServerToolResultStep.class); - registerType("file_search_result", FileSearchResultStep.class); - registerType("google_maps_result", GoogleMapsResultStep.class); + registerType("model_output", ModelOutputStep.class); + registerType("thought", ThoughtStep.class); + registerType("url_context_call", URLContextCallStep.class); + registerType("url_context_result", URLContextResultStep.class); + registerType("user_input", UserInputStep.class); } @Override diff --git a/src/main/java/com/google/genai/gaos/models/interactions/TextContent.java b/src/main/java/com/google/genai/gaos/models/interactions/TextContent.java index 93ec66c0b8e..ddc4ca943ea 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/TextContent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/TextContent.java @@ -38,7 +38,7 @@ * *

A text content block. */ -public class TextContent implements Content, ThoughtSummaryContent, FunctionResultSubcontent { +public class TextContent implements FunctionResultSubcontent, Content, ThoughtSummaryContent { /** * Citation information for model-generated content. */ diff --git a/src/main/java/com/google/genai/gaos/models/interactions/TranscriptionConfig.java b/src/main/java/com/google/genai/gaos/models/interactions/TranscriptionConfig.java index e9020c936a9..e82e30d3540 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/TranscriptionConfig.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/TranscriptionConfig.java @@ -70,15 +70,6 @@ public class TranscriptionConfig { @JsonProperty("language_codes") private List languageCodes; - /** - * Configures transcription mode. Supported values: `VERBATIM`, `SMART`. If - * unspecified, defaults to `VERBATIM` transcription. Mutually exclusive with - * `timestamp_granularities` and `diarization_mode`. - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("mode") - private TranscriptionMode mode; - /** * Optional. The granularity of timestamps to include in the transcription output. * Supported values: "word". If empty, no timestamps are generated. @@ -93,19 +84,17 @@ public TranscriptionConfig( @JsonProperty("custom_vocabulary") @Nullable List customVocabulary, @JsonProperty("diarization_mode") @Nullable String diarizationMode, @JsonProperty("language_codes") @Nullable List languageCodes, - @JsonProperty("mode") @Nullable TranscriptionMode mode, @JsonProperty("timestamp_granularities") @Nullable List timestampGranularities) { this.adaptationPhrases = adaptationPhrases; this.customVocabulary = customVocabulary; this.diarizationMode = diarizationMode; this.languageCodes = languageCodes; - this.mode = mode; this.timestampGranularities = timestampGranularities; } public TranscriptionConfig() { this(null, null, null, - null, null, null); + null, null); } /** @@ -141,15 +130,6 @@ public Optional> languageCodes() { return Optional.ofNullable(this.languageCodes); } - /** - * Configures transcription mode. Supported values: `VERBATIM`, `SMART`. If - * unspecified, defaults to `VERBATIM` transcription. Mutually exclusive with - * `timestamp_granularities` and `diarization_mode`. - */ - public Optional mode() { - return Optional.ofNullable(this.mode); - } - /** * Optional. The granularity of timestamps to include in the transcription output. * Supported values: "word". If empty, no timestamps are generated. @@ -204,17 +184,6 @@ public TranscriptionConfig withLanguageCodes(@Nullable List languageCode } - /** - * Configures transcription mode. Supported values: `VERBATIM`, `SMART`. If - * unspecified, defaults to `VERBATIM` transcription. Mutually exclusive with - * `timestamp_granularities` and `diarization_mode`. - */ - public TranscriptionConfig withMode(@Nullable TranscriptionMode mode) { - this.mode = mode; - return this; - } - - /** * Optional. The granularity of timestamps to include in the transcription output. * Supported values: "word". If empty, no timestamps are generated. @@ -239,7 +208,6 @@ public boolean equals(java.lang.Object o) { Utils.enhancedDeepEquals(this.customVocabulary, other.customVocabulary) && Utils.enhancedDeepEquals(this.diarizationMode, other.diarizationMode) && Utils.enhancedDeepEquals(this.languageCodes, other.languageCodes) && - Utils.enhancedDeepEquals(this.mode, other.mode) && Utils.enhancedDeepEquals(this.timestampGranularities, other.timestampGranularities); } @@ -247,7 +215,7 @@ public boolean equals(java.lang.Object o) { public int hashCode() { return Utils.enhancedHash( adaptationPhrases, customVocabulary, diarizationMode, - languageCodes, mode, timestampGranularities); + languageCodes, timestampGranularities); } @Override @@ -257,7 +225,6 @@ public String toString() { "customVocabulary", customVocabulary, "diarizationMode", diarizationMode, "languageCodes", languageCodes, - "mode", mode, "timestampGranularities", timestampGranularities); } @@ -273,8 +240,6 @@ public final static class Builder { private List languageCodes; - private TranscriptionMode mode; - private List timestampGranularities; private Builder() { @@ -318,16 +283,6 @@ public Builder languageCodes(@Nullable List languageCodes) { return this; } - /** - * Configures transcription mode. Supported values: `VERBATIM`, `SMART`. If - * unspecified, defaults to `VERBATIM` transcription. Mutually exclusive with - * `timestamp_granularities` and `diarization_mode`. - */ - public Builder mode(@Nullable TranscriptionMode mode) { - this.mode = mode; - return this; - } - /** * Optional. The granularity of timestamps to include in the transcription output. * Supported values: "word". If empty, no timestamps are generated. @@ -340,7 +295,7 @@ public Builder timestampGranularities(@Nullable List timestampGranularit public TranscriptionConfig build() { return new TranscriptionConfig( adaptationPhrases, customVocabulary, diarizationMode, - languageCodes, mode, timestampGranularities); + languageCodes, timestampGranularities); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/TranscriptionMode.java b/src/main/java/com/google/genai/gaos/models/interactions/TranscriptionMode.java deleted file mode 100644 index bd062fde8d2..00000000000 --- a/src/main/java/com/google/genai/gaos/models/interactions/TranscriptionMode.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2026 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ -package com.google.genai.gaos.models.interactions; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import java.lang.Override; -import java.lang.String; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -/** - * Wrapper for an "open" enum that can handle unknown values from API responses - * without runtime errors. Instances are immutable singletons with reference equality. - * Use {@code asEnum()} for switch expressions. - */ -/** - * TranscriptionMode - * - *

Configures transcription mode. Supported values: `VERBATIM`, `SMART`. If - * unspecified, defaults to `VERBATIM` transcription. Mutually exclusive with - * `timestamp_granularities` and `diarization_mode`. - */ -public class TranscriptionMode { - - public static final TranscriptionMode VERBATIM = new TranscriptionMode("verbatim"); - public static final TranscriptionMode SMART = new TranscriptionMode("smart"); - - // This map will grow whenever a Color gets created with a new - // unrecognized value (a potential memory leak if the user is not - // careful). Keep this field lower case to avoid clashing with - // generated member names which will always be upper cased (Java - // convention) - private static final Map values = createValuesMap(); - private static final Map enums = createEnumsMap(); - - private final String value; - - private TranscriptionMode(String value) { - this.value = value; - } - - /** - * Returns a TranscriptionMode with the given value. For a specific value the - * returned object will always be a singleton so reference equality - * is satisfied when the values are the same. - * - * @param value value to be wrapped as TranscriptionMode - */ - @JsonCreator - public static TranscriptionMode of(String value) { - synchronized (TranscriptionMode.class) { - return values.computeIfAbsent(value, v -> new TranscriptionMode(v)); - } - } - - @JsonValue - public String value() { - return value; - } - - public Optional asEnum() { - return Optional.ofNullable(enums.getOrDefault(value, null)); - } - - public boolean isKnown() { - return asEnum().isPresent(); - } - - @Override - public int hashCode() { - return Objects.hash(value); - } - - @Override - public boolean equals(java.lang.Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - TranscriptionMode other = (TranscriptionMode) obj; - return Objects.equals(value, other.value); - } - - @Override - public String toString() { - return "TranscriptionMode [value=" + value + "]"; - } - - // return an array just like an enum - public static TranscriptionMode[] values() { - synchronized (TranscriptionMode.class) { - return values.values().toArray(new TranscriptionMode[] {}); - } - } - - private static final Map createValuesMap() { - Map map = new LinkedHashMap<>(); - map.put("verbatim", VERBATIM); - map.put("smart", SMART); - return map; - } - - private static final Map createEnumsMap() { - Map map = new HashMap<>(); - map.put("verbatim", TranscriptionModeEnum.VERBATIM); - map.put("smart", TranscriptionModeEnum.SMART); - return map; - } - - - public enum TranscriptionModeEnum { - - VERBATIM("verbatim"), - SMART("smart"),; - - private final String value; - - private TranscriptionModeEnum(String value) { - this.value = value; - } - - public String value() { - return value; - } - } -} - diff --git a/src/main/java/com/google/genai/gaos/models/interactions/Transform.java b/src/main/java/com/google/genai/gaos/models/interactions/Transform.java index 028c0a3e168..c6c98f917be 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/Transform.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/Transform.java @@ -51,40 +51,40 @@ private Transform(TypedObject value) { this.value = value; } - public static Transform of(Map value) { + public static Transform of(List> value) { Utils.checkNotNull(value, "value"); - return new Transform(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); + return new Transform(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>>(){})); } - public static Transform of(List> value) { + public static Transform of(Map value) { Utils.checkNotNull(value, "value"); - return new Transform(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>>(){})); + return new Transform(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference>(){})); } /** - * Returns an {@link Optional} containing the value if it is of type {@code Map}, + * Returns an {@link Optional} containing the value if it is of type {@code List>}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code Map} value, or empty if not of this type + * @return an {@link Optional} containing the {@code List>} value, or empty if not of this type */ @SuppressWarnings("unchecked") - public Optional> mapOfString() { - if (value.value() instanceof Map) { - return Optional.of((Map) value.value()); + public Optional>> arrayOfMap() { + if (value.value() instanceof List) { + return Optional.of((List>) value.value()); } return Optional.empty(); } /** - * Returns an {@link Optional} containing the value if it is of type {@code List>}, + * Returns an {@link Optional} containing the value if it is of type {@code Map}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code List>} value, or empty if not of this type + * @return an {@link Optional} containing the {@code Map} value, or empty if not of this type */ @SuppressWarnings("unchecked") - public Optional>> arrayOfMap() { - if (value.value() instanceof List) { - return Optional.of((List>) value.value()); + public Optional> mapOfString() { + if (value.value() instanceof Map) { + return Optional.of((Map) value.value()); } return Optional.empty(); } @@ -123,8 +123,8 @@ public static final class _Deserializer extends OneOfDeserializer { public _Deserializer() { super(Transform.class, false, - TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference>>() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference>>() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference>() {}, JsonShape.DEFAULT)); } } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/URLContext.java b/src/main/java/com/google/genai/gaos/models/interactions/URLContext.java index ed2e487317f..02f32f73344 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/URLContext.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/URLContext.java @@ -33,7 +33,7 @@ * *

A tool that can be used by the model to fetch URL context. */ -public class URLContext implements Tool, AgentTool { +public class URLContext implements AgentTool, Tool { @JsonProperty("type") private String type; diff --git a/src/main/java/com/google/genai/gaos/models/interactions/VideoContent.java b/src/main/java/com/google/genai/gaos/models/interactions/VideoContent.java index 40608bf2f73..08982d6f5c4 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/VideoContent.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/VideoContent.java @@ -44,6 +44,13 @@ public class VideoContent implements Content { @JsonProperty("data") private String data; + /** + * The mime type of the video. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("mime_type") + private VideoContentMimeType mimeType; + /** * How the model processes this video for understanding. */ @@ -67,26 +74,19 @@ public class VideoContent implements Content { @JsonProperty("uri") private String uri; - /** - * The mime type of the video. - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("mime_type") - private VideoContentMimeType mimeType; - @JsonCreator public VideoContent( @JsonProperty("data") @Nullable String data, + @JsonProperty("mime_type") @Nullable VideoContentMimeType mimeType, @JsonProperty("processing") @Nullable Processing processing, @JsonProperty("resolution") @Nullable MediaResolution resolution, - @JsonProperty("uri") @Nullable String uri, - @JsonProperty("mime_type") @Nullable VideoContentMimeType mimeType) { + @JsonProperty("uri") @Nullable String uri) { this.data = data; + this.mimeType = mimeType; this.processing = processing; this.resolution = resolution; this.type = Builder._SINGLETON_VALUE_Type.value(); this.uri = uri; - this.mimeType = mimeType; } public VideoContent() { @@ -101,6 +101,13 @@ public Optional data() { return Optional.ofNullable(this.data); } + /** + * The mime type of the video. + */ + public Optional mimeType() { + return Optional.ofNullable(this.mimeType); + } + /** * How the model processes this video for understanding. */ @@ -124,13 +131,6 @@ public Optional uri() { return Optional.ofNullable(this.uri); } - /** - * The mime type of the video. - */ - public Optional mimeType() { - return Optional.ofNullable(this.mimeType); - } - public static Builder builder() { return new Builder(); } @@ -145,6 +145,15 @@ public VideoContent withData(@Nullable String data) { } + /** + * The mime type of the video. + */ + public VideoContent withMimeType(@Nullable VideoContentMimeType mimeType) { + this.mimeType = mimeType; + return this; + } + + /** * How the model processes this video for understanding. */ @@ -169,15 +178,6 @@ public VideoContent withUri(@Nullable String uri) { } - /** - * The mime type of the video. - */ - public VideoContent withMimeType(@Nullable VideoContentMimeType mimeType) { - this.mimeType = mimeType; - return this; - } - - @Override public boolean equals(java.lang.Object o) { if (this == o) { @@ -189,29 +189,29 @@ public boolean equals(java.lang.Object o) { VideoContent other = (VideoContent) o; return Utils.enhancedDeepEquals(this.data, other.data) && + Utils.enhancedDeepEquals(this.mimeType, other.mimeType) && Utils.enhancedDeepEquals(this.processing, other.processing) && Utils.enhancedDeepEquals(this.resolution, other.resolution) && Utils.enhancedDeepEquals(this.type, other.type) && - Utils.enhancedDeepEquals(this.uri, other.uri) && - Utils.enhancedDeepEquals(this.mimeType, other.mimeType); + Utils.enhancedDeepEquals(this.uri, other.uri); } @Override public int hashCode() { return Utils.enhancedHash( - data, processing, resolution, - type, uri, mimeType); + data, mimeType, processing, + resolution, type, uri); } @Override public String toString() { return Utils.toString(VideoContent.class, "data", data, + "mimeType", mimeType, "processing", processing, "resolution", resolution, "type", type, - "uri", uri, - "mimeType", mimeType); + "uri", uri); } @SuppressWarnings("UnusedReturnValue") @@ -219,14 +219,14 @@ public final static class Builder { private String data; + private VideoContentMimeType mimeType; + private Processing processing; private MediaResolution resolution; private String uri; - private VideoContentMimeType mimeType; - private Builder() { // force use of static builder() method } @@ -239,6 +239,14 @@ public Builder data(@Nullable String data) { return this; } + /** + * The mime type of the video. + */ + public Builder mimeType(@Nullable VideoContentMimeType mimeType) { + this.mimeType = mimeType; + return this; + } + /** * How the model processes this video for understanding. */ @@ -260,18 +268,10 @@ public Builder uri(@Nullable String uri) { return this; } - /** - * The mime type of the video. - */ - public Builder mimeType(@Nullable VideoContentMimeType mimeType) { - this.mimeType = mimeType; - return this; - } - public VideoContent build() { return new VideoContent( - data, processing, resolution, - uri, mimeType); + data, mimeType, processing, + resolution, uri); } diff --git a/src/main/java/com/google/genai/gaos/models/interactions/VideoDeltaMimeType.java b/src/main/java/com/google/genai/gaos/models/interactions/VideoDeltaMimeType.java index 3516fe60aeb..5b194730cd0 100644 --- a/src/main/java/com/google/genai/gaos/models/interactions/VideoDeltaMimeType.java +++ b/src/main/java/com/google/genai/gaos/models/interactions/VideoDeltaMimeType.java @@ -45,6 +45,7 @@ public class VideoDeltaMimeType { public static final VideoDeltaMimeType VIDEO_WEBM = new VideoDeltaMimeType("video/webm"); public static final VideoDeltaMimeType VIDEO_WMV = new VideoDeltaMimeType("video/wmv"); public static final VideoDeltaMimeType VIDEO3GPP = new VideoDeltaMimeType("video/3gpp"); + public static final VideoDeltaMimeType VIDEO_JPEG2000 = new VideoDeltaMimeType("video/jpeg2000"); // This map will grow whenever a Color gets created with a new // unrecognized value (a potential memory leak if the user is not @@ -127,6 +128,7 @@ private static final Map createValuesMap() { map.put("video/webm", VIDEO_WEBM); map.put("video/wmv", VIDEO_WMV); map.put("video/3gpp", VIDEO3GPP); + map.put("video/jpeg2000", VIDEO_JPEG2000); return map; } @@ -141,6 +143,7 @@ private static final Map createEnumsMap() { map.put("video/webm", VideoDeltaMimeTypeEnum.VIDEO_WEBM); map.put("video/wmv", VideoDeltaMimeTypeEnum.VIDEO_WMV); map.put("video/3gpp", VideoDeltaMimeTypeEnum.VIDEO3GPP); + map.put("video/jpeg2000", VideoDeltaMimeTypeEnum.VIDEO_JPEG2000); return map; } @@ -155,7 +158,8 @@ public enum VideoDeltaMimeTypeEnum { VIDEO_X_FLV("video/x-flv"), VIDEO_WEBM("video/webm"), VIDEO_WMV("video/wmv"), - VIDEO3GPP("video/3gpp"),; + VIDEO3GPP("video/3gpp"), + VIDEO_JPEG2000("video/jpeg2000"),; private final String value; diff --git a/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdRequest.java b/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdRequest.java index 6419d57867a..323a3632231 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdRequest.java @@ -30,44 +30,44 @@ public class CancelInteractionByIdRequest { - /** - * The unique identifier of the interaction to cancel. - */ - @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=id") - private String id; - /** * Which version of the API to use. */ @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=api_version") private String apiVersion; + /** + * The unique identifier of the interaction to cancel. + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=id") + private String id; + @JsonCreator public CancelInteractionByIdRequest( - @Nonnull String id, - @Nullable String apiVersion) { + @Nullable String apiVersion, + @Nonnull String id) { + this.apiVersion = apiVersion; this.id = Optional.ofNullable(id) .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); - this.apiVersion = apiVersion; } public CancelInteractionByIdRequest( @Nonnull String id) { - this(id, null); + this(null, id); } /** - * The unique identifier of the interaction to cancel. + * Which version of the API to use. */ - public Optional id() { - return Optional.ofNullable(this.id); + public Optional apiVersion() { + return Optional.ofNullable(this.apiVersion); } /** - * Which version of the API to use. + * The unique identifier of the interaction to cancel. */ - public Optional apiVersion() { - return Optional.ofNullable(this.apiVersion); + public Optional id() { + return Optional.ofNullable(this.id); } public static Builder builder() { @@ -76,19 +76,19 @@ public static Builder builder() { /** - * The unique identifier of the interaction to cancel. + * Which version of the API to use. */ - public CancelInteractionByIdRequest withId(@Nonnull String id) { - this.id = Utils.checkNotNull(id, "id"); + public CancelInteractionByIdRequest withApiVersion(@Nullable String apiVersion) { + this.apiVersion = apiVersion; return this; } /** - * Which version of the API to use. + * The unique identifier of the interaction to cancel. */ - public CancelInteractionByIdRequest withApiVersion(@Nullable String apiVersion) { - this.apiVersion = apiVersion; + public CancelInteractionByIdRequest withId(@Nonnull String id) { + this.id = Utils.checkNotNull(id, "id"); return this; } @@ -103,53 +103,53 @@ public boolean equals(java.lang.Object o) { } CancelInteractionByIdRequest other = (CancelInteractionByIdRequest) o; return - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion); + Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { return Utils.enhancedHash( - id, apiVersion); + apiVersion, id); } @Override public String toString() { return Utils.toString(CancelInteractionByIdRequest.class, - "id", id, - "apiVersion", apiVersion); + "apiVersion", apiVersion, + "id", id); } @SuppressWarnings("UnusedReturnValue") public final static class Builder { - private String id; - private String apiVersion; + private String id; + private Builder() { // force use of static builder() method } /** - * The unique identifier of the interaction to cancel. + * Which version of the API to use. */ - public Builder id(@Nonnull String id) { - this.id = Utils.checkNotNull(id, "id"); + public Builder apiVersion(@Nullable String apiVersion) { + this.apiVersion = apiVersion; return this; } /** - * Which version of the API to use. + * The unique identifier of the interaction to cancel. */ - public Builder apiVersion(@Nullable String apiVersion) { - this.apiVersion = apiVersion; + public Builder id(@Nonnull String id) { + this.id = Utils.checkNotNull(id, "id"); return this; } public CancelInteractionByIdRequest build() { return new CancelInteractionByIdRequest( - id, apiVersion); + apiVersion, id); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdRequestBuilder.java index d31928eeab9..8813c22a979 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/CancelInteractionByIdRequestBuilder.java @@ -45,14 +45,14 @@ public CancelInteractionByIdRequestBuilder(SDKConfiguration sdkConfiguration) { this.optionsBuilder = Options.builder(); } - public CancelInteractionByIdRequestBuilder id(@Nonnull String id) { - this.pojoBuilder.id(id); + public CancelInteractionByIdRequestBuilder apiVersion(@Nullable String apiVersion) { + this.pojoBuilder.apiVersion(apiVersion); this._setterCalled = true; return this; } - public CancelInteractionByIdRequestBuilder apiVersion(@Nullable String apiVersion) { - this.pojoBuilder.apiVersion(apiVersion); + public CancelInteractionByIdRequestBuilder id(@Nonnull String id) { + this.pojoBuilder.id(id); this._setterCalled = true; return this; } diff --git a/src/main/java/com/google/genai/gaos/models/operations/CreateInteractionRequestBody.java b/src/main/java/com/google/genai/gaos/models/operations/CreateInteractionRequestBody.java index bb0af993166..09b45f77231 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/CreateInteractionRequestBody.java +++ b/src/main/java/com/google/genai/gaos/models/operations/CreateInteractionRequestBody.java @@ -50,38 +50,38 @@ private CreateInteractionRequestBody(TypedObject value) { this.value = value; } - public static CreateInteractionRequestBody of(CreateModelInteraction value) { + public static CreateInteractionRequestBody of(CreateAgentInteraction value) { Utils.checkNotNull(value, "value"); - return new CreateInteractionRequestBody(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateInteractionRequestBody(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); } - public static CreateInteractionRequestBody of(CreateAgentInteraction value) { + public static CreateInteractionRequestBody of(CreateModelInteraction value) { Utils.checkNotNull(value, "value"); - return new CreateInteractionRequestBody(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); + return new CreateInteractionRequestBody(TypedObject.of(value, JsonShape.DEFAULT, new TypeReference(){})); } /** - * Returns an {@link Optional} containing the value if it is of type {@code CreateModelInteraction}, + * Returns an {@link Optional} containing the value if it is of type {@code CreateAgentInteraction}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code CreateModelInteraction} value, or empty if not of this type + * @return an {@link Optional} containing the {@code CreateAgentInteraction} value, or empty if not of this type */ - public Optional createModelInteraction() { - if (value.value() instanceof CreateModelInteraction) { - return Optional.of((CreateModelInteraction) value.value()); + public Optional createAgentInteraction() { + if (value.value() instanceof CreateAgentInteraction) { + return Optional.of((CreateAgentInteraction) value.value()); } return Optional.empty(); } /** - * Returns an {@link Optional} containing the value if it is of type {@code CreateAgentInteraction}, + * Returns an {@link Optional} containing the value if it is of type {@code CreateModelInteraction}, * otherwise returns an empty {@link Optional}. * - * @return an {@link Optional} containing the {@code CreateAgentInteraction} value, or empty if not of this type + * @return an {@link Optional} containing the {@code CreateModelInteraction} value, or empty if not of this type */ - public Optional createAgentInteraction() { - if (value.value() instanceof CreateAgentInteraction) { - return Optional.of((CreateAgentInteraction) value.value()); + public Optional createModelInteraction() { + if (value.value() instanceof CreateModelInteraction) { + return Optional.of((CreateModelInteraction) value.value()); } return Optional.empty(); } @@ -120,8 +120,8 @@ public static final class _Deserializer extends OneOfDeserializer() {}, JsonShape.DEFAULT), - TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT), + TypeReferenceWithShape.of(new TypeReference() {}, JsonShape.DEFAULT)); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/DeleteInteractionRequest.java b/src/main/java/com/google/genai/gaos/models/operations/DeleteInteractionRequest.java index 16a3b696e84..55e2ebb26e1 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/DeleteInteractionRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/DeleteInteractionRequest.java @@ -30,44 +30,44 @@ public class DeleteInteractionRequest { - /** - * The unique identifier of the interaction to delete. - */ - @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=id") - private String id; - /** * Which version of the API to use. */ @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=api_version") private String apiVersion; + /** + * The unique identifier of the interaction to delete. + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=id") + private String id; + @JsonCreator public DeleteInteractionRequest( - @Nonnull String id, - @Nullable String apiVersion) { + @Nullable String apiVersion, + @Nonnull String id) { + this.apiVersion = apiVersion; this.id = Optional.ofNullable(id) .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); - this.apiVersion = apiVersion; } public DeleteInteractionRequest( @Nonnull String id) { - this(id, null); + this(null, id); } /** - * The unique identifier of the interaction to delete. + * Which version of the API to use. */ - public Optional id() { - return Optional.ofNullable(this.id); + public Optional apiVersion() { + return Optional.ofNullable(this.apiVersion); } /** - * Which version of the API to use. + * The unique identifier of the interaction to delete. */ - public Optional apiVersion() { - return Optional.ofNullable(this.apiVersion); + public Optional id() { + return Optional.ofNullable(this.id); } public static Builder builder() { @@ -76,19 +76,19 @@ public static Builder builder() { /** - * The unique identifier of the interaction to delete. + * Which version of the API to use. */ - public DeleteInteractionRequest withId(@Nonnull String id) { - this.id = Utils.checkNotNull(id, "id"); + public DeleteInteractionRequest withApiVersion(@Nullable String apiVersion) { + this.apiVersion = apiVersion; return this; } /** - * Which version of the API to use. + * The unique identifier of the interaction to delete. */ - public DeleteInteractionRequest withApiVersion(@Nullable String apiVersion) { - this.apiVersion = apiVersion; + public DeleteInteractionRequest withId(@Nonnull String id) { + this.id = Utils.checkNotNull(id, "id"); return this; } @@ -103,53 +103,53 @@ public boolean equals(java.lang.Object o) { } DeleteInteractionRequest other = (DeleteInteractionRequest) o; return - Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion); + Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && + Utils.enhancedDeepEquals(this.id, other.id); } @Override public int hashCode() { return Utils.enhancedHash( - id, apiVersion); + apiVersion, id); } @Override public String toString() { return Utils.toString(DeleteInteractionRequest.class, - "id", id, - "apiVersion", apiVersion); + "apiVersion", apiVersion, + "id", id); } @SuppressWarnings("UnusedReturnValue") public final static class Builder { - private String id; - private String apiVersion; + private String id; + private Builder() { // force use of static builder() method } /** - * The unique identifier of the interaction to delete. + * Which version of the API to use. */ - public Builder id(@Nonnull String id) { - this.id = Utils.checkNotNull(id, "id"); + public Builder apiVersion(@Nullable String apiVersion) { + this.apiVersion = apiVersion; return this; } /** - * Which version of the API to use. + * The unique identifier of the interaction to delete. */ - public Builder apiVersion(@Nullable String apiVersion) { - this.apiVersion = apiVersion; + public Builder id(@Nonnull String id) { + this.id = Utils.checkNotNull(id, "id"); return this; } public DeleteInteractionRequest build() { return new DeleteInteractionRequest( - id, apiVersion); + apiVersion, id); } } diff --git a/src/main/java/com/google/genai/gaos/models/operations/DeleteInteractionRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/DeleteInteractionRequestBuilder.java index 3a194a4ebed..07899487a88 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/DeleteInteractionRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/DeleteInteractionRequestBuilder.java @@ -45,14 +45,14 @@ public DeleteInteractionRequestBuilder(SDKConfiguration sdkConfiguration) { this.optionsBuilder = Options.builder(); } - public DeleteInteractionRequestBuilder id(@Nonnull String id) { - this.pojoBuilder.id(id); + public DeleteInteractionRequestBuilder apiVersion(@Nullable String apiVersion) { + this.pojoBuilder.apiVersion(apiVersion); this._setterCalled = true; return this; } - public DeleteInteractionRequestBuilder apiVersion(@Nullable String apiVersion) { - this.pojoBuilder.apiVersion(apiVersion); + public DeleteInteractionRequestBuilder id(@Nonnull String id) { + this.pojoBuilder.id(id); this._setterCalled = true; return this; } diff --git a/src/main/java/com/google/genai/gaos/models/operations/GetInteractionByIdRequest.java b/src/main/java/com/google/genai/gaos/models/operations/GetInteractionByIdRequest.java index f4ba3e988bb..6e96565803f 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/GetInteractionByIdRequest.java +++ b/src/main/java/com/google/genai/gaos/models/operations/GetInteractionByIdRequest.java @@ -34,6 +34,12 @@ public class GetInteractionByIdRequest { + /** + * Which version of the API to use. + */ + @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=api_version") + private String apiVersion; + /** * The unique identifier of the interaction to retrieve. */ @@ -41,10 +47,13 @@ public class GetInteractionByIdRequest { private String id; /** - * If set to true, the generated content will be streamed incrementally. + * If set to true, includes the input in the response. + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ - @SpeakeasyMetadata("queryParam:style=form,explode=true,name=stream") - private Boolean stream; + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=include_input") + @Deprecated + private Boolean includeInput; /** * Optional. If set, resumes the interaction stream from the next chunk after the event marked by the @@ -54,43 +63,41 @@ public class GetInteractionByIdRequest { private String lastEventId; /** - * If set to true, includes the input in the response. - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. - */ - @SpeakeasyMetadata("queryParam:style=form,explode=true,name=include_input") - @Deprecated - private Boolean includeInput; - - /** - * Which version of the API to use. + * If set to true, the generated content will be streamed incrementally. */ - @SpeakeasyMetadata("pathParam:style=simple,explode=false,name=api_version") - private String apiVersion; + @SpeakeasyMetadata("queryParam:style=form,explode=true,name=stream") + private Boolean stream; @JsonCreator public GetInteractionByIdRequest( + @Nullable String apiVersion, @Nonnull String id, - @Nullable Boolean stream, - @Nullable String lastEventId, @Nullable Boolean includeInput, - @Nullable String apiVersion) { + @Nullable String lastEventId, + @Nullable Boolean stream) { + this.apiVersion = apiVersion; this.id = Optional.ofNullable(id) .orElseThrow(() -> new IllegalArgumentException("id cannot be null")); - this.stream = Optional.ofNullable(stream) - .orElse(Builder._SINGLETON_VALUE_Stream.value()); - this.lastEventId = lastEventId; this.includeInput = Optional.ofNullable(includeInput) .orElse(Builder._SINGLETON_VALUE_IncludeInput.value()); - this.apiVersion = apiVersion; + this.lastEventId = lastEventId; + this.stream = Optional.ofNullable(stream) + .orElse(Builder._SINGLETON_VALUE_Stream.value()); } public GetInteractionByIdRequest( @Nonnull String id) { - this(id, null, null, + this(null, id, null, null, null); } + /** + * Which version of the API to use. + */ + public Optional apiVersion() { + return Optional.ofNullable(this.apiVersion); + } + /** * The unique identifier of the interaction to retrieve. */ @@ -99,10 +106,13 @@ public Optional id() { } /** - * If set to true, the generated content will be streamed incrementally. + * If set to true, includes the input in the response. + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ - public Optional stream() { - return Optional.ofNullable(this.stream); + @Deprecated + public Optional includeInput() { + return Optional.ofNullable(this.includeInput); } /** @@ -114,24 +124,23 @@ public Optional lastEventId() { } /** - * If set to true, includes the input in the response. - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + * If set to true, the generated content will be streamed incrementally. */ - @Deprecated - public Optional includeInput() { - return Optional.ofNullable(this.includeInput); + public Optional stream() { + return Optional.ofNullable(this.stream); + } + + public static Builder builder() { + return new Builder(); } + /** * Which version of the API to use. */ - public Optional apiVersion() { - return Optional.ofNullable(this.apiVersion); - } - - public static Builder builder() { - return new Builder(); + public GetInteractionByIdRequest withApiVersion(@Nullable String apiVersion) { + this.apiVersion = apiVersion; + return this; } @@ -145,10 +154,13 @@ public GetInteractionByIdRequest withId(@Nonnull String id) { /** - * If set to true, the generated content will be streamed incrementally. + * If set to true, includes the input in the response. + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ - public GetInteractionByIdRequest withStream(@Nullable Boolean stream) { - this.stream = stream; + @Deprecated + public GetInteractionByIdRequest withIncludeInput(@Nullable Boolean includeInput) { + this.includeInput = includeInput; return this; } @@ -164,22 +176,10 @@ public GetInteractionByIdRequest withLastEventId(@Nullable String lastEventId) { /** - * If set to true, includes the input in the response. - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. - */ - @Deprecated - public GetInteractionByIdRequest withIncludeInput(@Nullable Boolean includeInput) { - this.includeInput = includeInput; - return this; - } - - - /** - * Which version of the API to use. + * If set to true, the generated content will be streamed incrementally. */ - public GetInteractionByIdRequest withApiVersion(@Nullable String apiVersion) { - this.apiVersion = apiVersion; + public GetInteractionByIdRequest withStream(@Nullable Boolean stream) { + this.stream = stream; return this; } @@ -194,48 +194,56 @@ public boolean equals(java.lang.Object o) { } GetInteractionByIdRequest other = (GetInteractionByIdRequest) o; return + Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion) && Utils.enhancedDeepEquals(this.id, other.id) && - Utils.enhancedDeepEquals(this.stream, other.stream) && - Utils.enhancedDeepEquals(this.lastEventId, other.lastEventId) && Utils.enhancedDeepEquals(this.includeInput, other.includeInput) && - Utils.enhancedDeepEquals(this.apiVersion, other.apiVersion); + Utils.enhancedDeepEquals(this.lastEventId, other.lastEventId) && + Utils.enhancedDeepEquals(this.stream, other.stream); } @Override public int hashCode() { return Utils.enhancedHash( - id, stream, lastEventId, - includeInput, apiVersion); + apiVersion, id, includeInput, + lastEventId, stream); } @Override public String toString() { return Utils.toString(GetInteractionByIdRequest.class, + "apiVersion", apiVersion, "id", id, - "stream", stream, - "lastEventId", lastEventId, "includeInput", includeInput, - "apiVersion", apiVersion); + "lastEventId", lastEventId, + "stream", stream); } @SuppressWarnings("UnusedReturnValue") public final static class Builder { - private String id; - - private Boolean stream; + private String apiVersion; - private String lastEventId; + private String id; @Deprecated private Boolean includeInput; - private String apiVersion; + private String lastEventId; + + private Boolean stream; private Builder() { // force use of static builder() method } + /** + * Which version of the API to use. + */ + public Builder apiVersion(@Nullable String apiVersion) { + this.apiVersion = apiVersion; + return this; + } + /** * The unique identifier of the interaction to retrieve. */ @@ -245,10 +253,13 @@ public Builder id(@Nonnull String id) { } /** - * If set to true, the generated content will be streamed incrementally. + * If set to true, includes the input in the response. + * + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ - public Builder stream(@Nullable Boolean stream) { - this.stream = stream; + @Deprecated + public Builder includeInput(@Nullable Boolean includeInput) { + this.includeInput = includeInput; return this; } @@ -262,40 +273,29 @@ public Builder lastEventId(@Nullable String lastEventId) { } /** - * If set to true, includes the input in the response. - * - * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. - */ - @Deprecated - public Builder includeInput(@Nullable Boolean includeInput) { - this.includeInput = includeInput; - return this; - } - - /** - * Which version of the API to use. + * If set to true, the generated content will be streamed incrementally. */ - public Builder apiVersion(@Nullable String apiVersion) { - this.apiVersion = apiVersion; + public Builder stream(@Nullable Boolean stream) { + this.stream = stream; return this; } public GetInteractionByIdRequest build() { return new GetInteractionByIdRequest( - id, stream, lastEventId, - includeInput, apiVersion); + apiVersion, id, includeInput, + lastEventId, stream); } - private static final LazySingletonValue _SINGLETON_VALUE_Stream = + private static final LazySingletonValue _SINGLETON_VALUE_IncludeInput = new LazySingletonValue<>( - "stream", + "include_input", "false", new TypeReference() {}); - private static final LazySingletonValue _SINGLETON_VALUE_IncludeInput = + private static final LazySingletonValue _SINGLETON_VALUE_Stream = new LazySingletonValue<>( - "include_input", + "stream", "false", new TypeReference() {}); } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/CancelInteractionByIdRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/CancelInteractionByIdRequestBuilder.java index 4a90b342882..f2a713d355e 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/CancelInteractionByIdRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/CancelInteractionByIdRequestBuilder.java @@ -48,14 +48,14 @@ public CancelInteractionByIdRequestBuilder(SDKConfiguration sdkConfiguration) { this.optionsBuilder = Options.builder(); } - public CancelInteractionByIdRequestBuilder id(@Nonnull String id) { - this.pojoBuilder.id(id); + public CancelInteractionByIdRequestBuilder apiVersion(@Nullable String apiVersion) { + this.pojoBuilder.apiVersion(apiVersion); this._setterCalled = true; return this; } - public CancelInteractionByIdRequestBuilder apiVersion(@Nullable String apiVersion) { - this.pojoBuilder.apiVersion(apiVersion); + public CancelInteractionByIdRequestBuilder id(@Nonnull String id) { + this.pojoBuilder.id(id); this._setterCalled = true; return this; } diff --git a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteInteractionRequestBuilder.java b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteInteractionRequestBuilder.java index cba2cc57c90..71d944c81d3 100644 --- a/src/main/java/com/google/genai/gaos/models/operations/async/DeleteInteractionRequestBuilder.java +++ b/src/main/java/com/google/genai/gaos/models/operations/async/DeleteInteractionRequestBuilder.java @@ -48,14 +48,14 @@ public DeleteInteractionRequestBuilder(SDKConfiguration sdkConfiguration) { this.optionsBuilder = Options.builder(); } - public DeleteInteractionRequestBuilder id(@Nonnull String id) { - this.pojoBuilder.id(id); + public DeleteInteractionRequestBuilder apiVersion(@Nullable String apiVersion) { + this.pojoBuilder.apiVersion(apiVersion); this._setterCalled = true; return this; } - public DeleteInteractionRequestBuilder apiVersion(@Nullable String apiVersion) { - this.pojoBuilder.apiVersion(apiVersion); + public DeleteInteractionRequestBuilder id(@Nonnull String id) { + this.pojoBuilder.id(id); this._setterCalled = true; return this; } diff --git a/src/main/java/com/google/genai/gaos/models/shared/Security.java b/src/main/java/com/google/genai/gaos/models/shared/Security.java index 5ce90457094..62227dc19f0 100644 --- a/src/main/java/com/google/genai/gaos/models/shared/Security.java +++ b/src/main/java/com/google/genai/gaos/models/shared/Security.java @@ -34,14 +34,6 @@ public class Security implements HasSecurity { - /** - * Gemini API key sent as x-goog-api-key. - */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("apiKey") - @SpeakeasyMetadata("security:scheme=true,type=http,subtype=custom,name=apiKey") - private String apiKey; - /** * OAuth access token sent as a bearer Authorization header. */ @@ -50,6 +42,14 @@ public class Security implements HasSecurity { @SpeakeasyMetadata("security:scheme=true,type=http,subtype=custom,name=accessToken") private String accessToken; + /** + * Gemini API key sent as x-goog-api-key. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("apiKey") + @SpeakeasyMetadata("security:scheme=true,type=http,subtype=custom,name=apiKey") + private String apiKey; + /** * Additional default headers to apply before request-specific headers and auth. */ @@ -60,11 +60,11 @@ public class Security implements HasSecurity { @JsonCreator public Security( - @JsonProperty("apiKey") @Nullable String apiKey, @JsonProperty("accessToken") @Nullable String accessToken, + @JsonProperty("apiKey") @Nullable String apiKey, @JsonProperty("defaultHeaders") @Nullable Map defaultHeaders) { - this.apiKey = apiKey; this.accessToken = accessToken; + this.apiKey = apiKey; this.defaultHeaders = defaultHeaders; } @@ -73,17 +73,17 @@ public Security() { } /** - * Gemini API key sent as x-goog-api-key. + * OAuth access token sent as a bearer Authorization header. */ - public Optional apiKey() { - return Optional.ofNullable(this.apiKey); + public Optional accessToken() { + return Optional.ofNullable(this.accessToken); } /** - * OAuth access token sent as a bearer Authorization header. + * Gemini API key sent as x-goog-api-key. */ - public Optional accessToken() { - return Optional.ofNullable(this.accessToken); + public Optional apiKey() { + return Optional.ofNullable(this.apiKey); } /** @@ -99,19 +99,19 @@ public static Builder builder() { /** - * Gemini API key sent as x-goog-api-key. + * OAuth access token sent as a bearer Authorization header. */ - public Security withApiKey(@Nullable String apiKey) { - this.apiKey = apiKey; + public Security withAccessToken(@Nullable String accessToken) { + this.accessToken = accessToken; return this; } /** - * OAuth access token sent as a bearer Authorization header. + * Gemini API key sent as x-goog-api-key. */ - public Security withAccessToken(@Nullable String accessToken) { - this.accessToken = accessToken; + public Security withApiKey(@Nullable String apiKey) { + this.apiKey = apiKey; return this; } @@ -135,32 +135,32 @@ public boolean equals(java.lang.Object o) { } Security other = (Security) o; return - Utils.enhancedDeepEquals(this.apiKey, other.apiKey) && Utils.enhancedDeepEquals(this.accessToken, other.accessToken) && + Utils.enhancedDeepEquals(this.apiKey, other.apiKey) && Utils.enhancedDeepEquals(this.defaultHeaders, other.defaultHeaders); } @Override public int hashCode() { return Utils.enhancedHash( - apiKey, accessToken, defaultHeaders); + accessToken, apiKey, defaultHeaders); } @Override public String toString() { return Utils.toString(Security.class, - "apiKey", apiKey, "accessToken", accessToken, + "apiKey", apiKey, "defaultHeaders", defaultHeaders); } @SuppressWarnings("UnusedReturnValue") public final static class Builder { - private String apiKey; - private String accessToken; + private String apiKey; + private Map defaultHeaders; private Builder() { @@ -168,18 +168,18 @@ private Builder() { } /** - * Gemini API key sent as x-goog-api-key. + * OAuth access token sent as a bearer Authorization header. */ - public Builder apiKey(@Nullable String apiKey) { - this.apiKey = apiKey; + public Builder accessToken(@Nullable String accessToken) { + this.accessToken = accessToken; return this; } /** - * OAuth access token sent as a bearer Authorization header. + * Gemini API key sent as x-goog-api-key. */ - public Builder accessToken(@Nullable String accessToken) { - this.accessToken = accessToken; + public Builder apiKey(@Nullable String apiKey) { + this.apiKey = apiKey; return this; } @@ -193,7 +193,7 @@ public Builder defaultHeaders(@Nullable Map defaultHeaders) { public Security build() { return new Security( - apiKey, accessToken, defaultHeaders); + accessToken, apiKey, defaultHeaders); } } diff --git a/src/main/java/com/google/genai/gaos/models/triggers/TriggerCreateParams.java b/src/main/java/com/google/genai/gaos/models/triggers/TriggerCreateParams.java index b36bf006161..64365bb08cd 100644 --- a/src/main/java/com/google/genai/gaos/models/triggers/TriggerCreateParams.java +++ b/src/main/java/com/google/genai/gaos/models/triggers/TriggerCreateParams.java @@ -37,18 +37,6 @@ *

Parameters for creating a trigger. */ public class TriggerCreateParams { - /** - * Required. The cron schedule on which the trigger should run. Standard cron format. - */ - @JsonProperty("schedule") - private String schedule; - - /** - * Required. Time zone in which the schedule should be interpreted. - */ - @JsonProperty("time_zone") - private String timeZone; - /** * Optional. The display name of the trigger. */ @@ -63,6 +51,19 @@ public class TriggerCreateParams { @JsonProperty("environment_id") private String environmentId; + /** + * Optional. The execution timeout for the triggered interaction. + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("execution_timeout_seconds") + private Integer executionTimeoutSeconds; + + /** + * Required. The interaction request template to be executed. + */ + @JsonProperty("interaction") + private Interaction interaction; + /** * Optional. The maximum number of consecutive failures allowed before the trigger is automatically * paused (status becomes ERROR). @@ -72,74 +73,73 @@ public class TriggerCreateParams { private Integer maxConsecutiveFailures; /** - * Optional. The execution timeout for the triggered interaction. + * Required. The cron schedule on which the trigger should run. Standard cron format. */ - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("execution_timeout_seconds") - private Integer executionTimeoutSeconds; + @JsonProperty("schedule") + private String schedule; /** - * Required. The interaction request template to be executed. + * Required. Time zone in which the schedule should be interpreted. */ - @JsonProperty("interaction") - private Interaction interaction; + @JsonProperty("time_zone") + private String timeZone; @JsonCreator public TriggerCreateParams( - @JsonProperty("schedule") @Nonnull String schedule, - @JsonProperty("time_zone") @Nonnull String timeZone, @JsonProperty("display_name") @Nullable String displayName, @JsonProperty("environment_id") @Nullable String environmentId, - @JsonProperty("max_consecutive_failures") @Nullable Integer maxConsecutiveFailures, @JsonProperty("execution_timeout_seconds") @Nullable Integer executionTimeoutSeconds, - @JsonProperty("interaction") @Nonnull Interaction interaction) { - this.schedule = Optional.ofNullable(schedule) - .orElseThrow(() -> new IllegalArgumentException("schedule cannot be null")); - this.timeZone = Optional.ofNullable(timeZone) - .orElseThrow(() -> new IllegalArgumentException("timeZone cannot be null")); + @JsonProperty("interaction") @Nonnull Interaction interaction, + @JsonProperty("max_consecutive_failures") @Nullable Integer maxConsecutiveFailures, + @JsonProperty("schedule") @Nonnull String schedule, + @JsonProperty("time_zone") @Nonnull String timeZone) { this.displayName = displayName; this.environmentId = environmentId; - this.maxConsecutiveFailures = maxConsecutiveFailures; this.executionTimeoutSeconds = executionTimeoutSeconds; this.interaction = Optional.ofNullable(interaction) .orElseThrow(() -> new IllegalArgumentException("interaction cannot be null")); + this.maxConsecutiveFailures = maxConsecutiveFailures; + this.schedule = Optional.ofNullable(schedule) + .orElseThrow(() -> new IllegalArgumentException("schedule cannot be null")); + this.timeZone = Optional.ofNullable(timeZone) + .orElseThrow(() -> new IllegalArgumentException("timeZone cannot be null")); } public TriggerCreateParams( + @Nonnull Interaction interaction, @Nonnull String schedule, - @Nonnull String timeZone, - @Nonnull Interaction interaction) { - this(schedule, timeZone, null, - null, null, null, - interaction); + @Nonnull String timeZone) { + this(null, null, null, + interaction, null, schedule, + timeZone); } /** - * Required. The cron schedule on which the trigger should run. Standard cron format. + * Optional. The display name of the trigger. */ - public Optional schedule() { - return Optional.ofNullable(this.schedule); + public Optional displayName() { + return Optional.ofNullable(this.displayName); } /** - * Required. Time zone in which the schedule should be interpreted. + * Optional. The environment ID for the trigger execution. */ - public Optional timeZone() { - return Optional.ofNullable(this.timeZone); + public Optional environmentId() { + return Optional.ofNullable(this.environmentId); } /** - * Optional. The display name of the trigger. + * Optional. The execution timeout for the triggered interaction. */ - public Optional displayName() { - return Optional.ofNullable(this.displayName); + public Optional executionTimeoutSeconds() { + return Optional.ofNullable(this.executionTimeoutSeconds); } /** - * Optional. The environment ID for the trigger execution. + * Required. The interaction request template to be executed. */ - public Optional environmentId() { - return Optional.ofNullable(this.environmentId); + public Optional interaction() { + return Optional.ofNullable(this.interaction); } /** @@ -151,17 +151,17 @@ public Optional maxConsecutiveFailures() { } /** - * Optional. The execution timeout for the triggered interaction. + * Required. The cron schedule on which the trigger should run. Standard cron format. */ - public Optional executionTimeoutSeconds() { - return Optional.ofNullable(this.executionTimeoutSeconds); + public Optional schedule() { + return Optional.ofNullable(this.schedule); } /** - * Required. The interaction request template to be executed. + * Required. Time zone in which the schedule should be interpreted. */ - public Optional interaction() { - return Optional.ofNullable(this.interaction); + public Optional timeZone() { + return Optional.ofNullable(this.timeZone); } public static Builder builder() { @@ -170,37 +170,37 @@ public static Builder builder() { /** - * Required. The cron schedule on which the trigger should run. Standard cron format. + * Optional. The display name of the trigger. */ - public TriggerCreateParams withSchedule(@Nonnull String schedule) { - this.schedule = Utils.checkNotNull(schedule, "schedule"); + public TriggerCreateParams withDisplayName(@Nullable String displayName) { + this.displayName = displayName; return this; } /** - * Required. Time zone in which the schedule should be interpreted. + * Optional. The environment ID for the trigger execution. */ - public TriggerCreateParams withTimeZone(@Nonnull String timeZone) { - this.timeZone = Utils.checkNotNull(timeZone, "timeZone"); + public TriggerCreateParams withEnvironmentId(@Nullable String environmentId) { + this.environmentId = environmentId; return this; } /** - * Optional. The display name of the trigger. + * Optional. The execution timeout for the triggered interaction. */ - public TriggerCreateParams withDisplayName(@Nullable String displayName) { - this.displayName = displayName; + public TriggerCreateParams withExecutionTimeoutSeconds(@Nullable Integer executionTimeoutSeconds) { + this.executionTimeoutSeconds = executionTimeoutSeconds; return this; } /** - * Optional. The environment ID for the trigger execution. + * Required. The interaction request template to be executed. */ - public TriggerCreateParams withEnvironmentId(@Nullable String environmentId) { - this.environmentId = environmentId; + public TriggerCreateParams withInteraction(@Nonnull Interaction interaction) { + this.interaction = Utils.checkNotNull(interaction, "interaction"); return this; } @@ -216,19 +216,19 @@ public TriggerCreateParams withMaxConsecutiveFailures(@Nullable Integer maxConse /** - * Optional. The execution timeout for the triggered interaction. + * Required. The cron schedule on which the trigger should run. Standard cron format. */ - public TriggerCreateParams withExecutionTimeoutSeconds(@Nullable Integer executionTimeoutSeconds) { - this.executionTimeoutSeconds = executionTimeoutSeconds; + public TriggerCreateParams withSchedule(@Nonnull String schedule) { + this.schedule = Utils.checkNotNull(schedule, "schedule"); return this; } /** - * Required. The interaction request template to be executed. + * Required. Time zone in which the schedule should be interpreted. */ - public TriggerCreateParams withInteraction(@Nonnull Interaction interaction) { - this.interaction = Utils.checkNotNull(interaction, "interaction"); + public TriggerCreateParams withTimeZone(@Nonnull String timeZone) { + this.timeZone = Utils.checkNotNull(timeZone, "timeZone"); return this; } @@ -243,85 +243,85 @@ public boolean equals(java.lang.Object o) { } TriggerCreateParams other = (TriggerCreateParams) o; return - Utils.enhancedDeepEquals(this.schedule, other.schedule) && - Utils.enhancedDeepEquals(this.timeZone, other.timeZone) && Utils.enhancedDeepEquals(this.displayName, other.displayName) && Utils.enhancedDeepEquals(this.environmentId, other.environmentId) && - Utils.enhancedDeepEquals(this.maxConsecutiveFailures, other.maxConsecutiveFailures) && Utils.enhancedDeepEquals(this.executionTimeoutSeconds, other.executionTimeoutSeconds) && - Utils.enhancedDeepEquals(this.interaction, other.interaction); + Utils.enhancedDeepEquals(this.interaction, other.interaction) && + Utils.enhancedDeepEquals(this.maxConsecutiveFailures, other.maxConsecutiveFailures) && + Utils.enhancedDeepEquals(this.schedule, other.schedule) && + Utils.enhancedDeepEquals(this.timeZone, other.timeZone); } @Override public int hashCode() { return Utils.enhancedHash( - schedule, timeZone, displayName, - environmentId, maxConsecutiveFailures, executionTimeoutSeconds, - interaction); + displayName, environmentId, executionTimeoutSeconds, + interaction, maxConsecutiveFailures, schedule, + timeZone); } @Override public String toString() { return Utils.toString(TriggerCreateParams.class, - "schedule", schedule, - "timeZone", timeZone, "displayName", displayName, "environmentId", environmentId, - "maxConsecutiveFailures", maxConsecutiveFailures, "executionTimeoutSeconds", executionTimeoutSeconds, - "interaction", interaction); + "interaction", interaction, + "maxConsecutiveFailures", maxConsecutiveFailures, + "schedule", schedule, + "timeZone", timeZone); } @SuppressWarnings("UnusedReturnValue") public final static class Builder { - private String schedule; - - private String timeZone; - private String displayName; private String environmentId; - private Integer maxConsecutiveFailures; - private Integer executionTimeoutSeconds; private Interaction interaction; + private Integer maxConsecutiveFailures; + + private String schedule; + + private String timeZone; + private Builder() { // force use of static builder() method } /** - * Required. The cron schedule on which the trigger should run. Standard cron format. + * Optional. The display name of the trigger. */ - public Builder schedule(@Nonnull String schedule) { - this.schedule = Utils.checkNotNull(schedule, "schedule"); + public Builder displayName(@Nullable String displayName) { + this.displayName = displayName; return this; } /** - * Required. Time zone in which the schedule should be interpreted. + * Optional. The environment ID for the trigger execution. */ - public Builder timeZone(@Nonnull String timeZone) { - this.timeZone = Utils.checkNotNull(timeZone, "timeZone"); + public Builder environmentId(@Nullable String environmentId) { + this.environmentId = environmentId; return this; } /** - * Optional. The display name of the trigger. + * Optional. The execution timeout for the triggered interaction. */ - public Builder displayName(@Nullable String displayName) { - this.displayName = displayName; + public Builder executionTimeoutSeconds(@Nullable Integer executionTimeoutSeconds) { + this.executionTimeoutSeconds = executionTimeoutSeconds; return this; } /** - * Optional. The environment ID for the trigger execution. + * Required. The interaction request template to be executed. */ - public Builder environmentId(@Nullable String environmentId) { - this.environmentId = environmentId; + public Builder interaction(@Nonnull Interaction interaction) { + this.interaction = Utils.checkNotNull(interaction, "interaction"); return this; } @@ -335,26 +335,26 @@ public Builder maxConsecutiveFailures(@Nullable Integer maxConsecutiveFailures) } /** - * Optional. The execution timeout for the triggered interaction. + * Required. The cron schedule on which the trigger should run. Standard cron format. */ - public Builder executionTimeoutSeconds(@Nullable Integer executionTimeoutSeconds) { - this.executionTimeoutSeconds = executionTimeoutSeconds; + public Builder schedule(@Nonnull String schedule) { + this.schedule = Utils.checkNotNull(schedule, "schedule"); return this; } /** - * Required. The interaction request template to be executed. + * Required. Time zone in which the schedule should be interpreted. */ - public Builder interaction(@Nonnull Interaction interaction) { - this.interaction = Utils.checkNotNull(interaction, "interaction"); + public Builder timeZone(@Nonnull String timeZone) { + this.timeZone = Utils.checkNotNull(timeZone, "timeZone"); return this; } public TriggerCreateParams build() { return new TriggerCreateParams( - schedule, timeZone, displayName, - environmentId, maxConsecutiveFailures, executionTimeoutSeconds, - interaction); + displayName, environmentId, executionTimeoutSeconds, + interaction, maxConsecutiveFailures, schedule, + timeZone); } } diff --git a/src/test/java/com/google/genai/GaosClientTest.java b/src/test/java/com/google/genai/GaosClientTest.java index 97fb70347d3..12497608145 100644 --- a/src/test/java/com/google/genai/GaosClientTest.java +++ b/src/test/java/com/google/genai/GaosClientTest.java @@ -288,7 +288,7 @@ public CompletableFuture> sendAsync(HttpRequest reques expectedUrlPrefix + "/interactions/" + interactionId - + "?stream=false&include_input=false"), + + "?include_input=false&stream=false"), req.uri()); // 2. Test Cancel