From d370b089732bd0685b1c446ad93b3863b937cb76 Mon Sep 17 00:00:00 2001 From: Ben Kazemi Date: Wed, 19 Nov 2025 13:36:00 -0800 Subject: [PATCH] chore: [vertexai] Introduce modules PiperOrigin-RevId: 834424318 --- .../cloud/vertexai/genai/AgentEngines.java | 967 ++++++++++++ .../cloud/vertexai/genai/ApiResponse.java | 32 + .../vertexai/genai/AsyncAgentEngines.java | 138 ++ .../cloud/vertexai/genai/AsyncDatasets.java | 160 ++ .../cloud/vertexai/genai/AsyncEvals.java | 195 +++ .../cloud/vertexai/genai/AsyncMemories.java | 204 +++ .../vertexai/genai/AsyncMemoryRevisions.java | 66 + .../vertexai/genai/AsyncPromptOptimizer.java | 82 + .../cloud/vertexai/genai/AsyncPrompts.java | 242 +++ .../cloud/vertexai/genai/AsyncSandboxes.java | 130 ++ .../cloud/vertexai/genai/AsyncSessions.java | 125 ++ .../google/cloud/vertexai/genai/Client.java | 333 ++++ .../google/cloud/vertexai/genai/Datasets.java | 869 ++++++++++ .../cloud/vertexai/genai/DebugConfig.java | 63 + .../google/cloud/vertexai/genai/Evals.java | 1252 +++++++++++++++ .../ExcludeFromGeneratedCoverageReport.java | 31 + .../google/cloud/vertexai/genai/Memories.java | 1392 +++++++++++++++++ .../cloud/vertexai/genai/MemoryRevisions.java | 266 ++++ .../cloud/vertexai/genai/PromptOptimizer.java | 555 +++++++ .../google/cloud/vertexai/genai/Prompts.java | 1385 ++++++++++++++++ .../vertexai/genai/RetryInterceptor.java | 128 ++ .../cloud/vertexai/genai/Sandboxes.java | 702 +++++++++ .../google/cloud/vertexai/genai/Sessions.java | 759 +++++++++ .../vertexai/genai/types/AcceleratorType.java | 165 ++ .../vertexai/genai/types/AgentConfig.java | 145 ++ .../cloud/vertexai/genai/types/AgentData.java | 145 ++ .../vertexai/genai/types/AgentEngine.java | 136 ++ .../genai/types/AgentEngineConfig.java | 916 +++++++++++ .../AgentEngineGenerateMemoriesOperation.java | 201 +++ .../genai/types/AgentEngineMemoryConfig.java | 325 ++++ .../types/AgentEngineMemoryOperation.java | 198 +++ .../genai/types/AgentEngineOperation.java | 198 +++ .../AgentEngineRollbackMemoryOperation.java | 169 ++ .../types/AgentEngineSandboxOperation.java | 198 +++ .../types/AgentEngineSessionOperation.java | 198 +++ .../vertexai/genai/types/AgentFramework.java | 138 ++ .../cloud/vertexai/genai/types/AgentInfo.java | 152 ++ .../vertexai/genai/types/AgentServerMode.java | 114 ++ .../genai/types/AggregatedMetricResult.java | 218 +++ .../genai/types/ApplicableGuideline.java | 147 ++ .../vertexai/genai/types/AssembleDataset.java | 81 + .../genai/types/AssembleDatasetConfig.java | 108 ++ .../types/AssembleDatasetParameters.java | 150 ++ ...edictionResourceUsageAssessmentResult.java | 107 ++ .../genai/types/BigQueryRequestSet.java | 188 +++ .../vertexai/genai/types/BigQuerySource.java | 85 + .../cloud/vertexai/genai/types/BleuInput.java | 108 ++ .../vertexai/genai/types/BleuInstance.java | 103 ++ .../vertexai/genai/types/BleuMetricValue.java | 81 + .../vertexai/genai/types/BleuResults.java | 108 ++ .../genai/types/CandidateResponse.java | 163 ++ .../vertexai/genai/types/CandidateResult.java | 223 +++ .../cloud/vertexai/genai/types/Chunk.java | 139 ++ .../vertexai/genai/types/CometResult.java | 84 + .../vertexai/genai/types/ContainerSpec.java | 203 +++ .../genai/types/ContentMapContents.java | 94 ++ .../genai/types/CreateAgentEngineConfig.java | 693 ++++++++ ...ateAgentEngineMemoryRequestParameters.java | 180 +++ .../CreateAgentEngineRequestParameters.java | 96 ++ .../types/CreateAgentEngineSandboxConfig.java | 173 ++ ...teAgentEngineSandboxRequestParameters.java | 151 ++ .../types/CreateAgentEngineSessionConfig.java | 237 +++ ...teAgentEngineSessionRequestParameters.java | 141 ++ .../genai/types/CreateDatasetConfig.java | 82 + .../genai/types/CreateDatasetParameters.java | 258 +++ .../types/CreateDatasetVersionConfig.java | 82 + .../types/CreateDatasetVersionParameters.java | 215 +++ .../types/CreateEvaluationItemConfig.java | 82 + .../types/CreateEvaluationItemParameters.java | 161 ++ .../types/CreateEvaluationSetConfig.java | 82 + .../types/CreateEvaluationSetParameters.java | 151 ++ .../types/CreateMultimodalDatasetConfig.java | 110 ++ .../CreateMultimodalDatasetParameters.java | 239 +++ .../genai/types/CreatePromptConfig.java | 158 ++ .../types/CreatePromptVersionConfig.java | 134 ++ .../cloud/vertexai/genai/types/CustomJob.java | 443 ++++++ .../genai/types/CustomJobParameters.java | 125 ++ .../vertexai/genai/types/CustomJobSpec.java | 588 +++++++ .../vertexai/genai/types/CustomOutput.java | 91 ++ .../cloud/vertexai/genai/types/Dataset.java | 522 +++++++ .../genai/types/DatasetOperation.java | 188 +++ .../vertexai/genai/types/DatasetSchema.java | 113 ++ .../vertexai/genai/types/DatasetVersion.java | 306 ++++ .../genai/types/DeleteAgentEngineConfig.java | 82 + .../types/DeleteAgentEngineMemoryConfig.java | 84 + .../DeleteAgentEngineMemoryOperation.java | 169 ++ ...eteAgentEngineMemoryRequestParameters.java | 119 ++ .../types/DeleteAgentEngineOperation.java | 166 ++ .../DeleteAgentEngineRequestParameters.java | 140 ++ .../types/DeleteAgentEngineSandboxConfig.java | 84 + .../DeleteAgentEngineSandboxOperation.java | 169 ++ ...teAgentEngineSandboxRequestParameters.java | 119 ++ .../types/DeleteAgentEngineSessionConfig.java | 84 + .../DeleteAgentEngineSessionOperation.java | 169 ++ ...teAgentEngineSessionRequestParameters.java | 119 ++ .../types/DeleteDatasetRequestParameters.java | 117 ++ ...eteMultimodalDatasetRequestParameters.java | 119 ++ .../genai/types/DeletePromptConfig.java | 104 ++ .../genai/types/DeletePromptOperation.java | 166 ++ .../types/DeletePromptVersionOperation.java | 168 ++ .../DeletePromptVersionRequestParameters.java | 140 ++ .../cloud/vertexai/genai/types/DiskSpec.java | 110 ++ .../genai/types/DnsPeeringConfig.java | 141 ++ .../cloud/vertexai/genai/types/EnvVar.java | 113 ++ .../cloud/vertexai/genai/types/EvalCase.java | 381 +++++ .../genai/types/EvalCaseMetricResult.java | 231 +++ .../vertexai/genai/types/EvalCaseResult.java | 136 ++ .../genai/types/EvalRunInferenceConfig.java | 126 ++ .../genai/types/EvaluateDatasetConfig.java | 82 + .../genai/types/EvaluateDatasetOperation.java | 198 +++ .../EvaluateDatasetRequestParameters.java | 223 +++ .../genai/types/EvaluateInstancesConfig.java | 82 + .../EvaluateInstancesRequestParameters.java | 534 +++++++ .../types/EvaluateInstancesResponse.java | 508 ++++++ .../genai/types/EvaluateMethodConfig.java | 152 ++ .../genai/types/EvaluationDataset.java | 194 +++ .../genai/types/EvaluationInstance.java | 246 +++ .../vertexai/genai/types/EvaluationItem.java | 327 ++++ .../genai/types/EvaluationItemRequest.java | 202 +++ .../genai/types/EvaluationItemResult.java | 229 +++ .../genai/types/EvaluationItemType.java | 111 ++ .../genai/types/EvaluationPrompt.java | 136 ++ .../genai/types/EvaluationResult.java | 293 ++++ .../vertexai/genai/types/EvaluationRun.java | 441 ++++++ .../genai/types/EvaluationRunAgentConfig.java | 121 ++ .../genai/types/EvaluationRunConfig.java | 154 ++ .../genai/types/EvaluationRunDataSource.java | 113 ++ .../types/EvaluationRunInferenceConfig.java | 119 ++ .../genai/types/EvaluationRunMetadata.java | 160 ++ .../genai/types/EvaluationRunMetric.java | 113 ++ .../genai/types/EvaluationRunResults.java | 113 ++ .../genai/types/EvaluationRunState.java | 128 ++ .../vertexai/genai/types/EvaluationSet.java | 205 +++ .../cloud/vertexai/genai/types/Event.java | 154 ++ .../cloud/vertexai/genai/types/Events.java | 94 ++ .../vertexai/genai/types/ExactMatchInput.java | 140 ++ .../genai/types/ExactMatchInstance.java | 103 ++ .../genai/types/ExactMatchMetricValue.java | 81 + .../genai/types/ExactMatchResults.java | 111 ++ .../vertexai/genai/types/ExactMatchSpec.java | 56 + .../ExcludeFromGeneratedCoverageReport.java | 31 + .../ExecuteCodeAgentEngineSandboxConfig.java | 85 + ...deAgentEngineSandboxRequestParameters.java | 168 ++ .../ExecuteSandboxEnvironmentResponse.java | 111 ++ .../cloud/vertexai/genai/types/GcsSource.java | 102 ++ .../vertexai/genai/types/GeminiExample.java | 275 ++++ .../genai/types/GeminiRequestReadConfig.java | 117 ++ .../genai/types/GeminiTemplateConfig.java | 119 ++ .../GenerateAgentEngineMemoriesConfig.java | 240 +++ ...eAgentEngineMemoriesRequestParameters.java | 257 +++ .../types/GenerateInstanceRubricsRequest.java | 216 +++ .../GenerateInstanceRubricsResponse.java | 110 ++ ...teMemoriesRequestDirectContentsSource.java | 114 ++ ...oriesRequestDirectContentsSourceEvent.java | 86 + ...teMemoriesRequestDirectMemoriesSource.java | 123 ++ ...questDirectMemoriesSourceDirectMemory.java | 138 ++ ...ateMemoriesRequestVertexSessionSource.java | 139 ++ .../genai/types/GenerateMemoriesResponse.java | 111 ++ ...nerateMemoriesResponseGeneratedMemory.java | 167 ++ ...MemoriesResponseGeneratedMemoryAction.java | 130 ++ .../genai/types/GetAgentEngineConfig.java | 82 + ...neGenerateMemoriesOperationParameters.java | 119 ++ .../types/GetAgentEngineMemoryConfig.java | 82 + ...tAgentEngineMemoryOperationParameters.java | 119 ++ ...GetAgentEngineMemoryRequestParameters.java | 118 ++ .../GetAgentEngineMemoryRevisionConfig.java | 85 + ...EngineMemoryRevisionRequestParameters.java | 119 ++ .../types/GetAgentEngineOperationConfig.java | 84 + .../GetAgentEngineOperationParameters.java | 118 ++ .../GetAgentEngineRequestParameters.java | 117 ++ .../types/GetAgentEngineSandboxConfig.java | 82 + ...AgentEngineSandboxOperationParameters.java | 119 ++ ...etAgentEngineSandboxRequestParameters.java | 119 ++ .../types/GetAgentEngineSessionConfig.java | 82 + ...AgentEngineSessionOperationParameters.java | 119 ++ ...etAgentEngineSessionRequestParameters.java | 119 ++ .../genai/types/GetCustomJobParameters.java | 115 ++ .../types/GetDatasetOperationConfig.java | 82 + .../types/GetDatasetOperationParameters.java | 139 ++ .../genai/types/GetDatasetParameters.java | 115 ++ .../types/GetDatasetVersionParameters.java | 137 ++ .../genai/types/GetEvaluationItemConfig.java | 82 + .../types/GetEvaluationItemParameters.java | 115 ++ .../genai/types/GetEvaluationRunConfig.java | 82 + .../types/GetEvaluationRunParameters.java | 115 ++ .../genai/types/GetEvaluationSetConfig.java | 82 + .../types/GetEvaluationSetParameters.java | 115 ++ .../GetMultimodalDatasetOperationConfig.java | 85 + ...tMultimodalDatasetOperationParameters.java | 141 ++ .../types/GetMultimodalDatasetParameters.java | 117 ++ .../vertexai/genai/types/GetPromptConfig.java | 82 + .../vertexai/genai/types/IdentityType.java | 122 ++ .../vertexai/genai/types/Importance.java | 114 ++ .../vertexai/genai/types/InstanceData.java | 113 ++ .../genai/types/InstanceDataContents.java | 94 ++ .../types/IntermediateExtractedMemory.java | 81 + .../cloud/vertexai/genai/types/JobState.java | 144 ++ .../genai/types/LLMBasedMetricSpec.java | 219 +++ .../cloud/vertexai/genai/types/Language.java | 111 ++ .../genai/types/ListAgentEngineConfig.java | 152 ++ .../types/ListAgentEngineMemoryConfig.java | 184 +++ ...istAgentEngineMemoryRequestParameters.java | 119 ++ .../ListAgentEngineMemoryRevisionsConfig.java | 155 ++ ...ngineMemoryRevisionsRequestParameters.java | 119 ++ ...istAgentEngineMemoryRevisionsResponse.java | 157 ++ .../ListAgentEngineRequestParameters.java | 96 ++ .../types/ListAgentEngineSandboxesConfig.java | 154 ++ ...AgentEngineSandboxesRequestParameters.java | 119 ++ .../ListAgentEngineSandboxesResponse.java | 156 ++ .../types/ListAgentEngineSessionsConfig.java | 154 ++ ...tAgentEngineSessionsRequestParameters.java | 119 ++ .../ListDatasetVersionsRequestParameters.java | 140 ++ .../types/ListDatasetVersionsResponse.java | 153 ++ .../types/ListDatasetsRequestParameters.java | 95 ++ .../genai/types/ListDatasetsResponse.java | 153 ++ .../types/ListMultimodalDatasetsConfig.java | 154 ++ ...stMultimodalDatasetsRequestParameters.java | 97 ++ .../types/ListMultimodalDatasetsResponse.java | 181 +++ .../genai/types/ListPromptsConfig.java | 152 ++ .../ListReasoningEnginesMemoriesResponse.java | 156 ++ .../types/ListReasoningEnginesResponse.java | 155 ++ .../ListReasoningEnginesSessionsResponse.java | 156 ++ .../vertexai/genai/types/LustreMount.java | 151 ++ .../vertexai/genai/types/MachineConfig.java | 108 ++ .../vertexai/genai/types/MachineSpec.java | 283 ++++ .../genai/types/ManagedTopicEnum.java | 120 ++ .../vertexai/genai/types/MapInstance.java | 82 + .../cloud/vertexai/genai/types/Memory.java | 400 +++++ .../types/MemoryBankCustomizationConfig.java | 217 +++ ...mizationConfigGenerateMemoriesExample.java | 173 ++ ...rateMemoriesExampleConversationSource.java | 135 ++ ...emoriesExampleConversationSourceEvent.java | 101 ++ ...enerateMemoriesExampleGeneratedMemory.java | 155 ++ ...oryBankCustomizationConfigMemoryTopic.java | 137 ++ ...ionConfigMemoryTopicCustomMemoryTopic.java | 116 ++ ...onConfigMemoryTopicManagedMemoryTopic.java | 110 ++ .../vertexai/genai/types/MemoryRevision.java | 244 +++ .../vertexai/genai/types/MemoryTopicId.java | 123 ++ .../cloud/vertexai/genai/types/Message.java | 149 ++ .../cloud/vertexai/genai/types/Metadata.java | 87 ++ .../cloud/vertexai/genai/types/Metric.java | 262 ++++ .../vertexai/genai/types/MetricResult.java | 179 +++ .../vertexai/genai/types/MetricxResult.java | 84 + .../genai/types/MultimodalDataset.java | 157 ++ .../types/MultimodalDatasetOperation.java | 188 +++ .../cloud/vertexai/genai/types/NfsMount.java | 130 ++ .../genai/types/ObservabilityEvalCase.java | 148 ++ .../vertexai/genai/types/OptimizeConfig.java | 124 ++ .../types/OptimizeRequestParameters.java | 116 ++ .../genai/types/OptimizeResponse.java | 113 ++ .../genai/types/OptimizeResponseEndpoint.java | 82 + .../vertexai/genai/types/OptimizeTarget.java | 107 ++ .../vertexai/genai/types/PairwiseChoice.java | 114 ++ .../genai/types/PairwiseMetricInput.java | 91 ++ .../genai/types/PairwiseMetricInstance.java | 85 + .../genai/types/PairwiseMetricResult.java | 155 ++ .../vertexai/genai/types/ParsedResponse.java | 175 +++ .../genai/types/PointwiseMetricInput.java | 91 ++ .../genai/types/PointwiseMetricInstance.java | 85 + .../genai/types/PointwiseMetricResult.java | 135 ++ .../genai/types/PredefinedMetricSpec.java | 82 + .../genai/types/PromptOptimizerConfig.java | 183 +++ .../genai/types/PromptOptimizerMethod.java | 110 ++ .../cloud/vertexai/genai/types/PromptRef.java | 103 ++ .../vertexai/genai/types/PromptTemplate.java | 81 + .../genai/types/PromptTemplateData.java | 83 + .../genai/types/PromptVersionRef.java | 125 ++ .../genai/types/PscInterfaceConfig.java | 156 ++ .../genai/types/PythonPackageSpec.java | 234 +++ .../vertexai/genai/types/PythonVersion.java | 134 ++ .../genai/types/QueryAgentEngineConfig.java | 149 ++ .../QueryAgentEngineRequestParameters.java | 118 ++ .../types/QueryReasoningEngineResponse.java | 83 + .../cloud/vertexai/genai/types/RawOutput.java | 93 ++ .../vertexai/genai/types/ReasoningEngine.java | 316 ++++ .../types/ReasoningEngineContextSpec.java | 96 ++ ...ningEngineContextSpecMemoryBankConfig.java | 268 ++++ ...tSpecMemoryBankConfigGenerationConfig.java | 94 ++ ...emoryBankConfigSimilaritySearchConfig.java | 99 ++ ...eContextSpecMemoryBankConfigTtlConfig.java | 161 ++ ...yBankConfigTtlConfigGranularTtlConfig.java | 155 ++ .../genai/types/ReasoningEngineSpec.java | 346 ++++ .../ReasoningEngineSpecDeploymentSpec.java | 359 +++++ .../types/ReasoningEngineSpecPackageSpec.java | 154 ++ .../ReasoningEngineSpecSourceCodeSpec.java | 130 ++ ...gEngineSpecSourceCodeSpecInlineSource.java | 89 ++ ...ingEngineSpecSourceCodeSpecPythonSpec.java | 170 ++ .../genai/types/ReservationAffinity.java | 172 ++ .../genai/types/ResponseCandidate.java | 82 + .../genai/types/ResponseCandidateResult.java | 105 ++ .../genai/types/RestoreVersionConfig.java | 82 + .../genai/types/RestoreVersionOperation.java | 166 ++ .../RestoreVersionRequestParameters.java | 139 ++ .../RetrieveAgentEngineMemoriesConfig.java | 115 ++ ...eAgentEngineMemoriesRequestParameters.java | 220 +++ ...MemoriesRequestSimilaritySearchParams.java | 119 ++ ...eMemoriesRequestSimpleRetrievalParams.java | 117 ++ .../genai/types/RetrieveMemoriesResponse.java | 139 ++ ...trieveMemoriesResponseRetrievedMemory.java | 121 ++ .../RollbackAgentEngineMemoryConfig.java | 106 ++ ...ackAgentEngineMemoryRequestParameters.java | 141 ++ .../vertexai/genai/types/RougeInput.java | 108 ++ .../vertexai/genai/types/RougeInstance.java | 103 ++ .../genai/types/RougeMetricValue.java | 81 + .../vertexai/genai/types/RougeResults.java | 108 ++ .../cloud/vertexai/genai/types/Rubric.java | 192 +++ .../genai/types/RubricBasedMetricInput.java | 123 ++ .../types/RubricBasedMetricInstance.java | 117 ++ .../genai/types/RubricBasedMetricResult.java | 130 ++ .../genai/types/RubricBasedMetricSpec.java | 214 +++ .../vertexai/genai/types/RubricContent.java | 91 ++ .../genai/types/RubricContentProperty.java | 85 + .../genai/types/RubricContentType.java | 113 ++ .../genai/types/RubricEnhancedContents.java | 126 ++ .../genai/types/RubricGenerationConfig.java | 82 + .../genai/types/RubricGenerationSpec.java | 197 +++ .../vertexai/genai/types/RubricGroup.java | 158 ++ .../vertexai/genai/types/RubricVerdict.java | 152 ++ .../vertexai/genai/types/SamplingConfig.java | 145 ++ .../vertexai/genai/types/SamplingMethod.java | 110 ++ .../genai/types/SandboxEnvironment.java | 304 ++++ .../SandboxEnvironmentConnectionInfo.java | 128 ++ .../genai/types/SandboxEnvironmentSpec.java | 130 ++ ...vironmentSpecCodeExecutionEnvironment.java | 147 ++ ...EnvironmentSpecComputerUseEnvironment.java | 60 + .../vertexai/genai/types/SavedQuery.java | 303 ++++ .../vertexai/genai/types/Scheduling.java | 206 +++ .../SchemaPredictParamsGroundingConfig.java | 135 ++ ...edictParamsGroundingConfigSourceEntry.java | 178 +++ .../genai/types/SchemaPromptApiSchema.java | 230 +++ .../SchemaPromptInstancePromptExecution.java | 85 + .../SchemaPromptInstanceVariableValue.java | 94 ++ .../SchemaPromptSpecMultimodalPrompt.java | 94 ++ .../genai/types/SchemaPromptSpecPartList.java | 94 ++ .../types/SchemaPromptSpecPromptMessage.java | 311 ++++ ...SchemaPromptSpecReferenceSentencePair.java | 106 ++ ...maPromptSpecReferenceSentencePairList.java | 116 ++ .../SchemaPromptSpecStructuredPrompt.java | 325 ++++ .../SchemaPromptSpecTranslationExample.java | 167 ++ ...aPromptSpecTranslationFileInputSource.java | 129 ++ ...maPromptSpecTranslationGcsInputSource.java | 85 + .../SchemaPromptSpecTranslationOption.java | 84 + .../SchemaPromptSpecTranslationPrompt.java | 202 +++ ...romptSpecTranslationSentenceFileInput.java | 133 ++ .../types/SchemaTablesDatasetMetadata.java | 91 ++ ...maTablesDatasetMetadataBigQuerySource.java | 88 ++ ...chemaTablesDatasetMetadataInputConfig.java | 98 ++ .../SchemaTextPromptDatasetMetadata.java | 508 ++++++ .../vertexai/genai/types/SecretEnvVar.java | 118 ++ .../cloud/vertexai/genai/types/SecretRef.java | 110 ++ .../cloud/vertexai/genai/types/Session.java | 276 ++++ .../vertexai/genai/types/SessionInput.java | 85 + .../cloud/vertexai/genai/types/State.java | 119 ++ .../cloud/vertexai/genai/types/Strategy.java | 120 ++ .../vertexai/genai/types/SummaryMetric.java | 126 ++ .../genai/types/ToolCallValidInput.java | 140 ++ .../genai/types/ToolCallValidInstance.java | 103 ++ .../genai/types/ToolCallValidMetricValue.java | 81 + .../genai/types/ToolCallValidResults.java | 112 ++ .../genai/types/ToolCallValidSpec.java | 56 + .../genai/types/ToolNameMatchInput.java | 140 ++ .../genai/types/ToolNameMatchInstance.java | 103 ++ .../genai/types/ToolNameMatchMetricValue.java | 81 + .../genai/types/ToolNameMatchResults.java | 112 ++ .../genai/types/ToolNameMatchSpec.java | 56 + .../types/ToolParameterKVMatchInput.java | 140 ++ .../types/ToolParameterKVMatchInstance.java | 105 ++ .../ToolParameterKVMatchMetricValue.java | 83 + .../types/ToolParameterKVMatchResults.java | 116 ++ .../genai/types/ToolParameterKVMatchSpec.java | 81 + .../types/ToolParameterKeyMatchInput.java | 140 ++ .../types/ToolParameterKeyMatchInstance.java | 105 ++ .../ToolParameterKeyMatchMetricValue.java | 84 + .../types/ToolParameterKeyMatchResults.java | 115 ++ .../types/ToolParameterKeyMatchSpec.java | 56 + .../cloud/vertexai/genai/types/Tools.java | 94 ++ .../TuningResourceUsageAssessmentResult.java | 106 ++ .../TuningValidationAssessmentResult.java | 96 ++ .../cloud/vertexai/genai/types/Type.java | 116 ++ .../vertexai/genai/types/UnifiedMetric.java | 123 ++ .../genai/types/UpdateAgentEngineConfig.java | 719 +++++++++ .../types/UpdateAgentEngineMemoryConfig.java | 353 +++++ ...ateAgentEngineMemoryRequestParameters.java | 180 +++ .../UpdateAgentEngineRequestParameters.java | 118 ++ .../types/UpdateAgentEngineSessionConfig.java | 285 ++++ ...teAgentEngineSessionRequestParameters.java | 119 ++ .../genai/types/UpdateDatasetConfig.java | 82 + .../genai/types/UpdateDatasetParameters.java | 258 +++ .../types/UpdateMultimodalDatasetConfig.java | 110 ++ .../UpdateMultimodalDatasetParameters.java | 217 +++ .../genai/types/VertexBaseConfig.java | 82 + .../vertexai/genai/types/WinRateStats.java | 115 ++ .../vertexai/genai/types/WorkerPoolSpec.java | 303 ++++ .../google/cloud/vertexai/VertexAITest.java | 2 + .../cloud/vertexai/genai/EvalsTest.java | 42 + .../google/cloud/vertexai/api/GcsSource.java | 26 +- .../vertexai/api/GcsSourceOrBuilder.java | 8 +- .../proto/google/cloud/vertexai/v1/io.proto | 2 +- 398 files changed, 66618 insertions(+), 18 deletions(-) create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AgentEngines.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/ApiResponse.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncAgentEngines.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncDatasets.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncEvals.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncMemories.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncMemoryRevisions.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncPromptOptimizer.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncPrompts.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncSandboxes.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncSessions.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Client.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Datasets.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/DebugConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Evals.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/ExcludeFromGeneratedCoverageReport.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Memories.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/MemoryRevisions.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/PromptOptimizer.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Prompts.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/RetryInterceptor.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Sandboxes.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Sessions.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AcceleratorType.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentData.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngine.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineGenerateMemoriesOperation.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineMemoryConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineMemoryOperation.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineOperation.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineRollbackMemoryOperation.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineSandboxOperation.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineSessionOperation.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentFramework.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentInfo.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentServerMode.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AggregatedMetricResult.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ApplicableGuideline.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AssembleDataset.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AssembleDatasetConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AssembleDatasetParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BatchPredictionResourceUsageAssessmentResult.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BigQueryRequestSet.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BigQuerySource.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BleuInput.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BleuInstance.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BleuMetricValue.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BleuResults.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CandidateResponse.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CandidateResult.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Chunk.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CometResult.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ContainerSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ContentMapContents.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineMemoryRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSandboxConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSandboxRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSessionConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSessionRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateDatasetConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateDatasetParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateDatasetVersionConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateDatasetVersionParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateEvaluationItemConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateEvaluationItemParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateEvaluationSetConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateEvaluationSetParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateMultimodalDatasetConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateMultimodalDatasetParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreatePromptConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreatePromptVersionConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CustomJob.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CustomJobParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CustomJobSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CustomOutput.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Dataset.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DatasetOperation.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DatasetSchema.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DatasetVersion.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryOperation.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineOperation.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxOperation.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSessionConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSessionOperation.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSessionRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteDatasetRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteMultimodalDatasetRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeletePromptConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeletePromptOperation.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeletePromptVersionOperation.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeletePromptVersionRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DiskSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DnsPeeringConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EnvVar.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvalCase.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvalCaseMetricResult.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvalCaseResult.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvalRunInferenceConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateDatasetConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateDatasetOperation.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateDatasetRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateInstancesConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateInstancesRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateInstancesResponse.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateMethodConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationDataset.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationInstance.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationItem.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationItemRequest.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationItemResult.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationItemType.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationPrompt.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationResult.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRun.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunAgentConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunDataSource.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunInferenceConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunMetadata.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunMetric.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunResults.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunState.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationSet.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Event.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Events.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchInput.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchInstance.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchMetricValue.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchResults.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExcludeFromGeneratedCoverageReport.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteCodeAgentEngineSandboxConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteCodeAgentEngineSandboxRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteSandboxEnvironmentResponse.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GcsSource.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GeminiExample.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GeminiRequestReadConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GeminiTemplateConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateAgentEngineMemoriesConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateAgentEngineMemoriesRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateInstanceRubricsRequest.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateInstanceRubricsResponse.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectContentsSource.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectContentsSourceEvent.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectMemoriesSource.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestVertexSessionSource.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponse.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponseGeneratedMemory.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponseGeneratedMemoryAction.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineGenerateMemoriesOperationParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryOperationParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRevisionConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRevisionRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineOperationConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineOperationParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxOperationParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSessionConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSessionOperationParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSessionRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetCustomJobParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetDatasetOperationConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetDatasetOperationParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetDatasetParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetDatasetVersionParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationItemConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationItemParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationRunConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationRunParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationSetConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationSetParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetMultimodalDatasetOperationConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetMultimodalDatasetOperationParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetMultimodalDatasetParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetPromptConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/IdentityType.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Importance.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/InstanceData.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/InstanceDataContents.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/IntermediateExtractedMemory.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/JobState.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/LLMBasedMetricSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Language.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsResponse.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesResponse.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSessionsConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSessionsRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListDatasetVersionsRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListDatasetVersionsResponse.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListDatasetsRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListDatasetsResponse.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListMultimodalDatasetsConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListMultimodalDatasetsRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListMultimodalDatasetsResponse.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListPromptsConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListReasoningEnginesMemoriesResponse.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListReasoningEnginesResponse.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListReasoningEnginesSessionsResponse.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/LustreMount.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MachineConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MachineSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ManagedTopicEnum.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MapInstance.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Memory.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigGenerateMemoriesExample.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSource.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigMemoryTopic.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryRevision.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryTopicId.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Message.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Metadata.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Metric.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MetricResult.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MetricxResult.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MultimodalDataset.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MultimodalDatasetOperation.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/NfsMount.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ObservabilityEvalCase.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeResponse.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeResponseEndpoint.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeTarget.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PairwiseChoice.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PairwiseMetricInput.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PairwiseMetricInstance.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PairwiseMetricResult.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ParsedResponse.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PointwiseMetricInput.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PointwiseMetricInstance.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PointwiseMetricResult.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PredefinedMetricSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptOptimizerConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptOptimizerMethod.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptRef.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptTemplate.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptTemplateData.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptVersionRef.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PscInterfaceConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PythonPackageSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PythonVersion.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/QueryAgentEngineConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/QueryAgentEngineRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/QueryReasoningEngineResponse.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RawOutput.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngine.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfigGenerationConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfigSimilaritySearchConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfigTtlConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfigTtlConfigGranularTtlConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecDeploymentSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecPackageSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecSourceCodeSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecSourceCodeSpecInlineSource.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecSourceCodeSpecPythonSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReservationAffinity.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ResponseCandidate.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ResponseCandidateResult.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RestoreVersionConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RestoreVersionOperation.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RestoreVersionRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveAgentEngineMemoriesConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveAgentEngineMemoriesRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesRequestSimilaritySearchParams.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesRequestSimpleRetrievalParams.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesResponse.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesResponseRetrievedMemory.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RollbackAgentEngineMemoryConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RollbackAgentEngineMemoryRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RougeInput.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RougeInstance.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RougeMetricValue.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RougeResults.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Rubric.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricBasedMetricInput.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricBasedMetricInstance.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricBasedMetricResult.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricBasedMetricSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricContent.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricContentProperty.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricContentType.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricEnhancedContents.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricGenerationConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricGenerationSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricGroup.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricVerdict.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SamplingConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SamplingMethod.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironment.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentConnectionInfo.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpecCodeExecutionEnvironment.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpecComputerUseEnvironment.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SavedQuery.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Scheduling.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPredictParamsGroundingConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPredictParamsGroundingConfigSourceEntry.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptApiSchema.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptInstancePromptExecution.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptInstanceVariableValue.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecMultimodalPrompt.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecPartList.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecPromptMessage.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecReferenceSentencePair.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecReferenceSentencePairList.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecStructuredPrompt.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationExample.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationFileInputSource.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationGcsInputSource.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationOption.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationPrompt.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationSentenceFileInput.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaTablesDatasetMetadata.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaTablesDatasetMetadataBigQuerySource.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaTablesDatasetMetadataInputConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaTextPromptDatasetMetadata.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SecretEnvVar.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SecretRef.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Session.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SessionInput.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/State.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Strategy.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SummaryMetric.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidInput.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidInstance.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidMetricValue.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidResults.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchInput.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchInstance.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchMetricValue.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchResults.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchInput.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchInstance.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchMetricValue.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchResults.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchInput.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchInstance.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchMetricValue.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchResults.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Tools.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/TuningResourceUsageAssessmentResult.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/TuningValidationAssessmentResult.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Type.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UnifiedMetric.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineMemoryConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineMemoryRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineSessionConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineSessionRequestParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateDatasetConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateDatasetParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateMultimodalDatasetConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateMultimodalDatasetParameters.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/VertexBaseConfig.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/WinRateStats.java create mode 100644 java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/WorkerPoolSpec.java create mode 100644 java-vertexai/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/genai/EvalsTest.java diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AgentEngines.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AgentEngines.java new file mode 100644 index 000000000000..795da2ff16d5 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AgentEngines.java @@ -0,0 +1,967 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.google.cloud.vertexai.genai.types.AgentEngineOperation; +import com.google.cloud.vertexai.genai.types.CreateAgentEngineConfig; +import com.google.cloud.vertexai.genai.types.CreateAgentEngineRequestParameters; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineConfig; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineOperation; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineRequestParameters; +import com.google.cloud.vertexai.genai.types.GetAgentEngineConfig; +import com.google.cloud.vertexai.genai.types.GetAgentEngineOperationConfig; +import com.google.cloud.vertexai.genai.types.GetAgentEngineOperationParameters; +import com.google.cloud.vertexai.genai.types.GetAgentEngineRequestParameters; +import com.google.cloud.vertexai.genai.types.ListAgentEngineConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineRequestParameters; +import com.google.cloud.vertexai.genai.types.ListReasoningEnginesResponse; +import com.google.cloud.vertexai.genai.types.QueryAgentEngineConfig; +import com.google.cloud.vertexai.genai.types.QueryAgentEngineRequestParameters; +import com.google.cloud.vertexai.genai.types.QueryReasoningEngineResponse; +import com.google.cloud.vertexai.genai.types.ReasoningEngine; +import com.google.cloud.vertexai.genai.types.UpdateAgentEngineConfig; +import com.google.cloud.vertexai.genai.types.UpdateAgentEngineRequestParameters; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common; +import com.google.genai.Common.BuiltRequest; +import com.google.genai.JsonSerializable; +import com.google.genai.errors.GenAiIOException; +import com.google.genai.types.HttpOptions; +import java.io.IOException; +import java.util.Optional; +import okhttp3.ResponseBody; + +public final class AgentEngines { + + final ApiClient apiClient; + + public AgentEngines(ApiClient apiClient) { + this.apiClient = apiClient; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode createAgentEngineConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"displayName"}, + Common.getValueByPath(fromObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"description"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"description"}, + Common.getValueByPath(fromObject, new String[] {"description"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"spec"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"spec"}, + Common.getValueByPath(fromObject, new String[] {"spec"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"contextSpec"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"contextSpec"}, + Common.getValueByPath(fromObject, new String[] {"contextSpec"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"pscInterfaceConfig"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"pscInterfaceConfig"}, + Common.getValueByPath(fromObject, new String[] {"pscInterfaceConfig"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"encryptionSpec"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"encryptionSpec"}, + Common.getValueByPath(fromObject, new String[] {"encryptionSpec"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"labels"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"labels"}, + Common.getValueByPath(fromObject, new String[] {"labels"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"sourcePackages"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"sourcePackages"}, + Common.getValueByPath(fromObject, new String[] {"sourcePackages"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"entrypointModule"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"entrypointModule"}, + Common.getValueByPath(fromObject, new String[] {"entrypointModule"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"entrypointObject"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"entrypointObject"}, + Common.getValueByPath(fromObject, new String[] {"entrypointObject"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"requirementsFile"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"requirementsFile"}, + Common.getValueByPath(fromObject, new String[] {"requirementsFile"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"agentFramework"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"agentFramework"}, + Common.getValueByPath(fromObject, new String[] {"agentFramework"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"pythonVersion"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"pythonVersion"}, + Common.getValueByPath(fromObject, new String[] {"pythonVersion"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode createAgentEngineRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + createAgentEngineConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode deleteAgentEngineRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"force"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"force"}, + Common.getValueByPath(fromObject, new String[] {"force"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getAgentEngineOperationParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"operationName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "operationName"}, + Common.getValueByPath(fromObject, new String[] {"operationName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getAgentEngineRequestParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listAgentEngineConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"pageSize"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageSize"}, + Common.getValueByPath(fromObject, new String[] {"pageSize"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"pageToken"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageToken"}, + Common.getValueByPath(fromObject, new String[] {"pageToken"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"filter"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "filter"}, + Common.getValueByPath(fromObject, new String[] {"filter"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listAgentEngineRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + listAgentEngineConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode queryAgentEngineConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"classMethod"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"classMethod"}, + Common.getValueByPath(fromObject, new String[] {"classMethod"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"input"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"input"}, + Common.getValueByPath(fromObject, new String[] {"input"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"includeAllFields"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"includeAllFields"}, + Common.getValueByPath(fromObject, new String[] {"includeAllFields"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode queryAgentEngineRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + queryAgentEngineConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode updateAgentEngineConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"displayName"}, + Common.getValueByPath(fromObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"description"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"description"}, + Common.getValueByPath(fromObject, new String[] {"description"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"spec"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"spec"}, + Common.getValueByPath(fromObject, new String[] {"spec"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"contextSpec"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"contextSpec"}, + Common.getValueByPath(fromObject, new String[] {"contextSpec"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"pscInterfaceConfig"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"pscInterfaceConfig"}, + Common.getValueByPath(fromObject, new String[] {"pscInterfaceConfig"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"encryptionSpec"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"encryptionSpec"}, + Common.getValueByPath(fromObject, new String[] {"encryptionSpec"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"labels"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"labels"}, + Common.getValueByPath(fromObject, new String[] {"labels"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"sourcePackages"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"sourcePackages"}, + Common.getValueByPath(fromObject, new String[] {"sourcePackages"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"entrypointModule"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"entrypointModule"}, + Common.getValueByPath(fromObject, new String[] {"entrypointModule"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"entrypointObject"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"entrypointObject"}, + Common.getValueByPath(fromObject, new String[] {"entrypointObject"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"requirementsFile"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"requirementsFile"}, + Common.getValueByPath(fromObject, new String[] {"requirementsFile"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"agentFramework"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"agentFramework"}, + Common.getValueByPath(fromObject, new String[] {"agentFramework"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"pythonVersion"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"pythonVersion"}, + Common.getValueByPath(fromObject, new String[] {"pythonVersion"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"updateMask"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "updateMask"}, + Common.getValueByPath(fromObject, new String[] {"updateMask"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode updateAgentEngineRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + updateAgentEngineConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateCreate(CreateAgentEngineConfig config) { + + CreateAgentEngineRequestParameters.Builder parameterBuilder = + CreateAgentEngineRequestParameters.builder(); + + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = createAgentEngineRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("reasoningEngines", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineOperation processResponseForPrivateCreate( + ApiResponse response, CreateAgentEngineConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineOperation.class); + } + + AgentEngineOperation privateCreate(CreateAgentEngineConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateCreate(config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateCreate(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateDelete( + String name, boolean force, DeleteAgentEngineConfig config) { + + DeleteAgentEngineRequestParameters.Builder parameterBuilder = + DeleteAgentEngineRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(force)) { + parameterBuilder.force(force); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = deleteAgentEngineRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + DeleteAgentEngineOperation processResponseForPrivateDelete( + ApiResponse response, DeleteAgentEngineConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, DeleteAgentEngineOperation.class); + } + + DeleteAgentEngineOperation privateDelete( + String name, boolean force, DeleteAgentEngineConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateDelete(name, force, config); + + try (ApiResponse response = + this.apiClient.request( + "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateDelete(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGet(String name, GetAgentEngineConfig config) { + + GetAgentEngineRequestParameters.Builder parameterBuilder = + GetAgentEngineRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getAgentEngineRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + ReasoningEngine processResponseForPrivateGet(ApiResponse response, GetAgentEngineConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, ReasoningEngine.class); + } + + ReasoningEngine privateGet(String name, GetAgentEngineConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateGet(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGet(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateList(ListAgentEngineConfig config) { + + ListAgentEngineRequestParameters.Builder parameterBuilder = + ListAgentEngineRequestParameters.builder(); + + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = listAgentEngineRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("reasoningEngines", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + ListReasoningEnginesResponse processResponseForPrivateList( + ApiResponse response, ListAgentEngineConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, ListReasoningEnginesResponse.class); + } + + ListReasoningEnginesResponse privateList(ListAgentEngineConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateList(config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateList(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGetAgentOperation( + String operationName, GetAgentEngineOperationConfig config) { + + GetAgentEngineOperationParameters.Builder parameterBuilder = + GetAgentEngineOperationParameters.builder(); + + if (!Common.isZero(operationName)) { + parameterBuilder.operationName(operationName); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getAgentEngineOperationParametersToVertex(parameterNode, null); + path = Common.formatMap("{operationName}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineOperation processResponseForPrivateGetAgentOperation( + ApiResponse response, GetAgentEngineOperationConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineOperation.class); + } + + AgentEngineOperation privateGetAgentOperation( + String operationName, GetAgentEngineOperationConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateGetAgentOperation(operationName, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGetAgentOperation(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateQuery(String name, QueryAgentEngineConfig config) { + + QueryAgentEngineRequestParameters.Builder parameterBuilder = + QueryAgentEngineRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = queryAgentEngineRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}:query", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + QueryReasoningEngineResponse processResponseForPrivateQuery( + ApiResponse response, QueryAgentEngineConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, QueryReasoningEngineResponse.class); + } + + QueryReasoningEngineResponse privateQuery(String name, QueryAgentEngineConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateQuery(name, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateQuery(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateUpdate(String name, UpdateAgentEngineConfig config) { + + UpdateAgentEngineRequestParameters.Builder parameterBuilder = + UpdateAgentEngineRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = updateAgentEngineRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineOperation processResponseForPrivateUpdate( + ApiResponse response, UpdateAgentEngineConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineOperation.class); + } + + AgentEngineOperation privateUpdate(String name, UpdateAgentEngineConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateUpdate(name, config); + + try (ApiResponse response = + this.apiClient.request( + "patch", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateUpdate(response, config); + } + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/ApiResponse.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/ApiResponse.java new file mode 100644 index 000000000000..bb92e38407a4 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/ApiResponse.java @@ -0,0 +1,32 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +package com.google.cloud.vertexai.genai; + +import okhttp3.Headers; +import okhttp3.ResponseBody; + +/** The API response contains a response to a call to the GenAI APIs. */ +abstract class ApiResponse implements AutoCloseable { + /** Gets the ResponseBody. */ + public abstract ResponseBody getBody(); + + /** Returns all of the headers from the response. */ + public abstract Headers getHeaders(); + + @Override + public abstract void close(); +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncAgentEngines.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncAgentEngines.java new file mode 100644 index 000000000000..b2480a921eeb --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncAgentEngines.java @@ -0,0 +1,138 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai; + +import com.google.cloud.vertexai.genai.types.AgentEngineOperation; +import com.google.cloud.vertexai.genai.types.CreateAgentEngineConfig; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineConfig; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineOperation; +import com.google.cloud.vertexai.genai.types.GetAgentEngineConfig; +import com.google.cloud.vertexai.genai.types.GetAgentEngineOperationConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineConfig; +import com.google.cloud.vertexai.genai.types.ListReasoningEnginesResponse; +import com.google.cloud.vertexai.genai.types.QueryAgentEngineConfig; +import com.google.cloud.vertexai.genai.types.QueryReasoningEngineResponse; +import com.google.cloud.vertexai.genai.types.ReasoningEngine; +import com.google.cloud.vertexai.genai.types.UpdateAgentEngineConfig; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common.BuiltRequest; +import java.util.concurrent.CompletableFuture; + +/** Async module of {@link AgentEngines} */ +public final class AsyncAgentEngines { + + AgentEngines agentEngines; + ApiClient apiClient; + + public AsyncAgentEngines(ApiClient apiClient) { + this.apiClient = apiClient; + this.agentEngines = new AgentEngines(apiClient); + } + + CompletableFuture privateCreate(CreateAgentEngineConfig config) { + BuiltRequest builtRequest = agentEngines.buildRequestForPrivateCreate(config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return agentEngines.processResponseForPrivateCreate(res, config); + } + }); + } + + CompletableFuture privateDelete( + String name, boolean force, DeleteAgentEngineConfig config) { + BuiltRequest builtRequest = agentEngines.buildRequestForPrivateDelete(name, force, config); + return this.apiClient + .asyncRequest( + "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return agentEngines.processResponseForPrivateDelete(res, config); + } + }); + } + + CompletableFuture privateGet(String name, GetAgentEngineConfig config) { + BuiltRequest builtRequest = agentEngines.buildRequestForPrivateGet(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return agentEngines.processResponseForPrivateGet(res, config); + } + }); + } + + CompletableFuture privateList(ListAgentEngineConfig config) { + BuiltRequest builtRequest = agentEngines.buildRequestForPrivateList(config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return agentEngines.processResponseForPrivateList(res, config); + } + }); + } + + CompletableFuture privateGetAgentOperation( + String operationName, GetAgentEngineOperationConfig config) { + BuiltRequest builtRequest = + agentEngines.buildRequestForPrivateGetAgentOperation(operationName, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return agentEngines.processResponseForPrivateGetAgentOperation(res, config); + } + }); + } + + CompletableFuture privateQuery( + String name, QueryAgentEngineConfig config) { + BuiltRequest builtRequest = agentEngines.buildRequestForPrivateQuery(name, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return agentEngines.processResponseForPrivateQuery(res, config); + } + }); + } + + CompletableFuture privateUpdate( + String name, UpdateAgentEngineConfig config) { + BuiltRequest builtRequest = agentEngines.buildRequestForPrivateUpdate(name, config); + return this.apiClient + .asyncRequest("patch", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return agentEngines.processResponseForPrivateUpdate(res, config); + } + }); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncDatasets.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncDatasets.java new file mode 100644 index 000000000000..b01e66ed0e11 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncDatasets.java @@ -0,0 +1,160 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai; + +import com.google.cloud.vertexai.genai.types.AssembleDatasetConfig; +import com.google.cloud.vertexai.genai.types.CreateMultimodalDatasetConfig; +import com.google.cloud.vertexai.genai.types.GeminiRequestReadConfig; +import com.google.cloud.vertexai.genai.types.GetMultimodalDatasetOperationConfig; +import com.google.cloud.vertexai.genai.types.ListMultimodalDatasetsConfig; +import com.google.cloud.vertexai.genai.types.ListMultimodalDatasetsResponse; +import com.google.cloud.vertexai.genai.types.MultimodalDataset; +import com.google.cloud.vertexai.genai.types.MultimodalDatasetOperation; +import com.google.cloud.vertexai.genai.types.SchemaTablesDatasetMetadata; +import com.google.cloud.vertexai.genai.types.UpdateMultimodalDatasetConfig; +import com.google.cloud.vertexai.genai.types.VertexBaseConfig; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common.BuiltRequest; +import com.google.genai.types.EncryptionSpec; +import java.util.concurrent.CompletableFuture; + +/** Async module of {@link Datasets} */ +public final class AsyncDatasets { + + Datasets datasets; + ApiClient apiClient; + + public AsyncDatasets(ApiClient apiClient) { + this.apiClient = apiClient; + this.datasets = new Datasets(apiClient); + } + + CompletableFuture privateAssembleMultimodalDataset( + String name, GeminiRequestReadConfig geminiRequestReadConfig, AssembleDatasetConfig config) { + BuiltRequest builtRequest = + datasets.buildRequestForPrivateAssembleMultimodalDataset( + name, geminiRequestReadConfig, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return datasets.processResponseForPrivateAssembleMultimodalDataset(res, config); + } + }); + } + + CompletableFuture privateCreateMultimodalDataset( + String name, + String displayName, + String metadataSchemaUri, + SchemaTablesDatasetMetadata metadata, + String description, + EncryptionSpec encryptionSpec, + CreateMultimodalDatasetConfig config) { + BuiltRequest builtRequest = + datasets.buildRequestForPrivateCreateMultimodalDataset( + name, displayName, metadataSchemaUri, metadata, description, encryptionSpec, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return datasets.processResponseForPrivateCreateMultimodalDataset(res, config); + } + }); + } + + CompletableFuture privateDeleteMultimodalDataset( + String name, VertexBaseConfig config) { + BuiltRequest builtRequest = + datasets.buildRequestForPrivateDeleteMultimodalDataset(name, config); + return this.apiClient + .asyncRequest( + "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return datasets.processResponseForPrivateDeleteMultimodalDataset(res, config); + } + }); + } + + CompletableFuture privateGetMultimodalDataset( + String name, VertexBaseConfig config) { + BuiltRequest builtRequest = datasets.buildRequestForPrivateGetMultimodalDataset(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return datasets.processResponseForPrivateGetMultimodalDataset(res, config); + } + }); + } + + CompletableFuture privateGetMultimodalDatasetOperation( + String datasetId, String operationId, GetMultimodalDatasetOperationConfig config) { + BuiltRequest builtRequest = + datasets.buildRequestForPrivateGetMultimodalDatasetOperation( + datasetId, operationId, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return datasets.processResponseForPrivateGetMultimodalDatasetOperation(res, config); + } + }); + } + + CompletableFuture privateListMultimodalDatasets( + ListMultimodalDatasetsConfig config) { + BuiltRequest builtRequest = datasets.buildRequestForPrivateListMultimodalDatasets(config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return datasets.processResponseForPrivateListMultimodalDatasets(res, config); + } + }); + } + + CompletableFuture privateUpdateMultimodalDataset( + String name, + String displayName, + SchemaTablesDatasetMetadata metadata, + String description, + EncryptionSpec encryptionSpec, + UpdateMultimodalDatasetConfig config) { + BuiltRequest builtRequest = + datasets.buildRequestForPrivateUpdateMultimodalDataset( + name, displayName, metadata, description, encryptionSpec, config); + return this.apiClient + .asyncRequest("patch", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return datasets.processResponseForPrivateUpdateMultimodalDataset(res, config); + } + }); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncEvals.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncEvals.java new file mode 100644 index 000000000000..1df44e320002 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncEvals.java @@ -0,0 +1,195 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai; + +import com.google.cloud.vertexai.genai.types.BleuInput; +import com.google.cloud.vertexai.genai.types.CreateEvaluationItemConfig; +import com.google.cloud.vertexai.genai.types.CreateEvaluationSetConfig; +import com.google.cloud.vertexai.genai.types.EvaluateInstancesConfig; +import com.google.cloud.vertexai.genai.types.EvaluateInstancesResponse; +import com.google.cloud.vertexai.genai.types.EvaluationInstance; +import com.google.cloud.vertexai.genai.types.EvaluationItem; +import com.google.cloud.vertexai.genai.types.EvaluationRun; +import com.google.cloud.vertexai.genai.types.EvaluationSet; +import com.google.cloud.vertexai.genai.types.ExactMatchInput; +import com.google.cloud.vertexai.genai.types.GenerateInstanceRubricsResponse; +import com.google.cloud.vertexai.genai.types.GetEvaluationItemConfig; +import com.google.cloud.vertexai.genai.types.GetEvaluationRunConfig; +import com.google.cloud.vertexai.genai.types.GetEvaluationSetConfig; +import com.google.cloud.vertexai.genai.types.Metric; +import com.google.cloud.vertexai.genai.types.PairwiseMetricInput; +import com.google.cloud.vertexai.genai.types.PointwiseMetricInput; +import com.google.cloud.vertexai.genai.types.PredefinedMetricSpec; +import com.google.cloud.vertexai.genai.types.RougeInput; +import com.google.cloud.vertexai.genai.types.RubricBasedMetricInput; +import com.google.cloud.vertexai.genai.types.RubricGenerationConfig; +import com.google.cloud.vertexai.genai.types.RubricGenerationSpec; +import com.google.cloud.vertexai.genai.types.ToolCallValidInput; +import com.google.cloud.vertexai.genai.types.ToolNameMatchInput; +import com.google.cloud.vertexai.genai.types.ToolParameterKVMatchInput; +import com.google.cloud.vertexai.genai.types.ToolParameterKeyMatchInput; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common.BuiltRequest; +import com.google.genai.types.AutoraterConfig; +import com.google.genai.types.Content; +import java.util.List; +import java.util.concurrent.CompletableFuture; + +/** Async module of {@link Evals} */ +public final class AsyncEvals { + + Evals evals; + ApiClient apiClient; + + public AsyncEvals(ApiClient apiClient) { + this.apiClient = apiClient; + this.evals = new Evals(apiClient); + } + + CompletableFuture privateCreateEvaluationItem( + String evaluationItemType, + String gcsUri, + String displayName, + CreateEvaluationItemConfig config) { + BuiltRequest builtRequest = + evals.buildRequestForPrivateCreateEvaluationItem( + evaluationItemType, gcsUri, displayName, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return evals.processResponseForPrivateCreateEvaluationItem(res, config); + } + }); + } + + CompletableFuture privateCreateEvaluationSet( + List evaluationItems, String displayName, CreateEvaluationSetConfig config) { + BuiltRequest builtRequest = + evals.buildRequestForPrivateCreateEvaluationSet(evaluationItems, displayName, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return evals.processResponseForPrivateCreateEvaluationSet(res, config); + } + }); + } + + public CompletableFuture EvaluateInstances( + BleuInput bleuInput, + ExactMatchInput exactMatchInput, + RougeInput rougeInput, + PointwiseMetricInput pointwiseMetricInput, + PairwiseMetricInput pairwiseMetricInput, + ToolCallValidInput toolCallValidInput, + ToolNameMatchInput toolNameMatchInput, + ToolParameterKeyMatchInput toolParameterKeyMatchInput, + ToolParameterKVMatchInput toolParameterKvMatchInput, + RubricBasedMetricInput rubricBasedMetricInput, + AutoraterConfig autoraterConfig, + List metrics, + EvaluationInstance instance, + EvaluateInstancesConfig config) { + BuiltRequest builtRequest = + evals.buildRequestForEvaluateInstances( + bleuInput, + exactMatchInput, + rougeInput, + pointwiseMetricInput, + pairwiseMetricInput, + toolCallValidInput, + toolNameMatchInput, + toolParameterKeyMatchInput, + toolParameterKvMatchInput, + rubricBasedMetricInput, + autoraterConfig, + metrics, + instance, + config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return evals.processResponseForEvaluateInstances(res, config); + } + }); + } + + CompletableFuture privateGenerateRubrics( + List contents, + PredefinedMetricSpec predefinedRubricGenerationSpec, + RubricGenerationSpec rubricGenerationSpec, + RubricGenerationConfig config) { + BuiltRequest builtRequest = + evals.buildRequestForPrivateGenerateRubrics( + contents, predefinedRubricGenerationSpec, rubricGenerationSpec, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return evals.processResponseForPrivateGenerateRubrics(res, config); + } + }); + } + + CompletableFuture privateGetEvaluationRun( + String name, GetEvaluationRunConfig config) { + BuiltRequest builtRequest = evals.buildRequestForPrivateGetEvaluationRun(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return evals.processResponseForPrivateGetEvaluationRun(res, config); + } + }); + } + + CompletableFuture privateGetEvaluationSet( + String name, GetEvaluationSetConfig config) { + BuiltRequest builtRequest = evals.buildRequestForPrivateGetEvaluationSet(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return evals.processResponseForPrivateGetEvaluationSet(res, config); + } + }); + } + + CompletableFuture privateGetEvaluationItem( + String name, GetEvaluationItemConfig config) { + BuiltRequest builtRequest = evals.buildRequestForPrivateGetEvaluationItem(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return evals.processResponseForPrivateGetEvaluationItem(res, config); + } + }); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncMemories.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncMemories.java new file mode 100644 index 000000000000..1c74f94b5052 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncMemories.java @@ -0,0 +1,204 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai; + +import com.google.cloud.vertexai.genai.types.AgentEngineGenerateMemoriesOperation; +import com.google.cloud.vertexai.genai.types.AgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.AgentEngineMemoryOperation; +import com.google.cloud.vertexai.genai.types.AgentEngineRollbackMemoryOperation; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineMemoryOperation; +import com.google.cloud.vertexai.genai.types.GenerateAgentEngineMemoriesConfig; +import com.google.cloud.vertexai.genai.types.GenerateMemoriesRequestDirectContentsSource; +import com.google.cloud.vertexai.genai.types.GenerateMemoriesRequestDirectMemoriesSource; +import com.google.cloud.vertexai.genai.types.GenerateMemoriesRequestVertexSessionSource; +import com.google.cloud.vertexai.genai.types.GetAgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.GetAgentEngineOperationConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.ListReasoningEnginesMemoriesResponse; +import com.google.cloud.vertexai.genai.types.Memory; +import com.google.cloud.vertexai.genai.types.RetrieveAgentEngineMemoriesConfig; +import com.google.cloud.vertexai.genai.types.RetrieveMemoriesRequestSimilaritySearchParams; +import com.google.cloud.vertexai.genai.types.RetrieveMemoriesRequestSimpleRetrievalParams; +import com.google.cloud.vertexai.genai.types.RetrieveMemoriesResponse; +import com.google.cloud.vertexai.genai.types.RollbackAgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.UpdateAgentEngineMemoryConfig; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common.BuiltRequest; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +/** Async module of {@link Memories} */ +public final class AsyncMemories { + + Memories memories; + ApiClient apiClient; + + public AsyncMemories(ApiClient apiClient) { + this.apiClient = apiClient; + this.memories = new Memories(apiClient); + } + + CompletableFuture privateCreate( + String name, String fact, Map scope, AgentEngineMemoryConfig config) { + BuiltRequest builtRequest = memories.buildRequestForPrivateCreate(name, fact, scope, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForPrivateCreate(res, config); + } + }); + } + + public CompletableFuture delete( + String name, DeleteAgentEngineMemoryConfig config) { + BuiltRequest builtRequest = memories.buildRequestForDelete(name, config); + return this.apiClient + .asyncRequest( + "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForDelete(res, config); + } + }); + } + + CompletableFuture privateGenerate( + String name, + GenerateMemoriesRequestVertexSessionSource vertexSessionSource, + GenerateMemoriesRequestDirectContentsSource directContentsSource, + GenerateMemoriesRequestDirectMemoriesSource directMemoriesSource, + Map scope, + GenerateAgentEngineMemoriesConfig config) { + BuiltRequest builtRequest = + memories.buildRequestForPrivateGenerate( + name, vertexSessionSource, directContentsSource, directMemoriesSource, scope, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForPrivateGenerate(res, config); + } + }); + } + + public CompletableFuture get(String name, GetAgentEngineMemoryConfig config) { + BuiltRequest builtRequest = memories.buildRequestForGet(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForGet(res, config); + } + }); + } + + CompletableFuture privateList( + String name, ListAgentEngineMemoryConfig config) { + BuiltRequest builtRequest = memories.buildRequestForPrivateList(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForPrivateList(res, config); + } + }); + } + + CompletableFuture privateGetMemoryOperation( + String operationName, GetAgentEngineOperationConfig config) { + BuiltRequest builtRequest = + memories.buildRequestForPrivateGetMemoryOperation(operationName, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForPrivateGetMemoryOperation(res, config); + } + }); + } + + CompletableFuture privateGetGenerateMemoriesOperation( + String operationName, GetAgentEngineOperationConfig config) { + BuiltRequest builtRequest = + memories.buildRequestForPrivateGetGenerateMemoriesOperation(operationName, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForPrivateGetGenerateMemoriesOperation(res, config); + } + }); + } + + CompletableFuture privateRetrieve( + String name, + Map scope, + RetrieveMemoriesRequestSimilaritySearchParams similaritySearchParams, + RetrieveMemoriesRequestSimpleRetrievalParams simpleRetrievalParams, + RetrieveAgentEngineMemoriesConfig config) { + BuiltRequest builtRequest = + memories.buildRequestForPrivateRetrieve( + name, scope, similaritySearchParams, simpleRetrievalParams, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForPrivateRetrieve(res, config); + } + }); + } + + CompletableFuture privateRollback( + String name, String targetRevisionId, RollbackAgentEngineMemoryConfig config) { + BuiltRequest builtRequest = + memories.buildRequestForPrivateRollback(name, targetRevisionId, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForPrivateRollback(res, config); + } + }); + } + + CompletableFuture privateUpdate( + String name, String fact, Map scope, UpdateAgentEngineMemoryConfig config) { + BuiltRequest builtRequest = memories.buildRequestForPrivateUpdate(name, fact, scope, config); + return this.apiClient + .asyncRequest("patch", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memories.processResponseForPrivateUpdate(res, config); + } + }); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncMemoryRevisions.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncMemoryRevisions.java new file mode 100644 index 000000000000..42a9c58319d1 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncMemoryRevisions.java @@ -0,0 +1,66 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai; + +import com.google.cloud.vertexai.genai.types.GetAgentEngineMemoryRevisionConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineMemoryRevisionsConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineMemoryRevisionsResponse; +import com.google.cloud.vertexai.genai.types.MemoryRevision; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common.BuiltRequest; +import java.util.concurrent.CompletableFuture; + +/** Async module of {@link MemoryRevisions} */ +public final class AsyncMemoryRevisions { + + MemoryRevisions memoryRevisions; + ApiClient apiClient; + + public AsyncMemoryRevisions(ApiClient apiClient) { + this.apiClient = apiClient; + this.memoryRevisions = new MemoryRevisions(apiClient); + } + + public CompletableFuture get( + String name, GetAgentEngineMemoryRevisionConfig config) { + BuiltRequest builtRequest = memoryRevisions.buildRequestForGet(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memoryRevisions.processResponseForGet(res, config); + } + }); + } + + CompletableFuture privateList( + String name, ListAgentEngineMemoryRevisionsConfig config) { + BuiltRequest builtRequest = memoryRevisions.buildRequestForPrivateList(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return memoryRevisions.processResponseForPrivateList(res, config); + } + }); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncPromptOptimizer.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncPromptOptimizer.java new file mode 100644 index 000000000000..52a0b65553a8 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncPromptOptimizer.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai; + +import com.google.cloud.vertexai.genai.types.CustomJob; +import com.google.cloud.vertexai.genai.types.OptimizeConfig; +import com.google.cloud.vertexai.genai.types.OptimizeResponseEndpoint; +import com.google.cloud.vertexai.genai.types.VertexBaseConfig; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common.BuiltRequest; +import com.google.genai.types.Content; +import java.util.concurrent.CompletableFuture; + +/** Async module of {@link PromptOptimizer} */ +public final class AsyncPromptOptimizer { + + PromptOptimizer promptOptimizer; + ApiClient apiClient; + + public AsyncPromptOptimizer(ApiClient apiClient) { + this.apiClient = apiClient; + this.promptOptimizer = new PromptOptimizer(apiClient); + } + + CompletableFuture privateOptimizePrompt( + Content content, OptimizeConfig config) { + BuiltRequest builtRequest = + promptOptimizer.buildRequestForPrivateOptimizePrompt(content, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return promptOptimizer.processResponseForPrivateOptimizePrompt(res, config); + } + }); + } + + CompletableFuture privateCreateCustomJobResource( + CustomJob customJob, VertexBaseConfig config) { + BuiltRequest builtRequest = + promptOptimizer.buildRequestForPrivateCreateCustomJobResource(customJob, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return promptOptimizer.processResponseForPrivateCreateCustomJobResource( + res, config); + } + }); + } + + CompletableFuture privateGetCustomJob(String name, VertexBaseConfig config) { + BuiltRequest builtRequest = promptOptimizer.buildRequestForPrivateGetCustomJob(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return promptOptimizer.processResponseForPrivateGetCustomJob(res, config); + } + }); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncPrompts.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncPrompts.java new file mode 100644 index 000000000000..b5c746c1996a --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncPrompts.java @@ -0,0 +1,242 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai; + +import com.google.cloud.vertexai.genai.types.CreateDatasetConfig; +import com.google.cloud.vertexai.genai.types.CreateDatasetVersionConfig; +import com.google.cloud.vertexai.genai.types.Dataset; +import com.google.cloud.vertexai.genai.types.DatasetOperation; +import com.google.cloud.vertexai.genai.types.DatasetVersion; +import com.google.cloud.vertexai.genai.types.DeletePromptConfig; +import com.google.cloud.vertexai.genai.types.DeletePromptOperation; +import com.google.cloud.vertexai.genai.types.DeletePromptVersionOperation; +import com.google.cloud.vertexai.genai.types.GetDatasetOperationConfig; +import com.google.cloud.vertexai.genai.types.ListDatasetVersionsResponse; +import com.google.cloud.vertexai.genai.types.ListDatasetsResponse; +import com.google.cloud.vertexai.genai.types.ListPromptsConfig; +import com.google.cloud.vertexai.genai.types.RestoreVersionConfig; +import com.google.cloud.vertexai.genai.types.RestoreVersionOperation; +import com.google.cloud.vertexai.genai.types.SchemaTextPromptDatasetMetadata; +import com.google.cloud.vertexai.genai.types.UpdateDatasetConfig; +import com.google.cloud.vertexai.genai.types.VertexBaseConfig; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common.BuiltRequest; +import com.google.genai.types.EncryptionSpec; +import java.util.concurrent.CompletableFuture; + +/** Async module of {@link Prompts} */ +public final class AsyncPrompts { + + Prompts prompts; + ApiClient apiClient; + + public AsyncPrompts(ApiClient apiClient) { + this.apiClient = apiClient; + this.prompts = new Prompts(apiClient); + } + + CompletableFuture privateCreateDatasetResource( + String name, + String displayName, + String metadataSchemaUri, + SchemaTextPromptDatasetMetadata metadata, + String description, + EncryptionSpec encryptionSpec, + String modelReference, + CreateDatasetConfig config) { + BuiltRequest builtRequest = + prompts.buildRequestForPrivateCreateDatasetResource( + name, + displayName, + metadataSchemaUri, + metadata, + description, + encryptionSpec, + modelReference, + config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return prompts.processResponseForPrivateCreateDatasetResource(res, config); + } + }); + } + + CompletableFuture privateCreateDatasetVersionResource( + String datasetName, + SchemaTextPromptDatasetMetadata metadata, + String modelReference, + String parent, + String displayName, + CreateDatasetVersionConfig config) { + BuiltRequest builtRequest = + prompts.buildRequestForPrivateCreateDatasetVersionResource( + datasetName, metadata, modelReference, parent, displayName, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return prompts.processResponseForPrivateCreateDatasetVersionResource(res, config); + } + }); + } + + CompletableFuture privateGetDatasetResource(String name, VertexBaseConfig config) { + BuiltRequest builtRequest = prompts.buildRequestForPrivateGetDatasetResource(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return prompts.processResponseForPrivateGetDatasetResource(res, config); + } + }); + } + + CompletableFuture privateGetDatasetVersionResource( + String datasetId, String datasetVersionId, VertexBaseConfig config) { + BuiltRequest builtRequest = + prompts.buildRequestForPrivateGetDatasetVersionResource( + datasetId, datasetVersionId, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return prompts.processResponseForPrivateGetDatasetVersionResource(res, config); + } + }); + } + + CompletableFuture privateGetDatasetOperation( + String datasetId, String operationId, GetDatasetOperationConfig config) { + BuiltRequest builtRequest = + prompts.buildRequestForPrivateGetDatasetOperation(datasetId, operationId, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return prompts.processResponseForPrivateGetDatasetOperation(res, config); + } + }); + } + + CompletableFuture privateListPrompts(ListPromptsConfig config) { + BuiltRequest builtRequest = prompts.buildRequestForPrivateListPrompts(config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return prompts.processResponseForPrivateListPrompts(res, config); + } + }); + } + + CompletableFuture privateListVersions( + String readMask, String datasetId, ListPromptsConfig config) { + BuiltRequest builtRequest = + prompts.buildRequestForPrivateListVersions(readMask, datasetId, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return prompts.processResponseForPrivateListVersions(res, config); + } + }); + } + + CompletableFuture privateDeleteDataset( + String promptId, DeletePromptConfig config) { + BuiltRequest builtRequest = prompts.buildRequestForPrivateDeleteDataset(promptId, config); + return this.apiClient + .asyncRequest( + "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return prompts.processResponseForPrivateDeleteDataset(res, config); + } + }); + } + + CompletableFuture privateDeleteDatasetVersion( + String promptId, String versionId, DeletePromptConfig config) { + BuiltRequest builtRequest = + prompts.buildRequestForPrivateDeleteDatasetVersion(promptId, versionId, config); + return this.apiClient + .asyncRequest( + "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return prompts.processResponseForPrivateDeleteDatasetVersion(res, config); + } + }); + } + + CompletableFuture privateRestoreVersion( + String datasetId, String versionId, RestoreVersionConfig config) { + BuiltRequest builtRequest = + prompts.buildRequestForPrivateRestoreVersion(datasetId, versionId, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return prompts.processResponseForPrivateRestoreVersion(res, config); + } + }); + } + + CompletableFuture privateUpdateDatasetResource( + String name, + String datasetId, + String displayName, + SchemaTextPromptDatasetMetadata metadata, + String description, + EncryptionSpec encryptionSpec, + String modelReference, + UpdateDatasetConfig config) { + BuiltRequest builtRequest = + prompts.buildRequestForPrivateUpdateDatasetResource( + name, + datasetId, + displayName, + metadata, + description, + encryptionSpec, + modelReference, + config); + return this.apiClient + .asyncRequest("patch", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return prompts.processResponseForPrivateUpdateDatasetResource(res, config); + } + }); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncSandboxes.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncSandboxes.java new file mode 100644 index 000000000000..a209ec0e1eda --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncSandboxes.java @@ -0,0 +1,130 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai; + +import com.google.cloud.vertexai.genai.types.AgentEngineSandboxOperation; +import com.google.cloud.vertexai.genai.types.Chunk; +import com.google.cloud.vertexai.genai.types.CreateAgentEngineSandboxConfig; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineSandboxConfig; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineSandboxOperation; +import com.google.cloud.vertexai.genai.types.ExecuteCodeAgentEngineSandboxConfig; +import com.google.cloud.vertexai.genai.types.ExecuteSandboxEnvironmentResponse; +import com.google.cloud.vertexai.genai.types.GetAgentEngineOperationConfig; +import com.google.cloud.vertexai.genai.types.GetAgentEngineSandboxConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineSandboxesConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineSandboxesResponse; +import com.google.cloud.vertexai.genai.types.SandboxEnvironment; +import com.google.cloud.vertexai.genai.types.SandboxEnvironmentSpec; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common.BuiltRequest; +import java.util.List; +import java.util.concurrent.CompletableFuture; + +/** Async module of {@link Sandboxes} */ +public final class AsyncSandboxes { + + Sandboxes sandboxes; + ApiClient apiClient; + + public AsyncSandboxes(ApiClient apiClient) { + this.apiClient = apiClient; + this.sandboxes = new Sandboxes(apiClient); + } + + CompletableFuture privateCreate( + String name, SandboxEnvironmentSpec spec, CreateAgentEngineSandboxConfig config) { + BuiltRequest builtRequest = sandboxes.buildRequestForPrivateCreate(name, spec, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return sandboxes.processResponseForPrivateCreate(res, config); + } + }); + } + + CompletableFuture privateDelete( + String name, DeleteAgentEngineSandboxConfig config) { + BuiltRequest builtRequest = sandboxes.buildRequestForPrivateDelete(name, config); + return this.apiClient + .asyncRequest( + "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return sandboxes.processResponseForPrivateDelete(res, config); + } + }); + } + + CompletableFuture privateExecuteCode( + String name, List inputs, ExecuteCodeAgentEngineSandboxConfig config) { + BuiltRequest builtRequest = sandboxes.buildRequestForPrivateExecuteCode(name, inputs, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return sandboxes.processResponseForPrivateExecuteCode(res, config); + } + }); + } + + CompletableFuture privateGet( + String name, GetAgentEngineSandboxConfig config) { + BuiltRequest builtRequest = sandboxes.buildRequestForPrivateGet(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return sandboxes.processResponseForPrivateGet(res, config); + } + }); + } + + CompletableFuture privateList( + String name, ListAgentEngineSandboxesConfig config) { + BuiltRequest builtRequest = sandboxes.buildRequestForPrivateList(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return sandboxes.processResponseForPrivateList(res, config); + } + }); + } + + CompletableFuture privateGetSandboxOperation( + String operationName, GetAgentEngineOperationConfig config) { + BuiltRequest builtRequest = + sandboxes.buildRequestForPrivateGetSandboxOperation(operationName, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return sandboxes.processResponseForPrivateGetSandboxOperation(res, config); + } + }); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncSessions.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncSessions.java new file mode 100644 index 000000000000..71d30eaff3ba --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/AsyncSessions.java @@ -0,0 +1,125 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai; + +import com.google.cloud.vertexai.genai.types.AgentEngineSessionOperation; +import com.google.cloud.vertexai.genai.types.CreateAgentEngineSessionConfig; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineSessionConfig; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineSessionOperation; +import com.google.cloud.vertexai.genai.types.GetAgentEngineOperationConfig; +import com.google.cloud.vertexai.genai.types.GetAgentEngineSessionConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineSessionsConfig; +import com.google.cloud.vertexai.genai.types.ListReasoningEnginesSessionsResponse; +import com.google.cloud.vertexai.genai.types.Session; +import com.google.cloud.vertexai.genai.types.UpdateAgentEngineSessionConfig; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common.BuiltRequest; +import java.util.concurrent.CompletableFuture; + +/** Async module of {@link Sessions} */ +public final class AsyncSessions { + + Sessions sessions; + ApiClient apiClient; + + public AsyncSessions(ApiClient apiClient) { + this.apiClient = apiClient; + this.sessions = new Sessions(apiClient); + } + + CompletableFuture privateCreate( + String name, String userId, CreateAgentEngineSessionConfig config) { + BuiltRequest builtRequest = sessions.buildRequestForPrivateCreate(name, userId, config); + return this.apiClient + .asyncRequest("post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return sessions.processResponseForPrivateCreate(res, config); + } + }); + } + + public CompletableFuture delete( + String name, DeleteAgentEngineSessionConfig config) { + BuiltRequest builtRequest = sessions.buildRequestForDelete(name, config); + return this.apiClient + .asyncRequest( + "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return sessions.processResponseForDelete(res, config); + } + }); + } + + public CompletableFuture get(String name, GetAgentEngineSessionConfig config) { + BuiltRequest builtRequest = sessions.buildRequestForGet(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return sessions.processResponseForGet(res, config); + } + }); + } + + CompletableFuture privateList( + String name, ListAgentEngineSessionsConfig config) { + BuiltRequest builtRequest = sessions.buildRequestForPrivateList(name, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return sessions.processResponseForPrivateList(res, config); + } + }); + } + + CompletableFuture privateGetSessionOperation( + String operationName, GetAgentEngineOperationConfig config) { + BuiltRequest builtRequest = + sessions.buildRequestForPrivateGetSessionOperation(operationName, config); + return this.apiClient + .asyncRequest("get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return sessions.processResponseForPrivateGetSessionOperation(res, config); + } + }); + } + + CompletableFuture privateUpdate( + String name, UpdateAgentEngineSessionConfig config) { + BuiltRequest builtRequest = sessions.buildRequestForPrivateUpdate(name, config); + return this.apiClient + .asyncRequest("patch", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions()) + .thenApplyAsync( + response -> { + try (ApiResponse res = response) { + return sessions.processResponseForPrivateUpdate(res, config); + } + }); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Client.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Client.java new file mode 100644 index 000000000000..5461b8a20192 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Client.java @@ -0,0 +1,333 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +package com.google.cloud.vertexai.genai; + +import static com.google.common.base.Preconditions.checkNotNull; + +import com.google.api.core.BetaApi; +import com.google.auth.oauth2.GoogleCredentials; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.ApiClient; +import com.google.genai.HttpApiClient; +import com.google.genai.ReplayApiClient; +import com.google.genai.errors.GenAiIOException; +import com.google.genai.types.ClientOptions; +import com.google.genai.types.HttpOptions; +import java.io.IOException; +import java.util.Optional; + +/** Client class for GenAI. This class is thread-safe. */ +public final class Client implements AutoCloseable { + + /** Async class for GenAI. */ + public final class Async { + public final AsyncDatasets datasets; + + public Async(ApiClient apiClient) { + this.datasets = new AsyncDatasets(apiClient); + } + } + + private final DebugConfig debugConfig; + private final ApiClient apiClient; + + @BetaApi public final Datasets datasets; + @BetaApi public final Evals evals; + + /** Builder for {@link Client}. */ + public static class Builder { + private Optional apiKey = Optional.empty(); + private Optional project = Optional.empty(); + private Optional location = Optional.empty(); + private Optional credentials = Optional.empty(); + private Optional clientOptions = Optional.empty(); + private Optional httpOptions = Optional.empty(); + private Optional vertexAI = Optional.empty(); + private Optional debugConfig = Optional.empty(); + + /** Builds the {@link Client} instance. */ + public Client build() { + return new Client( + apiKey, + project, + location, + credentials, + httpOptions, + clientOptions, + vertexAI, + debugConfig); + } + + /** Sets the API key for Gemini API. */ + @CanIgnoreReturnValue + public Builder apiKey(String apiKey) { + checkNotNull(apiKey, "apiKey cannot be null"); + this.apiKey = Optional.of(apiKey); + return this; + } + + /** Sets the project ID for Vertex AI APIs. */ + @CanIgnoreReturnValue + public Builder project(String project) { + checkNotNull(project, "project cannot be null"); + this.project = Optional.of(project); + return this; + } + + /** Sets the location for Vertex AI APIs. */ + @CanIgnoreReturnValue + public Builder location(String location) { + checkNotNull(location, "location cannot be null"); + this.location = Optional.of(location); + return this; + } + + /** Sets the {@link GoogleCredentials} for Vertex AI APIs. */ + @CanIgnoreReturnValue + public Builder credentials(GoogleCredentials credentials) { + checkNotNull(credentials, "credentials cannot be null"); + this.credentials = Optional.of(credentials); + return this; + } + + /** Sets the {@link ClientOptions} for the API client. */ + @CanIgnoreReturnValue + public Builder clientOptions(ClientOptions clientOptions) { + checkNotNull(clientOptions, "clientOptions cannot be null"); + this.clientOptions = Optional.of(clientOptions); + return this; + } + + /** Sets the {@link HttpOptions} for the API client. */ + @CanIgnoreReturnValue + public Builder httpOptions(HttpOptions httpOptions) { + checkNotNull(httpOptions, "httpOptions cannot be null"); + this.httpOptions = Optional.of(httpOptions); + return this; + } + + /** Sets whether to use Vertex AI APIs. */ + @CanIgnoreReturnValue + public Builder vertexAI(boolean vertexAI) { + this.vertexAI = Optional.of(vertexAI); + return this; + } + + /** + * Sets the {@link DebugConfig} for debugging or testing the Client. This is for internal use + * only. + */ + @CanIgnoreReturnValue + Builder debugConfig(DebugConfig debugConfig) { + checkNotNull(debugConfig, "debugConfig cannot be null"); + this.debugConfig = Optional.of(debugConfig); + return this; + } + } + + /** Returns a {@link Builder} for {@link Client}. */ + public static Builder builder() { + return new Builder(); + } + + /** Constructs a Client instance with environment variables. */ + public Client() { + this( + /* apiKey= */ Optional.empty(), + /* project= */ Optional.empty(), + /* location= */ Optional.empty(), + /* credentials= */ Optional.empty(), + /* httpOptions= */ Optional.empty(), + /* clientOptions= */ Optional.empty(), + /* vertexAI= */ Optional.empty(), + /* debugConfig= */ Optional.empty()); + } + + /** + * Constructs a Client instance with the given parameters. + * + * @param apiKey Optional String for the API key. Gemini API only. + * @param project Optional String for the project ID. Vertex AI APIs only. Find your project + * ID + * @param location Optional String for the location. + * Vertex AI APIs only. + * @param credentials Optional {@link GoogleCredentials}. Vertex AI APIs only. + * @param httpOptions Optional {@link HttpOptions} for sending HTTP requests. + * @param clientOptions Optional {@link ClientOptions} for the API client. + * @param vertexAI Optional Boolean for whether to use Vertex AI APIs. If not specified here nor + * in the environment variable, default to false. + * @param debugConfig Optional {@link DebugConfig} for debugging or testing the Client. + * @throws IllegalArgumentException if the project/location and API key are set together. + */ + private Client( + Optional apiKey, + Optional project, + Optional location, + Optional credentials, + Optional httpOptions, + Optional clientOptions, + Optional vertexAI, + Optional debugConfig) { + checkNotNull(vertexAI, "vertexAI cannot be null"); + checkNotNull(debugConfig, "debugConfig cannot be null"); + + boolean useVertexAI; + if (vertexAI.isPresent()) { + useVertexAI = vertexAI.get(); + } else { + String envVar = ApiClient.defaultEnvironmentVariables().get("vertexAI"); + useVertexAI = envVar != null && envVar.equalsIgnoreCase("true"); + } + + if (project.isPresent() || location.isPresent()) { + if (apiKey.isPresent()) { + throw new IllegalArgumentException( + "Project/location and API key are mutually exclusive in the client initializer."); + } + if (!useVertexAI) { + throw new IllegalArgumentException("Gemini API do not support project/location."); + } + } + + this.debugConfig = debugConfig.orElse(new DebugConfig()); + if (this.debugConfig.clientMode().equals("replay")) { + if (!useVertexAI) { + this.apiClient = + new ReplayApiClient( + /* apiKey= */ apiKey, + /* httpOptions= */ httpOptions, + /* clientOptions= */ clientOptions, + this.debugConfig.replaysDirectory(), + this.debugConfig.replayId(), + this.debugConfig.clientMode()); + } else { + this.apiClient = + new ReplayApiClient( + /* apiKey= */ apiKey, + /* project= */ project, + /* location= */ location, + /* credentials= */ credentials, + /* httpOptions= */ httpOptions, + /* clientOptions= */ clientOptions, + this.debugConfig.replaysDirectory(), + this.debugConfig.replayId(), + this.debugConfig.clientMode()); + } + } else { + if (!useVertexAI) { + this.apiClient = + new HttpApiClient( + /* apiKey= */ apiKey, + /* httpOptions= */ httpOptions, + /* clientOptions= */ clientOptions); + } else { + this.apiClient = + new HttpApiClient( + /* apiKey= */ apiKey, + /* project= */ project, + /* location= */ location, + /* credentials= */ credentials, + /* httpOptions= */ httpOptions, + /* clientOptions= */ clientOptions); + } + } + + datasets = new Datasets(this.apiClient); + evals = new Evals(this.apiClient); + } + + /** Returns whether the client is using Vertex AI APIs. */ + public boolean vertexAI() { + return apiClient.vertexAI(); + } + + /** Returns the project ID for Vertex AI APIs. */ + public String project() { + return apiClient.project(); + } + + /** Returns the location for Vertex AI APIs. */ + public String location() { + return apiClient.location(); + } + + /** Returns the API key for Gemini API. */ + public String apiKey() { + return apiClient.apiKey(); + } + + /** Sets the replay ID for the replay client. For internal testing only. */ + void setReplayId(String replayId) { + if (this.apiClient instanceof ReplayApiClient) { + ((ReplayApiClient) this.apiClient).initializeReplaySession(replayId); + } + } + + /** Returns the debug config for the client. */ + DebugConfig debugConfig() { + return debugConfig; + } + + /** Returns the client mode. If it's "replay", then the client is in testing mode. */ + String clientMode() { + return debugConfig.clientMode(); + } + + /** Returns the base URL for the API client. */ + Optional baseUrl() { + if (apiClient.httpOptions().baseUrl().isPresent()) { + return apiClient.httpOptions().baseUrl(); + } + return Optional.empty(); + } + + /** Closes the Client instance together with its instantiated http client. */ + @Override + public void close() { + try { + apiClient.httpClient().dispatcher().executorService().shutdown(); + apiClient.httpClient().connectionPool().evictAll(); + if (apiClient.httpClient().cache() != null) { + apiClient.httpClient().cache().close(); + } + } catch (IOException e) { + throw new GenAiIOException("Failed to close the client.", e); + } + } + + /** + * Overrides the base URLs for the Gemini API and/or Vertex AI API. + * + *

Note: This function should be called before initializing the SDK. If the base URLs are set + * after initializing the SDK, the base URLs will not be updated. + * + *

Precedence rule for base URL: + * + *

1. Base URL set via HttpOptions. + * + *

2. Base URL set via the latest call to setDefaultBaseUrls. + * + *

3. Base URL set via environment variables GOOGLE_GEMINI_BASE_URL or GOOGLE_VERTEX_BASE_URL. + */ + public static void setDefaultBaseUrls( + Optional geminiBaseUrl, Optional vertexBaseUrl) { + ApiClient.setDefaultBaseUrls(geminiBaseUrl, vertexBaseUrl); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Datasets.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Datasets.java new file mode 100644 index 000000000000..ec3038871117 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Datasets.java @@ -0,0 +1,869 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.google.cloud.vertexai.genai.types.AssembleDatasetConfig; +import com.google.cloud.vertexai.genai.types.AssembleDatasetParameters; +import com.google.cloud.vertexai.genai.types.CreateMultimodalDatasetConfig; +import com.google.cloud.vertexai.genai.types.CreateMultimodalDatasetParameters; +import com.google.cloud.vertexai.genai.types.DeleteMultimodalDatasetRequestParameters; +import com.google.cloud.vertexai.genai.types.GeminiRequestReadConfig; +import com.google.cloud.vertexai.genai.types.GetMultimodalDatasetOperationConfig; +import com.google.cloud.vertexai.genai.types.GetMultimodalDatasetOperationParameters; +import com.google.cloud.vertexai.genai.types.GetMultimodalDatasetParameters; +import com.google.cloud.vertexai.genai.types.ListMultimodalDatasetsConfig; +import com.google.cloud.vertexai.genai.types.ListMultimodalDatasetsRequestParameters; +import com.google.cloud.vertexai.genai.types.ListMultimodalDatasetsResponse; +import com.google.cloud.vertexai.genai.types.MultimodalDataset; +import com.google.cloud.vertexai.genai.types.MultimodalDatasetOperation; +import com.google.cloud.vertexai.genai.types.SchemaTablesDatasetMetadata; +import com.google.cloud.vertexai.genai.types.UpdateMultimodalDatasetConfig; +import com.google.cloud.vertexai.genai.types.UpdateMultimodalDatasetParameters; +import com.google.cloud.vertexai.genai.types.VertexBaseConfig; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common; +import com.google.genai.Common.BuiltRequest; +import com.google.genai.JsonSerializable; +import com.google.genai.errors.GenAiIOException; +import com.google.genai.types.EncryptionSpec; +import com.google.genai.types.HttpOptions; +import java.io.IOException; +import java.util.Optional; +import okhttp3.ResponseBody; + +public final class Datasets { + + final ApiClient apiClient; + + public Datasets(ApiClient apiClient) { + this.apiClient = apiClient; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode assembleDatasetParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"geminiRequestReadConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"geminiRequestReadConfig"}, + Common.getValueByPath(fromObject, new String[] {"geminiRequestReadConfig"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode createMultimodalDatasetParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"displayName"}, + Common.getValueByPath(fromObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"metadataSchemaUri"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"metadataSchemaUri"}, + Common.getValueByPath(fromObject, new String[] {"metadataSchemaUri"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"metadata"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"metadata"}, + Common.getValueByPath(fromObject, new String[] {"metadata"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"description"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"description"}, + Common.getValueByPath(fromObject, new String[] {"description"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"encryptionSpec"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"encryptionSpec"}, + Common.getValueByPath(fromObject, new String[] {"encryptionSpec"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode deleteMultimodalDatasetRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getMultimodalDatasetOperationParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"datasetId"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "dataset_id"}, + Common.getValueByPath(fromObject, new String[] {"datasetId"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"operationId"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "operation_id"}, + Common.getValueByPath(fromObject, new String[] {"operationId"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getMultimodalDatasetParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listMultimodalDatasetsConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"pageSize"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageSize"}, + Common.getValueByPath(fromObject, new String[] {"pageSize"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"pageToken"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageToken"}, + Common.getValueByPath(fromObject, new String[] {"pageToken"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"filter"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "filter"}, + Common.getValueByPath(fromObject, new String[] {"filter"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listMultimodalDatasetsRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + listMultimodalDatasetsConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode updateMultimodalDatasetParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"displayName"}, + Common.getValueByPath(fromObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"metadata"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"metadata"}, + Common.getValueByPath(fromObject, new String[] {"metadata"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"description"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"description"}, + Common.getValueByPath(fromObject, new String[] {"description"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"encryptionSpec"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"encryptionSpec"}, + Common.getValueByPath(fromObject, new String[] {"encryptionSpec"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateAssembleMultimodalDataset( + String name, GeminiRequestReadConfig geminiRequestReadConfig, AssembleDatasetConfig config) { + + AssembleDatasetParameters.Builder parameterBuilder = AssembleDatasetParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(geminiRequestReadConfig)) { + parameterBuilder.geminiRequestReadConfig(geminiRequestReadConfig); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = assembleDatasetParametersToVertex(parameterNode, null); + path = Common.formatMap("datasets/{name}:assemble", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + MultimodalDatasetOperation processResponseForPrivateAssembleMultimodalDataset( + ApiResponse response, AssembleDatasetConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, MultimodalDatasetOperation.class); + } + + MultimodalDatasetOperation privateAssembleMultimodalDataset( + String name, GeminiRequestReadConfig geminiRequestReadConfig, AssembleDatasetConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivateAssembleMultimodalDataset(name, geminiRequestReadConfig, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateAssembleMultimodalDataset(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateCreateMultimodalDataset( + String name, + String displayName, + String metadataSchemaUri, + SchemaTablesDatasetMetadata metadata, + String description, + EncryptionSpec encryptionSpec, + CreateMultimodalDatasetConfig config) { + + CreateMultimodalDatasetParameters.Builder parameterBuilder = + CreateMultimodalDatasetParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(displayName)) { + parameterBuilder.displayName(displayName); + } + if (!Common.isZero(metadataSchemaUri)) { + parameterBuilder.metadataSchemaUri(metadataSchemaUri); + } + if (!Common.isZero(metadata)) { + parameterBuilder.metadata(metadata); + } + if (!Common.isZero(description)) { + parameterBuilder.description(description); + } + if (!Common.isZero(encryptionSpec)) { + parameterBuilder.encryptionSpec(encryptionSpec); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = createMultimodalDatasetParametersToVertex(parameterNode, null); + path = Common.formatMap("datasets", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + MultimodalDatasetOperation processResponseForPrivateCreateMultimodalDataset( + ApiResponse response, CreateMultimodalDatasetConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, MultimodalDatasetOperation.class); + } + + MultimodalDatasetOperation privateCreateMultimodalDataset( + String name, + String displayName, + String metadataSchemaUri, + SchemaTablesDatasetMetadata metadata, + String description, + EncryptionSpec encryptionSpec, + CreateMultimodalDatasetConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivateCreateMultimodalDataset( + name, displayName, metadataSchemaUri, metadata, description, encryptionSpec, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateCreateMultimodalDataset(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateDeleteMultimodalDataset(String name, VertexBaseConfig config) { + + DeleteMultimodalDatasetRequestParameters.Builder parameterBuilder = + DeleteMultimodalDatasetRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = deleteMultimodalDatasetRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("datasets/{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + MultimodalDatasetOperation processResponseForPrivateDeleteMultimodalDataset( + ApiResponse response, VertexBaseConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, MultimodalDatasetOperation.class); + } + + MultimodalDatasetOperation privateDeleteMultimodalDataset(String name, VertexBaseConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateDeleteMultimodalDataset(name, config); + + try (ApiResponse response = + this.apiClient.request( + "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateDeleteMultimodalDataset(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGetMultimodalDataset(String name, VertexBaseConfig config) { + + GetMultimodalDatasetParameters.Builder parameterBuilder = + GetMultimodalDatasetParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getMultimodalDatasetParametersToVertex(parameterNode, null); + path = Common.formatMap("datasets/{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + MultimodalDataset processResponseForPrivateGetMultimodalDataset( + ApiResponse response, VertexBaseConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, MultimodalDataset.class); + } + + MultimodalDataset privateGetMultimodalDataset(String name, VertexBaseConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateGetMultimodalDataset(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGetMultimodalDataset(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGetMultimodalDatasetOperation( + String datasetId, String operationId, GetMultimodalDatasetOperationConfig config) { + + GetMultimodalDatasetOperationParameters.Builder parameterBuilder = + GetMultimodalDatasetOperationParameters.builder(); + + if (!Common.isZero(datasetId)) { + parameterBuilder.datasetId(datasetId); + } + if (!Common.isZero(operationId)) { + parameterBuilder.operationId(operationId); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getMultimodalDatasetOperationParametersToVertex(parameterNode, null); + path = Common.formatMap("datasets/{dataset_id}/operations/{operation_id}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + MultimodalDatasetOperation processResponseForPrivateGetMultimodalDatasetOperation( + ApiResponse response, GetMultimodalDatasetOperationConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, MultimodalDatasetOperation.class); + } + + MultimodalDatasetOperation privateGetMultimodalDatasetOperation( + String datasetId, String operationId, GetMultimodalDatasetOperationConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivateGetMultimodalDatasetOperation(datasetId, operationId, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGetMultimodalDatasetOperation(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateListMultimodalDatasets(ListMultimodalDatasetsConfig config) { + + ListMultimodalDatasetsRequestParameters.Builder parameterBuilder = + ListMultimodalDatasetsRequestParameters.builder(); + + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = listMultimodalDatasetsRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("datasets", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + ListMultimodalDatasetsResponse processResponseForPrivateListMultimodalDatasets( + ApiResponse response, ListMultimodalDatasetsConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, ListMultimodalDatasetsResponse.class); + } + + ListMultimodalDatasetsResponse privateListMultimodalDatasets( + ListMultimodalDatasetsConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateListMultimodalDatasets(config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateListMultimodalDatasets(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateUpdateMultimodalDataset( + String name, + String displayName, + SchemaTablesDatasetMetadata metadata, + String description, + EncryptionSpec encryptionSpec, + UpdateMultimodalDatasetConfig config) { + + UpdateMultimodalDatasetParameters.Builder parameterBuilder = + UpdateMultimodalDatasetParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(displayName)) { + parameterBuilder.displayName(displayName); + } + if (!Common.isZero(metadata)) { + parameterBuilder.metadata(metadata); + } + if (!Common.isZero(description)) { + parameterBuilder.description(description); + } + if (!Common.isZero(encryptionSpec)) { + parameterBuilder.encryptionSpec(encryptionSpec); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = updateMultimodalDatasetParametersToVertex(parameterNode, null); + path = Common.formatMap("datasets/{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + MultimodalDataset processResponseForPrivateUpdateMultimodalDataset( + ApiResponse response, UpdateMultimodalDatasetConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, MultimodalDataset.class); + } + + MultimodalDataset privateUpdateMultimodalDataset( + String name, + String displayName, + SchemaTablesDatasetMetadata metadata, + String description, + EncryptionSpec encryptionSpec, + UpdateMultimodalDatasetConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivateUpdateMultimodalDataset( + name, displayName, metadata, description, encryptionSpec, config); + + try (ApiResponse response = + this.apiClient.request( + "patch", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateUpdateMultimodalDataset(response, config); + } + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/DebugConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/DebugConfig.java new file mode 100644 index 000000000000..6158fd4d4d72 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/DebugConfig.java @@ -0,0 +1,63 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +package com.google.cloud.vertexai.genai; + +/** Data class configuration for debugging or testing the Client. */ +@ExcludeFromGeneratedCoverageReport +final class DebugConfig { + private final String clientMode; + private final String replayId; + private final String replaysDirectory; + + DebugConfig() { + String clientMode = System.getenv("GOOGLE_GENAI_CLIENT_MODE"); + this.clientMode = clientMode != null ? clientMode : ""; + + String replayId = System.getenv("GOOGLE_GENAI_REPLAY_ID"); + this.replayId = replayId != null ? replayId : ""; + + String replaysDirectory = System.getenv("GOOGLE_GENAI_REPLAYS_DIRECTORY"); + this.replaysDirectory = replaysDirectory != null ? replaysDirectory : ""; + } + + DebugConfig(String clientMode, String replayId, String replaysDirectory) { + String envClientMode = System.getenv("GOOGLE_GENAI_CLIENT_MODE"); + this.clientMode = + clientMode != null ? clientMode : (envClientMode != null ? envClientMode : ""); + + String envReplayId = System.getenv("GOOGLE_GENAI_REPLAY_ID"); + this.replayId = replayId != null ? replayId : (envReplayId != null ? envReplayId : ""); + + String envReplaysDirectory = System.getenv("GOOGLE_GENAI_REPLAYS_DIRECTORY"); + this.replaysDirectory = + replaysDirectory != null + ? replaysDirectory + : (envReplaysDirectory != null ? envReplaysDirectory : ""); + } + + public String clientMode() { + return this.clientMode; + } + + public String replayId() { + return this.replayId; + } + + public String replaysDirectory() { + return this.replaysDirectory; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Evals.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Evals.java new file mode 100644 index 000000000000..a92f6d0f1d46 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Evals.java @@ -0,0 +1,1252 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.google.cloud.vertexai.genai.types.BleuInput; +import com.google.cloud.vertexai.genai.types.CreateEvaluationItemConfig; +import com.google.cloud.vertexai.genai.types.CreateEvaluationItemParameters; +import com.google.cloud.vertexai.genai.types.CreateEvaluationSetConfig; +import com.google.cloud.vertexai.genai.types.CreateEvaluationSetParameters; +import com.google.cloud.vertexai.genai.types.EvaluateInstancesConfig; +import com.google.cloud.vertexai.genai.types.EvaluateInstancesRequestParameters; +import com.google.cloud.vertexai.genai.types.EvaluateInstancesResponse; +import com.google.cloud.vertexai.genai.types.EvaluationInstance; +import com.google.cloud.vertexai.genai.types.EvaluationItem; +import com.google.cloud.vertexai.genai.types.EvaluationRun; +import com.google.cloud.vertexai.genai.types.EvaluationSet; +import com.google.cloud.vertexai.genai.types.ExactMatchInput; +import com.google.cloud.vertexai.genai.types.GenerateInstanceRubricsRequest; +import com.google.cloud.vertexai.genai.types.GenerateInstanceRubricsResponse; +import com.google.cloud.vertexai.genai.types.GetEvaluationItemConfig; +import com.google.cloud.vertexai.genai.types.GetEvaluationItemParameters; +import com.google.cloud.vertexai.genai.types.GetEvaluationRunConfig; +import com.google.cloud.vertexai.genai.types.GetEvaluationRunParameters; +import com.google.cloud.vertexai.genai.types.GetEvaluationSetConfig; +import com.google.cloud.vertexai.genai.types.GetEvaluationSetParameters; +import com.google.cloud.vertexai.genai.types.Metric; +import com.google.cloud.vertexai.genai.types.PairwiseMetricInput; +import com.google.cloud.vertexai.genai.types.PointwiseMetricInput; +import com.google.cloud.vertexai.genai.types.PredefinedMetricSpec; +import com.google.cloud.vertexai.genai.types.RougeInput; +import com.google.cloud.vertexai.genai.types.RubricBasedMetricInput; +import com.google.cloud.vertexai.genai.types.RubricGenerationConfig; +import com.google.cloud.vertexai.genai.types.RubricGenerationSpec; +import com.google.cloud.vertexai.genai.types.ToolCallValidInput; +import com.google.cloud.vertexai.genai.types.ToolNameMatchInput; +import com.google.cloud.vertexai.genai.types.ToolParameterKVMatchInput; +import com.google.cloud.vertexai.genai.types.ToolParameterKeyMatchInput; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common; +import com.google.genai.Common.BuiltRequest; +import com.google.genai.JsonSerializable; +import com.google.genai.Transformers; +import com.google.genai.errors.GenAiIOException; +import com.google.genai.types.AutoraterConfig; +import com.google.genai.types.Content; +import com.google.genai.types.HttpOptions; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.logging.Logger; +import okhttp3.ResponseBody; + +public final class Evals { + + final ApiClient apiClient; + + public Evals(ApiClient apiClient) { + this.apiClient = apiClient; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode createEvaluationItemParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"evaluationItemType"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"evaluationItemType"}, + Common.getValueByPath(fromObject, new String[] {"evaluationItemType"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"gcsUri"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"gcsUri"}, + Common.getValueByPath(fromObject, new String[] {"gcsUri"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"displayName"}, + Common.getValueByPath(fromObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode createEvaluationSetParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"evaluationItems"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"evaluationItems"}, + Common.getValueByPath(fromObject, new String[] {"evaluationItems"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"displayName"}, + Common.getValueByPath(fromObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode evaluateInstancesRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"bleuInput"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"bleuInput"}, + Common.getValueByPath(fromObject, new String[] {"bleuInput"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"exactMatchInput"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"exactMatchInput"}, + Common.getValueByPath(fromObject, new String[] {"exactMatchInput"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"rougeInput"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"rougeInput"}, + Common.getValueByPath(fromObject, new String[] {"rougeInput"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"pointwiseMetricInput"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"pointwiseMetricInput"}, + Common.getValueByPath(fromObject, new String[] {"pointwiseMetricInput"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"pairwiseMetricInput"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"pairwiseMetricInput"}, + Common.getValueByPath(fromObject, new String[] {"pairwiseMetricInput"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"toolCallValidInput"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"toolCallValidInput"}, + Common.getValueByPath(fromObject, new String[] {"toolCallValidInput"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"toolNameMatchInput"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"toolNameMatchInput"}, + Common.getValueByPath(fromObject, new String[] {"toolNameMatchInput"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"toolParameterKeyMatchInput"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"toolParameterKeyMatchInput"}, + Common.getValueByPath(fromObject, new String[] {"toolParameterKeyMatchInput"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"toolParameterKvMatchInput"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"toolParameterKvMatchInput"}, + Common.getValueByPath(fromObject, new String[] {"toolParameterKvMatchInput"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"rubricBasedMetricInput"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"rubricBasedMetricInput"}, + rubricBasedMetricInputToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"rubricBasedMetricInput"})), + toObject)); + } + + if (Common.getValueByPath(fromObject, new String[] {"autoraterConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"autoraterConfig"}, + Common.getValueByPath(fromObject, new String[] {"autoraterConfig"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"metrics"}) != null) { + ArrayNode keyArray = + (ArrayNode) + Transformers.tMetrics(Common.getValueByPath(fromObject, new String[] {"metrics"})); + ObjectMapper objectMapper = new ObjectMapper(); + ArrayNode result = objectMapper.createArrayNode(); + + for (JsonNode item : keyArray) { + result.add(metricToVertex(JsonSerializable.toJsonNode(item), toObject)); + } + Common.setValueByPath(toObject, new String[] {"metrics"}, result); + } + + if (Common.getValueByPath(fromObject, new String[] {"instance"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"instance"}, + Common.getValueByPath(fromObject, new String[] {"instance"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode evaluationRunFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"displayName"}, + Common.getValueByPath(fromObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"metadata"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"metadata"}, + Common.getValueByPath(fromObject, new String[] {"metadata"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"createTime"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"createTime"}, + Common.getValueByPath(fromObject, new String[] {"createTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"completionTime"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"completionTime"}, + Common.getValueByPath(fromObject, new String[] {"completionTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"state"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"state"}, + Common.getValueByPath(fromObject, new String[] {"state"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"evaluationSetSnapshot"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"evaluationSetSnapshot"}, + Common.getValueByPath(fromObject, new String[] {"evaluationSetSnapshot"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"error"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"error"}, + Common.getValueByPath(fromObject, new String[] {"error"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"dataSource"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"dataSource"}, + Common.getValueByPath(fromObject, new String[] {"dataSource"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"evaluationResults"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"evaluationRunResults"}, + Common.getValueByPath(fromObject, new String[] {"evaluationResults"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"evaluationConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"evaluationConfig"}, + Common.getValueByPath(fromObject, new String[] {"evaluationConfig"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"inferenceConfigs"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"inferenceConfigs"}, + Common.getValueByPath(fromObject, new String[] {"inferenceConfigs"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"labels"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"labels"}, + Common.getValueByPath(fromObject, new String[] {"labels"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode generateInstanceRubricsRequestToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"contents"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"contents"}, + Common.getValueByPath(fromObject, new String[] {"contents"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"predefinedRubricGenerationSpec"}) + != null) { + Common.setValueByPath( + toObject, + new String[] {"predefinedRubricGenerationSpec"}, + Common.getValueByPath(fromObject, new String[] {"predefinedRubricGenerationSpec"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"rubricGenerationSpec"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"rubricGenerationSpec"}, + rubricGenerationSpecToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"rubricGenerationSpec"})), + toObject)); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getEvaluationItemParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getEvaluationRunParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getEvaluationSetParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode metricToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"promptTemplate"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"pointwise_metric_spec", "metric_prompt_template"}, + Common.getValueByPath(fromObject, new String[] {"promptTemplate"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"judgeModel"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"autorater_config", "autorater_model"}, + Common.getValueByPath(fromObject, new String[] {"judgeModel"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"judgeModelGenerationConfig"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"autorater_config", "generation_config"}, + Common.getValueByPath(fromObject, new String[] {"judgeModelGenerationConfig"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"judgeModelSamplingCount"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"autorater_config", "sampling_count"}, + Common.getValueByPath(fromObject, new String[] {"judgeModelSamplingCount"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"judgeModelSystemInstruction"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"pointwise_metric_spec", "system_instruction"}, + Common.getValueByPath(fromObject, new String[] {"judgeModelSystemInstruction"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"returnRawOutput"}) != null) { + Common.setValueByPath( + toObject, + new String[] { + "pointwise_metric_spec", "custom_output_format_config", "return_raw_output" + }, + Common.getValueByPath(fromObject, new String[] {"returnRawOutput"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"rubricGroupName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"rubricGroupName"}, + Common.getValueByPath(fromObject, new String[] {"rubricGroupName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"metricSpecParameters"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"metricSpecParameters"}, + Common.getValueByPath(fromObject, new String[] {"metricSpecParameters"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode rubricBasedMetricInputToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"metricSpec"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"metricSpec"}, + rubricBasedMetricSpecToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"metricSpec"})), + toObject)); + } + + if (Common.getValueByPath(fromObject, new String[] {"instance"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"instance"}, + Common.getValueByPath(fromObject, new String[] {"instance"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode rubricBasedMetricSpecToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"metricPromptTemplate"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"metricPromptTemplate"}, + Common.getValueByPath(fromObject, new String[] {"metricPromptTemplate"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"judgeAutoraterConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"judgeAutoraterConfig"}, + Common.getValueByPath(fromObject, new String[] {"judgeAutoraterConfig"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"inlineRubrics"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"inline_rubrics", "rubrics"}, + Common.getValueByPath(fromObject, new String[] {"inlineRubrics"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"rubricGroupKey"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"rubricGroupKey"}, + Common.getValueByPath(fromObject, new String[] {"rubricGroupKey"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"rubricGenerationSpec"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"rubricGenerationSpec"}, + rubricGenerationSpecToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"rubricGenerationSpec"})), + toObject)); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode rubricGenerationSpecToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"promptTemplate"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"promptTemplate"}, + Common.getValueByPath(fromObject, new String[] {"promptTemplate"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"generatorModelConfig"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"model_config"}, + Common.getValueByPath(fromObject, new String[] {"generatorModelConfig"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"rubricContentType"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"rubricContentType"}, + Common.getValueByPath(fromObject, new String[] {"rubricContentType"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"rubricTypeOntology"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"rubricTypeOntology"}, + Common.getValueByPath(fromObject, new String[] {"rubricTypeOntology"})); + } + + return toObject; + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateCreateEvaluationItem( + String evaluationItemType, + String gcsUri, + String displayName, + CreateEvaluationItemConfig config) { + + CreateEvaluationItemParameters.Builder parameterBuilder = + CreateEvaluationItemParameters.builder(); + + if (!Common.isZero(evaluationItemType)) { + parameterBuilder.evaluationItemType(evaluationItemType); + } + if (!Common.isZero(gcsUri)) { + parameterBuilder.gcsUri(gcsUri); + } + if (!Common.isZero(displayName)) { + parameterBuilder.displayName(displayName); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = createEvaluationItemParametersToVertex(parameterNode, null); + path = Common.formatMap("evaluationItems", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + EvaluationItem processResponseForPrivateCreateEvaluationItem( + ApiResponse response, CreateEvaluationItemConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, EvaluationItem.class); + } + + EvaluationItem privateCreateEvaluationItem( + String evaluationItemType, + String gcsUri, + String displayName, + CreateEvaluationItemConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivateCreateEvaluationItem(evaluationItemType, gcsUri, displayName, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateCreateEvaluationItem(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateCreateEvaluationSet( + List evaluationItems, String displayName, CreateEvaluationSetConfig config) { + + CreateEvaluationSetParameters.Builder parameterBuilder = + CreateEvaluationSetParameters.builder(); + + if (!Common.isZero(evaluationItems)) { + parameterBuilder.evaluationItems(evaluationItems); + } + if (!Common.isZero(displayName)) { + parameterBuilder.displayName(displayName); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = createEvaluationSetParametersToVertex(parameterNode, null); + path = Common.formatMap("evaluationSets", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + EvaluationSet processResponseForPrivateCreateEvaluationSet( + ApiResponse response, CreateEvaluationSetConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, EvaluationSet.class); + } + + EvaluationSet privateCreateEvaluationSet( + List evaluationItems, String displayName, CreateEvaluationSetConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivateCreateEvaluationSet(evaluationItems, displayName, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateCreateEvaluationSet(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForEvaluateInstances( + BleuInput bleuInput, + ExactMatchInput exactMatchInput, + RougeInput rougeInput, + PointwiseMetricInput pointwiseMetricInput, + PairwiseMetricInput pairwiseMetricInput, + ToolCallValidInput toolCallValidInput, + ToolNameMatchInput toolNameMatchInput, + ToolParameterKeyMatchInput toolParameterKeyMatchInput, + ToolParameterKVMatchInput toolParameterKvMatchInput, + RubricBasedMetricInput rubricBasedMetricInput, + AutoraterConfig autoraterConfig, + List metrics, + EvaluationInstance instance, + EvaluateInstancesConfig config) { + + EvaluateInstancesRequestParameters.Builder parameterBuilder = + EvaluateInstancesRequestParameters.builder(); + + if (!Common.isZero(bleuInput)) { + parameterBuilder.bleuInput(bleuInput); + } + if (!Common.isZero(exactMatchInput)) { + parameterBuilder.exactMatchInput(exactMatchInput); + } + if (!Common.isZero(rougeInput)) { + parameterBuilder.rougeInput(rougeInput); + } + if (!Common.isZero(pointwiseMetricInput)) { + parameterBuilder.pointwiseMetricInput(pointwiseMetricInput); + } + if (!Common.isZero(pairwiseMetricInput)) { + parameterBuilder.pairwiseMetricInput(pairwiseMetricInput); + } + if (!Common.isZero(toolCallValidInput)) { + parameterBuilder.toolCallValidInput(toolCallValidInput); + } + if (!Common.isZero(toolNameMatchInput)) { + parameterBuilder.toolNameMatchInput(toolNameMatchInput); + } + if (!Common.isZero(toolParameterKeyMatchInput)) { + parameterBuilder.toolParameterKeyMatchInput(toolParameterKeyMatchInput); + } + if (!Common.isZero(toolParameterKvMatchInput)) { + parameterBuilder.toolParameterKvMatchInput(toolParameterKvMatchInput); + } + if (!Common.isZero(rubricBasedMetricInput)) { + parameterBuilder.rubricBasedMetricInput(rubricBasedMetricInput); + } + if (!Common.isZero(autoraterConfig)) { + parameterBuilder.autoraterConfig(autoraterConfig); + } + if (!Common.isZero(metrics)) { + parameterBuilder.metrics(metrics); + } + if (!Common.isZero(instance)) { + parameterBuilder.instance(instance); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = evaluateInstancesRequestParametersToVertex(parameterNode, null); + path = Common.formatMap(":evaluateInstances", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + EvaluateInstancesResponse processResponseForEvaluateInstances( + ApiResponse response, EvaluateInstancesConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, EvaluateInstancesResponse.class); + } + + public EvaluateInstancesResponse EvaluateInstances( + BleuInput bleuInput, + ExactMatchInput exactMatchInput, + RougeInput rougeInput, + PointwiseMetricInput pointwiseMetricInput, + PairwiseMetricInput pairwiseMetricInput, + ToolCallValidInput toolCallValidInput, + ToolNameMatchInput toolNameMatchInput, + ToolParameterKeyMatchInput toolParameterKeyMatchInput, + ToolParameterKVMatchInput toolParameterKvMatchInput, + RubricBasedMetricInput rubricBasedMetricInput, + AutoraterConfig autoraterConfig, + List metrics, + EvaluationInstance instance, + EvaluateInstancesConfig config) { + BuiltRequest builtRequest = + buildRequestForEvaluateInstances( + bleuInput, + exactMatchInput, + rougeInput, + pointwiseMetricInput, + pairwiseMetricInput, + toolCallValidInput, + toolNameMatchInput, + toolParameterKeyMatchInput, + toolParameterKvMatchInput, + rubricBasedMetricInput, + autoraterConfig, + metrics, + instance, + config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForEvaluateInstances(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGenerateRubrics( + List contents, + PredefinedMetricSpec predefinedRubricGenerationSpec, + RubricGenerationSpec rubricGenerationSpec, + RubricGenerationConfig config) { + + GenerateInstanceRubricsRequest.Builder parameterBuilder = + GenerateInstanceRubricsRequest.builder(); + + if (!Common.isZero(contents)) { + parameterBuilder.contents(contents); + } + if (!Common.isZero(predefinedRubricGenerationSpec)) { + parameterBuilder.predefinedRubricGenerationSpec(predefinedRubricGenerationSpec); + } + if (!Common.isZero(rubricGenerationSpec)) { + parameterBuilder.rubricGenerationSpec(rubricGenerationSpec); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = generateInstanceRubricsRequestToVertex(parameterNode, null); + path = Common.formatMap(":generateInstanceRubrics", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + GenerateInstanceRubricsResponse processResponseForPrivateGenerateRubrics( + ApiResponse response, RubricGenerationConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, GenerateInstanceRubricsResponse.class); + } + + GenerateInstanceRubricsResponse privateGenerateRubrics( + List contents, + PredefinedMetricSpec predefinedRubricGenerationSpec, + RubricGenerationSpec rubricGenerationSpec, + RubricGenerationConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivateGenerateRubrics( + contents, predefinedRubricGenerationSpec, rubricGenerationSpec, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGenerateRubrics(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGetEvaluationRun(String name, GetEvaluationRunConfig config) { + + GetEvaluationRunParameters.Builder parameterBuilder = GetEvaluationRunParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getEvaluationRunParametersToVertex(parameterNode, null); + path = Common.formatMap("evaluationRuns/{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + EvaluationRun processResponseForPrivateGetEvaluationRun( + ApiResponse response, GetEvaluationRunConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (this.apiClient.vertexAI()) { + responseNode = evaluationRunFromVertex(responseNode, null); + } + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, EvaluationRun.class); + } + + EvaluationRun privateGetEvaluationRun(String name, GetEvaluationRunConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateGetEvaluationRun(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGetEvaluationRun(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGetEvaluationSet(String name, GetEvaluationSetConfig config) { + + GetEvaluationSetParameters.Builder parameterBuilder = GetEvaluationSetParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getEvaluationSetParametersToVertex(parameterNode, null); + path = Common.formatMap("evaluationSets/{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + EvaluationSet processResponseForPrivateGetEvaluationSet( + ApiResponse response, GetEvaluationSetConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, EvaluationSet.class); + } + + EvaluationSet privateGetEvaluationSet(String name, GetEvaluationSetConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateGetEvaluationSet(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGetEvaluationSet(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGetEvaluationItem( + String name, GetEvaluationItemConfig config) { + + GetEvaluationItemParameters.Builder parameterBuilder = GetEvaluationItemParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getEvaluationItemParametersToVertex(parameterNode, null); + path = Common.formatMap("evaluationItems/{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + EvaluationItem processResponseForPrivateGetEvaluationItem( + ApiResponse response, GetEvaluationItemConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, EvaluationItem.class); + } + + EvaluationItem privateGetEvaluationItem(String name, GetEvaluationItemConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateGetEvaluationItem(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGetEvaluationItem(response, config); + } + } + + private static final Logger logger = Logger.getLogger(Evals.class.getName()); + + /** + * Creates an evaluation item. + * + * @param evaluationItemType The type of the evaluation item. + * @param gcsUri The GCS URI of the evaluation item. + * @param displayName The display name of the evaluation item. + * @param config The configuration for creating the evaluation item. + * @return The created evaluation item. + * @throws IOException If an error occurs during the request. + */ + public EvaluationItem createEvaluationItem( + String evaluationItemType, + String gcsUri, + String displayName, + CreateEvaluationItemConfig config) { + return privateCreateEvaluationItem(evaluationItemType, gcsUri, displayName, config); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/ExcludeFromGeneratedCoverageReport.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/ExcludeFromGeneratedCoverageReport.java new file mode 100644 index 000000000000..c3adcdc9d656 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/ExcludeFromGeneratedCoverageReport.java @@ -0,0 +1,31 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +package com.google.cloud.vertexai.genai; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation to exclude a method or constructor from the Jacoco coverage report. + * + *

Jacoco will exclude methods that have an annotation with the word "generated" in it. + */ +@Retention(RetentionPolicy.CLASS) +@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE}) +@interface ExcludeFromGeneratedCoverageReport {} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Memories.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Memories.java new file mode 100644 index 000000000000..04864bddbd4c --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Memories.java @@ -0,0 +1,1392 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.google.cloud.vertexai.genai.types.AgentEngineGenerateMemoriesOperation; +import com.google.cloud.vertexai.genai.types.AgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.AgentEngineMemoryOperation; +import com.google.cloud.vertexai.genai.types.AgentEngineRollbackMemoryOperation; +import com.google.cloud.vertexai.genai.types.CreateAgentEngineMemoryRequestParameters; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineMemoryOperation; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineMemoryRequestParameters; +import com.google.cloud.vertexai.genai.types.GenerateAgentEngineMemoriesConfig; +import com.google.cloud.vertexai.genai.types.GenerateAgentEngineMemoriesRequestParameters; +import com.google.cloud.vertexai.genai.types.GenerateMemoriesRequestDirectContentsSource; +import com.google.cloud.vertexai.genai.types.GenerateMemoriesRequestDirectMemoriesSource; +import com.google.cloud.vertexai.genai.types.GenerateMemoriesRequestVertexSessionSource; +import com.google.cloud.vertexai.genai.types.GetAgentEngineGenerateMemoriesOperationParameters; +import com.google.cloud.vertexai.genai.types.GetAgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.GetAgentEngineMemoryOperationParameters; +import com.google.cloud.vertexai.genai.types.GetAgentEngineMemoryRequestParameters; +import com.google.cloud.vertexai.genai.types.GetAgentEngineOperationConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineMemoryRequestParameters; +import com.google.cloud.vertexai.genai.types.ListReasoningEnginesMemoriesResponse; +import com.google.cloud.vertexai.genai.types.Memory; +import com.google.cloud.vertexai.genai.types.RetrieveAgentEngineMemoriesConfig; +import com.google.cloud.vertexai.genai.types.RetrieveAgentEngineMemoriesRequestParameters; +import com.google.cloud.vertexai.genai.types.RetrieveMemoriesRequestSimilaritySearchParams; +import com.google.cloud.vertexai.genai.types.RetrieveMemoriesRequestSimpleRetrievalParams; +import com.google.cloud.vertexai.genai.types.RetrieveMemoriesResponse; +import com.google.cloud.vertexai.genai.types.RollbackAgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.RollbackAgentEngineMemoryRequestParameters; +import com.google.cloud.vertexai.genai.types.UpdateAgentEngineMemoryConfig; +import com.google.cloud.vertexai.genai.types.UpdateAgentEngineMemoryRequestParameters; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common; +import com.google.genai.Common.BuiltRequest; +import com.google.genai.JsonSerializable; +import com.google.genai.errors.GenAiIOException; +import com.google.genai.types.HttpOptions; +import java.io.IOException; +import java.util.Map; +import java.util.Optional; +import okhttp3.ResponseBody; + +public final class Memories { + + final ApiClient apiClient; + + public Memories(ApiClient apiClient) { + this.apiClient = apiClient; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode agentEngineMemoryConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"displayName"}, + Common.getValueByPath(fromObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"description"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"description"}, + Common.getValueByPath(fromObject, new String[] {"description"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"ttl"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"ttl"}, + Common.getValueByPath(fromObject, new String[] {"ttl"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"expireTime"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"expireTime"}, + Common.getValueByPath(fromObject, new String[] {"expireTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"revisionExpireTime"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"revisionExpireTime"}, + Common.getValueByPath(fromObject, new String[] {"revisionExpireTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"revisionTtl"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"revisionTtl"}, + Common.getValueByPath(fromObject, new String[] {"revisionTtl"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"disableMemoryRevisions"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"disableMemoryRevisions"}, + Common.getValueByPath(fromObject, new String[] {"disableMemoryRevisions"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"topics"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"topics"}, + Common.getValueByPath(fromObject, new String[] {"topics"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode createAgentEngineMemoryRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"fact"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"fact"}, + Common.getValueByPath(fromObject, new String[] {"fact"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"scope"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"scope"}, + Common.getValueByPath(fromObject, new String[] {"scope"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + agentEngineMemoryConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode deleteAgentEngineMemoryRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode generateAgentEngineMemoriesConfigToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"disableConsolidation"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"disableConsolidation"}, + Common.getValueByPath(fromObject, new String[] {"disableConsolidation"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"revisionLabels"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"revisionLabels"}, + Common.getValueByPath(fromObject, new String[] {"revisionLabels"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"revisionExpireTime"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"revisionExpireTime"}, + Common.getValueByPath(fromObject, new String[] {"revisionExpireTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"revisionTtl"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"revisionTtl"}, + Common.getValueByPath(fromObject, new String[] {"revisionTtl"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"disableMemoryRevisions"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"disableMemoryRevisions"}, + Common.getValueByPath(fromObject, new String[] {"disableMemoryRevisions"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode generateAgentEngineMemoriesRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"vertexSessionSource"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"vertexSessionSource"}, + Common.getValueByPath(fromObject, new String[] {"vertexSessionSource"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"directContentsSource"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"directContentsSource"}, + Common.getValueByPath(fromObject, new String[] {"directContentsSource"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"directMemoriesSource"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"directMemoriesSource"}, + Common.getValueByPath(fromObject, new String[] {"directMemoriesSource"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"scope"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"scope"}, + Common.getValueByPath(fromObject, new String[] {"scope"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + generateAgentEngineMemoriesConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getAgentEngineGenerateMemoriesOperationParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"operationName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "operationName"}, + Common.getValueByPath(fromObject, new String[] {"operationName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getAgentEngineMemoryOperationParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"operationName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "operationName"}, + Common.getValueByPath(fromObject, new String[] {"operationName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getAgentEngineMemoryRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listAgentEngineMemoryConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"pageSize"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageSize"}, + Common.getValueByPath(fromObject, new String[] {"pageSize"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"pageToken"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageToken"}, + Common.getValueByPath(fromObject, new String[] {"pageToken"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"filter"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "filter"}, + Common.getValueByPath(fromObject, new String[] {"filter"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"orderBy"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "orderBy"}, + Common.getValueByPath(fromObject, new String[] {"orderBy"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listAgentEngineMemoryRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + listAgentEngineMemoryConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode retrieveAgentEngineMemoriesConfigToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"filter"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"filter"}, + Common.getValueByPath(fromObject, new String[] {"filter"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode retrieveAgentEngineMemoriesRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"scope"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"scope"}, + Common.getValueByPath(fromObject, new String[] {"scope"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"similaritySearchParams"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"similaritySearchParams"}, + Common.getValueByPath(fromObject, new String[] {"similaritySearchParams"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"simpleRetrievalParams"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"simpleRetrievalParams"}, + Common.getValueByPath(fromObject, new String[] {"simpleRetrievalParams"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + retrieveAgentEngineMemoriesConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode rollbackAgentEngineMemoryRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"targetRevisionId"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"targetRevisionId"}, + Common.getValueByPath(fromObject, new String[] {"targetRevisionId"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode updateAgentEngineMemoryConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"displayName"}, + Common.getValueByPath(fromObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"description"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"description"}, + Common.getValueByPath(fromObject, new String[] {"description"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"ttl"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"ttl"}, + Common.getValueByPath(fromObject, new String[] {"ttl"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"expireTime"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"expireTime"}, + Common.getValueByPath(fromObject, new String[] {"expireTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"revisionExpireTime"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"revisionExpireTime"}, + Common.getValueByPath(fromObject, new String[] {"revisionExpireTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"revisionTtl"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"revisionTtl"}, + Common.getValueByPath(fromObject, new String[] {"revisionTtl"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"disableMemoryRevisions"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"disableMemoryRevisions"}, + Common.getValueByPath(fromObject, new String[] {"disableMemoryRevisions"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"topics"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"topics"}, + Common.getValueByPath(fromObject, new String[] {"topics"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"updateMask"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "updateMask"}, + Common.getValueByPath(fromObject, new String[] {"updateMask"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode updateAgentEngineMemoryRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"fact"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"fact"}, + Common.getValueByPath(fromObject, new String[] {"fact"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"scope"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"scope"}, + Common.getValueByPath(fromObject, new String[] {"scope"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + updateAgentEngineMemoryConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateCreate( + String name, String fact, Map scope, AgentEngineMemoryConfig config) { + + CreateAgentEngineMemoryRequestParameters.Builder parameterBuilder = + CreateAgentEngineMemoryRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(fact)) { + parameterBuilder.fact(fact); + } + if (!Common.isZero(scope)) { + parameterBuilder.scope(scope); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = createAgentEngineMemoryRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}/memories", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineMemoryOperation processResponseForPrivateCreate( + ApiResponse response, AgentEngineMemoryConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineMemoryOperation.class); + } + + AgentEngineMemoryOperation privateCreate( + String name, String fact, Map scope, AgentEngineMemoryConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateCreate(name, fact, scope, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateCreate(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForDelete(String name, DeleteAgentEngineMemoryConfig config) { + + DeleteAgentEngineMemoryRequestParameters.Builder parameterBuilder = + DeleteAgentEngineMemoryRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = deleteAgentEngineMemoryRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + DeleteAgentEngineMemoryOperation processResponseForDelete( + ApiResponse response, DeleteAgentEngineMemoryConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, DeleteAgentEngineMemoryOperation.class); + } + + public DeleteAgentEngineMemoryOperation delete( + String name, DeleteAgentEngineMemoryConfig config) { + BuiltRequest builtRequest = buildRequestForDelete(name, config); + + try (ApiResponse response = + this.apiClient.request( + "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForDelete(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGenerate( + String name, + GenerateMemoriesRequestVertexSessionSource vertexSessionSource, + GenerateMemoriesRequestDirectContentsSource directContentsSource, + GenerateMemoriesRequestDirectMemoriesSource directMemoriesSource, + Map scope, + GenerateAgentEngineMemoriesConfig config) { + + GenerateAgentEngineMemoriesRequestParameters.Builder parameterBuilder = + GenerateAgentEngineMemoriesRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(vertexSessionSource)) { + parameterBuilder.vertexSessionSource(vertexSessionSource); + } + if (!Common.isZero(directContentsSource)) { + parameterBuilder.directContentsSource(directContentsSource); + } + if (!Common.isZero(directMemoriesSource)) { + parameterBuilder.directMemoriesSource(directMemoriesSource); + } + if (!Common.isZero(scope)) { + parameterBuilder.scope(scope); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = generateAgentEngineMemoriesRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}/memories:generate", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineGenerateMemoriesOperation processResponseForPrivateGenerate( + ApiResponse response, GenerateAgentEngineMemoriesConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineGenerateMemoriesOperation.class); + } + + AgentEngineGenerateMemoriesOperation privateGenerate( + String name, + GenerateMemoriesRequestVertexSessionSource vertexSessionSource, + GenerateMemoriesRequestDirectContentsSource directContentsSource, + GenerateMemoriesRequestDirectMemoriesSource directMemoriesSource, + Map scope, + GenerateAgentEngineMemoriesConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivateGenerate( + name, vertexSessionSource, directContentsSource, directMemoriesSource, scope, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGenerate(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForGet(String name, GetAgentEngineMemoryConfig config) { + + GetAgentEngineMemoryRequestParameters.Builder parameterBuilder = + GetAgentEngineMemoryRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getAgentEngineMemoryRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + Memory processResponseForGet(ApiResponse response, GetAgentEngineMemoryConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, Memory.class); + } + + public Memory get(String name, GetAgentEngineMemoryConfig config) { + BuiltRequest builtRequest = buildRequestForGet(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForGet(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateList(String name, ListAgentEngineMemoryConfig config) { + + ListAgentEngineMemoryRequestParameters.Builder parameterBuilder = + ListAgentEngineMemoryRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = listAgentEngineMemoryRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}/memories", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + ListReasoningEnginesMemoriesResponse processResponseForPrivateList( + ApiResponse response, ListAgentEngineMemoryConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, ListReasoningEnginesMemoriesResponse.class); + } + + ListReasoningEnginesMemoriesResponse privateList( + String name, ListAgentEngineMemoryConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateList(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateList(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGetMemoryOperation( + String operationName, GetAgentEngineOperationConfig config) { + + GetAgentEngineMemoryOperationParameters.Builder parameterBuilder = + GetAgentEngineMemoryOperationParameters.builder(); + + if (!Common.isZero(operationName)) { + parameterBuilder.operationName(operationName); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getAgentEngineMemoryOperationParametersToVertex(parameterNode, null); + path = Common.formatMap("{operationName}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineMemoryOperation processResponseForPrivateGetMemoryOperation( + ApiResponse response, GetAgentEngineOperationConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineMemoryOperation.class); + } + + AgentEngineMemoryOperation privateGetMemoryOperation( + String operationName, GetAgentEngineOperationConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateGetMemoryOperation(operationName, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGetMemoryOperation(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGetGenerateMemoriesOperation( + String operationName, GetAgentEngineOperationConfig config) { + + GetAgentEngineGenerateMemoriesOperationParameters.Builder parameterBuilder = + GetAgentEngineGenerateMemoriesOperationParameters.builder(); + + if (!Common.isZero(operationName)) { + parameterBuilder.operationName(operationName); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getAgentEngineGenerateMemoriesOperationParametersToVertex(parameterNode, null); + path = Common.formatMap("{operationName}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineGenerateMemoriesOperation processResponseForPrivateGetGenerateMemoriesOperation( + ApiResponse response, GetAgentEngineOperationConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineGenerateMemoriesOperation.class); + } + + AgentEngineGenerateMemoriesOperation privateGetGenerateMemoriesOperation( + String operationName, GetAgentEngineOperationConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivateGetGenerateMemoriesOperation(operationName, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGetGenerateMemoriesOperation(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateRetrieve( + String name, + Map scope, + RetrieveMemoriesRequestSimilaritySearchParams similaritySearchParams, + RetrieveMemoriesRequestSimpleRetrievalParams simpleRetrievalParams, + RetrieveAgentEngineMemoriesConfig config) { + + RetrieveAgentEngineMemoriesRequestParameters.Builder parameterBuilder = + RetrieveAgentEngineMemoriesRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(scope)) { + parameterBuilder.scope(scope); + } + if (!Common.isZero(similaritySearchParams)) { + parameterBuilder.similaritySearchParams(similaritySearchParams); + } + if (!Common.isZero(simpleRetrievalParams)) { + parameterBuilder.simpleRetrievalParams(simpleRetrievalParams); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = retrieveAgentEngineMemoriesRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}/memories:retrieve", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + RetrieveMemoriesResponse processResponseForPrivateRetrieve( + ApiResponse response, RetrieveAgentEngineMemoriesConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, RetrieveMemoriesResponse.class); + } + + RetrieveMemoriesResponse privateRetrieve( + String name, + Map scope, + RetrieveMemoriesRequestSimilaritySearchParams similaritySearchParams, + RetrieveMemoriesRequestSimpleRetrievalParams simpleRetrievalParams, + RetrieveAgentEngineMemoriesConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivateRetrieve( + name, scope, similaritySearchParams, simpleRetrievalParams, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateRetrieve(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateRollback( + String name, String targetRevisionId, RollbackAgentEngineMemoryConfig config) { + + RollbackAgentEngineMemoryRequestParameters.Builder parameterBuilder = + RollbackAgentEngineMemoryRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(targetRevisionId)) { + parameterBuilder.targetRevisionId(targetRevisionId); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = rollbackAgentEngineMemoryRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}:rollback", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineRollbackMemoryOperation processResponseForPrivateRollback( + ApiResponse response, RollbackAgentEngineMemoryConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineRollbackMemoryOperation.class); + } + + AgentEngineRollbackMemoryOperation privateRollback( + String name, String targetRevisionId, RollbackAgentEngineMemoryConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateRollback(name, targetRevisionId, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateRollback(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateUpdate( + String name, String fact, Map scope, UpdateAgentEngineMemoryConfig config) { + + UpdateAgentEngineMemoryRequestParameters.Builder parameterBuilder = + UpdateAgentEngineMemoryRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(fact)) { + parameterBuilder.fact(fact); + } + if (!Common.isZero(scope)) { + parameterBuilder.scope(scope); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = updateAgentEngineMemoryRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineMemoryOperation processResponseForPrivateUpdate( + ApiResponse response, UpdateAgentEngineMemoryConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineMemoryOperation.class); + } + + AgentEngineMemoryOperation privateUpdate( + String name, String fact, Map scope, UpdateAgentEngineMemoryConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateUpdate(name, fact, scope, config); + + try (ApiResponse response = + this.apiClient.request( + "patch", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateUpdate(response, config); + } + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/MemoryRevisions.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/MemoryRevisions.java new file mode 100644 index 000000000000..5be955cad709 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/MemoryRevisions.java @@ -0,0 +1,266 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.google.cloud.vertexai.genai.types.GetAgentEngineMemoryRevisionConfig; +import com.google.cloud.vertexai.genai.types.GetAgentEngineMemoryRevisionRequestParameters; +import com.google.cloud.vertexai.genai.types.ListAgentEngineMemoryRevisionsConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineMemoryRevisionsRequestParameters; +import com.google.cloud.vertexai.genai.types.ListAgentEngineMemoryRevisionsResponse; +import com.google.cloud.vertexai.genai.types.MemoryRevision; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common; +import com.google.genai.Common.BuiltRequest; +import com.google.genai.JsonSerializable; +import com.google.genai.errors.GenAiIOException; +import com.google.genai.types.HttpOptions; +import java.io.IOException; +import java.util.Optional; +import okhttp3.ResponseBody; + +public final class MemoryRevisions { + + final ApiClient apiClient; + + public MemoryRevisions(ApiClient apiClient) { + this.apiClient = apiClient; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getAgentEngineMemoryRevisionRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listAgentEngineMemoryRevisionsConfigToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"pageSize"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageSize"}, + Common.getValueByPath(fromObject, new String[] {"pageSize"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"pageToken"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageToken"}, + Common.getValueByPath(fromObject, new String[] {"pageToken"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"filter"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "filter"}, + Common.getValueByPath(fromObject, new String[] {"filter"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listAgentEngineMemoryRevisionsRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + listAgentEngineMemoryRevisionsConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForGet(String name, GetAgentEngineMemoryRevisionConfig config) { + + GetAgentEngineMemoryRevisionRequestParameters.Builder parameterBuilder = + GetAgentEngineMemoryRevisionRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getAgentEngineMemoryRevisionRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + MemoryRevision processResponseForGet( + ApiResponse response, GetAgentEngineMemoryRevisionConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, MemoryRevision.class); + } + + public MemoryRevision get(String name, GetAgentEngineMemoryRevisionConfig config) { + BuiltRequest builtRequest = buildRequestForGet(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForGet(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateList( + String name, ListAgentEngineMemoryRevisionsConfig config) { + + ListAgentEngineMemoryRevisionsRequestParameters.Builder parameterBuilder = + ListAgentEngineMemoryRevisionsRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = listAgentEngineMemoryRevisionsRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}/revisions", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + ListAgentEngineMemoryRevisionsResponse processResponseForPrivateList( + ApiResponse response, ListAgentEngineMemoryRevisionsConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode( + responseNode, ListAgentEngineMemoryRevisionsResponse.class); + } + + ListAgentEngineMemoryRevisionsResponse privateList( + String name, ListAgentEngineMemoryRevisionsConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateList(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateList(response, config); + } + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/PromptOptimizer.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/PromptOptimizer.java new file mode 100644 index 000000000000..7720c31c2029 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/PromptOptimizer.java @@ -0,0 +1,555 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.google.cloud.vertexai.genai.types.CustomJob; +import com.google.cloud.vertexai.genai.types.CustomJobParameters; +import com.google.cloud.vertexai.genai.types.GetCustomJobParameters; +import com.google.cloud.vertexai.genai.types.OptimizeConfig; +import com.google.cloud.vertexai.genai.types.OptimizeRequestParameters; +import com.google.cloud.vertexai.genai.types.OptimizeResponseEndpoint; +import com.google.cloud.vertexai.genai.types.VertexBaseConfig; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common; +import com.google.genai.Common.BuiltRequest; +import com.google.genai.JsonSerializable; +import com.google.genai.errors.GenAiIOException; +import com.google.genai.types.Content; +import com.google.genai.types.HttpOptions; +import java.io.IOException; +import java.util.Optional; +import okhttp3.ResponseBody; + +public final class PromptOptimizer { + + final ApiClient apiClient; + + public PromptOptimizer(ApiClient apiClient) { + this.apiClient = apiClient; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode customJobFromVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(parentObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"displayName"}, + Common.getValueByPath(parentObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(parentObject, new String[] {"jobSpec"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"jobSpec"}, + Common.getValueByPath(parentObject, new String[] {"jobSpec"})); + } + + if (Common.getValueByPath(parentObject, new String[] {"encryptionSpec"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"encryptionSpec"}, + Common.getValueByPath(parentObject, new String[] {"encryptionSpec"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"state"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"state"}, + Common.getValueByPath(fromObject, new String[] {"state"})); + } + + if (Common.getValueByPath(parentObject, new String[] {"error"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"error"}, + Common.getValueByPath(parentObject, new String[] {"error"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"createTime"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"createTime"}, + Common.getValueByPath(fromObject, new String[] {"createTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"endTime"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"endTime"}, + Common.getValueByPath(fromObject, new String[] {"endTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"labels"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"labels"}, + Common.getValueByPath(fromObject, new String[] {"labels"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"satisfiesPzi"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"satisfiesPzi"}, + Common.getValueByPath(fromObject, new String[] {"satisfiesPzi"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"satisfiesPzs"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"satisfiesPzs"}, + Common.getValueByPath(fromObject, new String[] {"satisfiesPzs"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"startTime"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"startTime"}, + Common.getValueByPath(fromObject, new String[] {"startTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"updateTime"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"updateTime"}, + Common.getValueByPath(fromObject, new String[] {"updateTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"webAccessUris"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"webAccessUris"}, + Common.getValueByPath(fromObject, new String[] {"webAccessUris"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode customJobParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"customJob"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"customJob"}, + customJobToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"customJob"})), + toObject)); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode customJobToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"displayName"}, + Common.getValueByPath(fromObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"jobSpec"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"jobSpec"}, + Common.getValueByPath(fromObject, new String[] {"jobSpec"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"encryptionSpec"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"encryptionSpec"}, + Common.getValueByPath(fromObject, new String[] {"encryptionSpec"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"state"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"state"}, + Common.getValueByPath(fromObject, new String[] {"state"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"error"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"error"}, + Common.getValueByPath(fromObject, new String[] {"error"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"createTime"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"createTime"}, + Common.getValueByPath(fromObject, new String[] {"createTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"endTime"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"endTime"}, + Common.getValueByPath(fromObject, new String[] {"endTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"labels"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"labels"}, + Common.getValueByPath(fromObject, new String[] {"labels"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"satisfiesPzi"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"satisfiesPzi"}, + Common.getValueByPath(fromObject, new String[] {"satisfiesPzi"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"satisfiesPzs"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"satisfiesPzs"}, + Common.getValueByPath(fromObject, new String[] {"satisfiesPzs"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"startTime"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"startTime"}, + Common.getValueByPath(fromObject, new String[] {"startTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"updateTime"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"updateTime"}, + Common.getValueByPath(fromObject, new String[] {"updateTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"webAccessUris"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"webAccessUris"}, + Common.getValueByPath(fromObject, new String[] {"webAccessUris"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getCustomJobParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode optimizeConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"optimizationTarget"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"optimizationTarget"}, + Common.getValueByPath(fromObject, new String[] {"optimizationTarget"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode optimizeRequestParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"content"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"content"}, + Common.getValueByPath(fromObject, new String[] {"content"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + optimizeConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateOptimizePrompt(Content content, OptimizeConfig config) { + + OptimizeRequestParameters.Builder parameterBuilder = OptimizeRequestParameters.builder(); + + if (!Common.isZero(content)) { + parameterBuilder.content(content); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = optimizeRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("tuningJobs:optimizePrompt", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + OptimizeResponseEndpoint processResponseForPrivateOptimizePrompt( + ApiResponse response, OptimizeConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, OptimizeResponseEndpoint.class); + } + + OptimizeResponseEndpoint privateOptimizePrompt(Content content, OptimizeConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateOptimizePrompt(content, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateOptimizePrompt(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateCreateCustomJobResource( + CustomJob customJob, VertexBaseConfig config) { + + CustomJobParameters.Builder parameterBuilder = CustomJobParameters.builder(); + + if (!Common.isZero(customJob)) { + parameterBuilder.customJob(customJob); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = customJobParametersToVertex(parameterNode, null); + path = Common.formatMap("customJobs", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + CustomJob processResponseForPrivateCreateCustomJobResource( + ApiResponse response, VertexBaseConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (this.apiClient.vertexAI()) { + responseNode = customJobFromVertex(responseNode, null); + } + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, CustomJob.class); + } + + CustomJob privateCreateCustomJobResource(CustomJob customJob, VertexBaseConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateCreateCustomJobResource(customJob, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateCreateCustomJobResource(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGetCustomJob(String name, VertexBaseConfig config) { + + GetCustomJobParameters.Builder parameterBuilder = GetCustomJobParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getCustomJobParametersToVertex(parameterNode, null); + path = Common.formatMap("customJobs/{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + CustomJob processResponseForPrivateGetCustomJob(ApiResponse response, VertexBaseConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (this.apiClient.vertexAI()) { + responseNode = customJobFromVertex(responseNode, null); + } + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, CustomJob.class); + } + + CustomJob privateGetCustomJob(String name, VertexBaseConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateGetCustomJob(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGetCustomJob(response, config); + } + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Prompts.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Prompts.java new file mode 100644 index 000000000000..d90fce0332e3 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Prompts.java @@ -0,0 +1,1385 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.google.cloud.vertexai.genai.types.CreateDatasetConfig; +import com.google.cloud.vertexai.genai.types.CreateDatasetParameters; +import com.google.cloud.vertexai.genai.types.CreateDatasetVersionConfig; +import com.google.cloud.vertexai.genai.types.CreateDatasetVersionParameters; +import com.google.cloud.vertexai.genai.types.Dataset; +import com.google.cloud.vertexai.genai.types.DatasetOperation; +import com.google.cloud.vertexai.genai.types.DatasetVersion; +import com.google.cloud.vertexai.genai.types.DeleteDatasetRequestParameters; +import com.google.cloud.vertexai.genai.types.DeletePromptConfig; +import com.google.cloud.vertexai.genai.types.DeletePromptOperation; +import com.google.cloud.vertexai.genai.types.DeletePromptVersionOperation; +import com.google.cloud.vertexai.genai.types.DeletePromptVersionRequestParameters; +import com.google.cloud.vertexai.genai.types.GetDatasetOperationConfig; +import com.google.cloud.vertexai.genai.types.GetDatasetOperationParameters; +import com.google.cloud.vertexai.genai.types.GetDatasetParameters; +import com.google.cloud.vertexai.genai.types.GetDatasetVersionParameters; +import com.google.cloud.vertexai.genai.types.ListDatasetVersionsRequestParameters; +import com.google.cloud.vertexai.genai.types.ListDatasetVersionsResponse; +import com.google.cloud.vertexai.genai.types.ListDatasetsRequestParameters; +import com.google.cloud.vertexai.genai.types.ListDatasetsResponse; +import com.google.cloud.vertexai.genai.types.ListPromptsConfig; +import com.google.cloud.vertexai.genai.types.RestoreVersionConfig; +import com.google.cloud.vertexai.genai.types.RestoreVersionOperation; +import com.google.cloud.vertexai.genai.types.RestoreVersionRequestParameters; +import com.google.cloud.vertexai.genai.types.SchemaTextPromptDatasetMetadata; +import com.google.cloud.vertexai.genai.types.UpdateDatasetConfig; +import com.google.cloud.vertexai.genai.types.UpdateDatasetParameters; +import com.google.cloud.vertexai.genai.types.VertexBaseConfig; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common; +import com.google.genai.Common.BuiltRequest; +import com.google.genai.JsonSerializable; +import com.google.genai.errors.GenAiIOException; +import com.google.genai.types.EncryptionSpec; +import com.google.genai.types.HttpOptions; +import java.io.IOException; +import java.util.Optional; +import okhttp3.ResponseBody; + +public final class Prompts { + + final ApiClient apiClient; + + public Prompts(ApiClient apiClient) { + this.apiClient = apiClient; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode createDatasetParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"displayName"}, + Common.getValueByPath(fromObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"metadataSchemaUri"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"metadataSchemaUri"}, + Common.getValueByPath(fromObject, new String[] {"metadataSchemaUri"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"metadata"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"metadata"}, + Common.getValueByPath(fromObject, new String[] {"metadata"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"description"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"description"}, + Common.getValueByPath(fromObject, new String[] {"description"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"encryptionSpec"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"encryptionSpec"}, + Common.getValueByPath(fromObject, new String[] {"encryptionSpec"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"modelReference"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"modelReference"}, + Common.getValueByPath(fromObject, new String[] {"modelReference"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode createDatasetVersionParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"datasetName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"datasetName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"metadata"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"metadata"}, + Common.getValueByPath(fromObject, new String[] {"metadata"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"modelReference"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"modelReference"}, + Common.getValueByPath(fromObject, new String[] {"modelReference"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"parent"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"parent"}, + Common.getValueByPath(fromObject, new String[] {"parent"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"displayName"}, + Common.getValueByPath(fromObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode deleteDatasetRequestParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"promptId"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "dataset_id"}, + Common.getValueByPath(fromObject, new String[] {"promptId"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode deletePromptVersionRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"promptId"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "dataset_id"}, + Common.getValueByPath(fromObject, new String[] {"promptId"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"versionId"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "version_id"}, + Common.getValueByPath(fromObject, new String[] {"versionId"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getDatasetOperationParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"datasetId"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "dataset_id"}, + Common.getValueByPath(fromObject, new String[] {"datasetId"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"operationId"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "operation_id"}, + Common.getValueByPath(fromObject, new String[] {"operationId"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getDatasetParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getDatasetVersionParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"datasetId"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "dataset_id"}, + Common.getValueByPath(fromObject, new String[] {"datasetId"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"datasetVersionId"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "dataset_version_id"}, + Common.getValueByPath(fromObject, new String[] {"datasetVersionId"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listDatasetVersionsRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"readMask"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "read_mask"}, + Common.getValueByPath(fromObject, new String[] {"readMask"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"datasetId"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "dataset_id"}, + Common.getValueByPath(fromObject, new String[] {"datasetId"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + listPromptsConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listDatasetsRequestParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + listPromptsConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listPromptsConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"pageSize"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageSize"}, + Common.getValueByPath(fromObject, new String[] {"pageSize"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"pageToken"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageToken"}, + Common.getValueByPath(fromObject, new String[] {"pageToken"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"filter"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "filter"}, + Common.getValueByPath(fromObject, new String[] {"filter"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode restoreVersionRequestParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"datasetId"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "dataset_id"}, + Common.getValueByPath(fromObject, new String[] {"datasetId"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"versionId"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "version_id"}, + Common.getValueByPath(fromObject, new String[] {"versionId"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode updateDatasetParametersToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"datasetId"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "dataset_id"}, + Common.getValueByPath(fromObject, new String[] {"datasetId"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"displayName"}, + Common.getValueByPath(fromObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"metadata"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"metadata"}, + Common.getValueByPath(fromObject, new String[] {"metadata"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"description"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"description"}, + Common.getValueByPath(fromObject, new String[] {"description"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"encryptionSpec"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"encryptionSpec"}, + Common.getValueByPath(fromObject, new String[] {"encryptionSpec"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"modelReference"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"modelReference"}, + Common.getValueByPath(fromObject, new String[] {"modelReference"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateCreateDatasetResource( + String name, + String displayName, + String metadataSchemaUri, + SchemaTextPromptDatasetMetadata metadata, + String description, + EncryptionSpec encryptionSpec, + String modelReference, + CreateDatasetConfig config) { + + CreateDatasetParameters.Builder parameterBuilder = CreateDatasetParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(displayName)) { + parameterBuilder.displayName(displayName); + } + if (!Common.isZero(metadataSchemaUri)) { + parameterBuilder.metadataSchemaUri(metadataSchemaUri); + } + if (!Common.isZero(metadata)) { + parameterBuilder.metadata(metadata); + } + if (!Common.isZero(description)) { + parameterBuilder.description(description); + } + if (!Common.isZero(encryptionSpec)) { + parameterBuilder.encryptionSpec(encryptionSpec); + } + if (!Common.isZero(modelReference)) { + parameterBuilder.modelReference(modelReference); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = createDatasetParametersToVertex(parameterNode, null); + path = Common.formatMap("datasets", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + DatasetOperation processResponseForPrivateCreateDatasetResource( + ApiResponse response, CreateDatasetConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, DatasetOperation.class); + } + + DatasetOperation privateCreateDatasetResource( + String name, + String displayName, + String metadataSchemaUri, + SchemaTextPromptDatasetMetadata metadata, + String description, + EncryptionSpec encryptionSpec, + String modelReference, + CreateDatasetConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivateCreateDatasetResource( + name, + displayName, + metadataSchemaUri, + metadata, + description, + encryptionSpec, + modelReference, + config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateCreateDatasetResource(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateCreateDatasetVersionResource( + String datasetName, + SchemaTextPromptDatasetMetadata metadata, + String modelReference, + String parent, + String displayName, + CreateDatasetVersionConfig config) { + + CreateDatasetVersionParameters.Builder parameterBuilder = + CreateDatasetVersionParameters.builder(); + + if (!Common.isZero(datasetName)) { + parameterBuilder.datasetName(datasetName); + } + if (!Common.isZero(metadata)) { + parameterBuilder.metadata(metadata); + } + if (!Common.isZero(modelReference)) { + parameterBuilder.modelReference(modelReference); + } + if (!Common.isZero(parent)) { + parameterBuilder.parent(parent); + } + if (!Common.isZero(displayName)) { + parameterBuilder.displayName(displayName); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = createDatasetVersionParametersToVertex(parameterNode, null); + path = Common.formatMap("datasets/{name}/datasetVersions", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + DatasetOperation processResponseForPrivateCreateDatasetVersionResource( + ApiResponse response, CreateDatasetVersionConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, DatasetOperation.class); + } + + DatasetOperation privateCreateDatasetVersionResource( + String datasetName, + SchemaTextPromptDatasetMetadata metadata, + String modelReference, + String parent, + String displayName, + CreateDatasetVersionConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivateCreateDatasetVersionResource( + datasetName, metadata, modelReference, parent, displayName, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateCreateDatasetVersionResource(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGetDatasetResource(String name, VertexBaseConfig config) { + + GetDatasetParameters.Builder parameterBuilder = GetDatasetParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getDatasetParametersToVertex(parameterNode, null); + path = Common.formatMap("datasets/{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + Dataset processResponseForPrivateGetDatasetResource( + ApiResponse response, VertexBaseConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, Dataset.class); + } + + Dataset privateGetDatasetResource(String name, VertexBaseConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateGetDatasetResource(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGetDatasetResource(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGetDatasetVersionResource( + String datasetId, String datasetVersionId, VertexBaseConfig config) { + + GetDatasetVersionParameters.Builder parameterBuilder = GetDatasetVersionParameters.builder(); + + if (!Common.isZero(datasetId)) { + parameterBuilder.datasetId(datasetId); + } + if (!Common.isZero(datasetVersionId)) { + parameterBuilder.datasetVersionId(datasetVersionId); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getDatasetVersionParametersToVertex(parameterNode, null); + path = + Common.formatMap( + "datasets/{dataset_id}/datasetVersions/{dataset_version_id}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + DatasetVersion processResponseForPrivateGetDatasetVersionResource( + ApiResponse response, VertexBaseConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, DatasetVersion.class); + } + + DatasetVersion privateGetDatasetVersionResource( + String datasetId, String datasetVersionId, VertexBaseConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivateGetDatasetVersionResource(datasetId, datasetVersionId, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGetDatasetVersionResource(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGetDatasetOperation( + String datasetId, String operationId, GetDatasetOperationConfig config) { + + GetDatasetOperationParameters.Builder parameterBuilder = + GetDatasetOperationParameters.builder(); + + if (!Common.isZero(datasetId)) { + parameterBuilder.datasetId(datasetId); + } + if (!Common.isZero(operationId)) { + parameterBuilder.operationId(operationId); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getDatasetOperationParametersToVertex(parameterNode, null); + path = Common.formatMap("datasets/{dataset_id}/operations/{operation_id}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + DatasetOperation processResponseForPrivateGetDatasetOperation( + ApiResponse response, GetDatasetOperationConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, DatasetOperation.class); + } + + DatasetOperation privateGetDatasetOperation( + String datasetId, String operationId, GetDatasetOperationConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivateGetDatasetOperation(datasetId, operationId, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGetDatasetOperation(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateListPrompts(ListPromptsConfig config) { + + ListDatasetsRequestParameters.Builder parameterBuilder = + ListDatasetsRequestParameters.builder(); + + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = listDatasetsRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("datasets", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + ListDatasetsResponse processResponseForPrivateListPrompts( + ApiResponse response, ListPromptsConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, ListDatasetsResponse.class); + } + + ListDatasetsResponse privateListPrompts(ListPromptsConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateListPrompts(config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateListPrompts(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateListVersions( + String readMask, String datasetId, ListPromptsConfig config) { + + ListDatasetVersionsRequestParameters.Builder parameterBuilder = + ListDatasetVersionsRequestParameters.builder(); + + if (!Common.isZero(readMask)) { + parameterBuilder.readMask(readMask); + } + if (!Common.isZero(datasetId)) { + parameterBuilder.datasetId(datasetId); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = listDatasetVersionsRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("datasets/{dataset_id}/datasetVersions", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + ListDatasetVersionsResponse processResponseForPrivateListVersions( + ApiResponse response, ListPromptsConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, ListDatasetVersionsResponse.class); + } + + ListDatasetVersionsResponse privateListVersions( + String readMask, String datasetId, ListPromptsConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateListVersions(readMask, datasetId, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateListVersions(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateDeleteDataset(String promptId, DeletePromptConfig config) { + + DeleteDatasetRequestParameters.Builder parameterBuilder = + DeleteDatasetRequestParameters.builder(); + + if (!Common.isZero(promptId)) { + parameterBuilder.promptId(promptId); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = deleteDatasetRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("datasets/{dataset_id}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + DeletePromptOperation processResponseForPrivateDeleteDataset( + ApiResponse response, DeletePromptConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, DeletePromptOperation.class); + } + + DeletePromptOperation privateDeleteDataset(String promptId, DeletePromptConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateDeleteDataset(promptId, config); + + try (ApiResponse response = + this.apiClient.request( + "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateDeleteDataset(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateDeleteDatasetVersion( + String promptId, String versionId, DeletePromptConfig config) { + + DeletePromptVersionRequestParameters.Builder parameterBuilder = + DeletePromptVersionRequestParameters.builder(); + + if (!Common.isZero(promptId)) { + parameterBuilder.promptId(promptId); + } + if (!Common.isZero(versionId)) { + parameterBuilder.versionId(versionId); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = deletePromptVersionRequestParametersToVertex(parameterNode, null); + path = + Common.formatMap("datasets/{dataset_id}/datasetVersions/{version_id}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + DeletePromptVersionOperation processResponseForPrivateDeleteDatasetVersion( + ApiResponse response, DeletePromptConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, DeletePromptVersionOperation.class); + } + + DeletePromptVersionOperation privateDeleteDatasetVersion( + String promptId, String versionId, DeletePromptConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivateDeleteDatasetVersion(promptId, versionId, config); + + try (ApiResponse response = + this.apiClient.request( + "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateDeleteDatasetVersion(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateRestoreVersion( + String datasetId, String versionId, RestoreVersionConfig config) { + + RestoreVersionRequestParameters.Builder parameterBuilder = + RestoreVersionRequestParameters.builder(); + + if (!Common.isZero(datasetId)) { + parameterBuilder.datasetId(datasetId); + } + if (!Common.isZero(versionId)) { + parameterBuilder.versionId(versionId); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = restoreVersionRequestParametersToVertex(parameterNode, null); + path = + Common.formatMap( + "datasets/{dataset_id}/datasetVersions/{version_id}:restore", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + RestoreVersionOperation processResponseForPrivateRestoreVersion( + ApiResponse response, RestoreVersionConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, RestoreVersionOperation.class); + } + + RestoreVersionOperation privateRestoreVersion( + String datasetId, String versionId, RestoreVersionConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateRestoreVersion(datasetId, versionId, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateRestoreVersion(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateUpdateDatasetResource( + String name, + String datasetId, + String displayName, + SchemaTextPromptDatasetMetadata metadata, + String description, + EncryptionSpec encryptionSpec, + String modelReference, + UpdateDatasetConfig config) { + + UpdateDatasetParameters.Builder parameterBuilder = UpdateDatasetParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(datasetId)) { + parameterBuilder.datasetId(datasetId); + } + if (!Common.isZero(displayName)) { + parameterBuilder.displayName(displayName); + } + if (!Common.isZero(metadata)) { + parameterBuilder.metadata(metadata); + } + if (!Common.isZero(description)) { + parameterBuilder.description(description); + } + if (!Common.isZero(encryptionSpec)) { + parameterBuilder.encryptionSpec(encryptionSpec); + } + if (!Common.isZero(modelReference)) { + parameterBuilder.modelReference(modelReference); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = updateDatasetParametersToVertex(parameterNode, null); + path = Common.formatMap("datasets/{dataset_id}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + Dataset processResponseForPrivateUpdateDatasetResource( + ApiResponse response, UpdateDatasetConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, Dataset.class); + } + + Dataset privateUpdateDatasetResource( + String name, + String datasetId, + String displayName, + SchemaTextPromptDatasetMetadata metadata, + String description, + EncryptionSpec encryptionSpec, + String modelReference, + UpdateDatasetConfig config) { + BuiltRequest builtRequest = + buildRequestForPrivateUpdateDatasetResource( + name, + datasetId, + displayName, + metadata, + description, + encryptionSpec, + modelReference, + config); + + try (ApiResponse response = + this.apiClient.request( + "patch", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateUpdateDatasetResource(response, config); + } + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/RetryInterceptor.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/RetryInterceptor.java new file mode 100644 index 000000000000..e0c08b0f0205 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/RetryInterceptor.java @@ -0,0 +1,128 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +package com.google.cloud.vertexai.genai; + +import com.google.common.collect.ImmutableList; +import com.google.genai.types.HttpRetryOptions; +import java.io.IOException; +import java.util.List; +import java.util.Random; +import okhttp3.Interceptor; +import okhttp3.Request; +import okhttp3.Response; + +/** Retry interceptor for the API requests. */ +class RetryInterceptor implements Interceptor { + + // Default retry options. + private static final int RETRY_MAX_ATTEMPTS = 5; + private static final double RETRY_INITIAL_DELAY = 1.0; // in seconds + private static final double RETRY_MAX_DELAY = 60.0; // in seconds + private static final double RETRY_EXP_BASE = 2.0; + private static final double RETRY_JITTER = 1.0; + private static final ImmutableList RETRY_HTTP_STATUS_CODES = + ImmutableList.of( + 408, // Request timeout. + 429, // Too many requests. + 500, // Internal server error. + 502, // Bad gateway. + 503, // Service unavailable. + 504 // Gateway timeout + ); + + private final HttpRetryOptions retryOptions; + private final Random random; + + /** Creates an interceptor with a retry strategy. */ + RetryInterceptor(HttpRetryOptions retryOptions) { + this(retryOptions, new Random()); + } + + /** Constructor for testing. Allows injecting a mock Random. */ + RetryInterceptor(HttpRetryOptions retryOptions, Random random) { + this.retryOptions = retryOptions; + this.random = random; + } + + @Override + public Response intercept(Chain chain) throws IOException { + Request request = chain.request(); + + // Check if the request has a *per-request* retry options object attached as a tag. + HttpRetryOptions perRequestOptions = request.tag(HttpRetryOptions.class); + + // Use per-request options if present, otherwise fall back to client-default options. + HttpRetryOptions options = (perRequestOptions != null) ? perRequestOptions : this.retryOptions; + + if (options == null) { + return chain.proceed(request); + } + + Response response = null; + int maxAttempts = options.attempts().orElse(RETRY_MAX_ATTEMPTS); + maxAttempts = Math.max(maxAttempts, 1); + List httpStatusCodes = options.httpStatusCodes().orElse(RETRY_HTTP_STATUS_CODES); + + for (int attempt = 1; attempt <= maxAttempts; attempt++) { + try { + response = chain.proceed(request); + // If the response is successful or the response code is not in the retry list, exist the + // attempt loop. + if (response.isSuccessful() || !httpStatusCodes.contains(response.code())) { + break; + } else if (attempt < maxAttempts) { + // Close the unsuccessful response so that the connection can be reused for the next + // attempt. + response.close(); + } + } catch (IOException e) { + if (attempt == maxAttempts) { + throw e; + } + } + + try { + // Blocking sleep before retrying. + Thread.sleep(calculateDelay(options, attempt)); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new IOException("Retry was interrupted.", e); + } + } + return response; + } + + /** Calculates the delay (in milliseconds) using exponential backoff with jitter. */ + long calculateDelay(HttpRetryOptions options, int attempt) { + double initialDelay = options.initialDelay().orElse(RETRY_INITIAL_DELAY); + double maxDelay = options.maxDelay().orElse(RETRY_MAX_DELAY); + double expBase = options.expBase().orElse(RETRY_EXP_BASE); + double jitter = options.jitter().orElse(RETRY_JITTER); + + double factor = + Math.pow(expBase, attempt - 1) * (1.0 + jitter * (random.nextDouble() * 2.0 - 1.0)); + + double delay = Math.min(maxDelay, initialDelay * factor); + + return (long) (delay * 1000); // Convert to milliseconds. + } + + /** Returns the client-level retry options. */ + HttpRetryOptions retryOptions() { + return retryOptions; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Sandboxes.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Sandboxes.java new file mode 100644 index 000000000000..5e2240dc5967 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Sandboxes.java @@ -0,0 +1,702 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.google.cloud.vertexai.genai.types.AgentEngineSandboxOperation; +import com.google.cloud.vertexai.genai.types.Chunk; +import com.google.cloud.vertexai.genai.types.CreateAgentEngineSandboxConfig; +import com.google.cloud.vertexai.genai.types.CreateAgentEngineSandboxRequestParameters; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineSandboxConfig; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineSandboxOperation; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineSandboxRequestParameters; +import com.google.cloud.vertexai.genai.types.ExecuteCodeAgentEngineSandboxConfig; +import com.google.cloud.vertexai.genai.types.ExecuteCodeAgentEngineSandboxRequestParameters; +import com.google.cloud.vertexai.genai.types.ExecuteSandboxEnvironmentResponse; +import com.google.cloud.vertexai.genai.types.GetAgentEngineOperationConfig; +import com.google.cloud.vertexai.genai.types.GetAgentEngineSandboxConfig; +import com.google.cloud.vertexai.genai.types.GetAgentEngineSandboxOperationParameters; +import com.google.cloud.vertexai.genai.types.GetAgentEngineSandboxRequestParameters; +import com.google.cloud.vertexai.genai.types.ListAgentEngineSandboxesConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineSandboxesRequestParameters; +import com.google.cloud.vertexai.genai.types.ListAgentEngineSandboxesResponse; +import com.google.cloud.vertexai.genai.types.SandboxEnvironment; +import com.google.cloud.vertexai.genai.types.SandboxEnvironmentSpec; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common; +import com.google.genai.Common.BuiltRequest; +import com.google.genai.JsonSerializable; +import com.google.genai.errors.GenAiIOException; +import com.google.genai.types.HttpOptions; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.ResponseBody; + +public final class Sandboxes { + + final ApiClient apiClient; + + public Sandboxes(ApiClient apiClient) { + this.apiClient = apiClient; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode createAgentEngineSandboxConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"displayName"}, + Common.getValueByPath(fromObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"description"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"description"}, + Common.getValueByPath(fromObject, new String[] {"description"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"ttl"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"ttl"}, + Common.getValueByPath(fromObject, new String[] {"ttl"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode createAgentEngineSandboxRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"spec"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"spec"}, + Common.getValueByPath(fromObject, new String[] {"spec"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + createAgentEngineSandboxConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode deleteAgentEngineSandboxRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode executeCodeAgentEngineSandboxRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"inputs"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"inputs"}, + Common.getValueByPath(fromObject, new String[] {"inputs"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getAgentEngineSandboxOperationParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"operationName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "operationName"}, + Common.getValueByPath(fromObject, new String[] {"operationName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getAgentEngineSandboxRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listAgentEngineSandboxesConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"pageSize"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageSize"}, + Common.getValueByPath(fromObject, new String[] {"pageSize"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"pageToken"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageToken"}, + Common.getValueByPath(fromObject, new String[] {"pageToken"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"filter"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "filter"}, + Common.getValueByPath(fromObject, new String[] {"filter"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listAgentEngineSandboxesRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + listAgentEngineSandboxesConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateCreate( + String name, SandboxEnvironmentSpec spec, CreateAgentEngineSandboxConfig config) { + + CreateAgentEngineSandboxRequestParameters.Builder parameterBuilder = + CreateAgentEngineSandboxRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(spec)) { + parameterBuilder.spec(spec); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = createAgentEngineSandboxRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}/sandboxEnvironments", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineSandboxOperation processResponseForPrivateCreate( + ApiResponse response, CreateAgentEngineSandboxConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineSandboxOperation.class); + } + + AgentEngineSandboxOperation privateCreate( + String name, SandboxEnvironmentSpec spec, CreateAgentEngineSandboxConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateCreate(name, spec, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateCreate(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateDelete(String name, DeleteAgentEngineSandboxConfig config) { + + DeleteAgentEngineSandboxRequestParameters.Builder parameterBuilder = + DeleteAgentEngineSandboxRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = deleteAgentEngineSandboxRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + DeleteAgentEngineSandboxOperation processResponseForPrivateDelete( + ApiResponse response, DeleteAgentEngineSandboxConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, DeleteAgentEngineSandboxOperation.class); + } + + DeleteAgentEngineSandboxOperation privateDelete( + String name, DeleteAgentEngineSandboxConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateDelete(name, config); + + try (ApiResponse response = + this.apiClient.request( + "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateDelete(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateExecuteCode( + String name, List inputs, ExecuteCodeAgentEngineSandboxConfig config) { + + ExecuteCodeAgentEngineSandboxRequestParameters.Builder parameterBuilder = + ExecuteCodeAgentEngineSandboxRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(inputs)) { + parameterBuilder.inputs(inputs); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = executeCodeAgentEngineSandboxRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}/:execute", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + ExecuteSandboxEnvironmentResponse processResponseForPrivateExecuteCode( + ApiResponse response, ExecuteCodeAgentEngineSandboxConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, ExecuteSandboxEnvironmentResponse.class); + } + + ExecuteSandboxEnvironmentResponse privateExecuteCode( + String name, List inputs, ExecuteCodeAgentEngineSandboxConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateExecuteCode(name, inputs, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateExecuteCode(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGet(String name, GetAgentEngineSandboxConfig config) { + + GetAgentEngineSandboxRequestParameters.Builder parameterBuilder = + GetAgentEngineSandboxRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getAgentEngineSandboxRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + SandboxEnvironment processResponseForPrivateGet( + ApiResponse response, GetAgentEngineSandboxConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, SandboxEnvironment.class); + } + + SandboxEnvironment privateGet(String name, GetAgentEngineSandboxConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateGet(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGet(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateList(String name, ListAgentEngineSandboxesConfig config) { + + ListAgentEngineSandboxesRequestParameters.Builder parameterBuilder = + ListAgentEngineSandboxesRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = listAgentEngineSandboxesRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}/sandboxEnvironments", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + ListAgentEngineSandboxesResponse processResponseForPrivateList( + ApiResponse response, ListAgentEngineSandboxesConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, ListAgentEngineSandboxesResponse.class); + } + + ListAgentEngineSandboxesResponse privateList(String name, ListAgentEngineSandboxesConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateList(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateList(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGetSandboxOperation( + String operationName, GetAgentEngineOperationConfig config) { + + GetAgentEngineSandboxOperationParameters.Builder parameterBuilder = + GetAgentEngineSandboxOperationParameters.builder(); + + if (!Common.isZero(operationName)) { + parameterBuilder.operationName(operationName); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getAgentEngineSandboxOperationParametersToVertex(parameterNode, null); + path = Common.formatMap("{operationName}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineSandboxOperation processResponseForPrivateGetSandboxOperation( + ApiResponse response, GetAgentEngineOperationConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineSandboxOperation.class); + } + + AgentEngineSandboxOperation privateGetSandboxOperation( + String operationName, GetAgentEngineOperationConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateGetSandboxOperation(operationName, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGetSandboxOperation(response, config); + } + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Sessions.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Sessions.java new file mode 100644 index 000000000000..13bac0a90f8d --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/Sessions.java @@ -0,0 +1,759 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.google.cloud.vertexai.genai.types.AgentEngineSessionOperation; +import com.google.cloud.vertexai.genai.types.CreateAgentEngineSessionConfig; +import com.google.cloud.vertexai.genai.types.CreateAgentEngineSessionRequestParameters; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineSessionConfig; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineSessionOperation; +import com.google.cloud.vertexai.genai.types.DeleteAgentEngineSessionRequestParameters; +import com.google.cloud.vertexai.genai.types.GetAgentEngineOperationConfig; +import com.google.cloud.vertexai.genai.types.GetAgentEngineSessionConfig; +import com.google.cloud.vertexai.genai.types.GetAgentEngineSessionOperationParameters; +import com.google.cloud.vertexai.genai.types.GetAgentEngineSessionRequestParameters; +import com.google.cloud.vertexai.genai.types.ListAgentEngineSessionsConfig; +import com.google.cloud.vertexai.genai.types.ListAgentEngineSessionsRequestParameters; +import com.google.cloud.vertexai.genai.types.ListReasoningEnginesSessionsResponse; +import com.google.cloud.vertexai.genai.types.Session; +import com.google.cloud.vertexai.genai.types.UpdateAgentEngineSessionConfig; +import com.google.cloud.vertexai.genai.types.UpdateAgentEngineSessionRequestParameters; +import com.google.genai.ApiClient; +import com.google.genai.ApiResponse; +import com.google.genai.Common; +import com.google.genai.Common.BuiltRequest; +import com.google.genai.JsonSerializable; +import com.google.genai.errors.GenAiIOException; +import com.google.genai.types.HttpOptions; +import java.io.IOException; +import java.util.Optional; +import okhttp3.ResponseBody; + +public final class Sessions { + + final ApiClient apiClient; + + public Sessions(ApiClient apiClient) { + this.apiClient = apiClient; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode createAgentEngineSessionConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"displayName"}, + Common.getValueByPath(fromObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"sessionState"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"sessionState"}, + Common.getValueByPath(fromObject, new String[] {"sessionState"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"ttl"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"ttl"}, + Common.getValueByPath(fromObject, new String[] {"ttl"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"expireTime"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"expireTime"}, + Common.getValueByPath(fromObject, new String[] {"expireTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"labels"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"labels"}, + Common.getValueByPath(fromObject, new String[] {"labels"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode createAgentEngineSessionRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"userId"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"userId"}, + Common.getValueByPath(fromObject, new String[] {"userId"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + createAgentEngineSessionConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode deleteAgentEngineSessionRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getAgentEngineSessionOperationParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"operationName"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "operationName"}, + Common.getValueByPath(fromObject, new String[] {"operationName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode getAgentEngineSessionRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + Common.getValueByPath(fromObject, new String[] {"config"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listAgentEngineSessionsConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"pageSize"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageSize"}, + Common.getValueByPath(fromObject, new String[] {"pageSize"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"pageToken"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "pageToken"}, + Common.getValueByPath(fromObject, new String[] {"pageToken"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"filter"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "filter"}, + Common.getValueByPath(fromObject, new String[] {"filter"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode listAgentEngineSessionsRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + listAgentEngineSessionsConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode updateAgentEngineSessionConfigToVertex(JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + + if (Common.getValueByPath(fromObject, new String[] {"displayName"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"displayName"}, + Common.getValueByPath(fromObject, new String[] {"displayName"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"sessionState"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"sessionState"}, + Common.getValueByPath(fromObject, new String[] {"sessionState"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"ttl"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"ttl"}, + Common.getValueByPath(fromObject, new String[] {"ttl"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"expireTime"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"expireTime"}, + Common.getValueByPath(fromObject, new String[] {"expireTime"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"labels"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"labels"}, + Common.getValueByPath(fromObject, new String[] {"labels"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"updateMask"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"_query", "updateMask"}, + Common.getValueByPath(fromObject, new String[] {"updateMask"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"userId"}) != null) { + Common.setValueByPath( + parentObject, + new String[] {"userId"}, + Common.getValueByPath(fromObject, new String[] {"userId"})); + } + + return toObject; + } + + @ExcludeFromGeneratedCoverageReport + ObjectNode updateAgentEngineSessionRequestParametersToVertex( + JsonNode fromObject, ObjectNode parentObject) { + ObjectNode toObject = JsonSerializable.objectMapper().createObjectNode(); + if (Common.getValueByPath(fromObject, new String[] {"name"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"_url", "name"}, + Common.getValueByPath(fromObject, new String[] {"name"})); + } + + if (Common.getValueByPath(fromObject, new String[] {"config"}) != null) { + Common.setValueByPath( + toObject, + new String[] {"config"}, + updateAgentEngineSessionConfigToVertex( + JsonSerializable.toJsonNode( + Common.getValueByPath(fromObject, new String[] {"config"})), + toObject)); + } + + return toObject; + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateCreate( + String name, String userId, CreateAgentEngineSessionConfig config) { + + CreateAgentEngineSessionRequestParameters.Builder parameterBuilder = + CreateAgentEngineSessionRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(userId)) { + parameterBuilder.userId(userId); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = createAgentEngineSessionRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}/sessions", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineSessionOperation processResponseForPrivateCreate( + ApiResponse response, CreateAgentEngineSessionConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineSessionOperation.class); + } + + AgentEngineSessionOperation privateCreate( + String name, String userId, CreateAgentEngineSessionConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateCreate(name, userId, config); + + try (ApiResponse response = + this.apiClient.request( + "post", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateCreate(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForDelete(String name, DeleteAgentEngineSessionConfig config) { + + DeleteAgentEngineSessionRequestParameters.Builder parameterBuilder = + DeleteAgentEngineSessionRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = deleteAgentEngineSessionRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + DeleteAgentEngineSessionOperation processResponseForDelete( + ApiResponse response, DeleteAgentEngineSessionConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, DeleteAgentEngineSessionOperation.class); + } + + public DeleteAgentEngineSessionOperation delete( + String name, DeleteAgentEngineSessionConfig config) { + BuiltRequest builtRequest = buildRequestForDelete(name, config); + + try (ApiResponse response = + this.apiClient.request( + "delete", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForDelete(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForGet(String name, GetAgentEngineSessionConfig config) { + + GetAgentEngineSessionRequestParameters.Builder parameterBuilder = + GetAgentEngineSessionRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getAgentEngineSessionRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + Session processResponseForGet(ApiResponse response, GetAgentEngineSessionConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, Session.class); + } + + public Session get(String name, GetAgentEngineSessionConfig config) { + BuiltRequest builtRequest = buildRequestForGet(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForGet(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateList(String name, ListAgentEngineSessionsConfig config) { + + ListAgentEngineSessionsRequestParameters.Builder parameterBuilder = + ListAgentEngineSessionsRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = listAgentEngineSessionsRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}/sessions", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + ListReasoningEnginesSessionsResponse processResponseForPrivateList( + ApiResponse response, ListAgentEngineSessionsConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, ListReasoningEnginesSessionsResponse.class); + } + + ListReasoningEnginesSessionsResponse privateList( + String name, ListAgentEngineSessionsConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateList(name, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateList(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateGetSessionOperation( + String operationName, GetAgentEngineOperationConfig config) { + + GetAgentEngineSessionOperationParameters.Builder parameterBuilder = + GetAgentEngineSessionOperationParameters.builder(); + + if (!Common.isZero(operationName)) { + parameterBuilder.operationName(operationName); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = getAgentEngineSessionOperationParametersToVertex(parameterNode, null); + path = Common.formatMap("{operationName}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineSessionOperation processResponseForPrivateGetSessionOperation( + ApiResponse response, GetAgentEngineOperationConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineSessionOperation.class); + } + + AgentEngineSessionOperation privateGetSessionOperation( + String operationName, GetAgentEngineOperationConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateGetSessionOperation(operationName, config); + + try (ApiResponse response = + this.apiClient.request( + "get", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateGetSessionOperation(response, config); + } + } + + /** A shared buildRequest method for both sync and async methods. */ + BuiltRequest buildRequestForPrivateUpdate(String name, UpdateAgentEngineSessionConfig config) { + + UpdateAgentEngineSessionRequestParameters.Builder parameterBuilder = + UpdateAgentEngineSessionRequestParameters.builder(); + + if (!Common.isZero(name)) { + parameterBuilder.name(name); + } + if (!Common.isZero(config)) { + parameterBuilder.config(config); + } + JsonNode parameterNode = JsonSerializable.toJsonNode(parameterBuilder.build()); + + ObjectNode body; + String path; + if (this.apiClient.vertexAI()) { + body = updateAgentEngineSessionRequestParametersToVertex(parameterNode, null); + path = Common.formatMap("{name}", body.get("_url")); + } else { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + body.remove("_url"); + + JsonNode queryParams = body.get("_query"); + if (queryParams != null) { + body.remove("_query"); + path = String.format("%s?%s", path, Common.urlEncode((ObjectNode) queryParams)); + } + + // TODO: Remove the hack that removes config. + Optional requestHttpOptions = Optional.empty(); + if (config != null) { + requestHttpOptions = config.httpOptions(); + } + + return new BuiltRequest(path, JsonSerializable.toJsonString(body), requestHttpOptions); + } + + /** A shared processResponse function for both sync and async methods. */ + AgentEngineSessionOperation processResponseForPrivateUpdate( + ApiResponse response, UpdateAgentEngineSessionConfig config) { + ResponseBody responseBody = response.getBody(); + String responseString; + try { + responseString = responseBody.string(); + } catch (IOException e) { + throw new GenAiIOException("Failed to read HTTP response.", e); + } + + JsonNode responseNode = JsonSerializable.stringToJsonNode(responseString); + + if (!this.apiClient.vertexAI()) { + throw new UnsupportedOperationException( + "This method is only supported in the Vertex AI client."); + } + + return JsonSerializable.fromJsonNode(responseNode, AgentEngineSessionOperation.class); + } + + AgentEngineSessionOperation privateUpdate(String name, UpdateAgentEngineSessionConfig config) { + BuiltRequest builtRequest = buildRequestForPrivateUpdate(name, config); + + try (ApiResponse response = + this.apiClient.request( + "patch", builtRequest.path(), builtRequest.body(), builtRequest.httpOptions())) { + return processResponseForPrivateUpdate(response, config); + } + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AcceleratorType.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AcceleratorType.java new file mode 100644 index 000000000000..3c067f52eb58 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AcceleratorType.java @@ -0,0 +1,165 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** + * Immutable. The type of accelerator(s) that may be attached to the machine as per + * accelerator_count. + */ +public class AcceleratorType { + + /** Enum representing the known values for AcceleratorType. */ + public enum Known { + /** Unspecified accelerator type, which means no accelerator. */ + ACCELERATOR_TYPE_UNSPECIFIED, + + /** + * Deprecated: Nvidia Tesla K80 GPU has reached end of support, see + * https://cloud.google.com/compute/docs/eol/k80-eol. + */ + NVIDIA_TESLA_K80, + + /** Nvidia Tesla P100 GPU. */ + NVIDIA_TESLA_P100, + + /** Nvidia Tesla V100 GPU. */ + NVIDIA_TESLA_V100, + + /** Nvidia Tesla P4 GPU. */ + NVIDIA_TESLA_P4, + + /** Nvidia Tesla T4 GPU. */ + NVIDIA_TESLA_T4, + + /** Nvidia Tesla A100 GPU. */ + NVIDIA_TESLA_A100, + + /** Nvidia A100 80GB GPU. */ + NVIDIA_A100_80GB, + + /** Nvidia L4 GPU. */ + NVIDIA_L4, + + /** Nvidia H100 80Gb GPU. */ + NVIDIA_H100_80GB, + + /** Nvidia H100 Mega 80Gb GPU. */ + NVIDIA_H100_MEGA_80GB, + + /** Nvidia H200 141Gb GPU. */ + NVIDIA_H200_141GB, + + /** Nvidia B200 GPU. */ + NVIDIA_B200, + + /** Nvidia GB200 GPU. */ + NVIDIA_GB200, + + /** Nvidia RTX Pro 6000 GPU. */ + NVIDIA_RTX_PRO_6000, + + /** TPU v2. */ + TPU_V2, + + /** TPU v3. */ + TPU_V3, + + /** TPU v4. */ + TPU_V4_POD, + + /** TPU v5. */ + TPU_V5_LITEPOD + } + + private Known acceleratorTypeEnum; + private final String value; + + @JsonCreator + public AcceleratorType(String value) { + this.value = value; + for (Known acceleratorTypeEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(acceleratorTypeEnum.toString(), value)) { + this.acceleratorTypeEnum = acceleratorTypeEnum; + break; + } + } + if (this.acceleratorTypeEnum == null) { + this.acceleratorTypeEnum = Known.ACCELERATOR_TYPE_UNSPECIFIED; + } + } + + public AcceleratorType(Known knownValue) { + this.acceleratorTypeEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof AcceleratorType)) { + return false; + } + + AcceleratorType other = (AcceleratorType) o; + + if (this.acceleratorTypeEnum != Known.ACCELERATOR_TYPE_UNSPECIFIED + && other.acceleratorTypeEnum != Known.ACCELERATOR_TYPE_UNSPECIFIED) { + return this.acceleratorTypeEnum == other.acceleratorTypeEnum; + } else if (this.acceleratorTypeEnum == Known.ACCELERATOR_TYPE_UNSPECIFIED + && other.acceleratorTypeEnum == Known.ACCELERATOR_TYPE_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.acceleratorTypeEnum != Known.ACCELERATOR_TYPE_UNSPECIFIED) { + return this.acceleratorTypeEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.acceleratorTypeEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentConfig.java new file mode 100644 index 000000000000..da14a208f30f --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentConfig.java @@ -0,0 +1,145 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Configuration for an Agent. */ +@AutoValue +@JsonDeserialize(builder = AgentConfig.Builder.class) +public abstract class AgentConfig extends JsonSerializable { + /** A JSON string containing a list of tools available to an agent. */ + @JsonProperty("toolsText") + public abstract Optional toolsText(); + + /** List of tools. */ + @JsonProperty("tools") + public abstract Optional tools(); + + /** A field containing instructions from the developer for the agent. */ + @JsonProperty("developerInstruction") + public abstract Optional developerInstruction(); + + /** Instantiates a builder for AgentConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AgentConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AgentConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `AgentConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_AgentConfig.Builder(); + } + + /** + * Setter for toolsText. + * + *

toolsText: A JSON string containing a list of tools available to an agent. + */ + @JsonProperty("toolsText") + public abstract Builder toolsText(String toolsText); + + @ExcludeFromGeneratedCoverageReport + abstract Builder toolsText(Optional toolsText); + + /** Clears the value of toolsText field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearToolsText() { + return toolsText(Optional.empty()); + } + + /** + * Setter for tools. + * + *

tools: List of tools. + */ + @JsonProperty("tools") + public abstract Builder tools(Tools tools); + + /** + * Setter for tools builder. + * + *

tools: List of tools. + */ + @CanIgnoreReturnValue + public Builder tools(Tools.Builder toolsBuilder) { + return tools(toolsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder tools(Optional tools); + + /** Clears the value of tools field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTools() { + return tools(Optional.empty()); + } + + /** + * Setter for developerInstruction. + * + *

developerInstruction: A field containing instructions from the developer for the agent. + */ + @JsonProperty("developerInstruction") + public abstract Builder developerInstruction(InstanceData developerInstruction); + + /** + * Setter for developerInstruction builder. + * + *

developerInstruction: A field containing instructions from the developer for the agent. + */ + @CanIgnoreReturnValue + public Builder developerInstruction(InstanceData.Builder developerInstructionBuilder) { + return developerInstruction(developerInstructionBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder developerInstruction(Optional developerInstruction); + + /** Clears the value of developerInstruction field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDeveloperInstruction() { + return developerInstruction(Optional.empty()); + } + + public abstract AgentConfig build(); + } + + /** Deserializes a JSON string to a AgentConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static AgentConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AgentConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentData.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentData.java new file mode 100644 index 000000000000..3b581ddc9658 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentData.java @@ -0,0 +1,145 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Contains data specific to agent evaluations. */ +@AutoValue +@JsonDeserialize(builder = AgentData.Builder.class) +public abstract class AgentData extends JsonSerializable { + /** Agent configuration. */ + @JsonProperty("agentConfig") + public abstract Optional agentConfig(); + + /** A JSON string containing a sequence of events. */ + @JsonProperty("eventsText") + public abstract Optional eventsText(); + + /** A list of events. */ + @JsonProperty("events") + public abstract Optional events(); + + /** Instantiates a builder for AgentData. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AgentData.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AgentData. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `AgentData.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_AgentData.Builder(); + } + + /** + * Setter for agentConfig. + * + *

agentConfig: Agent configuration. + */ + @JsonProperty("agentConfig") + public abstract Builder agentConfig(AgentConfig agentConfig); + + /** + * Setter for agentConfig builder. + * + *

agentConfig: Agent configuration. + */ + @CanIgnoreReturnValue + public Builder agentConfig(AgentConfig.Builder agentConfigBuilder) { + return agentConfig(agentConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder agentConfig(Optional agentConfig); + + /** Clears the value of agentConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAgentConfig() { + return agentConfig(Optional.empty()); + } + + /** + * Setter for eventsText. + * + *

eventsText: A JSON string containing a sequence of events. + */ + @JsonProperty("eventsText") + public abstract Builder eventsText(String eventsText); + + @ExcludeFromGeneratedCoverageReport + abstract Builder eventsText(Optional eventsText); + + /** Clears the value of eventsText field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEventsText() { + return eventsText(Optional.empty()); + } + + /** + * Setter for events. + * + *

events: A list of events. + */ + @JsonProperty("events") + public abstract Builder events(Events events); + + /** + * Setter for events builder. + * + *

events: A list of events. + */ + @CanIgnoreReturnValue + public Builder events(Events.Builder eventsBuilder) { + return events(eventsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder events(Optional events); + + /** Clears the value of events field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvents() { + return events(Optional.empty()); + } + + public abstract AgentData build(); + } + + /** Deserializes a JSON string to a AgentData object. */ + @ExcludeFromGeneratedCoverageReport + public static AgentData fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AgentData.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngine.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngine.java new file mode 100644 index 000000000000..a05790fbb266 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngine.java @@ -0,0 +1,136 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** An agent engine instance. */ +@AutoValue +@JsonDeserialize(builder = AgentEngine.Builder.class) +public abstract class AgentEngine extends JsonSerializable { + /** The underlying API client. */ + @JsonIgnore + public abstract Optional apiClient(); + + /** The underlying API client for asynchronous operations. */ + @JsonIgnore + public abstract Optional apiAsyncClient(); + + /** The underlying API resource (i.e. ReasoningEngine). */ + @JsonProperty("apiResource") + public abstract Optional apiResource(); + + /** Instantiates a builder for AgentEngine. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AgentEngine.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AgentEngine. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `AgentEngine.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_AgentEngine.Builder(); + } + + /** + * Setter for apiClient. + * + *

apiClient: The underlying API client. + */ + @JsonIgnore + public abstract Builder apiClient(Object apiClient); + + @ExcludeFromGeneratedCoverageReport + abstract Builder apiClient(Optional apiClient); + + /** Clears the value of apiClient field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearApiClient() { + return apiClient(Optional.empty()); + } + + /** + * Setter for apiAsyncClient. + * + *

apiAsyncClient: The underlying API client for asynchronous operations. + */ + @JsonIgnore + public abstract Builder apiAsyncClient(Object apiAsyncClient); + + @ExcludeFromGeneratedCoverageReport + abstract Builder apiAsyncClient(Optional apiAsyncClient); + + /** Clears the value of apiAsyncClient field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearApiAsyncClient() { + return apiAsyncClient(Optional.empty()); + } + + /** + * Setter for apiResource. + * + *

apiResource: The underlying API resource (i.e. ReasoningEngine). + */ + @JsonProperty("apiResource") + public abstract Builder apiResource(ReasoningEngine apiResource); + + /** + * Setter for apiResource builder. + * + *

apiResource: The underlying API resource (i.e. ReasoningEngine). + */ + @CanIgnoreReturnValue + public Builder apiResource(ReasoningEngine.Builder apiResourceBuilder) { + return apiResource(apiResourceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder apiResource(Optional apiResource); + + /** Clears the value of apiResource field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearApiResource() { + return apiResource(Optional.empty()); + } + + public abstract AgentEngine build(); + } + + /** Deserializes a JSON string to a AgentEngine object. */ + @ExcludeFromGeneratedCoverageReport + public static AgentEngine fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AgentEngine.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineConfig.java new file mode 100644 index 000000000000..a3d9905b364b --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineConfig.java @@ -0,0 +1,916 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.EncryptionSpec; +import com.google.genai.types.HttpOptions; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** Config for agent engine methods. */ +@AutoValue +@JsonDeserialize(builder = AgentEngineConfig.Builder.class) +public abstract class AgentEngineConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** + * The GCS bucket to use for staging the artifacts needed. + * + *

It must be a valid GCS bucket name, e.g. "gs://bucket-name". It is required if + * `agent_engine` is specified. + */ + @JsonProperty("stagingBucket") + public abstract Optional stagingBucket(); + + /** + * The set of PyPI dependencies needed. + * + *

It can either be the path to a single file (requirements.txt), or an ordered list of strings + * corresponding to each line of the requirements file. + */ + @JsonProperty("requirements") + public abstract Optional requirements(); + + /** + * The user-defined name of the Agent Engine. + * + *

The name can be up to 128 characters long and can comprise any UTF-8 character. + */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** The description of the Agent Engine. */ + @JsonProperty("description") + public abstract Optional description(); + + /** The GCS bucket directory under `staging_bucket` to use for staging the artifacts needed. */ + @JsonProperty("gcsDirName") + public abstract Optional gcsDirName(); + + /** The set of extra user-provided packages (if any). */ + @JsonProperty("extraPackages") + public abstract Optional> extraPackages(); + + /** + * The environment variables to be set when running the Agent Engine. + * + *

If it is a dictionary, the keys are the environment variable names, and the values are the + * corresponding values. + */ + @JsonProperty("envVars") + public abstract Optional envVars(); + + /** + * The service account to be used for the Agent Engine. + * + *

If not specified, the default Reasoning Engine P6SA service agent will be used. + */ + @JsonProperty("serviceAccount") + public abstract Optional serviceAccount(); + + /** The identity type to use for the Agent Engine. */ + @JsonProperty("identityType") + public abstract Optional identityType(); + + /** The context spec to be used for the Agent Engine. */ + @JsonProperty("contextSpec") + public abstract Optional contextSpec(); + + /** The PSC interface config for PSC-I to be used for the Agent Engine. */ + @JsonProperty("pscInterfaceConfig") + public abstract Optional pscInterfaceConfig(); + + /** The minimum number of instances to run for the Agent Engine. Defaults to 1. Range: [0, 10]. */ + @JsonProperty("minInstances") + public abstract Optional minInstances(); + + /** + * The maximum number of instances to run for the Agent Engine. Defaults to 100. Range: [1, 1000]. + * If VPC-SC or PSC-I is enabled, the acceptable range is [1, 100]. + */ + @JsonProperty("maxInstances") + public abstract Optional maxInstances(); + + /** + * The resource limits to be applied to the Agent Engine. Required keys: 'cpu' and 'memory'. + * Supported values for 'cpu': '1', '2', '4', '6', '8'. Supported values for 'memory': '1Gi', + * '2Gi', ..., '32Gi'. + */ + @JsonProperty("resourceLimits") + public abstract Optional> resourceLimits(); + + /** + * The container concurrency to be used for the Agent Engine. Recommended value: 2 * cpu + 1. + * Defaults to 9. + */ + @JsonProperty("containerConcurrency") + public abstract Optional containerConcurrency(); + + /** The encryption spec to be used for the Agent Engine. */ + @JsonProperty("encryptionSpec") + public abstract Optional encryptionSpec(); + + /** The labels to be used for the Agent Engine. */ + @JsonProperty("labels") + public abstract Optional> labels(); + + /** The agent server mode to use for deployment. */ + @JsonProperty("agentServerMode") + public abstract Optional agentServerMode(); + + /** + * The class methods to be used for the Agent Engine. If specified, they'll override the class + * methods that are autogenerated by default. By default, methods are generated by inspecting the + * agent object and generating a corresponding method for each method defined on the agent class. + */ + @JsonProperty("classMethods") + public abstract Optional>> classMethods(); + + /** + * The user-provided paths to the source packages (if any). If specified, the files in the source + * packages will be packed into a a tarball file, uploaded to Agent Engine's API, and deployed to + * the Agent Engine. The following fields will be ignored: - agent - extra_packages - + * staging_bucket - requirements The following fields will be used to install and use the agent + * from the source packages: - entrypoint_module (required) - entrypoint_object (required) - + * requirements_file (optional) - class_methods (required) + */ + @JsonProperty("sourcePackages") + public abstract Optional> sourcePackages(); + + /** + * The entrypoint module to be used for the Agent Engine This field only used when source_packages + * is specified. + */ + @JsonProperty("entrypointModule") + public abstract Optional entrypointModule(); + + /** + * The entrypoint object to be used for the Agent Engine. This field only used when + * source_packages is specified. + */ + @JsonProperty("entrypointObject") + public abstract Optional entrypointObject(); + + /** + * The user-provided path to the requirements file (if any). This field is only used when + * source_packages is specified. If not specified, agent engine will find and use the + * `requirements.txt` in the source package. + */ + @JsonProperty("requirementsFile") + public abstract Optional requirementsFile(); + + /** + * The agent framework to be used for the Agent Engine. The OSS agent framework used to develop + * the agent. Currently supported values: "google-adk", "langchain", "langgraph", "ag2", + * "llama-index", "custom". If not specified: - If `agent` is specified, the agent framework will + * be auto-detected. - If `source_packages` is specified, the agent framework will default to + * "custom". + */ + @JsonProperty("agentFramework") + public abstract Optional agentFramework(); + + /** + * The Python version to be used for the Agent Engine. If not specified, it will use the current + * Python version of the environment. Supported versions: "3.9", "3.10", "3.11", "3.12", "3.13". + */ + @JsonProperty("pythonVersion") + public abstract Optional pythonVersion(); + + /** + * The build options for the Agent Engine. The following keys are supported: - + * installation_scripts: Optional. The paths to the installation scripts to be executed in the + * Docker image. The scripts must be located in the `installation_scripts` subdirectory and the + * path must be added to `extra_packages`. + */ + @JsonProperty("buildOptions") + public abstract Optional>> buildOptions(); + + /** Instantiates a builder for AgentEngineConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AgentEngineConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AgentEngineConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `AgentEngineConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_AgentEngineConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for stagingBucket. + * + *

stagingBucket: The GCS bucket to use for staging the artifacts needed. + * + *

It must be a valid GCS bucket name, e.g. "gs://bucket-name". It is required if + * `agent_engine` is specified. + */ + @JsonProperty("stagingBucket") + public abstract Builder stagingBucket(String stagingBucket); + + @ExcludeFromGeneratedCoverageReport + abstract Builder stagingBucket(Optional stagingBucket); + + /** Clears the value of stagingBucket field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearStagingBucket() { + return stagingBucket(Optional.empty()); + } + + /** + * Setter for requirements. + * + *

requirements: The set of PyPI dependencies needed. + * + *

It can either be the path to a single file (requirements.txt), or an ordered list of + * strings corresponding to each line of the requirements file. + */ + @JsonProperty("requirements") + public abstract Builder requirements(Object requirements); + + @ExcludeFromGeneratedCoverageReport + abstract Builder requirements(Optional requirements); + + /** Clears the value of requirements field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRequirements() { + return requirements(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: The user-defined name of the Agent Engine. + * + *

The name can be up to 128 characters long and can comprise any UTF-8 character. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: The description of the Agent Engine. + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + /** + * Setter for gcsDirName. + * + *

gcsDirName: The GCS bucket directory under `staging_bucket` to use for staging the + * artifacts needed. + */ + @JsonProperty("gcsDirName") + public abstract Builder gcsDirName(String gcsDirName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder gcsDirName(Optional gcsDirName); + + /** Clears the value of gcsDirName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGcsDirName() { + return gcsDirName(Optional.empty()); + } + + /** + * Setter for extraPackages. + * + *

extraPackages: The set of extra user-provided packages (if any). + */ + @JsonProperty("extraPackages") + public abstract Builder extraPackages(List extraPackages); + + /** + * Setter for extraPackages. + * + *

extraPackages: The set of extra user-provided packages (if any). + */ + @CanIgnoreReturnValue + public Builder extraPackages(String... extraPackages) { + return extraPackages(Arrays.asList(extraPackages)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder extraPackages(Optional> extraPackages); + + /** Clears the value of extraPackages field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExtraPackages() { + return extraPackages(Optional.empty()); + } + + /** + * Setter for envVars. + * + *

envVars: The environment variables to be set when running the Agent Engine. + * + *

If it is a dictionary, the keys are the environment variable names, and the values are the + * corresponding values. + */ + @JsonProperty("envVars") + public abstract Builder envVars(Object envVars); + + @ExcludeFromGeneratedCoverageReport + abstract Builder envVars(Optional envVars); + + /** Clears the value of envVars field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEnvVars() { + return envVars(Optional.empty()); + } + + /** + * Setter for serviceAccount. + * + *

serviceAccount: The service account to be used for the Agent Engine. + * + *

If not specified, the default Reasoning Engine P6SA service agent will be used. + */ + @JsonProperty("serviceAccount") + public abstract Builder serviceAccount(String serviceAccount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder serviceAccount(Optional serviceAccount); + + /** Clears the value of serviceAccount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearServiceAccount() { + return serviceAccount(Optional.empty()); + } + + /** + * Setter for identityType. + * + *

identityType: The identity type to use for the Agent Engine. + */ + @JsonProperty("identityType") + public abstract Builder identityType(IdentityType identityType); + + @ExcludeFromGeneratedCoverageReport + abstract Builder identityType(Optional identityType); + + /** Clears the value of identityType field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearIdentityType() { + return identityType(Optional.empty()); + } + + /** + * Setter for identityType given a known enum. + * + *

identityType: The identity type to use for the Agent Engine. + */ + @CanIgnoreReturnValue + public Builder identityType(IdentityType.Known knownType) { + return identityType(new IdentityType(knownType)); + } + + /** + * Setter for identityType given a string. + * + *

identityType: The identity type to use for the Agent Engine. + */ + @CanIgnoreReturnValue + public Builder identityType(String identityType) { + return identityType(new IdentityType(identityType)); + } + + /** + * Setter for contextSpec. + * + *

contextSpec: The context spec to be used for the Agent Engine. + */ + @JsonProperty("contextSpec") + public abstract Builder contextSpec(ReasoningEngineContextSpec contextSpec); + + /** + * Setter for contextSpec builder. + * + *

contextSpec: The context spec to be used for the Agent Engine. + */ + @CanIgnoreReturnValue + public Builder contextSpec(ReasoningEngineContextSpec.Builder contextSpecBuilder) { + return contextSpec(contextSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder contextSpec(Optional contextSpec); + + /** Clears the value of contextSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContextSpec() { + return contextSpec(Optional.empty()); + } + + /** + * Setter for pscInterfaceConfig. + * + *

pscInterfaceConfig: The PSC interface config for PSC-I to be used for the Agent Engine. + */ + @JsonProperty("pscInterfaceConfig") + public abstract Builder pscInterfaceConfig(PscInterfaceConfig pscInterfaceConfig); + + /** + * Setter for pscInterfaceConfig builder. + * + *

pscInterfaceConfig: The PSC interface config for PSC-I to be used for the Agent Engine. + */ + @CanIgnoreReturnValue + public Builder pscInterfaceConfig(PscInterfaceConfig.Builder pscInterfaceConfigBuilder) { + return pscInterfaceConfig(pscInterfaceConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder pscInterfaceConfig(Optional pscInterfaceConfig); + + /** Clears the value of pscInterfaceConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPscInterfaceConfig() { + return pscInterfaceConfig(Optional.empty()); + } + + /** + * Setter for minInstances. + * + *

minInstances: The minimum number of instances to run for the Agent Engine. Defaults to 1. + * Range: [0, 10]. + */ + @JsonProperty("minInstances") + public abstract Builder minInstances(Integer minInstances); + + @ExcludeFromGeneratedCoverageReport + abstract Builder minInstances(Optional minInstances); + + /** Clears the value of minInstances field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMinInstances() { + return minInstances(Optional.empty()); + } + + /** + * Setter for maxInstances. + * + *

maxInstances: The maximum number of instances to run for the Agent Engine. Defaults to + * 100. Range: [1, 1000]. If VPC-SC or PSC-I is enabled, the acceptable range is [1, 100]. + */ + @JsonProperty("maxInstances") + public abstract Builder maxInstances(Integer maxInstances); + + @ExcludeFromGeneratedCoverageReport + abstract Builder maxInstances(Optional maxInstances); + + /** Clears the value of maxInstances field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMaxInstances() { + return maxInstances(Optional.empty()); + } + + /** + * Setter for resourceLimits. + * + *

resourceLimits: The resource limits to be applied to the Agent Engine. Required keys: + * 'cpu' and 'memory'. Supported values for 'cpu': '1', '2', '4', '6', '8'. Supported values for + * 'memory': '1Gi', '2Gi', ..., '32Gi'. + */ + @JsonProperty("resourceLimits") + public abstract Builder resourceLimits(Map resourceLimits); + + @ExcludeFromGeneratedCoverageReport + abstract Builder resourceLimits(Optional> resourceLimits); + + /** Clears the value of resourceLimits field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResourceLimits() { + return resourceLimits(Optional.empty()); + } + + /** + * Setter for containerConcurrency. + * + *

containerConcurrency: The container concurrency to be used for the Agent Engine. + * Recommended value: 2 * cpu + 1. Defaults to 9. + */ + @JsonProperty("containerConcurrency") + public abstract Builder containerConcurrency(Integer containerConcurrency); + + @ExcludeFromGeneratedCoverageReport + abstract Builder containerConcurrency(Optional containerConcurrency); + + /** Clears the value of containerConcurrency field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContainerConcurrency() { + return containerConcurrency(Optional.empty()); + } + + /** + * Setter for encryptionSpec. + * + *

encryptionSpec: The encryption spec to be used for the Agent Engine. + */ + @JsonProperty("encryptionSpec") + public abstract Builder encryptionSpec(EncryptionSpec encryptionSpec); + + @ExcludeFromGeneratedCoverageReport + abstract Builder encryptionSpec(Optional encryptionSpec); + + /** Clears the value of encryptionSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEncryptionSpec() { + return encryptionSpec(Optional.empty()); + } + + /** + * Setter for labels. + * + *

labels: The labels to be used for the Agent Engine. + */ + @JsonProperty("labels") + public abstract Builder labels(Map labels); + + @ExcludeFromGeneratedCoverageReport + abstract Builder labels(Optional> labels); + + /** Clears the value of labels field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLabels() { + return labels(Optional.empty()); + } + + /** + * Setter for agentServerMode. + * + *

agentServerMode: The agent server mode to use for deployment. + */ + @JsonProperty("agentServerMode") + public abstract Builder agentServerMode(AgentServerMode agentServerMode); + + @ExcludeFromGeneratedCoverageReport + abstract Builder agentServerMode(Optional agentServerMode); + + /** Clears the value of agentServerMode field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAgentServerMode() { + return agentServerMode(Optional.empty()); + } + + /** + * Setter for agentServerMode given a known enum. + * + *

agentServerMode: The agent server mode to use for deployment. + */ + @CanIgnoreReturnValue + public Builder agentServerMode(AgentServerMode.Known knownType) { + return agentServerMode(new AgentServerMode(knownType)); + } + + /** + * Setter for agentServerMode given a string. + * + *

agentServerMode: The agent server mode to use for deployment. + */ + @CanIgnoreReturnValue + public Builder agentServerMode(String agentServerMode) { + return agentServerMode(new AgentServerMode(agentServerMode)); + } + + /** + * Setter for classMethods. + * + *

classMethods: The class methods to be used for the Agent Engine. If specified, they'll + * override the class methods that are autogenerated by default. By default, methods are + * generated by inspecting the agent object and generating a corresponding method for each + * method defined on the agent class. + */ + @JsonProperty("classMethods") + public abstract Builder classMethods(List> classMethods); + + /** + * Setter for classMethods. + * + *

classMethods: The class methods to be used for the Agent Engine. If specified, they'll + * override the class methods that are autogenerated by default. By default, methods are + * generated by inspecting the agent object and generating a corresponding method for each + * method defined on the agent class. + */ + @CanIgnoreReturnValue + public Builder classMethods(Map... classMethods) { + return classMethods(Arrays.asList(classMethods)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder classMethods(Optional>> classMethods); + + /** Clears the value of classMethods field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearClassMethods() { + return classMethods(Optional.empty()); + } + + /** + * Setter for sourcePackages. + * + *

sourcePackages: The user-provided paths to the source packages (if any). If specified, the + * files in the source packages will be packed into a a tarball file, uploaded to Agent Engine's + * API, and deployed to the Agent Engine. The following fields will be ignored: - agent - + * extra_packages - staging_bucket - requirements The following fields will be used to install + * and use the agent from the source packages: - entrypoint_module (required) - + * entrypoint_object (required) - requirements_file (optional) - class_methods (required) + */ + @JsonProperty("sourcePackages") + public abstract Builder sourcePackages(List sourcePackages); + + /** + * Setter for sourcePackages. + * + *

sourcePackages: The user-provided paths to the source packages (if any). If specified, the + * files in the source packages will be packed into a a tarball file, uploaded to Agent Engine's + * API, and deployed to the Agent Engine. The following fields will be ignored: - agent - + * extra_packages - staging_bucket - requirements The following fields will be used to install + * and use the agent from the source packages: - entrypoint_module (required) - + * entrypoint_object (required) - requirements_file (optional) - class_methods (required) + */ + @CanIgnoreReturnValue + public Builder sourcePackages(String... sourcePackages) { + return sourcePackages(Arrays.asList(sourcePackages)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder sourcePackages(Optional> sourcePackages); + + /** Clears the value of sourcePackages field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSourcePackages() { + return sourcePackages(Optional.empty()); + } + + /** + * Setter for entrypointModule. + * + *

entrypointModule: The entrypoint module to be used for the Agent Engine This field only + * used when source_packages is specified. + */ + @JsonProperty("entrypointModule") + public abstract Builder entrypointModule(String entrypointModule); + + @ExcludeFromGeneratedCoverageReport + abstract Builder entrypointModule(Optional entrypointModule); + + /** Clears the value of entrypointModule field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEntrypointModule() { + return entrypointModule(Optional.empty()); + } + + /** + * Setter for entrypointObject. + * + *

entrypointObject: The entrypoint object to be used for the Agent Engine. This field only + * used when source_packages is specified. + */ + @JsonProperty("entrypointObject") + public abstract Builder entrypointObject(String entrypointObject); + + @ExcludeFromGeneratedCoverageReport + abstract Builder entrypointObject(Optional entrypointObject); + + /** Clears the value of entrypointObject field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEntrypointObject() { + return entrypointObject(Optional.empty()); + } + + /** + * Setter for requirementsFile. + * + *

requirementsFile: The user-provided path to the requirements file (if any). This field is + * only used when source_packages is specified. If not specified, agent engine will find and use + * the `requirements.txt` in the source package. + */ + @JsonProperty("requirementsFile") + public abstract Builder requirementsFile(String requirementsFile); + + @ExcludeFromGeneratedCoverageReport + abstract Builder requirementsFile(Optional requirementsFile); + + /** Clears the value of requirementsFile field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRequirementsFile() { + return requirementsFile(Optional.empty()); + } + + /** + * Setter for agentFramework. + * + *

agentFramework: The agent framework to be used for the Agent Engine. The OSS agent + * framework used to develop the agent. Currently supported values: "google-adk", "langchain", + * "langgraph", "ag2", "llama-index", "custom". If not specified: - If `agent` is specified, the + * agent framework will be auto-detected. - If `source_packages` is specified, the agent + * framework will default to "custom". + */ + @JsonProperty("agentFramework") + public abstract Builder agentFramework(AgentFramework agentFramework); + + @ExcludeFromGeneratedCoverageReport + abstract Builder agentFramework(Optional agentFramework); + + /** Clears the value of agentFramework field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAgentFramework() { + return agentFramework(Optional.empty()); + } + + /** + * Setter for agentFramework given a known enum. + * + *

agentFramework: The agent framework to be used for the Agent Engine. The OSS agent + * framework used to develop the agent. Currently supported values: "google-adk", "langchain", + * "langgraph", "ag2", "llama-index", "custom". If not specified: - If `agent` is specified, the + * agent framework will be auto-detected. - If `source_packages` is specified, the agent + * framework will default to "custom". + */ + @CanIgnoreReturnValue + public Builder agentFramework(AgentFramework.Known knownType) { + return agentFramework(new AgentFramework(knownType)); + } + + /** + * Setter for agentFramework given a string. + * + *

agentFramework: The agent framework to be used for the Agent Engine. The OSS agent + * framework used to develop the agent. Currently supported values: "google-adk", "langchain", + * "langgraph", "ag2", "llama-index", "custom". If not specified: - If `agent` is specified, the + * agent framework will be auto-detected. - If `source_packages` is specified, the agent + * framework will default to "custom". + */ + @CanIgnoreReturnValue + public Builder agentFramework(String agentFramework) { + return agentFramework(new AgentFramework(agentFramework)); + } + + /** + * Setter for pythonVersion. + * + *

pythonVersion: The Python version to be used for the Agent Engine. If not specified, it + * will use the current Python version of the environment. Supported versions: "3.9", "3.10", + * "3.11", "3.12", "3.13". + */ + @JsonProperty("pythonVersion") + public abstract Builder pythonVersion(PythonVersion pythonVersion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pythonVersion(Optional pythonVersion); + + /** Clears the value of pythonVersion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPythonVersion() { + return pythonVersion(Optional.empty()); + } + + /** + * Setter for pythonVersion given a known enum. + * + *

pythonVersion: The Python version to be used for the Agent Engine. If not specified, it + * will use the current Python version of the environment. Supported versions: "3.9", "3.10", + * "3.11", "3.12", "3.13". + */ + @CanIgnoreReturnValue + public Builder pythonVersion(PythonVersion.Known knownType) { + return pythonVersion(new PythonVersion(knownType)); + } + + /** + * Setter for pythonVersion given a string. + * + *

pythonVersion: The Python version to be used for the Agent Engine. If not specified, it + * will use the current Python version of the environment. Supported versions: "3.9", "3.10", + * "3.11", "3.12", "3.13". + */ + @CanIgnoreReturnValue + public Builder pythonVersion(String pythonVersion) { + return pythonVersion(new PythonVersion(pythonVersion)); + } + + /** + * Setter for buildOptions. + * + *

buildOptions: The build options for the Agent Engine. The following keys are supported: - + * installation_scripts: Optional. The paths to the installation scripts to be executed in the + * Docker image. The scripts must be located in the `installation_scripts` subdirectory and the + * path must be added to `extra_packages`. + */ + @JsonProperty("buildOptions") + public abstract Builder buildOptions(Map> buildOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder buildOptions(Optional>> buildOptions); + + /** Clears the value of buildOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBuildOptions() { + return buildOptions(Optional.empty()); + } + + public abstract AgentEngineConfig build(); + } + + /** Deserializes a JSON string to a AgentEngineConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static AgentEngineConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AgentEngineConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineGenerateMemoriesOperation.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineGenerateMemoriesOperation.java new file mode 100644 index 000000000000..a1502879e9c4 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineGenerateMemoriesOperation.java @@ -0,0 +1,201 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Operation that generates memories for an agent engine. */ +@AutoValue +@JsonDeserialize(builder = AgentEngineGenerateMemoriesOperation.Builder.class) +public abstract class AgentEngineGenerateMemoriesOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** The response for generating memories. */ + @JsonProperty("response") + public abstract Optional response(); + + /** Instantiates a builder for AgentEngineGenerateMemoriesOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AgentEngineGenerateMemoriesOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AgentEngineGenerateMemoriesOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `AgentEngineGenerateMemoriesOperation.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_AgentEngineGenerateMemoriesOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + /** + * Setter for response. + * + *

response: The response for generating memories. + */ + @JsonProperty("response") + public abstract Builder response(GenerateMemoriesResponse response); + + /** + * Setter for response builder. + * + *

response: The response for generating memories. + */ + @CanIgnoreReturnValue + public Builder response(GenerateMemoriesResponse.Builder responseBuilder) { + return response(responseBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder response(Optional response); + + /** Clears the value of response field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResponse() { + return response(Optional.empty()); + } + + public abstract AgentEngineGenerateMemoriesOperation build(); + } + + /** Deserializes a JSON string to a AgentEngineGenerateMemoriesOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static AgentEngineGenerateMemoriesOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AgentEngineGenerateMemoriesOperation.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineMemoryConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineMemoryConfig.java new file mode 100644 index 000000000000..7878024546db --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineMemoryConfig.java @@ -0,0 +1,325 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.time.Duration; +import java.time.Instant; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Config for creating a Memory. */ +@AutoValue +@JsonDeserialize(builder = AgentEngineMemoryConfig.Builder.class) +public abstract class AgentEngineMemoryConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** The display name of the memory. */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** The description of the memory. */ + @JsonProperty("description") + public abstract Optional description(); + + /** Waits for the operation to complete before returning. */ + @JsonProperty("waitForCompletion") + public abstract Optional waitForCompletion(); + + /** + * Optional. Input only. The TTL for this resource. + * + *

The expiration time is computed: now + TTL. + */ + @JsonProperty("ttl") + public abstract Optional ttl(); + + /** + * Optional. Timestamp of when this resource is considered expired. This is *always* provided on + * output, regardless of what `expiration` was sent on input. + */ + @JsonProperty("expireTime") + public abstract Optional expireTime(); + + /** + * Optional. Input only. Timestamp of when the revision is considered expired. If not set, the + * memory revision will be kept until manually deleted. + */ + @JsonProperty("revisionExpireTime") + public abstract Optional revisionExpireTime(); + + /** Optional. Input only. The TTL for the revision. The expiration time is computed: now + TTL. */ + @JsonProperty("revisionTtl") + public abstract Optional revisionTtl(); + + /** Optional. Input only. If true, no revision will be created for this request. */ + @JsonProperty("disableMemoryRevisions") + public abstract Optional disableMemoryRevisions(); + + /** Optional. The topics of the memory. */ + @JsonProperty("topics") + public abstract Optional> topics(); + + /** Instantiates a builder for AgentEngineMemoryConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AgentEngineMemoryConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AgentEngineMemoryConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `AgentEngineMemoryConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_AgentEngineMemoryConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: The display name of the memory. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: The description of the memory. + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + /** + * Setter for waitForCompletion. + * + *

waitForCompletion: Waits for the operation to complete before returning. + */ + @JsonProperty("waitForCompletion") + public abstract Builder waitForCompletion(boolean waitForCompletion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder waitForCompletion(Optional waitForCompletion); + + /** Clears the value of waitForCompletion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWaitForCompletion() { + return waitForCompletion(Optional.empty()); + } + + /** + * Setter for ttl. + * + *

ttl: Optional. Input only. The TTL for this resource. + * + *

The expiration time is computed: now + TTL. + */ + @JsonProperty("ttl") + public abstract Builder ttl(Duration ttl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder ttl(Optional ttl); + + /** Clears the value of ttl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTtl() { + return ttl(Optional.empty()); + } + + /** + * Setter for expireTime. + * + *

expireTime: Optional. Timestamp of when this resource is considered expired. This is + * *always* provided on output, regardless of what `expiration` was sent on input. + */ + @JsonProperty("expireTime") + public abstract Builder expireTime(Instant expireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder expireTime(Optional expireTime); + + /** Clears the value of expireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExpireTime() { + return expireTime(Optional.empty()); + } + + /** + * Setter for revisionExpireTime. + * + *

revisionExpireTime: Optional. Input only. Timestamp of when the revision is considered + * expired. If not set, the memory revision will be kept until manually deleted. + */ + @JsonProperty("revisionExpireTime") + public abstract Builder revisionExpireTime(Instant revisionExpireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder revisionExpireTime(Optional revisionExpireTime); + + /** Clears the value of revisionExpireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRevisionExpireTime() { + return revisionExpireTime(Optional.empty()); + } + + /** + * Setter for revisionTtl. + * + *

revisionTtl: Optional. Input only. The TTL for the revision. The expiration time is + * computed: now + TTL. + */ + @JsonProperty("revisionTtl") + public abstract Builder revisionTtl(Duration revisionTtl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder revisionTtl(Optional revisionTtl); + + /** Clears the value of revisionTtl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRevisionTtl() { + return revisionTtl(Optional.empty()); + } + + /** + * Setter for disableMemoryRevisions. + * + *

disableMemoryRevisions: Optional. Input only. If true, no revision will be created for + * this request. + */ + @JsonProperty("disableMemoryRevisions") + public abstract Builder disableMemoryRevisions(boolean disableMemoryRevisions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder disableMemoryRevisions(Optional disableMemoryRevisions); + + /** Clears the value of disableMemoryRevisions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisableMemoryRevisions() { + return disableMemoryRevisions(Optional.empty()); + } + + /** + * Setter for topics. + * + *

topics: Optional. The topics of the memory. + */ + @JsonProperty("topics") + public abstract Builder topics(List topics); + + /** + * Setter for topics. + * + *

topics: Optional. The topics of the memory. + */ + @CanIgnoreReturnValue + public Builder topics(MemoryTopicId... topics) { + return topics(Arrays.asList(topics)); + } + + /** + * Setter for topics builder. + * + *

topics: Optional. The topics of the memory. + */ + @CanIgnoreReturnValue + public Builder topics(MemoryTopicId.Builder... topicsBuilders) { + return topics( + Arrays.asList(topicsBuilders).stream() + .map(MemoryTopicId.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder topics(Optional> topics); + + /** Clears the value of topics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTopics() { + return topics(Optional.empty()); + } + + public abstract AgentEngineMemoryConfig build(); + } + + /** Deserializes a JSON string to a AgentEngineMemoryConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static AgentEngineMemoryConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AgentEngineMemoryConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineMemoryOperation.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineMemoryOperation.java new file mode 100644 index 000000000000..56700bac51c5 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineMemoryOperation.java @@ -0,0 +1,198 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Operation that has an agent engine memory as a response. */ +@AutoValue +@JsonDeserialize(builder = AgentEngineMemoryOperation.Builder.class) +public abstract class AgentEngineMemoryOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** The Agent Engine Memory. */ + @JsonProperty("response") + public abstract Optional response(); + + /** Instantiates a builder for AgentEngineMemoryOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AgentEngineMemoryOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AgentEngineMemoryOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `AgentEngineMemoryOperation.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_AgentEngineMemoryOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + /** + * Setter for response. + * + *

response: The Agent Engine Memory. + */ + @JsonProperty("response") + public abstract Builder response(Memory response); + + /** + * Setter for response builder. + * + *

response: The Agent Engine Memory. + */ + @CanIgnoreReturnValue + public Builder response(Memory.Builder responseBuilder) { + return response(responseBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder response(Optional response); + + /** Clears the value of response field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResponse() { + return response(Optional.empty()); + } + + public abstract AgentEngineMemoryOperation build(); + } + + /** Deserializes a JSON string to a AgentEngineMemoryOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static AgentEngineMemoryOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AgentEngineMemoryOperation.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineOperation.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineOperation.java new file mode 100644 index 000000000000..b0df273c5124 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineOperation.java @@ -0,0 +1,198 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Operation that has an agent engine as a response. */ +@AutoValue +@JsonDeserialize(builder = AgentEngineOperation.Builder.class) +public abstract class AgentEngineOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** The created Agent Engine. */ + @JsonProperty("response") + public abstract Optional response(); + + /** Instantiates a builder for AgentEngineOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AgentEngineOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AgentEngineOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `AgentEngineOperation.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_AgentEngineOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + /** + * Setter for response. + * + *

response: The created Agent Engine. + */ + @JsonProperty("response") + public abstract Builder response(ReasoningEngine response); + + /** + * Setter for response builder. + * + *

response: The created Agent Engine. + */ + @CanIgnoreReturnValue + public Builder response(ReasoningEngine.Builder responseBuilder) { + return response(responseBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder response(Optional response); + + /** Clears the value of response field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResponse() { + return response(Optional.empty()); + } + + public abstract AgentEngineOperation build(); + } + + /** Deserializes a JSON string to a AgentEngineOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static AgentEngineOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AgentEngineOperation.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineRollbackMemoryOperation.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineRollbackMemoryOperation.java new file mode 100644 index 000000000000..bd2e3128b504 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineRollbackMemoryOperation.java @@ -0,0 +1,169 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Operation that rolls back a memory. */ +@AutoValue +@JsonDeserialize(builder = AgentEngineRollbackMemoryOperation.Builder.class) +public abstract class AgentEngineRollbackMemoryOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** Instantiates a builder for AgentEngineRollbackMemoryOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AgentEngineRollbackMemoryOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AgentEngineRollbackMemoryOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `AgentEngineRollbackMemoryOperation.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_AgentEngineRollbackMemoryOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + public abstract AgentEngineRollbackMemoryOperation build(); + } + + /** Deserializes a JSON string to a AgentEngineRollbackMemoryOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static AgentEngineRollbackMemoryOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AgentEngineRollbackMemoryOperation.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineSandboxOperation.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineSandboxOperation.java new file mode 100644 index 000000000000..add419b4540a --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineSandboxOperation.java @@ -0,0 +1,198 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Operation that has an agent engine sandbox as a response. */ +@AutoValue +@JsonDeserialize(builder = AgentEngineSandboxOperation.Builder.class) +public abstract class AgentEngineSandboxOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** The Agent Engine Sandbox. */ + @JsonProperty("response") + public abstract Optional response(); + + /** Instantiates a builder for AgentEngineSandboxOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AgentEngineSandboxOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AgentEngineSandboxOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `AgentEngineSandboxOperation.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_AgentEngineSandboxOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + /** + * Setter for response. + * + *

response: The Agent Engine Sandbox. + */ + @JsonProperty("response") + public abstract Builder response(SandboxEnvironment response); + + /** + * Setter for response builder. + * + *

response: The Agent Engine Sandbox. + */ + @CanIgnoreReturnValue + public Builder response(SandboxEnvironment.Builder responseBuilder) { + return response(responseBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder response(Optional response); + + /** Clears the value of response field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResponse() { + return response(Optional.empty()); + } + + public abstract AgentEngineSandboxOperation build(); + } + + /** Deserializes a JSON string to a AgentEngineSandboxOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static AgentEngineSandboxOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AgentEngineSandboxOperation.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineSessionOperation.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineSessionOperation.java new file mode 100644 index 000000000000..af084fd19898 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentEngineSessionOperation.java @@ -0,0 +1,198 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Operation that has an agent engine session as a response. */ +@AutoValue +@JsonDeserialize(builder = AgentEngineSessionOperation.Builder.class) +public abstract class AgentEngineSessionOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** The Agent Engine Session. */ + @JsonProperty("response") + public abstract Optional response(); + + /** Instantiates a builder for AgentEngineSessionOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AgentEngineSessionOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AgentEngineSessionOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `AgentEngineSessionOperation.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_AgentEngineSessionOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + /** + * Setter for response. + * + *

response: The Agent Engine Session. + */ + @JsonProperty("response") + public abstract Builder response(Session response); + + /** + * Setter for response builder. + * + *

response: The Agent Engine Session. + */ + @CanIgnoreReturnValue + public Builder response(Session.Builder responseBuilder) { + return response(responseBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder response(Optional response); + + /** Clears the value of response field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResponse() { + return response(Optional.empty()); + } + + public abstract AgentEngineSessionOperation build(); + } + + /** Deserializes a JSON string to a AgentEngineSessionOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static AgentEngineSessionOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AgentEngineSessionOperation.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentFramework.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentFramework.java new file mode 100644 index 000000000000..ead5c8375b05 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentFramework.java @@ -0,0 +1,138 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** + * The agent framework to be used for the Agent Engine. The OSS agent framework used to develop the + * agent. Currently supported values: "google-adk", "langchain", "langgraph", "ag2", "llama-index", + * "custom". If not specified: - If `agent` is specified, the agent framework will be auto-detected. + * - If `source_packages` is specified, the agent framework will default to "custom". + */ +public class AgentFramework { + + /** Enum representing the known values for AgentFramework. */ + public enum Known { + GOOGLE_ADK("GOOGLE-ADK"), + + LANGCHAIN, + + LANGGRAPH, + + AG2, + + LLAMA_INDEX("LLAMA-INDEX"), + + CUSTOM, + + AGENT_FRAMEWORK_UNSPECIFIED; + private final String value; + + Known() { + this.value = this.name(); + } + + Known(String value) { + this.value = value; + } + + public String value() { + return value; + } + + public String toString() { + return value; + } + } + + private Known agentFrameworkEnum; + private final String value; + + @JsonCreator + public AgentFramework(String value) { + this.value = value; + for (Known agentFrameworkEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(agentFrameworkEnum.toString(), value)) { + this.agentFrameworkEnum = agentFrameworkEnum; + break; + } + } + if (this.agentFrameworkEnum == null) { + this.agentFrameworkEnum = Known.AGENT_FRAMEWORK_UNSPECIFIED; + } + } + + public AgentFramework(Known knownValue) { + this.agentFrameworkEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof AgentFramework)) { + return false; + } + + AgentFramework other = (AgentFramework) o; + + if (this.agentFrameworkEnum != Known.AGENT_FRAMEWORK_UNSPECIFIED + && other.agentFrameworkEnum != Known.AGENT_FRAMEWORK_UNSPECIFIED) { + return this.agentFrameworkEnum == other.agentFrameworkEnum; + } else if (this.agentFrameworkEnum == Known.AGENT_FRAMEWORK_UNSPECIFIED + && other.agentFrameworkEnum == Known.AGENT_FRAMEWORK_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.agentFrameworkEnum != Known.AGENT_FRAMEWORK_UNSPECIFIED) { + return this.agentFrameworkEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.agentFrameworkEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentInfo.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentInfo.java new file mode 100644 index 000000000000..e84c980968d1 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentInfo.java @@ -0,0 +1,152 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** The agent info of an agent, used for agent eval. */ +@AutoValue +@JsonDeserialize(builder = AgentInfo.Builder.class) +public abstract class AgentInfo extends JsonSerializable { + /** + * The agent engine used to run agent. Agent engine resource name in str type, with format + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine_id}`. + */ + @JsonProperty("agentResourceName") + public abstract Optional agentResourceName(); + + /** Agent name, used as an identifier. */ + @JsonProperty("name") + public abstract Optional name(); + + /** Agent developer instruction. */ + @JsonProperty("instruction") + public abstract Optional instruction(); + + /** Agent description. */ + @JsonProperty("description") + public abstract Optional description(); + + /** Instantiates a builder for AgentInfo. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AgentInfo.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AgentInfo. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `AgentInfo.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_AgentInfo.Builder(); + } + + /** + * Setter for agentResourceName. + * + *

agentResourceName: The agent engine used to run agent. Agent engine resource name in str + * type, with format + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine_id}`. + */ + @JsonProperty("agentResourceName") + public abstract Builder agentResourceName(String agentResourceName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder agentResourceName(Optional agentResourceName); + + /** Clears the value of agentResourceName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAgentResourceName() { + return agentResourceName(Optional.empty()); + } + + /** + * Setter for name. + * + *

name: Agent name, used as an identifier. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for instruction. + * + *

instruction: Agent developer instruction. + */ + @JsonProperty("instruction") + public abstract Builder instruction(String instruction); + + @ExcludeFromGeneratedCoverageReport + abstract Builder instruction(Optional instruction); + + /** Clears the value of instruction field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInstruction() { + return instruction(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: Agent description. + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + public abstract AgentInfo build(); + } + + /** Deserializes a JSON string to a AgentInfo object. */ + @ExcludeFromGeneratedCoverageReport + public static AgentInfo fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AgentInfo.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentServerMode.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentServerMode.java new file mode 100644 index 000000000000..13ad125370d5 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AgentServerMode.java @@ -0,0 +1,114 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** The agent server mode. */ +public class AgentServerMode { + + /** Enum representing the known values for AgentServerMode. */ + public enum Known { + /** Unspecified agent server mode. Do not use. */ + AGENT_SERVER_MODE_UNSPECIFIED, + + /** + * Stable agent server mode. This mode has everything stable and well-tested features agent + * engine offers. + */ + STABLE, + + /** Experimental agent server mode. This mode contains experimental features. */ + EXPERIMENTAL + } + + private Known agentServerModeEnum; + private final String value; + + @JsonCreator + public AgentServerMode(String value) { + this.value = value; + for (Known agentServerModeEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(agentServerModeEnum.toString(), value)) { + this.agentServerModeEnum = agentServerModeEnum; + break; + } + } + if (this.agentServerModeEnum == null) { + this.agentServerModeEnum = Known.AGENT_SERVER_MODE_UNSPECIFIED; + } + } + + public AgentServerMode(Known knownValue) { + this.agentServerModeEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof AgentServerMode)) { + return false; + } + + AgentServerMode other = (AgentServerMode) o; + + if (this.agentServerModeEnum != Known.AGENT_SERVER_MODE_UNSPECIFIED + && other.agentServerModeEnum != Known.AGENT_SERVER_MODE_UNSPECIFIED) { + return this.agentServerModeEnum == other.agentServerModeEnum; + } else if (this.agentServerModeEnum == Known.AGENT_SERVER_MODE_UNSPECIFIED + && other.agentServerModeEnum == Known.AGENT_SERVER_MODE_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.agentServerModeEnum != Known.AGENT_SERVER_MODE_UNSPECIFIED) { + return this.agentServerModeEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.agentServerModeEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AggregatedMetricResult.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AggregatedMetricResult.java new file mode 100644 index 000000000000..dc72e054b72f --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AggregatedMetricResult.java @@ -0,0 +1,218 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Evaluation result for a single metric for an evaluation dataset. */ +@AutoValue +@JsonDeserialize(builder = AggregatedMetricResult.Builder.class) +public abstract class AggregatedMetricResult extends JsonSerializable { + /** Name of the metric. */ + @JsonProperty("metricName") + public abstract Optional metricName(); + + /** Total number of cases in the dataset. */ + @JsonProperty("numCasesTotal") + public abstract Optional numCasesTotal(); + + /** Number of valid cases in the dataset. */ + @JsonProperty("numCasesValid") + public abstract Optional numCasesValid(); + + /** Number of cases with errors in the dataset. */ + @JsonProperty("numCasesError") + public abstract Optional numCasesError(); + + /** Mean score of the metric. */ + @JsonProperty("meanScore") + public abstract Optional meanScore(); + + /** Standard deviation of the metric. */ + @JsonProperty("stdevScore") + public abstract Optional stdevScore(); + + /** + * Pass rate of the adaptive rubric metric. Calculated as the number of cases where all criteria + * passed divided by the total number of valid cases. A case is passing if it has a score of 1.0. + */ + @JsonProperty("passRate") + public abstract Optional passRate(); + + /** Instantiates a builder for AggregatedMetricResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AggregatedMetricResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AggregatedMetricResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `AggregatedMetricResult.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_AggregatedMetricResult.Builder(); + } + + /** + * Setter for metricName. + * + *

metricName: Name of the metric. + */ + @JsonProperty("metricName") + public abstract Builder metricName(String metricName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metricName(Optional metricName); + + /** Clears the value of metricName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetricName() { + return metricName(Optional.empty()); + } + + /** + * Setter for numCasesTotal. + * + *

numCasesTotal: Total number of cases in the dataset. + */ + @JsonProperty("numCasesTotal") + public abstract Builder numCasesTotal(Integer numCasesTotal); + + @ExcludeFromGeneratedCoverageReport + abstract Builder numCasesTotal(Optional numCasesTotal); + + /** Clears the value of numCasesTotal field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNumCasesTotal() { + return numCasesTotal(Optional.empty()); + } + + /** + * Setter for numCasesValid. + * + *

numCasesValid: Number of valid cases in the dataset. + */ + @JsonProperty("numCasesValid") + public abstract Builder numCasesValid(Integer numCasesValid); + + @ExcludeFromGeneratedCoverageReport + abstract Builder numCasesValid(Optional numCasesValid); + + /** Clears the value of numCasesValid field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNumCasesValid() { + return numCasesValid(Optional.empty()); + } + + /** + * Setter for numCasesError. + * + *

numCasesError: Number of cases with errors in the dataset. + */ + @JsonProperty("numCasesError") + public abstract Builder numCasesError(Integer numCasesError); + + @ExcludeFromGeneratedCoverageReport + abstract Builder numCasesError(Optional numCasesError); + + /** Clears the value of numCasesError field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNumCasesError() { + return numCasesError(Optional.empty()); + } + + /** + * Setter for meanScore. + * + *

meanScore: Mean score of the metric. + */ + @JsonProperty("meanScore") + public abstract Builder meanScore(Float meanScore); + + @ExcludeFromGeneratedCoverageReport + abstract Builder meanScore(Optional meanScore); + + /** Clears the value of meanScore field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMeanScore() { + return meanScore(Optional.empty()); + } + + /** + * Setter for stdevScore. + * + *

stdevScore: Standard deviation of the metric. + */ + @JsonProperty("stdevScore") + public abstract Builder stdevScore(Float stdevScore); + + @ExcludeFromGeneratedCoverageReport + abstract Builder stdevScore(Optional stdevScore); + + /** Clears the value of stdevScore field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearStdevScore() { + return stdevScore(Optional.empty()); + } + + /** + * Setter for passRate. + * + *

passRate: Pass rate of the adaptive rubric metric. Calculated as the number of cases where + * all criteria passed divided by the total number of valid cases. A case is passing if it has a + * score of 1.0. + */ + @JsonProperty("passRate") + public abstract Builder passRate(Float passRate); + + @ExcludeFromGeneratedCoverageReport + abstract Builder passRate(Optional passRate); + + /** Clears the value of passRate field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPassRate() { + return passRate(Optional.empty()); + } + + public abstract AggregatedMetricResult build(); + } + + /** Deserializes a JSON string to a AggregatedMetricResult object. */ + @ExcludeFromGeneratedCoverageReport + public static AggregatedMetricResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AggregatedMetricResult.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ApplicableGuideline.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ApplicableGuideline.java new file mode 100644 index 000000000000..86ac8addb219 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ApplicableGuideline.java @@ -0,0 +1,147 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Applicable guideline for the optimize_prompt method. */ +@AutoValue +@JsonDeserialize(builder = ApplicableGuideline.Builder.class) +public abstract class ApplicableGuideline extends JsonSerializable { + /** */ + @JsonProperty("applicableGuideline") + public abstract Optional applicableGuideline(); + + /** */ + @JsonProperty("suggestedImprovement") + public abstract Optional suggestedImprovement(); + + /** */ + @JsonProperty("textBeforeChange") + public abstract Optional textBeforeChange(); + + /** */ + @JsonProperty("textAfterChange") + public abstract Optional textAfterChange(); + + /** Instantiates a builder for ApplicableGuideline. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ApplicableGuideline.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ApplicableGuideline. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ApplicableGuideline.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ApplicableGuideline.Builder(); + } + + /** + * Setter for applicableGuideline. + * + *

applicableGuideline: + */ + @JsonProperty("applicableGuideline") + public abstract Builder applicableGuideline(String applicableGuideline); + + @ExcludeFromGeneratedCoverageReport + abstract Builder applicableGuideline(Optional applicableGuideline); + + /** Clears the value of applicableGuideline field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearApplicableGuideline() { + return applicableGuideline(Optional.empty()); + } + + /** + * Setter for suggestedImprovement. + * + *

suggestedImprovement: + */ + @JsonProperty("suggestedImprovement") + public abstract Builder suggestedImprovement(String suggestedImprovement); + + @ExcludeFromGeneratedCoverageReport + abstract Builder suggestedImprovement(Optional suggestedImprovement); + + /** Clears the value of suggestedImprovement field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSuggestedImprovement() { + return suggestedImprovement(Optional.empty()); + } + + /** + * Setter for textBeforeChange. + * + *

textBeforeChange: + */ + @JsonProperty("textBeforeChange") + public abstract Builder textBeforeChange(String textBeforeChange); + + @ExcludeFromGeneratedCoverageReport + abstract Builder textBeforeChange(Optional textBeforeChange); + + /** Clears the value of textBeforeChange field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTextBeforeChange() { + return textBeforeChange(Optional.empty()); + } + + /** + * Setter for textAfterChange. + * + *

textAfterChange: + */ + @JsonProperty("textAfterChange") + public abstract Builder textAfterChange(String textAfterChange); + + @ExcludeFromGeneratedCoverageReport + abstract Builder textAfterChange(Optional textAfterChange); + + /** Clears the value of textAfterChange field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTextAfterChange() { + return textAfterChange(Optional.empty()); + } + + public abstract ApplicableGuideline build(); + } + + /** Deserializes a JSON string to a ApplicableGuideline object. */ + @ExcludeFromGeneratedCoverageReport + public static ApplicableGuideline fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ApplicableGuideline.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AssembleDataset.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AssembleDataset.java new file mode 100644 index 000000000000..c6f7dfbcbc3e --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AssembleDataset.java @@ -0,0 +1,81 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents the assembled dataset. */ +@AutoValue +@JsonDeserialize(builder = AssembleDataset.Builder.class) +public abstract class AssembleDataset extends JsonSerializable { + /** The BigQuery destination of the assembled dataset. */ + @JsonProperty("bigqueryDestination") + public abstract Optional bigqueryDestination(); + + /** Instantiates a builder for AssembleDataset. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AssembleDataset.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AssembleDataset. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `AssembleDataset.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_AssembleDataset.Builder(); + } + + /** + * Setter for bigqueryDestination. + * + *

bigqueryDestination: The BigQuery destination of the assembled dataset. + */ + @JsonProperty("bigqueryDestination") + public abstract Builder bigqueryDestination(String bigqueryDestination); + + @ExcludeFromGeneratedCoverageReport + abstract Builder bigqueryDestination(Optional bigqueryDestination); + + /** Clears the value of bigqueryDestination field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBigqueryDestination() { + return bigqueryDestination(Optional.empty()); + } + + public abstract AssembleDataset build(); + } + + /** Deserializes a JSON string to a AssembleDataset object. */ + @ExcludeFromGeneratedCoverageReport + public static AssembleDataset fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AssembleDataset.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AssembleDatasetConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AssembleDatasetConfig.java new file mode 100644 index 000000000000..4a7b3135f976 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AssembleDatasetConfig.java @@ -0,0 +1,108 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for assembling a multimodal dataset resource. */ +@AutoValue +@JsonDeserialize(builder = AssembleDatasetConfig.Builder.class) +public abstract class AssembleDatasetConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** + * The timeout for the assemble dataset request in seconds. If not set, the default timeout is 90 + * seconds. + */ + @JsonProperty("timeout") + public abstract Optional timeout(); + + /** Instantiates a builder for AssembleDatasetConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AssembleDatasetConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AssembleDatasetConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `AssembleDatasetConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_AssembleDatasetConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for timeout. + * + *

timeout: The timeout for the assemble dataset request in seconds. If not set, the default + * timeout is 90 seconds. + */ + @JsonProperty("timeout") + public abstract Builder timeout(Integer timeout); + + @ExcludeFromGeneratedCoverageReport + abstract Builder timeout(Optional timeout); + + /** Clears the value of timeout field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTimeout() { + return timeout(Optional.empty()); + } + + public abstract AssembleDatasetConfig build(); + } + + /** Deserializes a JSON string to a AssembleDatasetConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static AssembleDatasetConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AssembleDatasetConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AssembleDatasetParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AssembleDatasetParameters.java new file mode 100644 index 000000000000..8d109d3f72c9 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/AssembleDatasetParameters.java @@ -0,0 +1,150 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for assembling a multimodal dataset resource. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = AssembleDatasetParameters.Builder.class) +public abstract class AssembleDatasetParameters extends JsonSerializable { + /** */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("geminiRequestReadConfig") + public abstract Optional geminiRequestReadConfig(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for AssembleDatasetParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_AssembleDatasetParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for AssembleDatasetParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `AssembleDatasetParameters.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_AssembleDatasetParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for geminiRequestReadConfig. + * + *

geminiRequestReadConfig: + */ + @JsonProperty("geminiRequestReadConfig") + public abstract Builder geminiRequestReadConfig( + GeminiRequestReadConfig geminiRequestReadConfig); + + /** + * Setter for geminiRequestReadConfig builder. + * + *

geminiRequestReadConfig: + */ + @CanIgnoreReturnValue + public Builder geminiRequestReadConfig( + GeminiRequestReadConfig.Builder geminiRequestReadConfigBuilder) { + return geminiRequestReadConfig(geminiRequestReadConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder geminiRequestReadConfig( + Optional geminiRequestReadConfig); + + /** Clears the value of geminiRequestReadConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGeminiRequestReadConfig() { + return geminiRequestReadConfig(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(AssembleDatasetConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(AssembleDatasetConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract AssembleDatasetParameters build(); + } + + /** Deserializes a JSON string to a AssembleDatasetParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static AssembleDatasetParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, AssembleDatasetParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BatchPredictionResourceUsageAssessmentResult.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BatchPredictionResourceUsageAssessmentResult.java new file mode 100644 index 000000000000..6028f9eb74fb --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BatchPredictionResourceUsageAssessmentResult.java @@ -0,0 +1,107 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Result of batch prediction resource usage assessment. */ +@AutoValue +@JsonDeserialize(builder = BatchPredictionResourceUsageAssessmentResult.Builder.class) +public abstract class BatchPredictionResourceUsageAssessmentResult extends JsonSerializable { + /** Number of tokens in the dataset. */ + @JsonProperty("tokenCount") + public abstract Optional tokenCount(); + + /** Number of audio tokens in the dataset. */ + @JsonProperty("audioTokenCount") + public abstract Optional audioTokenCount(); + + /** Instantiates a builder for BatchPredictionResourceUsageAssessmentResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_BatchPredictionResourceUsageAssessmentResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for BatchPredictionResourceUsageAssessmentResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `BatchPredictionResourceUsageAssessmentResult.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_BatchPredictionResourceUsageAssessmentResult.Builder(); + } + + /** + * Setter for tokenCount. + * + *

tokenCount: Number of tokens in the dataset. + */ + @JsonProperty("tokenCount") + public abstract Builder tokenCount(Integer tokenCount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder tokenCount(Optional tokenCount); + + /** Clears the value of tokenCount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTokenCount() { + return tokenCount(Optional.empty()); + } + + /** + * Setter for audioTokenCount. + * + *

audioTokenCount: Number of audio tokens in the dataset. + */ + @JsonProperty("audioTokenCount") + public abstract Builder audioTokenCount(Integer audioTokenCount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder audioTokenCount(Optional audioTokenCount); + + /** Clears the value of audioTokenCount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAudioTokenCount() { + return audioTokenCount(Optional.empty()); + } + + public abstract BatchPredictionResourceUsageAssessmentResult build(); + } + + /** Deserializes a JSON string to a BatchPredictionResourceUsageAssessmentResult object. */ + @ExcludeFromGeneratedCoverageReport + public static BatchPredictionResourceUsageAssessmentResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, BatchPredictionResourceUsageAssessmentResult.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BigQueryRequestSet.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BigQueryRequestSet.java new file mode 100644 index 000000000000..4c7f493795ae --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BigQueryRequestSet.java @@ -0,0 +1,188 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Represents a BigQuery request set. */ +@AutoValue +@JsonDeserialize(builder = BigQueryRequestSet.Builder.class) +public abstract class BigQueryRequestSet extends JsonSerializable { + /** */ + @JsonProperty("uri") + public abstract Optional uri(); + + /** The column name of the prompt in the BigQuery table. Used for EvaluationRun only. */ + @JsonProperty("promptColumn") + public abstract Optional promptColumn(); + + /** The column name of the rubrics in the BigQuery table. Used for EvaluationRun only. */ + @JsonProperty("rubricsColumn") + public abstract Optional rubricsColumn(); + + /** + * The column name of the response candidates in the BigQuery table. Used for EvaluationRun only. + */ + @JsonProperty("candidateResponseColumns") + public abstract Optional> candidateResponseColumns(); + + /** The sampling config for the BigQuery request set. Used for EvaluationRun only. */ + @JsonProperty("samplingConfig") + public abstract Optional samplingConfig(); + + /** Instantiates a builder for BigQueryRequestSet. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_BigQueryRequestSet.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for BigQueryRequestSet. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `BigQueryRequestSet.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_BigQueryRequestSet.Builder(); + } + + /** + * Setter for uri. + * + *

uri: + */ + @JsonProperty("uri") + public abstract Builder uri(String uri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder uri(Optional uri); + + /** Clears the value of uri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUri() { + return uri(Optional.empty()); + } + + /** + * Setter for promptColumn. + * + *

promptColumn: The column name of the prompt in the BigQuery table. Used for EvaluationRun + * only. + */ + @JsonProperty("promptColumn") + public abstract Builder promptColumn(String promptColumn); + + @ExcludeFromGeneratedCoverageReport + abstract Builder promptColumn(Optional promptColumn); + + /** Clears the value of promptColumn field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPromptColumn() { + return promptColumn(Optional.empty()); + } + + /** + * Setter for rubricsColumn. + * + *

rubricsColumn: The column name of the rubrics in the BigQuery table. Used for + * EvaluationRun only. + */ + @JsonProperty("rubricsColumn") + public abstract Builder rubricsColumn(String rubricsColumn); + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubricsColumn(Optional rubricsColumn); + + /** Clears the value of rubricsColumn field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubricsColumn() { + return rubricsColumn(Optional.empty()); + } + + /** + * Setter for candidateResponseColumns. + * + *

candidateResponseColumns: The column name of the response candidates in the BigQuery + * table. Used for EvaluationRun only. + */ + @JsonProperty("candidateResponseColumns") + public abstract Builder candidateResponseColumns(Map candidateResponseColumns); + + @ExcludeFromGeneratedCoverageReport + abstract Builder candidateResponseColumns( + Optional> candidateResponseColumns); + + /** Clears the value of candidateResponseColumns field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCandidateResponseColumns() { + return candidateResponseColumns(Optional.empty()); + } + + /** + * Setter for samplingConfig. + * + *

samplingConfig: The sampling config for the BigQuery request set. Used for EvaluationRun + * only. + */ + @JsonProperty("samplingConfig") + public abstract Builder samplingConfig(SamplingConfig samplingConfig); + + /** + * Setter for samplingConfig builder. + * + *

samplingConfig: The sampling config for the BigQuery request set. Used for EvaluationRun + * only. + */ + @CanIgnoreReturnValue + public Builder samplingConfig(SamplingConfig.Builder samplingConfigBuilder) { + return samplingConfig(samplingConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder samplingConfig(Optional samplingConfig); + + /** Clears the value of samplingConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSamplingConfig() { + return samplingConfig(Optional.empty()); + } + + public abstract BigQueryRequestSet build(); + } + + /** Deserializes a JSON string to a BigQueryRequestSet object. */ + @ExcludeFromGeneratedCoverageReport + public static BigQueryRequestSet fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, BigQueryRequestSet.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BigQuerySource.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BigQuerySource.java new file mode 100644 index 000000000000..e24dc38c0b5b --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BigQuerySource.java @@ -0,0 +1,85 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** The BigQuery location for the input content. */ +@AutoValue +@JsonDeserialize(builder = BigQuerySource.Builder.class) +public abstract class BigQuerySource extends JsonSerializable { + /** + * Required. BigQuery URI to a table, up to 2000 characters long. Accepted forms: * BigQuery path. + * For example: `bq://projectId.bqDatasetId.bqTableId`. + */ + @JsonProperty("inputUri") + public abstract Optional inputUri(); + + /** Instantiates a builder for BigQuerySource. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_BigQuerySource.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for BigQuerySource. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `BigQuerySource.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_BigQuerySource.Builder(); + } + + /** + * Setter for inputUri. + * + *

inputUri: Required. BigQuery URI to a table, up to 2000 characters long. Accepted forms: * + * BigQuery path. For example: `bq://projectId.bqDatasetId.bqTableId`. + */ + @JsonProperty("inputUri") + public abstract Builder inputUri(String inputUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder inputUri(Optional inputUri); + + /** Clears the value of inputUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInputUri() { + return inputUri(Optional.empty()); + } + + public abstract BigQuerySource build(); + } + + /** Deserializes a JSON string to a BigQuerySource object. */ + @ExcludeFromGeneratedCoverageReport + public static BigQuerySource fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, BigQuerySource.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BleuInput.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BleuInput.java new file mode 100644 index 000000000000..f222493a7a3d --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BleuInput.java @@ -0,0 +1,108 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** None */ +@AutoValue +@JsonDeserialize(builder = BleuInput.Builder.class) +public abstract class BleuInput extends JsonSerializable { + /** Required. Repeated bleu instances. */ + @JsonProperty("instances") + public abstract Optional> instances(); + + /** Instantiates a builder for BleuInput. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_BleuInput.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for BleuInput. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `BleuInput.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_BleuInput.Builder(); + } + + /** + * Setter for instances. + * + *

instances: Required. Repeated bleu instances. + */ + @JsonProperty("instances") + public abstract Builder instances(List instances); + + /** + * Setter for instances. + * + *

instances: Required. Repeated bleu instances. + */ + @CanIgnoreReturnValue + public Builder instances(BleuInstance... instances) { + return instances(Arrays.asList(instances)); + } + + /** + * Setter for instances builder. + * + *

instances: Required. Repeated bleu instances. + */ + @CanIgnoreReturnValue + public Builder instances(BleuInstance.Builder... instancesBuilders) { + return instances( + Arrays.asList(instancesBuilders).stream() + .map(BleuInstance.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder instances(Optional> instances); + + /** Clears the value of instances field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInstances() { + return instances(Optional.empty()); + } + + public abstract BleuInput build(); + } + + /** Deserializes a JSON string to a BleuInput object. */ + @ExcludeFromGeneratedCoverageReport + public static BleuInput fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, BleuInput.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BleuInstance.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BleuInstance.java new file mode 100644 index 000000000000..bcb69e460720 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BleuInstance.java @@ -0,0 +1,103 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Bleu instance. */ +@AutoValue +@JsonDeserialize(builder = BleuInstance.Builder.class) +public abstract class BleuInstance extends JsonSerializable { + /** Required. Output of the evaluated model. */ + @JsonProperty("prediction") + public abstract Optional prediction(); + + /** Required. Ground truth used to compare against the prediction. */ + @JsonProperty("reference") + public abstract Optional reference(); + + /** Instantiates a builder for BleuInstance. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_BleuInstance.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for BleuInstance. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `BleuInstance.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_BleuInstance.Builder(); + } + + /** + * Setter for prediction. + * + *

prediction: Required. Output of the evaluated model. + */ + @JsonProperty("prediction") + public abstract Builder prediction(String prediction); + + @ExcludeFromGeneratedCoverageReport + abstract Builder prediction(Optional prediction); + + /** Clears the value of prediction field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPrediction() { + return prediction(Optional.empty()); + } + + /** + * Setter for reference. + * + *

reference: Required. Ground truth used to compare against the prediction. + */ + @JsonProperty("reference") + public abstract Builder reference(String reference); + + @ExcludeFromGeneratedCoverageReport + abstract Builder reference(Optional reference); + + /** Clears the value of reference field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReference() { + return reference(Optional.empty()); + } + + public abstract BleuInstance build(); + } + + /** Deserializes a JSON string to a BleuInstance object. */ + @ExcludeFromGeneratedCoverageReport + public static BleuInstance fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, BleuInstance.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BleuMetricValue.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BleuMetricValue.java new file mode 100644 index 000000000000..ada58238a319 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BleuMetricValue.java @@ -0,0 +1,81 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Bleu metric value for an instance. */ +@AutoValue +@JsonDeserialize(builder = BleuMetricValue.Builder.class) +public abstract class BleuMetricValue extends JsonSerializable { + /** Output only. Bleu score. */ + @JsonProperty("score") + public abstract Optional score(); + + /** Instantiates a builder for BleuMetricValue. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_BleuMetricValue.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for BleuMetricValue. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `BleuMetricValue.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_BleuMetricValue.Builder(); + } + + /** + * Setter for score. + * + *

score: Output only. Bleu score. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + @ExcludeFromGeneratedCoverageReport + abstract Builder score(Optional score); + + /** Clears the value of score field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScore() { + return score(Optional.empty()); + } + + public abstract BleuMetricValue build(); + } + + /** Deserializes a JSON string to a BleuMetricValue object. */ + @ExcludeFromGeneratedCoverageReport + public static BleuMetricValue fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, BleuMetricValue.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BleuResults.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BleuResults.java new file mode 100644 index 000000000000..7bd34158c4f0 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/BleuResults.java @@ -0,0 +1,108 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Results for bleu metric. */ +@AutoValue +@JsonDeserialize(builder = BleuResults.Builder.class) +public abstract class BleuResults extends JsonSerializable { + /** Output only. Bleu metric values. */ + @JsonProperty("bleuMetricValues") + public abstract Optional> bleuMetricValues(); + + /** Instantiates a builder for BleuResults. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_BleuResults.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for BleuResults. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `BleuResults.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_BleuResults.Builder(); + } + + /** + * Setter for bleuMetricValues. + * + *

bleuMetricValues: Output only. Bleu metric values. + */ + @JsonProperty("bleuMetricValues") + public abstract Builder bleuMetricValues(List bleuMetricValues); + + /** + * Setter for bleuMetricValues. + * + *

bleuMetricValues: Output only. Bleu metric values. + */ + @CanIgnoreReturnValue + public Builder bleuMetricValues(BleuMetricValue... bleuMetricValues) { + return bleuMetricValues(Arrays.asList(bleuMetricValues)); + } + + /** + * Setter for bleuMetricValues builder. + * + *

bleuMetricValues: Output only. Bleu metric values. + */ + @CanIgnoreReturnValue + public Builder bleuMetricValues(BleuMetricValue.Builder... bleuMetricValuesBuilders) { + return bleuMetricValues( + Arrays.asList(bleuMetricValuesBuilders).stream() + .map(BleuMetricValue.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder bleuMetricValues(Optional> bleuMetricValues); + + /** Clears the value of bleuMetricValues field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBleuMetricValues() { + return bleuMetricValues(Optional.empty()); + } + + public abstract BleuResults build(); + } + + /** Deserializes a JSON string to a BleuResults object. */ + @ExcludeFromGeneratedCoverageReport + public static BleuResults fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, BleuResults.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CandidateResponse.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CandidateResponse.java new file mode 100644 index 000000000000..839e9636878a --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CandidateResponse.java @@ -0,0 +1,163 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** Responses from model or agent. */ +@AutoValue +@JsonDeserialize(builder = CandidateResponse.Builder.class) +public abstract class CandidateResponse extends JsonSerializable { + /** The name of the candidate that produced the response. */ + @JsonProperty("candidate") + public abstract Optional candidate(); + + /** The text response. */ + @JsonProperty("text") + public abstract Optional text(); + + /** Fields and values that can be used to populate the response template. */ + @JsonProperty("value") + public abstract Optional> value(); + + /** Intermediate events (such as tool calls and responses) that led to the final response. */ + @JsonProperty("events") + public abstract Optional> events(); + + /** Instantiates a builder for CandidateResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CandidateResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CandidateResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `CandidateResponse.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_CandidateResponse.Builder(); + } + + /** + * Setter for candidate. + * + *

candidate: The name of the candidate that produced the response. + */ + @JsonProperty("candidate") + public abstract Builder candidate(String candidate); + + @ExcludeFromGeneratedCoverageReport + abstract Builder candidate(Optional candidate); + + /** Clears the value of candidate field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCandidate() { + return candidate(Optional.empty()); + } + + /** + * Setter for text. + * + *

text: The text response. + */ + @JsonProperty("text") + public abstract Builder text(String text); + + @ExcludeFromGeneratedCoverageReport + abstract Builder text(Optional text); + + /** Clears the value of text field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearText() { + return text(Optional.empty()); + } + + /** + * Setter for value. + * + *

value: Fields and values that can be used to populate the response template. + */ + @JsonProperty("value") + public abstract Builder value(Map value); + + @ExcludeFromGeneratedCoverageReport + abstract Builder value(Optional> value); + + /** Clears the value of value field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearValue() { + return value(Optional.empty()); + } + + /** + * Setter for events. + * + *

events: Intermediate events (such as tool calls and responses) that led to the final + * response. + */ + @JsonProperty("events") + public abstract Builder events(List events); + + /** + * Setter for events. + * + *

events: Intermediate events (such as tool calls and responses) that led to the final + * response. + */ + @CanIgnoreReturnValue + public Builder events(Content... events) { + return events(Arrays.asList(events)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder events(Optional> events); + + /** Clears the value of events field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvents() { + return events(Optional.empty()); + } + + public abstract CandidateResponse build(); + } + + /** Deserializes a JSON string to a CandidateResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static CandidateResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CandidateResponse.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CandidateResult.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CandidateResult.java new file mode 100644 index 000000000000..a69d0a141b10 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CandidateResult.java @@ -0,0 +1,223 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** Result for a single candidate. */ +@AutoValue +@JsonDeserialize(builder = CandidateResult.Builder.class) +public abstract class CandidateResult extends JsonSerializable { + /** + * The candidate that is being evaluated. The value is the same as the candidate name in the + * EvaluationRequest. + */ + @JsonProperty("candidate") + public abstract Optional candidate(); + + /** The metric that was evaluated. */ + @JsonProperty("metric") + public abstract Optional metric(); + + /** The score of the metric. */ + @JsonProperty("score") + public abstract Optional score(); + + /** The explanation for the metric. */ + @JsonProperty("explanation") + public abstract Optional explanation(); + + /** The rubric verdicts for the metric. */ + @JsonProperty("rubricVerdicts") + public abstract Optional> rubricVerdicts(); + + /** Additional results for the metric. */ + @JsonProperty("additionalResults") + public abstract Optional> additionalResults(); + + /** Instantiates a builder for CandidateResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CandidateResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CandidateResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `CandidateResult.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_CandidateResult.Builder(); + } + + /** + * Setter for candidate. + * + *

candidate: The candidate that is being evaluated. The value is the same as the candidate + * name in the EvaluationRequest. + */ + @JsonProperty("candidate") + public abstract Builder candidate(String candidate); + + @ExcludeFromGeneratedCoverageReport + abstract Builder candidate(Optional candidate); + + /** Clears the value of candidate field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCandidate() { + return candidate(Optional.empty()); + } + + /** + * Setter for metric. + * + *

metric: The metric that was evaluated. + */ + @JsonProperty("metric") + public abstract Builder metric(String metric); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metric(Optional metric); + + /** Clears the value of metric field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetric() { + return metric(Optional.empty()); + } + + /** + * Setter for score. + * + *

score: The score of the metric. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + @ExcludeFromGeneratedCoverageReport + abstract Builder score(Optional score); + + /** Clears the value of score field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScore() { + return score(Optional.empty()); + } + + /** + * Setter for explanation. + * + *

explanation: The explanation for the metric. + */ + @JsonProperty("explanation") + public abstract Builder explanation(String explanation); + + @ExcludeFromGeneratedCoverageReport + abstract Builder explanation(Optional explanation); + + /** Clears the value of explanation field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExplanation() { + return explanation(Optional.empty()); + } + + /** + * Setter for rubricVerdicts. + * + *

rubricVerdicts: The rubric verdicts for the metric. + */ + @JsonProperty("rubricVerdicts") + public abstract Builder rubricVerdicts(List rubricVerdicts); + + /** + * Setter for rubricVerdicts. + * + *

rubricVerdicts: The rubric verdicts for the metric. + */ + @CanIgnoreReturnValue + public Builder rubricVerdicts(RubricVerdict... rubricVerdicts) { + return rubricVerdicts(Arrays.asList(rubricVerdicts)); + } + + /** + * Setter for rubricVerdicts builder. + * + *

rubricVerdicts: The rubric verdicts for the metric. + */ + @CanIgnoreReturnValue + public Builder rubricVerdicts(RubricVerdict.Builder... rubricVerdictsBuilders) { + return rubricVerdicts( + Arrays.asList(rubricVerdictsBuilders).stream() + .map(RubricVerdict.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubricVerdicts(Optional> rubricVerdicts); + + /** Clears the value of rubricVerdicts field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubricVerdicts() { + return rubricVerdicts(Optional.empty()); + } + + /** + * Setter for additionalResults. + * + *

additionalResults: Additional results for the metric. + */ + @JsonProperty("additionalResults") + public abstract Builder additionalResults(Map additionalResults); + + @ExcludeFromGeneratedCoverageReport + abstract Builder additionalResults(Optional> additionalResults); + + /** Clears the value of additionalResults field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAdditionalResults() { + return additionalResults(Optional.empty()); + } + + public abstract CandidateResult build(); + } + + /** Deserializes a JSON string to a CandidateResult object. */ + @ExcludeFromGeneratedCoverageReport + public static CandidateResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CandidateResult.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Chunk.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Chunk.java new file mode 100644 index 000000000000..2bd4d201577d --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Chunk.java @@ -0,0 +1,139 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** A chunk of data. */ +@AutoValue +@JsonDeserialize(builder = Chunk.Builder.class) +public abstract class Chunk extends JsonSerializable { + /** Required. The data in the chunk. */ + @JsonProperty("data") + public abstract Optional data(); + + /** Optional. Metadata that is associated with the data in the payload. */ + @JsonProperty("metadata") + public abstract Optional metadata(); + + /** + * Required. Mime type of the chunk data. See + * https://www.iana.org/assignments/media-types/media-types.xhtml for the full list. + */ + @JsonProperty("mimeType") + public abstract Optional mimeType(); + + /** Instantiates a builder for Chunk. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_Chunk.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for Chunk. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `Chunk.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_Chunk.Builder(); + } + + /** + * Setter for data. + * + *

data: Required. The data in the chunk. + */ + @JsonProperty("data") + public abstract Builder data(byte[] data); + + @ExcludeFromGeneratedCoverageReport + abstract Builder data(Optional data); + + /** Clears the value of data field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearData() { + return data(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Optional. Metadata that is associated with the data in the payload. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Metadata metadata); + + /** + * Setter for metadata builder. + * + *

metadata: Optional. Metadata that is associated with the data in the payload. + */ + @CanIgnoreReturnValue + public Builder metadata(Metadata.Builder metadataBuilder) { + return metadata(metadataBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for mimeType. + * + *

mimeType: Required. Mime type of the chunk data. See + * https://www.iana.org/assignments/media-types/media-types.xhtml for the full list. + */ + @JsonProperty("mimeType") + public abstract Builder mimeType(String mimeType); + + @ExcludeFromGeneratedCoverageReport + abstract Builder mimeType(Optional mimeType); + + /** Clears the value of mimeType field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMimeType() { + return mimeType(Optional.empty()); + } + + public abstract Chunk build(); + } + + /** Deserializes a JSON string to a Chunk object. */ + @ExcludeFromGeneratedCoverageReport + public static Chunk fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, Chunk.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CometResult.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CometResult.java new file mode 100644 index 000000000000..1f40b3947595 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CometResult.java @@ -0,0 +1,84 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** + * Spec for Comet result - calculates the comet score for the given instance using the version + * specified in the spec. + */ +@AutoValue +@JsonDeserialize(builder = CometResult.Builder.class) +public abstract class CometResult extends JsonSerializable { + /** Output only. Comet score. Range depends on version. */ + @JsonProperty("score") + public abstract Optional score(); + + /** Instantiates a builder for CometResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CometResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CometResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `CometResult.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_CometResult.Builder(); + } + + /** + * Setter for score. + * + *

score: Output only. Comet score. Range depends on version. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + @ExcludeFromGeneratedCoverageReport + abstract Builder score(Optional score); + + /** Clears the value of score field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScore() { + return score(Optional.empty()); + } + + public abstract CometResult build(); + } + + /** Deserializes a JSON string to a CometResult object. */ + @ExcludeFromGeneratedCoverageReport + public static CometResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CometResult.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ContainerSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ContainerSpec.java new file mode 100644 index 000000000000..122e790a2f21 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ContainerSpec.java @@ -0,0 +1,203 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The spec of a Container. */ +@AutoValue +@JsonDeserialize(builder = ContainerSpec.Builder.class) +public abstract class ContainerSpec extends JsonSerializable { + /** The arguments to be passed when starting the container. */ + @JsonProperty("args") + public abstract Optional> args(); + + /** + * The command to be invoked when the container is started. It overrides the entrypoint + * instruction in Dockerfile when provided. + */ + @JsonProperty("command") + public abstract Optional> command(); + + /** Environment variables to be passed to the container. Maximum limit is 100. */ + @JsonProperty("env") + public abstract Optional> env(); + + /** + * Required. The URI of a container image in the Container Registry that is to be run on each + * worker replica. + */ + @JsonProperty("imageUri") + public abstract Optional imageUri(); + + /** Instantiates a builder for ContainerSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ContainerSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ContainerSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ContainerSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ContainerSpec.Builder(); + } + + /** + * Setter for args. + * + *

args: The arguments to be passed when starting the container. + */ + @JsonProperty("args") + public abstract Builder args(List args); + + /** + * Setter for args. + * + *

args: The arguments to be passed when starting the container. + */ + @CanIgnoreReturnValue + public Builder args(String... args) { + return args(Arrays.asList(args)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder args(Optional> args); + + /** Clears the value of args field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearArgs() { + return args(Optional.empty()); + } + + /** + * Setter for command. + * + *

command: The command to be invoked when the container is started. It overrides the + * entrypoint instruction in Dockerfile when provided. + */ + @JsonProperty("command") + public abstract Builder command(List command); + + /** + * Setter for command. + * + *

command: The command to be invoked when the container is started. It overrides the + * entrypoint instruction in Dockerfile when provided. + */ + @CanIgnoreReturnValue + public Builder command(String... command) { + return command(Arrays.asList(command)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder command(Optional> command); + + /** Clears the value of command field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCommand() { + return command(Optional.empty()); + } + + /** + * Setter for env. + * + *

env: Environment variables to be passed to the container. Maximum limit is 100. + */ + @JsonProperty("env") + public abstract Builder env(List env); + + /** + * Setter for env. + * + *

env: Environment variables to be passed to the container. Maximum limit is 100. + */ + @CanIgnoreReturnValue + public Builder env(EnvVar... env) { + return env(Arrays.asList(env)); + } + + /** + * Setter for env builder. + * + *

env: Environment variables to be passed to the container. Maximum limit is 100. + */ + @CanIgnoreReturnValue + public Builder env(EnvVar.Builder... envBuilders) { + return env( + Arrays.asList(envBuilders).stream() + .map(EnvVar.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder env(Optional> env); + + /** Clears the value of env field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEnv() { + return env(Optional.empty()); + } + + /** + * Setter for imageUri. + * + *

imageUri: Required. The URI of a container image in the Container Registry that is to be + * run on each worker replica. + */ + @JsonProperty("imageUri") + public abstract Builder imageUri(String imageUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder imageUri(Optional imageUri); + + /** Clears the value of imageUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearImageUri() { + return imageUri(Optional.empty()); + } + + public abstract ContainerSpec build(); + } + + /** Deserializes a JSON string to a ContainerSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static ContainerSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ContainerSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ContentMapContents.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ContentMapContents.java new file mode 100644 index 000000000000..e8f89d40039d --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ContentMapContents.java @@ -0,0 +1,94 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Map of placeholder in metric prompt template to contents of model input. */ +@AutoValue +@JsonDeserialize(builder = ContentMapContents.Builder.class) +public abstract class ContentMapContents extends JsonSerializable { + /** Contents of the model input. */ + @JsonProperty("contents") + public abstract Optional> contents(); + + /** Instantiates a builder for ContentMapContents. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ContentMapContents.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ContentMapContents. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ContentMapContents.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ContentMapContents.Builder(); + } + + /** + * Setter for contents. + * + *

contents: Contents of the model input. + */ + @JsonProperty("contents") + public abstract Builder contents(List contents); + + /** + * Setter for contents. + * + *

contents: Contents of the model input. + */ + @CanIgnoreReturnValue + public Builder contents(Content... contents) { + return contents(Arrays.asList(contents)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder contents(Optional> contents); + + /** Clears the value of contents field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContents() { + return contents(Optional.empty()); + } + + public abstract ContentMapContents build(); + } + + /** Deserializes a JSON string to a ContentMapContents object. */ + @ExcludeFromGeneratedCoverageReport + public static ContentMapContents fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ContentMapContents.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineConfig.java new file mode 100644 index 000000000000..9ba118213fac --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineConfig.java @@ -0,0 +1,693 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.EncryptionSpec; +import com.google.genai.types.HttpOptions; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** Config for create agent engine. */ +@AutoValue +@JsonDeserialize(builder = CreateAgentEngineConfig.Builder.class) +public abstract class CreateAgentEngineConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** + * The user-defined name of the Agent Engine. + * + *

The display name can be up to 128 characters long and can comprise any UTF-8 characters. + */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** The description of the Agent Engine. */ + @JsonProperty("description") + public abstract Optional description(); + + /** Optional. Configurations of the Agent Engine. */ + @JsonProperty("spec") + public abstract Optional spec(); + + /** Optional. The context spec to be used for the Agent Engine. */ + @JsonProperty("contextSpec") + public abstract Optional contextSpec(); + + /** Optional. The PSC interface config for PSC-I to be used for the Agent Engine. */ + @JsonProperty("pscInterfaceConfig") + public abstract Optional pscInterfaceConfig(); + + /** The minimum number of instances to run for the Agent Engine. Defaults to 1. Range: [0, 10]. */ + @JsonProperty("minInstances") + public abstract Optional minInstances(); + + /** + * The maximum number of instances to run for the Agent Engine. Defaults to 100. Range: [1, 1000]. + * If VPC-SC or PSC-I is enabled, the acceptable range is [1, 100]. + */ + @JsonProperty("maxInstances") + public abstract Optional maxInstances(); + + /** + * The resource limits to be applied to the Agent Engine. Required keys: 'cpu' and 'memory'. + * Supported values for 'cpu': '1', '2', '4', '6', '8'. Supported values for 'memory': '1Gi', + * '2Gi', ..., '32Gi'. + */ + @JsonProperty("resourceLimits") + public abstract Optional> resourceLimits(); + + /** + * The container concurrency to be used for the Agent Engine. Recommended value: 2 * cpu + 1. + * Defaults to 9. + */ + @JsonProperty("containerConcurrency") + public abstract Optional containerConcurrency(); + + /** The encryption spec to be used for the Agent Engine. */ + @JsonProperty("encryptionSpec") + public abstract Optional encryptionSpec(); + + /** The labels to be used for the Agent Engine. */ + @JsonProperty("labels") + public abstract Optional> labels(); + + /** + * The class methods to be used for the Agent Engine. If specified, they'll override the class + * methods that are autogenerated by default. By default, methods are generated by inspecting the + * agent object and generating a corresponding method for each method defined on the agent class. + */ + @JsonProperty("classMethods") + public abstract Optional>> classMethods(); + + /** + * The user-provided paths to the source packages (if any). If specified, the files in the source + * packages will be packed into a a tarball file, uploaded to Agent Engine's API, and deployed to + * the Agent Engine. The following fields will be ignored: - agent - extra_packages - + * staging_bucket - requirements The following fields will be used to install and use the agent + * from the source packages: - entrypoint_module (required) - entrypoint_object (required) - + * requirements_file (optional) - class_methods (required) + */ + @JsonProperty("sourcePackages") + public abstract Optional> sourcePackages(); + + /** + * The entrypoint module to be used for the Agent Engine This field only used when source_packages + * is specified. + */ + @JsonProperty("entrypointModule") + public abstract Optional entrypointModule(); + + /** + * The entrypoint object to be used for the Agent Engine. This field only used when + * source_packages is specified. + */ + @JsonProperty("entrypointObject") + public abstract Optional entrypointObject(); + + /** + * The user-provided path to the requirements file (if any). This field is only used when + * source_packages is specified. If not specified, agent engine will find and use the + * `requirements.txt` in the source package. + */ + @JsonProperty("requirementsFile") + public abstract Optional requirementsFile(); + + /** + * The agent framework to be used for the Agent Engine. The OSS agent framework used to develop + * the agent. Currently supported values: "google-adk", "langchain", "langgraph", "ag2", + * "llama-index", "custom". If not specified: - If `agent` is specified, the agent framework will + * be auto-detected. - If `source_packages` is specified, the agent framework will default to + * "custom". + */ + @JsonProperty("agentFramework") + public abstract Optional agentFramework(); + + /** + * The Python version to be used for the Agent Engine. If not specified, it will use the current + * Python version of the environment. Supported versions: "3.9", "3.10", "3.11", "3.12", "3.13". + */ + @JsonProperty("pythonVersion") + public abstract Optional pythonVersion(); + + /** + * The build options for the Agent Engine. The following keys are supported: - + * installation_scripts: Optional. The paths to the installation scripts to be executed in the + * Docker image. The scripts must be located in the `installation_scripts` subdirectory and the + * path must be added to `extra_packages`. + */ + @JsonProperty("buildOptions") + public abstract Optional>> buildOptions(); + + /** Instantiates a builder for CreateAgentEngineConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateAgentEngineConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateAgentEngineConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `CreateAgentEngineConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateAgentEngineConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: The user-defined name of the Agent Engine. + * + *

The display name can be up to 128 characters long and can comprise any UTF-8 characters. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: The description of the Agent Engine. + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + /** + * Setter for spec. + * + *

spec: Optional. Configurations of the Agent Engine. + */ + @JsonProperty("spec") + public abstract Builder spec(ReasoningEngineSpec spec); + + /** + * Setter for spec builder. + * + *

spec: Optional. Configurations of the Agent Engine. + */ + @CanIgnoreReturnValue + public Builder spec(ReasoningEngineSpec.Builder specBuilder) { + return spec(specBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder spec(Optional spec); + + /** Clears the value of spec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSpec() { + return spec(Optional.empty()); + } + + /** + * Setter for contextSpec. + * + *

contextSpec: Optional. The context spec to be used for the Agent Engine. + */ + @JsonProperty("contextSpec") + public abstract Builder contextSpec(ReasoningEngineContextSpec contextSpec); + + /** + * Setter for contextSpec builder. + * + *

contextSpec: Optional. The context spec to be used for the Agent Engine. + */ + @CanIgnoreReturnValue + public Builder contextSpec(ReasoningEngineContextSpec.Builder contextSpecBuilder) { + return contextSpec(contextSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder contextSpec(Optional contextSpec); + + /** Clears the value of contextSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContextSpec() { + return contextSpec(Optional.empty()); + } + + /** + * Setter for pscInterfaceConfig. + * + *

pscInterfaceConfig: Optional. The PSC interface config for PSC-I to be used for the Agent + * Engine. + */ + @JsonProperty("pscInterfaceConfig") + public abstract Builder pscInterfaceConfig(PscInterfaceConfig pscInterfaceConfig); + + /** + * Setter for pscInterfaceConfig builder. + * + *

pscInterfaceConfig: Optional. The PSC interface config for PSC-I to be used for the Agent + * Engine. + */ + @CanIgnoreReturnValue + public Builder pscInterfaceConfig(PscInterfaceConfig.Builder pscInterfaceConfigBuilder) { + return pscInterfaceConfig(pscInterfaceConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder pscInterfaceConfig(Optional pscInterfaceConfig); + + /** Clears the value of pscInterfaceConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPscInterfaceConfig() { + return pscInterfaceConfig(Optional.empty()); + } + + /** + * Setter for minInstances. + * + *

minInstances: The minimum number of instances to run for the Agent Engine. Defaults to 1. + * Range: [0, 10]. + */ + @JsonProperty("minInstances") + public abstract Builder minInstances(Integer minInstances); + + @ExcludeFromGeneratedCoverageReport + abstract Builder minInstances(Optional minInstances); + + /** Clears the value of minInstances field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMinInstances() { + return minInstances(Optional.empty()); + } + + /** + * Setter for maxInstances. + * + *

maxInstances: The maximum number of instances to run for the Agent Engine. Defaults to + * 100. Range: [1, 1000]. If VPC-SC or PSC-I is enabled, the acceptable range is [1, 100]. + */ + @JsonProperty("maxInstances") + public abstract Builder maxInstances(Integer maxInstances); + + @ExcludeFromGeneratedCoverageReport + abstract Builder maxInstances(Optional maxInstances); + + /** Clears the value of maxInstances field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMaxInstances() { + return maxInstances(Optional.empty()); + } + + /** + * Setter for resourceLimits. + * + *

resourceLimits: The resource limits to be applied to the Agent Engine. Required keys: + * 'cpu' and 'memory'. Supported values for 'cpu': '1', '2', '4', '6', '8'. Supported values for + * 'memory': '1Gi', '2Gi', ..., '32Gi'. + */ + @JsonProperty("resourceLimits") + public abstract Builder resourceLimits(Map resourceLimits); + + @ExcludeFromGeneratedCoverageReport + abstract Builder resourceLimits(Optional> resourceLimits); + + /** Clears the value of resourceLimits field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResourceLimits() { + return resourceLimits(Optional.empty()); + } + + /** + * Setter for containerConcurrency. + * + *

containerConcurrency: The container concurrency to be used for the Agent Engine. + * Recommended value: 2 * cpu + 1. Defaults to 9. + */ + @JsonProperty("containerConcurrency") + public abstract Builder containerConcurrency(Integer containerConcurrency); + + @ExcludeFromGeneratedCoverageReport + abstract Builder containerConcurrency(Optional containerConcurrency); + + /** Clears the value of containerConcurrency field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContainerConcurrency() { + return containerConcurrency(Optional.empty()); + } + + /** + * Setter for encryptionSpec. + * + *

encryptionSpec: The encryption spec to be used for the Agent Engine. + */ + @JsonProperty("encryptionSpec") + public abstract Builder encryptionSpec(EncryptionSpec encryptionSpec); + + @ExcludeFromGeneratedCoverageReport + abstract Builder encryptionSpec(Optional encryptionSpec); + + /** Clears the value of encryptionSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEncryptionSpec() { + return encryptionSpec(Optional.empty()); + } + + /** + * Setter for labels. + * + *

labels: The labels to be used for the Agent Engine. + */ + @JsonProperty("labels") + public abstract Builder labels(Map labels); + + @ExcludeFromGeneratedCoverageReport + abstract Builder labels(Optional> labels); + + /** Clears the value of labels field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLabels() { + return labels(Optional.empty()); + } + + /** + * Setter for classMethods. + * + *

classMethods: The class methods to be used for the Agent Engine. If specified, they'll + * override the class methods that are autogenerated by default. By default, methods are + * generated by inspecting the agent object and generating a corresponding method for each + * method defined on the agent class. + */ + @JsonProperty("classMethods") + public abstract Builder classMethods(List> classMethods); + + /** + * Setter for classMethods. + * + *

classMethods: The class methods to be used for the Agent Engine. If specified, they'll + * override the class methods that are autogenerated by default. By default, methods are + * generated by inspecting the agent object and generating a corresponding method for each + * method defined on the agent class. + */ + @CanIgnoreReturnValue + public Builder classMethods(Map... classMethods) { + return classMethods(Arrays.asList(classMethods)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder classMethods(Optional>> classMethods); + + /** Clears the value of classMethods field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearClassMethods() { + return classMethods(Optional.empty()); + } + + /** + * Setter for sourcePackages. + * + *

sourcePackages: The user-provided paths to the source packages (if any). If specified, the + * files in the source packages will be packed into a a tarball file, uploaded to Agent Engine's + * API, and deployed to the Agent Engine. The following fields will be ignored: - agent - + * extra_packages - staging_bucket - requirements The following fields will be used to install + * and use the agent from the source packages: - entrypoint_module (required) - + * entrypoint_object (required) - requirements_file (optional) - class_methods (required) + */ + @JsonProperty("sourcePackages") + public abstract Builder sourcePackages(List sourcePackages); + + /** + * Setter for sourcePackages. + * + *

sourcePackages: The user-provided paths to the source packages (if any). If specified, the + * files in the source packages will be packed into a a tarball file, uploaded to Agent Engine's + * API, and deployed to the Agent Engine. The following fields will be ignored: - agent - + * extra_packages - staging_bucket - requirements The following fields will be used to install + * and use the agent from the source packages: - entrypoint_module (required) - + * entrypoint_object (required) - requirements_file (optional) - class_methods (required) + */ + @CanIgnoreReturnValue + public Builder sourcePackages(String... sourcePackages) { + return sourcePackages(Arrays.asList(sourcePackages)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder sourcePackages(Optional> sourcePackages); + + /** Clears the value of sourcePackages field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSourcePackages() { + return sourcePackages(Optional.empty()); + } + + /** + * Setter for entrypointModule. + * + *

entrypointModule: The entrypoint module to be used for the Agent Engine This field only + * used when source_packages is specified. + */ + @JsonProperty("entrypointModule") + public abstract Builder entrypointModule(String entrypointModule); + + @ExcludeFromGeneratedCoverageReport + abstract Builder entrypointModule(Optional entrypointModule); + + /** Clears the value of entrypointModule field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEntrypointModule() { + return entrypointModule(Optional.empty()); + } + + /** + * Setter for entrypointObject. + * + *

entrypointObject: The entrypoint object to be used for the Agent Engine. This field only + * used when source_packages is specified. + */ + @JsonProperty("entrypointObject") + public abstract Builder entrypointObject(String entrypointObject); + + @ExcludeFromGeneratedCoverageReport + abstract Builder entrypointObject(Optional entrypointObject); + + /** Clears the value of entrypointObject field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEntrypointObject() { + return entrypointObject(Optional.empty()); + } + + /** + * Setter for requirementsFile. + * + *

requirementsFile: The user-provided path to the requirements file (if any). This field is + * only used when source_packages is specified. If not specified, agent engine will find and use + * the `requirements.txt` in the source package. + */ + @JsonProperty("requirementsFile") + public abstract Builder requirementsFile(String requirementsFile); + + @ExcludeFromGeneratedCoverageReport + abstract Builder requirementsFile(Optional requirementsFile); + + /** Clears the value of requirementsFile field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRequirementsFile() { + return requirementsFile(Optional.empty()); + } + + /** + * Setter for agentFramework. + * + *

agentFramework: The agent framework to be used for the Agent Engine. The OSS agent + * framework used to develop the agent. Currently supported values: "google-adk", "langchain", + * "langgraph", "ag2", "llama-index", "custom". If not specified: - If `agent` is specified, the + * agent framework will be auto-detected. - If `source_packages` is specified, the agent + * framework will default to "custom". + */ + @JsonProperty("agentFramework") + public abstract Builder agentFramework(AgentFramework agentFramework); + + @ExcludeFromGeneratedCoverageReport + abstract Builder agentFramework(Optional agentFramework); + + /** Clears the value of agentFramework field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAgentFramework() { + return agentFramework(Optional.empty()); + } + + /** + * Setter for agentFramework given a known enum. + * + *

agentFramework: The agent framework to be used for the Agent Engine. The OSS agent + * framework used to develop the agent. Currently supported values: "google-adk", "langchain", + * "langgraph", "ag2", "llama-index", "custom". If not specified: - If `agent` is specified, the + * agent framework will be auto-detected. - If `source_packages` is specified, the agent + * framework will default to "custom". + */ + @CanIgnoreReturnValue + public Builder agentFramework(AgentFramework.Known knownType) { + return agentFramework(new AgentFramework(knownType)); + } + + /** + * Setter for agentFramework given a string. + * + *

agentFramework: The agent framework to be used for the Agent Engine. The OSS agent + * framework used to develop the agent. Currently supported values: "google-adk", "langchain", + * "langgraph", "ag2", "llama-index", "custom". If not specified: - If `agent` is specified, the + * agent framework will be auto-detected. - If `source_packages` is specified, the agent + * framework will default to "custom". + */ + @CanIgnoreReturnValue + public Builder agentFramework(String agentFramework) { + return agentFramework(new AgentFramework(agentFramework)); + } + + /** + * Setter for pythonVersion. + * + *

pythonVersion: The Python version to be used for the Agent Engine. If not specified, it + * will use the current Python version of the environment. Supported versions: "3.9", "3.10", + * "3.11", "3.12", "3.13". + */ + @JsonProperty("pythonVersion") + public abstract Builder pythonVersion(PythonVersion pythonVersion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pythonVersion(Optional pythonVersion); + + /** Clears the value of pythonVersion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPythonVersion() { + return pythonVersion(Optional.empty()); + } + + /** + * Setter for pythonVersion given a known enum. + * + *

pythonVersion: The Python version to be used for the Agent Engine. If not specified, it + * will use the current Python version of the environment. Supported versions: "3.9", "3.10", + * "3.11", "3.12", "3.13". + */ + @CanIgnoreReturnValue + public Builder pythonVersion(PythonVersion.Known knownType) { + return pythonVersion(new PythonVersion(knownType)); + } + + /** + * Setter for pythonVersion given a string. + * + *

pythonVersion: The Python version to be used for the Agent Engine. If not specified, it + * will use the current Python version of the environment. Supported versions: "3.9", "3.10", + * "3.11", "3.12", "3.13". + */ + @CanIgnoreReturnValue + public Builder pythonVersion(String pythonVersion) { + return pythonVersion(new PythonVersion(pythonVersion)); + } + + /** + * Setter for buildOptions. + * + *

buildOptions: The build options for the Agent Engine. The following keys are supported: - + * installation_scripts: Optional. The paths to the installation scripts to be executed in the + * Docker image. The scripts must be located in the `installation_scripts` subdirectory and the + * path must be added to `extra_packages`. + */ + @JsonProperty("buildOptions") + public abstract Builder buildOptions(Map> buildOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder buildOptions(Optional>> buildOptions); + + /** Clears the value of buildOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBuildOptions() { + return buildOptions(Optional.empty()); + } + + public abstract CreateAgentEngineConfig build(); + } + + /** Deserializes a JSON string to a CreateAgentEngineConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateAgentEngineConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CreateAgentEngineConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineMemoryRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineMemoryRequestParameters.java new file mode 100644 index 000000000000..4fdc6739e6fc --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineMemoryRequestParameters.java @@ -0,0 +1,180 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Parameters for creating Agent Engine Memories. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = CreateAgentEngineMemoryRequestParameters.Builder.class) +public abstract class CreateAgentEngineMemoryRequestParameters extends JsonSerializable { + /** Name of the agent engine to create the memory under. */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * The fact of the memory. + * + *

This is the semantic knowledge extracted from the source content). + */ + @JsonProperty("fact") + public abstract Optional fact(); + + /** + * The scope of the memory. + * + *

Memories are isolated within their scope. The scope is defined when creating or generating + * memories. Up to 5 key-value pairs are accepted, andscope values cannot contain the wildcard + * character '*'. + */ + @JsonProperty("scope") + public abstract Optional> scope(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for CreateAgentEngineMemoryRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateAgentEngineMemoryRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateAgentEngineMemoryRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `CreateAgentEngineMemoryRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateAgentEngineMemoryRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine to create the memory under. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for fact. + * + *

fact: The fact of the memory. + * + *

This is the semantic knowledge extracted from the source content). + */ + @JsonProperty("fact") + public abstract Builder fact(String fact); + + @ExcludeFromGeneratedCoverageReport + abstract Builder fact(Optional fact); + + /** Clears the value of fact field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFact() { + return fact(Optional.empty()); + } + + /** + * Setter for scope. + * + *

scope: The scope of the memory. + * + *

Memories are isolated within their scope. The scope is defined when creating or generating + * memories. Up to 5 key-value pairs are accepted, andscope values cannot contain the wildcard + * character '*'. + */ + @JsonProperty("scope") + public abstract Builder scope(Map scope); + + @ExcludeFromGeneratedCoverageReport + abstract Builder scope(Optional> scope); + + /** Clears the value of scope field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScope() { + return scope(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(AgentEngineMemoryConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(AgentEngineMemoryConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract CreateAgentEngineMemoryRequestParameters build(); + } + + /** Deserializes a JSON string to a CreateAgentEngineMemoryRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateAgentEngineMemoryRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, CreateAgentEngineMemoryRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineRequestParameters.java new file mode 100644 index 000000000000..b34c730bbf44 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineRequestParameters.java @@ -0,0 +1,96 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for creating agent engines. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = CreateAgentEngineRequestParameters.Builder.class) +public abstract class CreateAgentEngineRequestParameters extends JsonSerializable { + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for CreateAgentEngineRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateAgentEngineRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateAgentEngineRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `CreateAgentEngineRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateAgentEngineRequestParameters.Builder(); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(CreateAgentEngineConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(CreateAgentEngineConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract CreateAgentEngineRequestParameters build(); + } + + /** Deserializes a JSON string to a CreateAgentEngineRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateAgentEngineRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CreateAgentEngineRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSandboxConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSandboxConfig.java new file mode 100644 index 000000000000..729657bd25f4 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSandboxConfig.java @@ -0,0 +1,173 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.time.Duration; +import java.util.Optional; + +/** Config for creating a Sandbox. */ +@AutoValue +@JsonDeserialize(builder = CreateAgentEngineSandboxConfig.Builder.class) +public abstract class CreateAgentEngineSandboxConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** The display name of the sandbox. */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** The description of the sandbox. */ + @JsonProperty("description") + public abstract Optional description(); + + /** Waits for the operation to complete before returning. */ + @JsonProperty("waitForCompletion") + public abstract Optional waitForCompletion(); + + /** The TTL for this resource. The expiration time is computed: now + TTL. */ + @JsonProperty("ttl") + public abstract Optional ttl(); + + /** Instantiates a builder for CreateAgentEngineSandboxConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateAgentEngineSandboxConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateAgentEngineSandboxConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `CreateAgentEngineSandboxConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateAgentEngineSandboxConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: The display name of the sandbox. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: The description of the sandbox. + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + /** + * Setter for waitForCompletion. + * + *

waitForCompletion: Waits for the operation to complete before returning. + */ + @JsonProperty("waitForCompletion") + public abstract Builder waitForCompletion(boolean waitForCompletion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder waitForCompletion(Optional waitForCompletion); + + /** Clears the value of waitForCompletion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWaitForCompletion() { + return waitForCompletion(Optional.empty()); + } + + /** + * Setter for ttl. + * + *

ttl: The TTL for this resource. The expiration time is computed: now + TTL. + */ + @JsonProperty("ttl") + public abstract Builder ttl(Duration ttl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder ttl(Optional ttl); + + /** Clears the value of ttl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTtl() { + return ttl(Optional.empty()); + } + + public abstract CreateAgentEngineSandboxConfig build(); + } + + /** Deserializes a JSON string to a CreateAgentEngineSandboxConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateAgentEngineSandboxConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CreateAgentEngineSandboxConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSandboxRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSandboxRequestParameters.java new file mode 100644 index 000000000000..86e37009d9f7 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSandboxRequestParameters.java @@ -0,0 +1,151 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for creating Agent Engine Sandboxes. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = CreateAgentEngineSandboxRequestParameters.Builder.class) +public abstract class CreateAgentEngineSandboxRequestParameters extends JsonSerializable { + /** Name of the agent engine to create the sandbox under. */ + @JsonProperty("name") + public abstract Optional name(); + + /** The specification of the sandbox. */ + @JsonProperty("spec") + public abstract Optional spec(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for CreateAgentEngineSandboxRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateAgentEngineSandboxRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateAgentEngineSandboxRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `CreateAgentEngineSandboxRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateAgentEngineSandboxRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine to create the sandbox under. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for spec. + * + *

spec: The specification of the sandbox. + */ + @JsonProperty("spec") + public abstract Builder spec(SandboxEnvironmentSpec spec); + + /** + * Setter for spec builder. + * + *

spec: The specification of the sandbox. + */ + @CanIgnoreReturnValue + public Builder spec(SandboxEnvironmentSpec.Builder specBuilder) { + return spec(specBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder spec(Optional spec); + + /** Clears the value of spec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSpec() { + return spec(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(CreateAgentEngineSandboxConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(CreateAgentEngineSandboxConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract CreateAgentEngineSandboxRequestParameters build(); + } + + /** Deserializes a JSON string to a CreateAgentEngineSandboxRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateAgentEngineSandboxRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, CreateAgentEngineSandboxRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSessionConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSessionConfig.java new file mode 100644 index 000000000000..31fc0a18f13d --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSessionConfig.java @@ -0,0 +1,237 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.time.Duration; +import java.time.Instant; +import java.util.Map; +import java.util.Optional; + +/** Config for creating a Session. */ +@AutoValue +@JsonDeserialize(builder = CreateAgentEngineSessionConfig.Builder.class) +public abstract class CreateAgentEngineSessionConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** The display name of the session. */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** Session state which stores key conversation points. */ + @JsonProperty("sessionState") + public abstract Optional> sessionState(); + + /** Waits for the operation to complete before returning. */ + @JsonProperty("waitForCompletion") + public abstract Optional waitForCompletion(); + + /** + * Optional. Input only. The TTL for this resource. + * + *

The expiration time is computed: now + TTL. + */ + @JsonProperty("ttl") + public abstract Optional ttl(); + + /** + * Optional. Timestamp of when this resource is considered expired. This is *always* provided on + * output, regardless of what `expiration` was sent on input. + */ + @JsonProperty("expireTime") + public abstract Optional expireTime(); + + /** + * Optional. The labels with user-defined metadata to organize your Sessions. Label keys and + * values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase + * letters, numeric characters, underscores and dashes. International characters are allowed. See + * https://goo.gl/xmQnxf for more information and examples of labels. + */ + @JsonProperty("labels") + public abstract Optional> labels(); + + /** Instantiates a builder for CreateAgentEngineSessionConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateAgentEngineSessionConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateAgentEngineSessionConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `CreateAgentEngineSessionConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateAgentEngineSessionConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: The display name of the session. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for sessionState. + * + *

sessionState: Session state which stores key conversation points. + */ + @JsonProperty("sessionState") + public abstract Builder sessionState(Map sessionState); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sessionState(Optional> sessionState); + + /** Clears the value of sessionState field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSessionState() { + return sessionState(Optional.empty()); + } + + /** + * Setter for waitForCompletion. + * + *

waitForCompletion: Waits for the operation to complete before returning. + */ + @JsonProperty("waitForCompletion") + public abstract Builder waitForCompletion(boolean waitForCompletion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder waitForCompletion(Optional waitForCompletion); + + /** Clears the value of waitForCompletion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWaitForCompletion() { + return waitForCompletion(Optional.empty()); + } + + /** + * Setter for ttl. + * + *

ttl: Optional. Input only. The TTL for this resource. + * + *

The expiration time is computed: now + TTL. + */ + @JsonProperty("ttl") + public abstract Builder ttl(Duration ttl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder ttl(Optional ttl); + + /** Clears the value of ttl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTtl() { + return ttl(Optional.empty()); + } + + /** + * Setter for expireTime. + * + *

expireTime: Optional. Timestamp of when this resource is considered expired. This is + * *always* provided on output, regardless of what `expiration` was sent on input. + */ + @JsonProperty("expireTime") + public abstract Builder expireTime(Instant expireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder expireTime(Optional expireTime); + + /** Clears the value of expireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExpireTime() { + return expireTime(Optional.empty()); + } + + /** + * Setter for labels. + * + *

labels: Optional. The labels with user-defined metadata to organize your Sessions. Label + * keys and values can be no longer than 64 characters (Unicode codepoints), can only contain + * lowercase letters, numeric characters, underscores and dashes. International characters are + * allowed. See https://goo.gl/xmQnxf for more information and examples of labels. + */ + @JsonProperty("labels") + public abstract Builder labels(Map labels); + + @ExcludeFromGeneratedCoverageReport + abstract Builder labels(Optional> labels); + + /** Clears the value of labels field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLabels() { + return labels(Optional.empty()); + } + + public abstract CreateAgentEngineSessionConfig build(); + } + + /** Deserializes a JSON string to a CreateAgentEngineSessionConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateAgentEngineSessionConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CreateAgentEngineSessionConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSessionRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSessionRequestParameters.java new file mode 100644 index 000000000000..27539425c3fd --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateAgentEngineSessionRequestParameters.java @@ -0,0 +1,141 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for creating Agent Engine Sessions. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = CreateAgentEngineSessionRequestParameters.Builder.class) +public abstract class CreateAgentEngineSessionRequestParameters extends JsonSerializable { + /** Name of the agent engine to create the session under. */ + @JsonProperty("name") + public abstract Optional name(); + + /** The user ID of the session. */ + @JsonProperty("userId") + public abstract Optional userId(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for CreateAgentEngineSessionRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateAgentEngineSessionRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateAgentEngineSessionRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `CreateAgentEngineSessionRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateAgentEngineSessionRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine to create the session under. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for userId. + * + *

userId: The user ID of the session. + */ + @JsonProperty("userId") + public abstract Builder userId(String userId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder userId(Optional userId); + + /** Clears the value of userId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUserId() { + return userId(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(CreateAgentEngineSessionConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(CreateAgentEngineSessionConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract CreateAgentEngineSessionRequestParameters build(); + } + + /** Deserializes a JSON string to a CreateAgentEngineSessionRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateAgentEngineSessionRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, CreateAgentEngineSessionRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateDatasetConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateDatasetConfig.java new file mode 100644 index 000000000000..80ae64771b91 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateDatasetConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for creating a dataset resource to store prompts. */ +@AutoValue +@JsonDeserialize(builder = CreateDatasetConfig.Builder.class) +public abstract class CreateDatasetConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for CreateDatasetConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateDatasetConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateDatasetConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `CreateDatasetConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateDatasetConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract CreateDatasetConfig build(); + } + + /** Deserializes a JSON string to a CreateDatasetConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateDatasetConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CreateDatasetConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateDatasetParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateDatasetParameters.java new file mode 100644 index 000000000000..2159a514cb88 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateDatasetParameters.java @@ -0,0 +1,258 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.EncryptionSpec; +import java.util.Optional; + +/** Parameters for creating a dataset resource to store prompts. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = CreateDatasetParameters.Builder.class) +public abstract class CreateDatasetParameters extends JsonSerializable { + /** */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** */ + @JsonProperty("metadataSchemaUri") + public abstract Optional metadataSchemaUri(); + + /** */ + @JsonProperty("metadata") + public abstract Optional metadata(); + + /** */ + @JsonProperty("description") + public abstract Optional description(); + + /** */ + @JsonProperty("encryptionSpec") + public abstract Optional encryptionSpec(); + + /** */ + @JsonProperty("modelReference") + public abstract Optional modelReference(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for CreateDatasetParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateDatasetParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateDatasetParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `CreateDatasetParameters.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateDatasetParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for metadataSchemaUri. + * + *

metadataSchemaUri: + */ + @JsonProperty("metadataSchemaUri") + public abstract Builder metadataSchemaUri(String metadataSchemaUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadataSchemaUri(Optional metadataSchemaUri); + + /** Clears the value of metadataSchemaUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadataSchemaUri() { + return metadataSchemaUri(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: + */ + @JsonProperty("metadata") + public abstract Builder metadata(SchemaTextPromptDatasetMetadata metadata); + + /** + * Setter for metadata builder. + * + *

metadata: + */ + @CanIgnoreReturnValue + public Builder metadata(SchemaTextPromptDatasetMetadata.Builder metadataBuilder) { + return metadata(metadataBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + /** + * Setter for encryptionSpec. + * + *

encryptionSpec: + */ + @JsonProperty("encryptionSpec") + public abstract Builder encryptionSpec(EncryptionSpec encryptionSpec); + + @ExcludeFromGeneratedCoverageReport + abstract Builder encryptionSpec(Optional encryptionSpec); + + /** Clears the value of encryptionSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEncryptionSpec() { + return encryptionSpec(Optional.empty()); + } + + /** + * Setter for modelReference. + * + *

modelReference: + */ + @JsonProperty("modelReference") + public abstract Builder modelReference(String modelReference); + + @ExcludeFromGeneratedCoverageReport + abstract Builder modelReference(Optional modelReference); + + /** Clears the value of modelReference field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearModelReference() { + return modelReference(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(CreateDatasetConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(CreateDatasetConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract CreateDatasetParameters build(); + } + + /** Deserializes a JSON string to a CreateDatasetParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateDatasetParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CreateDatasetParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateDatasetVersionConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateDatasetVersionConfig.java new file mode 100644 index 000000000000..292acfe1ea90 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateDatasetVersionConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for creating a dataset version resource to store prompts. */ +@AutoValue +@JsonDeserialize(builder = CreateDatasetVersionConfig.Builder.class) +public abstract class CreateDatasetVersionConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for CreateDatasetVersionConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateDatasetVersionConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateDatasetVersionConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `CreateDatasetVersionConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateDatasetVersionConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract CreateDatasetVersionConfig build(); + } + + /** Deserializes a JSON string to a CreateDatasetVersionConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateDatasetVersionConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CreateDatasetVersionConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateDatasetVersionParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateDatasetVersionParameters.java new file mode 100644 index 000000000000..af1bb49ee2a9 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateDatasetVersionParameters.java @@ -0,0 +1,215 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents the create dataset version parameters. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = CreateDatasetVersionParameters.Builder.class) +public abstract class CreateDatasetVersionParameters extends JsonSerializable { + /** */ + @JsonProperty("datasetName") + public abstract Optional datasetName(); + + /** */ + @JsonProperty("metadata") + public abstract Optional metadata(); + + /** */ + @JsonProperty("modelReference") + public abstract Optional modelReference(); + + /** */ + @JsonProperty("parent") + public abstract Optional parent(); + + /** */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for CreateDatasetVersionParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateDatasetVersionParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateDatasetVersionParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `CreateDatasetVersionParameters.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateDatasetVersionParameters.Builder(); + } + + /** + * Setter for datasetName. + * + *

datasetName: + */ + @JsonProperty("datasetName") + public abstract Builder datasetName(String datasetName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder datasetName(Optional datasetName); + + /** Clears the value of datasetName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDatasetName() { + return datasetName(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: + */ + @JsonProperty("metadata") + public abstract Builder metadata(SchemaTextPromptDatasetMetadata metadata); + + /** + * Setter for metadata builder. + * + *

metadata: + */ + @CanIgnoreReturnValue + public Builder metadata(SchemaTextPromptDatasetMetadata.Builder metadataBuilder) { + return metadata(metadataBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for modelReference. + * + *

modelReference: + */ + @JsonProperty("modelReference") + public abstract Builder modelReference(String modelReference); + + @ExcludeFromGeneratedCoverageReport + abstract Builder modelReference(Optional modelReference); + + /** Clears the value of modelReference field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearModelReference() { + return modelReference(Optional.empty()); + } + + /** + * Setter for parent. + * + *

parent: + */ + @JsonProperty("parent") + public abstract Builder parent(String parent); + + @ExcludeFromGeneratedCoverageReport + abstract Builder parent(Optional parent); + + /** Clears the value of parent field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearParent() { + return parent(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(CreateDatasetVersionConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(CreateDatasetVersionConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract CreateDatasetVersionParameters build(); + } + + /** Deserializes a JSON string to a CreateDatasetVersionParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateDatasetVersionParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CreateDatasetVersionParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateEvaluationItemConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateEvaluationItemConfig.java new file mode 100644 index 000000000000..a13bdfdd923f --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateEvaluationItemConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config to create an evaluation item. */ +@AutoValue +@JsonDeserialize(builder = CreateEvaluationItemConfig.Builder.class) +public abstract class CreateEvaluationItemConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for CreateEvaluationItemConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateEvaluationItemConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateEvaluationItemConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `CreateEvaluationItemConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateEvaluationItemConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract CreateEvaluationItemConfig build(); + } + + /** Deserializes a JSON string to a CreateEvaluationItemConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateEvaluationItemConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CreateEvaluationItemConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateEvaluationItemParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateEvaluationItemParameters.java new file mode 100644 index 000000000000..42dcd7f4c424 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateEvaluationItemParameters.java @@ -0,0 +1,161 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents a job that creates an evaluation item. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = CreateEvaluationItemParameters.Builder.class) +public abstract class CreateEvaluationItemParameters extends JsonSerializable { + /** */ + @JsonProperty("evaluationItemType") + public abstract Optional evaluationItemType(); + + /** */ + @JsonProperty("gcsUri") + public abstract Optional gcsUri(); + + /** */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for CreateEvaluationItemParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateEvaluationItemParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateEvaluationItemParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `CreateEvaluationItemParameters.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateEvaluationItemParameters.Builder(); + } + + /** + * Setter for evaluationItemType. + * + *

evaluationItemType: + */ + @JsonProperty("evaluationItemType") + public abstract Builder evaluationItemType(String evaluationItemType); + + @ExcludeFromGeneratedCoverageReport + abstract Builder evaluationItemType(Optional evaluationItemType); + + /** Clears the value of evaluationItemType field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvaluationItemType() { + return evaluationItemType(Optional.empty()); + } + + /** + * Setter for gcsUri. + * + *

gcsUri: + */ + @JsonProperty("gcsUri") + public abstract Builder gcsUri(String gcsUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder gcsUri(Optional gcsUri); + + /** Clears the value of gcsUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGcsUri() { + return gcsUri(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(CreateEvaluationItemConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(CreateEvaluationItemConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract CreateEvaluationItemParameters build(); + } + + /** Deserializes a JSON string to a CreateEvaluationItemParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateEvaluationItemParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CreateEvaluationItemParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateEvaluationSetConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateEvaluationSetConfig.java new file mode 100644 index 000000000000..28eff1694fdc --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateEvaluationSetConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config to create an evaluation set. */ +@AutoValue +@JsonDeserialize(builder = CreateEvaluationSetConfig.Builder.class) +public abstract class CreateEvaluationSetConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for CreateEvaluationSetConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateEvaluationSetConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateEvaluationSetConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `CreateEvaluationSetConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateEvaluationSetConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract CreateEvaluationSetConfig build(); + } + + /** Deserializes a JSON string to a CreateEvaluationSetConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateEvaluationSetConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CreateEvaluationSetConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateEvaluationSetParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateEvaluationSetParameters.java new file mode 100644 index 000000000000..2c9fe2fdb687 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateEvaluationSetParameters.java @@ -0,0 +1,151 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Represents a job that creates an evaluation set. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = CreateEvaluationSetParameters.Builder.class) +public abstract class CreateEvaluationSetParameters extends JsonSerializable { + /** */ + @JsonProperty("evaluationItems") + public abstract Optional> evaluationItems(); + + /** */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for CreateEvaluationSetParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateEvaluationSetParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateEvaluationSetParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `CreateEvaluationSetParameters.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateEvaluationSetParameters.Builder(); + } + + /** + * Setter for evaluationItems. + * + *

evaluationItems: + */ + @JsonProperty("evaluationItems") + public abstract Builder evaluationItems(List evaluationItems); + + /** + * Setter for evaluationItems. + * + *

evaluationItems: + */ + @CanIgnoreReturnValue + public Builder evaluationItems(String... evaluationItems) { + return evaluationItems(Arrays.asList(evaluationItems)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder evaluationItems(Optional> evaluationItems); + + /** Clears the value of evaluationItems field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvaluationItems() { + return evaluationItems(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(CreateEvaluationSetConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(CreateEvaluationSetConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract CreateEvaluationSetParameters build(); + } + + /** Deserializes a JSON string to a CreateEvaluationSetParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateEvaluationSetParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CreateEvaluationSetParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateMultimodalDatasetConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateMultimodalDatasetConfig.java new file mode 100644 index 000000000000..9878acada6d9 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateMultimodalDatasetConfig.java @@ -0,0 +1,110 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for creating a dataset resource to store multimodal dataset. */ +@AutoValue +@JsonDeserialize(builder = CreateMultimodalDatasetConfig.Builder.class) +public abstract class CreateMultimodalDatasetConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** + * The timeout for the create dataset request in seconds. If not set, the default timeout is 90 + * seconds. + */ + @JsonProperty("timeout") + public abstract Optional timeout(); + + /** Instantiates a builder for CreateMultimodalDatasetConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateMultimodalDatasetConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateMultimodalDatasetConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `CreateMultimodalDatasetConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateMultimodalDatasetConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for timeout. + * + *

timeout: The timeout for the create dataset request in seconds. If not set, the default + * timeout is 90 seconds. + */ + @JsonProperty("timeout") + public abstract Builder timeout(Integer timeout); + + @ExcludeFromGeneratedCoverageReport + abstract Builder timeout(Optional timeout); + + /** Clears the value of timeout field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTimeout() { + return timeout(Optional.empty()); + } + + public abstract CreateMultimodalDatasetConfig build(); + } + + /** Deserializes a JSON string to a CreateMultimodalDatasetConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateMultimodalDatasetConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CreateMultimodalDatasetConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateMultimodalDatasetParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateMultimodalDatasetParameters.java new file mode 100644 index 000000000000..ba9b4d1d52d4 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreateMultimodalDatasetParameters.java @@ -0,0 +1,239 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.EncryptionSpec; +import java.util.Optional; + +/** Parameters for creating a dataset resource to store multimodal dataset. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = CreateMultimodalDatasetParameters.Builder.class) +public abstract class CreateMultimodalDatasetParameters extends JsonSerializable { + /** */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** */ + @JsonProperty("metadataSchemaUri") + public abstract Optional metadataSchemaUri(); + + /** */ + @JsonProperty("metadata") + public abstract Optional metadata(); + + /** */ + @JsonProperty("description") + public abstract Optional description(); + + /** */ + @JsonProperty("encryptionSpec") + public abstract Optional encryptionSpec(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for CreateMultimodalDatasetParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreateMultimodalDatasetParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreateMultimodalDatasetParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `CreateMultimodalDatasetParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreateMultimodalDatasetParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for metadataSchemaUri. + * + *

metadataSchemaUri: + */ + @JsonProperty("metadataSchemaUri") + public abstract Builder metadataSchemaUri(String metadataSchemaUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadataSchemaUri(Optional metadataSchemaUri); + + /** Clears the value of metadataSchemaUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadataSchemaUri() { + return metadataSchemaUri(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: + */ + @JsonProperty("metadata") + public abstract Builder metadata(SchemaTablesDatasetMetadata metadata); + + /** + * Setter for metadata builder. + * + *

metadata: + */ + @CanIgnoreReturnValue + public Builder metadata(SchemaTablesDatasetMetadata.Builder metadataBuilder) { + return metadata(metadataBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + /** + * Setter for encryptionSpec. + * + *

encryptionSpec: + */ + @JsonProperty("encryptionSpec") + public abstract Builder encryptionSpec(EncryptionSpec encryptionSpec); + + @ExcludeFromGeneratedCoverageReport + abstract Builder encryptionSpec(Optional encryptionSpec); + + /** Clears the value of encryptionSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEncryptionSpec() { + return encryptionSpec(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(CreateMultimodalDatasetConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(CreateMultimodalDatasetConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract CreateMultimodalDatasetParameters build(); + } + + /** Deserializes a JSON string to a CreateMultimodalDatasetParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static CreateMultimodalDatasetParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CreateMultimodalDatasetParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreatePromptConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreatePromptConfig.java new file mode 100644 index 000000000000..9689f8be3e91 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreatePromptConfig.java @@ -0,0 +1,158 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.EncryptionSpec; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for creating a prompt. */ +@AutoValue +@JsonDeserialize(builder = CreatePromptConfig.Builder.class) +public abstract class CreatePromptConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** The display name for the prompt. If not set, a default name with a timestamp will be used. */ + @JsonProperty("promptDisplayName") + public abstract Optional promptDisplayName(); + + /** + * The timeout for the create_version request in seconds. If not set, the default timeout is 90 + * seconds. + */ + @JsonProperty("timeout") + public abstract Optional timeout(); + + /** + * Customer-managed encryption key spec for a prompt dataset. If set, this prompt dataset and all + * sub-resources of this prompt dataset will be secured by this key. + */ + @JsonProperty("encryptionSpec") + public abstract Optional encryptionSpec(); + + /** Instantiates a builder for CreatePromptConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreatePromptConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreatePromptConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `CreatePromptConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreatePromptConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for promptDisplayName. + * + *

promptDisplayName: The display name for the prompt. If not set, a default name with a + * timestamp will be used. + */ + @JsonProperty("promptDisplayName") + public abstract Builder promptDisplayName(String promptDisplayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder promptDisplayName(Optional promptDisplayName); + + /** Clears the value of promptDisplayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPromptDisplayName() { + return promptDisplayName(Optional.empty()); + } + + /** + * Setter for timeout. + * + *

timeout: The timeout for the create_version request in seconds. If not set, the default + * timeout is 90 seconds. + */ + @JsonProperty("timeout") + public abstract Builder timeout(Integer timeout); + + @ExcludeFromGeneratedCoverageReport + abstract Builder timeout(Optional timeout); + + /** Clears the value of timeout field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTimeout() { + return timeout(Optional.empty()); + } + + /** + * Setter for encryptionSpec. + * + *

encryptionSpec: Customer-managed encryption key spec for a prompt dataset. If set, this + * prompt dataset and all sub-resources of this prompt dataset will be secured by this key. + */ + @JsonProperty("encryptionSpec") + public abstract Builder encryptionSpec(EncryptionSpec encryptionSpec); + + @ExcludeFromGeneratedCoverageReport + abstract Builder encryptionSpec(Optional encryptionSpec); + + /** Clears the value of encryptionSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEncryptionSpec() { + return encryptionSpec(Optional.empty()); + } + + public abstract CreatePromptConfig build(); + } + + /** Deserializes a JSON string to a CreatePromptConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static CreatePromptConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CreatePromptConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreatePromptVersionConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreatePromptVersionConfig.java new file mode 100644 index 000000000000..436ac6613a73 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CreatePromptVersionConfig.java @@ -0,0 +1,134 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for creating a prompt version. */ +@AutoValue +@JsonDeserialize(builder = CreatePromptVersionConfig.Builder.class) +public abstract class CreatePromptVersionConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** + * The display name for the prompt version. If not set, a default name with a timestamp will be + * used. + */ + @JsonProperty("versionDisplayName") + public abstract Optional versionDisplayName(); + + /** + * The timeout for the create_version request in seconds. If not set, the default timeout is 90 + * seconds. + */ + @JsonProperty("timeout") + public abstract Optional timeout(); + + /** Instantiates a builder for CreatePromptVersionConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CreatePromptVersionConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CreatePromptVersionConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `CreatePromptVersionConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_CreatePromptVersionConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for versionDisplayName. + * + *

versionDisplayName: The display name for the prompt version. If not set, a default name + * with a timestamp will be used. + */ + @JsonProperty("versionDisplayName") + public abstract Builder versionDisplayName(String versionDisplayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder versionDisplayName(Optional versionDisplayName); + + /** Clears the value of versionDisplayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearVersionDisplayName() { + return versionDisplayName(Optional.empty()); + } + + /** + * Setter for timeout. + * + *

timeout: The timeout for the create_version request in seconds. If not set, the default + * timeout is 90 seconds. + */ + @JsonProperty("timeout") + public abstract Builder timeout(Integer timeout); + + @ExcludeFromGeneratedCoverageReport + abstract Builder timeout(Optional timeout); + + /** Clears the value of timeout field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTimeout() { + return timeout(Optional.empty()); + } + + public abstract CreatePromptVersionConfig build(); + } + + /** Deserializes a JSON string to a CreatePromptVersionConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static CreatePromptVersionConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CreatePromptVersionConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CustomJob.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CustomJob.java new file mode 100644 index 000000000000..c51250c3f550 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CustomJob.java @@ -0,0 +1,443 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.EncryptionSpec; +import com.google.genai.types.GoogleRpcStatus; +import com.google.genai.types.JobState; +import java.time.Instant; +import java.util.Map; +import java.util.Optional; + +/** Represents a job that runs custom workloads such as a Docker container or a Python package. */ +@AutoValue +@JsonDeserialize(builder = CustomJob.Builder.class) +public abstract class CustomJob extends JsonSerializable { + /** + * Required. The display name of the CustomJob. The name can be up to 128 characters long and can + * consist of any UTF-8 characters. + */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** Required. Job spec. */ + @JsonProperty("jobSpec") + public abstract Optional jobSpec(); + + /** + * Customer-managed encryption key options for a CustomJob. If this is set, then all resources + * created by the CustomJob will be encrypted with the provided encryption key. + */ + @JsonProperty("encryptionSpec") + public abstract Optional encryptionSpec(); + + /** Output only. The detailed state of the job. */ + @JsonProperty("state") + public abstract Optional state(); + + /** + * Output only. Only populated when job's state is `JOB_STATE_FAILED` or `JOB_STATE_CANCELLED`. + */ + @JsonProperty("error") + public abstract Optional error(); + + /** Output only. Time when the CustomJob was created. */ + @JsonProperty("createTime") + public abstract Optional createTime(); + + /** + * Output only. Time when the CustomJob entered any of the following states: + * `JOB_STATE_SUCCEEDED`, `JOB_STATE_FAILED`, `JOB_STATE_CANCELLED`. + */ + @JsonProperty("endTime") + public abstract Optional endTime(); + + /** + * The labels with user-defined metadata to organize CustomJobs. Label keys and values can be no + * longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. See + * https://goo.gl/xmQnxf for more information and examples of labels. + */ + @JsonProperty("labels") + public abstract Optional> labels(); + + /** Output only. Resource name of a CustomJob. */ + @JsonProperty("name") + public abstract Optional name(); + + /** Output only. Reserved for future use. */ + @JsonProperty("satisfiesPzi") + public abstract Optional satisfiesPzi(); + + /** Output only. Reserved for future use. */ + @JsonProperty("satisfiesPzs") + public abstract Optional satisfiesPzs(); + + /** + * Output only. Time when the CustomJob for the first time entered the `JOB_STATE_RUNNING` state. + */ + @JsonProperty("startTime") + public abstract Optional startTime(); + + /** Output only. Time when the CustomJob was most recently updated. */ + @JsonProperty("updateTime") + public abstract Optional updateTime(); + + /** + * Output only. URIs for accessing [interactive + * shells](https://cloud.google.com/vertex-ai/docs/training/monitor-debug-interactive-shell) (one + * URI for each training node). Only available if job_spec.enable_web_access is `true`. The keys + * are names of each node in the training job; for example, `workerpool0-0` for the primary node, + * `workerpool1-0` for the first node in the second worker pool, and `workerpool1-1` for the + * second node in the second worker pool. The values are the URIs for each node's interactive + * shell. + */ + @JsonProperty("webAccessUris") + public abstract Optional> webAccessUris(); + + /** Instantiates a builder for CustomJob. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CustomJob.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CustomJob. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `CustomJob.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_CustomJob.Builder(); + } + + /** + * Setter for displayName. + * + *

displayName: Required. The display name of the CustomJob. The name can be up to 128 + * characters long and can consist of any UTF-8 characters. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for jobSpec. + * + *

jobSpec: Required. Job spec. + */ + @JsonProperty("jobSpec") + public abstract Builder jobSpec(CustomJobSpec jobSpec); + + /** + * Setter for jobSpec builder. + * + *

jobSpec: Required. Job spec. + */ + @CanIgnoreReturnValue + public Builder jobSpec(CustomJobSpec.Builder jobSpecBuilder) { + return jobSpec(jobSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder jobSpec(Optional jobSpec); + + /** Clears the value of jobSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearJobSpec() { + return jobSpec(Optional.empty()); + } + + /** + * Setter for encryptionSpec. + * + *

encryptionSpec: Customer-managed encryption key options for a CustomJob. If this is set, + * then all resources created by the CustomJob will be encrypted with the provided encryption + * key. + */ + @JsonProperty("encryptionSpec") + public abstract Builder encryptionSpec(EncryptionSpec encryptionSpec); + + @ExcludeFromGeneratedCoverageReport + abstract Builder encryptionSpec(Optional encryptionSpec); + + /** Clears the value of encryptionSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEncryptionSpec() { + return encryptionSpec(Optional.empty()); + } + + /** + * Setter for state. + * + *

state: Output only. The detailed state of the job. + */ + @JsonProperty("state") + public abstract Builder state(JobState state); + + @ExcludeFromGeneratedCoverageReport + abstract Builder state(Optional state); + + /** Clears the value of state field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearState() { + return state(Optional.empty()); + } + + /** + * Setter for state given a known enum. + * + *

state: Output only. The detailed state of the job. + */ + @CanIgnoreReturnValue + public Builder state(JobState.Known knownType) { + return state(new JobState(knownType)); + } + + /** + * Setter for state given a string. + * + *

state: Output only. The detailed state of the job. + */ + @CanIgnoreReturnValue + public Builder state(String state) { + return state(new JobState(state)); + } + + /** + * Setter for error. + * + *

error: Output only. Only populated when job's state is `JOB_STATE_FAILED` or + * `JOB_STATE_CANCELLED`. + */ + @JsonProperty("error") + public abstract Builder error(GoogleRpcStatus error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + /** + * Setter for createTime. + * + *

createTime: Output only. Time when the CustomJob was created. + */ + @JsonProperty("createTime") + public abstract Builder createTime(Instant createTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder createTime(Optional createTime); + + /** Clears the value of createTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCreateTime() { + return createTime(Optional.empty()); + } + + /** + * Setter for endTime. + * + *

endTime: Output only. Time when the CustomJob entered any of the following states: + * `JOB_STATE_SUCCEEDED`, `JOB_STATE_FAILED`, `JOB_STATE_CANCELLED`. + */ + @JsonProperty("endTime") + public abstract Builder endTime(Instant endTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder endTime(Optional endTime); + + /** Clears the value of endTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEndTime() { + return endTime(Optional.empty()); + } + + /** + * Setter for labels. + * + *

labels: The labels with user-defined metadata to organize CustomJobs. Label keys and + * values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase + * letters, numeric characters, underscores and dashes. International characters are allowed. + * See https://goo.gl/xmQnxf for more information and examples of labels. + */ + @JsonProperty("labels") + public abstract Builder labels(Map labels); + + @ExcludeFromGeneratedCoverageReport + abstract Builder labels(Optional> labels); + + /** Clears the value of labels field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLabels() { + return labels(Optional.empty()); + } + + /** + * Setter for name. + * + *

name: Output only. Resource name of a CustomJob. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for satisfiesPzi. + * + *

satisfiesPzi: Output only. Reserved for future use. + */ + @JsonProperty("satisfiesPzi") + public abstract Builder satisfiesPzi(boolean satisfiesPzi); + + @ExcludeFromGeneratedCoverageReport + abstract Builder satisfiesPzi(Optional satisfiesPzi); + + /** Clears the value of satisfiesPzi field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSatisfiesPzi() { + return satisfiesPzi(Optional.empty()); + } + + /** + * Setter for satisfiesPzs. + * + *

satisfiesPzs: Output only. Reserved for future use. + */ + @JsonProperty("satisfiesPzs") + public abstract Builder satisfiesPzs(boolean satisfiesPzs); + + @ExcludeFromGeneratedCoverageReport + abstract Builder satisfiesPzs(Optional satisfiesPzs); + + /** Clears the value of satisfiesPzs field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSatisfiesPzs() { + return satisfiesPzs(Optional.empty()); + } + + /** + * Setter for startTime. + * + *

startTime: Output only. Time when the CustomJob for the first time entered the + * `JOB_STATE_RUNNING` state. + */ + @JsonProperty("startTime") + public abstract Builder startTime(Instant startTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder startTime(Optional startTime); + + /** Clears the value of startTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearStartTime() { + return startTime(Optional.empty()); + } + + /** + * Setter for updateTime. + * + *

updateTime: Output only. Time when the CustomJob was most recently updated. + */ + @JsonProperty("updateTime") + public abstract Builder updateTime(Instant updateTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder updateTime(Optional updateTime); + + /** Clears the value of updateTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUpdateTime() { + return updateTime(Optional.empty()); + } + + /** + * Setter for webAccessUris. + * + *

webAccessUris: Output only. URIs for accessing [interactive + * shells](https://cloud.google.com/vertex-ai/docs/training/monitor-debug-interactive-shell) + * (one URI for each training node). Only available if job_spec.enable_web_access is `true`. The + * keys are names of each node in the training job; for example, `workerpool0-0` for the primary + * node, `workerpool1-0` for the first node in the second worker pool, and `workerpool1-1` for + * the second node in the second worker pool. The values are the URIs for each node's + * interactive shell. + */ + @JsonProperty("webAccessUris") + public abstract Builder webAccessUris(Map webAccessUris); + + @ExcludeFromGeneratedCoverageReport + abstract Builder webAccessUris(Optional> webAccessUris); + + /** Clears the value of webAccessUris field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWebAccessUris() { + return webAccessUris(Optional.empty()); + } + + public abstract CustomJob build(); + } + + /** Deserializes a JSON string to a CustomJob object. */ + @ExcludeFromGeneratedCoverageReport + public static CustomJob fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CustomJob.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CustomJobParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CustomJobParameters.java new file mode 100644 index 000000000000..982fafdacc99 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CustomJobParameters.java @@ -0,0 +1,125 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents a job that runs custom workloads such as a Docker container or a Python package. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = CustomJobParameters.Builder.class) +public abstract class CustomJobParameters extends JsonSerializable { + /** */ + @JsonProperty("customJob") + public abstract Optional customJob(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for CustomJobParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CustomJobParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CustomJobParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `CustomJobParameters.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_CustomJobParameters.Builder(); + } + + /** + * Setter for customJob. + * + *

customJob: + */ + @JsonProperty("customJob") + public abstract Builder customJob(CustomJob customJob); + + /** + * Setter for customJob builder. + * + *

customJob: + */ + @CanIgnoreReturnValue + public Builder customJob(CustomJob.Builder customJobBuilder) { + return customJob(customJobBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder customJob(Optional customJob); + + /** Clears the value of customJob field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCustomJob() { + return customJob(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(VertexBaseConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(VertexBaseConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract CustomJobParameters build(); + } + + /** Deserializes a JSON string to a CustomJobParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static CustomJobParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CustomJobParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CustomJobSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CustomJobSpec.java new file mode 100644 index 000000000000..d1aa07bf79b1 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CustomJobSpec.java @@ -0,0 +1,588 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.GcsDestination; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Represents a job that runs custom workloads such as a Docker container or a Python package. */ +@AutoValue +@JsonDeserialize(builder = CustomJobSpec.Builder.class) +public abstract class CustomJobSpec extends JsonSerializable { + /** + * The Cloud Storage location to store the output of this CustomJob or HyperparameterTuningJob. + * For HyperparameterTuningJob, the baseOutputDirectory of each child CustomJob backing a Trial is + * set to a subdirectory of name id under its parent HyperparameterTuningJob's + * baseOutputDirectory. The following Vertex AI environment variables will be passed to containers + * or python modules when this field is set: For CustomJob: * AIP_MODEL_DIR = `/model/` * + * AIP_CHECKPOINT_DIR = `/checkpoints/` * AIP_TENSORBOARD_LOG_DIR = `/logs/` For CustomJob backing + * a Trial of HyperparameterTuningJob: * AIP_MODEL_DIR = `//model/` * AIP_CHECKPOINT_DIR = + * `//checkpoints/` * AIP_TENSORBOARD_LOG_DIR = `//logs/` + */ + @JsonProperty("baseOutputDirectory") + public abstract Optional baseOutputDirectory(); + + /** + * Optional. Whether you want Vertex AI to enable access to the customized dashboard in training + * chief container. If set to `true`, you can access the dashboard at the URIs given by + * CustomJob.web_access_uris or Trial.web_access_uris (within HyperparameterTuningJob.trials). + */ + @JsonProperty("enableDashboardAccess") + public abstract Optional enableDashboardAccess(); + + /** + * Optional. Whether you want Vertex AI to enable [interactive shell + * access](https://cloud.google.com/vertex-ai/docs/training/monitor-debug-interactive-shell) to + * training containers. If set to `true`, you can access interactive shells at the URIs given by + * CustomJob.web_access_uris or Trial.web_access_uris (within HyperparameterTuningJob.trials). + */ + @JsonProperty("enableWebAccess") + public abstract Optional enableWebAccess(); + + /** + * Optional. The Experiment associated with this job. Format: + * `projects/{project}/locations/{location}/metadataStores/{metadataStores}/contexts/{experiment-name}` + */ + @JsonProperty("experiment") + public abstract Optional experiment(); + + /** + * Optional. The Experiment Run associated with this job. Format: + * `projects/{project}/locations/{location}/metadataStores/{metadataStores}/contexts/{experiment-name}-{experiment-run-name}` + */ + @JsonProperty("experimentRun") + public abstract Optional experimentRun(); + + /** + * Optional. The name of the Model resources for which to generate a mapping to artifact URIs. + * Applicable only to some of the Google-provided custom jobs. Format: + * `projects/{project}/locations/{location}/models/{model}` In order to retrieve a specific + * version of the model, also provide the version ID or version alias. Example: + * `projects/{project}/locations/{location}/models/{model}@2` or + * `projects/{project}/locations/{location}/models/{model}@golden` If no version ID or alias is + * specified, the "default" version will be returned. The "default" version alias is created for + * the first version of the model, and can be moved to other versions later on. There will be + * exactly one default version. + */ + @JsonProperty("models") + public abstract Optional> models(); + + /** + * Optional. The full name of the Compute Engine + * [network](/compute/docs/networks-and-firewalls#networks) to which the Job should be peered. For + * example, `projects/12345/global/networks/myVPC`. + * [Format](/compute/docs/reference/rest/v1/networks/insert) is of the form + * `projects/{project}/global/networks/{network}`. Where {project} is a project number, as in + * `12345`, and {network} is a network name. To specify this field, you must have already + * [configured VPC Network Peering for Vertex + * AI](https://cloud.google.com/vertex-ai/docs/general/vpc-peering). If this field is left + * unspecified, the job is not peered with any network. + */ + @JsonProperty("network") + public abstract Optional network(); + + /** + * Optional. The ID of the PersistentResource in the same Project and Location which to run If + * this is specified, the job will be run on existing machines held by the PersistentResource + * instead of on-demand short-live machines. The network and CMEK configs on the job should be + * consistent with those on the PersistentResource, otherwise, the job will be rejected. + */ + @JsonProperty("persistentResourceId") + public abstract Optional persistentResourceId(); + + /** + * The ID of the location to store protected artifacts. e.g. us-central1. Populate only when the + * location is different than CustomJob location. List of supported locations: + * https://cloud.google.com/vertex-ai/docs/general/locations + */ + @JsonProperty("protectedArtifactLocationId") + public abstract Optional protectedArtifactLocationId(); + + /** Optional. Configuration for PSC-I for CustomJob. */ + @JsonProperty("pscInterfaceConfig") + public abstract Optional pscInterfaceConfig(); + + /** + * Optional. A list of names for the reserved ip ranges under the VPC network that can be used for + * this job. If set, we will deploy the job within the provided ip ranges. Otherwise, the job will + * be deployed to any ip ranges under the provided VPC network. Example: ['vertex-ai-ip-range']. + */ + @JsonProperty("reservedIpRanges") + public abstract Optional> reservedIpRanges(); + + /** Scheduling options for a CustomJob. */ + @JsonProperty("scheduling") + public abstract Optional scheduling(); + + /** + * Specifies the service account for workload run-as account. Users submitting jobs must have + * act-as permission on this run-as account. If unspecified, the [Vertex AI Custom Code Service + * Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) for the + * CustomJob's project is used. + */ + @JsonProperty("serviceAccount") + public abstract Optional serviceAccount(); + + /** + * Optional. The name of a Vertex AI Tensorboard resource to which this CustomJob will upload + * Tensorboard logs. Format: `projects/{project}/locations/{location}/tensorboards/{tensorboard}` + */ + @JsonProperty("tensorboard") + public abstract Optional tensorboard(); + + /** + * Required. The spec of the worker pools including machine type and Docker image. All worker + * pools except the first one are optional and can be skipped by providing an empty value. + */ + @JsonProperty("workerPoolSpecs") + public abstract Optional> workerPoolSpecs(); + + /** Instantiates a builder for CustomJobSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CustomJobSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CustomJobSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `CustomJobSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_CustomJobSpec.Builder(); + } + + /** + * Setter for baseOutputDirectory. + * + *

baseOutputDirectory: The Cloud Storage location to store the output of this CustomJob or + * HyperparameterTuningJob. For HyperparameterTuningJob, the baseOutputDirectory of each child + * CustomJob backing a Trial is set to a subdirectory of name id under its parent + * HyperparameterTuningJob's baseOutputDirectory. The following Vertex AI environment variables + * will be passed to containers or python modules when this field is set: For CustomJob: * + * AIP_MODEL_DIR = `/model/` * AIP_CHECKPOINT_DIR = `/checkpoints/` * AIP_TENSORBOARD_LOG_DIR = + * `/logs/` For CustomJob backing a Trial of HyperparameterTuningJob: * AIP_MODEL_DIR = + * `//model/` * AIP_CHECKPOINT_DIR = `//checkpoints/` * AIP_TENSORBOARD_LOG_DIR = `//logs/` + */ + @JsonProperty("baseOutputDirectory") + public abstract Builder baseOutputDirectory(GcsDestination baseOutputDirectory); + + @ExcludeFromGeneratedCoverageReport + abstract Builder baseOutputDirectory(Optional baseOutputDirectory); + + /** Clears the value of baseOutputDirectory field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBaseOutputDirectory() { + return baseOutputDirectory(Optional.empty()); + } + + /** + * Setter for enableDashboardAccess. + * + *

enableDashboardAccess: Optional. Whether you want Vertex AI to enable access to the + * customized dashboard in training chief container. If set to `true`, you can access the + * dashboard at the URIs given by CustomJob.web_access_uris or Trial.web_access_uris (within + * HyperparameterTuningJob.trials). + */ + @JsonProperty("enableDashboardAccess") + public abstract Builder enableDashboardAccess(boolean enableDashboardAccess); + + @ExcludeFromGeneratedCoverageReport + abstract Builder enableDashboardAccess(Optional enableDashboardAccess); + + /** Clears the value of enableDashboardAccess field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEnableDashboardAccess() { + return enableDashboardAccess(Optional.empty()); + } + + /** + * Setter for enableWebAccess. + * + *

enableWebAccess: Optional. Whether you want Vertex AI to enable [interactive shell + * access](https://cloud.google.com/vertex-ai/docs/training/monitor-debug-interactive-shell) to + * training containers. If set to `true`, you can access interactive shells at the URIs given by + * CustomJob.web_access_uris or Trial.web_access_uris (within HyperparameterTuningJob.trials). + */ + @JsonProperty("enableWebAccess") + public abstract Builder enableWebAccess(boolean enableWebAccess); + + @ExcludeFromGeneratedCoverageReport + abstract Builder enableWebAccess(Optional enableWebAccess); + + /** Clears the value of enableWebAccess field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEnableWebAccess() { + return enableWebAccess(Optional.empty()); + } + + /** + * Setter for experiment. + * + *

experiment: Optional. The Experiment associated with this job. Format: + * `projects/{project}/locations/{location}/metadataStores/{metadataStores}/contexts/{experiment-name}` + */ + @JsonProperty("experiment") + public abstract Builder experiment(String experiment); + + @ExcludeFromGeneratedCoverageReport + abstract Builder experiment(Optional experiment); + + /** Clears the value of experiment field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExperiment() { + return experiment(Optional.empty()); + } + + /** + * Setter for experimentRun. + * + *

experimentRun: Optional. The Experiment Run associated with this job. Format: + * `projects/{project}/locations/{location}/metadataStores/{metadataStores}/contexts/{experiment-name}-{experiment-run-name}` + */ + @JsonProperty("experimentRun") + public abstract Builder experimentRun(String experimentRun); + + @ExcludeFromGeneratedCoverageReport + abstract Builder experimentRun(Optional experimentRun); + + /** Clears the value of experimentRun field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExperimentRun() { + return experimentRun(Optional.empty()); + } + + /** + * Setter for models. + * + *

models: Optional. The name of the Model resources for which to generate a mapping to + * artifact URIs. Applicable only to some of the Google-provided custom jobs. Format: + * `projects/{project}/locations/{location}/models/{model}` In order to retrieve a specific + * version of the model, also provide the version ID or version alias. Example: + * `projects/{project}/locations/{location}/models/{model}@2` or + * `projects/{project}/locations/{location}/models/{model}@golden` If no version ID or alias is + * specified, the "default" version will be returned. The "default" version alias is created for + * the first version of the model, and can be moved to other versions later on. There will be + * exactly one default version. + */ + @JsonProperty("models") + public abstract Builder models(List models); + + /** + * Setter for models. + * + *

models: Optional. The name of the Model resources for which to generate a mapping to + * artifact URIs. Applicable only to some of the Google-provided custom jobs. Format: + * `projects/{project}/locations/{location}/models/{model}` In order to retrieve a specific + * version of the model, also provide the version ID or version alias. Example: + * `projects/{project}/locations/{location}/models/{model}@2` or + * `projects/{project}/locations/{location}/models/{model}@golden` If no version ID or alias is + * specified, the "default" version will be returned. The "default" version alias is created for + * the first version of the model, and can be moved to other versions later on. There will be + * exactly one default version. + */ + @CanIgnoreReturnValue + public Builder models(String... models) { + return models(Arrays.asList(models)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder models(Optional> models); + + /** Clears the value of models field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearModels() { + return models(Optional.empty()); + } + + /** + * Setter for network. + * + *

network: Optional. The full name of the Compute Engine + * [network](/compute/docs/networks-and-firewalls#networks) to which the Job should be peered. + * For example, `projects/12345/global/networks/myVPC`. + * [Format](/compute/docs/reference/rest/v1/networks/insert) is of the form + * `projects/{project}/global/networks/{network}`. Where {project} is a project number, as in + * `12345`, and {network} is a network name. To specify this field, you must have already + * [configured VPC Network Peering for Vertex + * AI](https://cloud.google.com/vertex-ai/docs/general/vpc-peering). If this field is left + * unspecified, the job is not peered with any network. + */ + @JsonProperty("network") + public abstract Builder network(String network); + + @ExcludeFromGeneratedCoverageReport + abstract Builder network(Optional network); + + /** Clears the value of network field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNetwork() { + return network(Optional.empty()); + } + + /** + * Setter for persistentResourceId. + * + *

persistentResourceId: Optional. The ID of the PersistentResource in the same Project and + * Location which to run If this is specified, the job will be run on existing machines held by + * the PersistentResource instead of on-demand short-live machines. The network and CMEK configs + * on the job should be consistent with those on the PersistentResource, otherwise, the job will + * be rejected. + */ + @JsonProperty("persistentResourceId") + public abstract Builder persistentResourceId(String persistentResourceId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder persistentResourceId(Optional persistentResourceId); + + /** Clears the value of persistentResourceId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPersistentResourceId() { + return persistentResourceId(Optional.empty()); + } + + /** + * Setter for protectedArtifactLocationId. + * + *

protectedArtifactLocationId: The ID of the location to store protected artifacts. e.g. + * us-central1. Populate only when the location is different than CustomJob location. List of + * supported locations: https://cloud.google.com/vertex-ai/docs/general/locations + */ + @JsonProperty("protectedArtifactLocationId") + public abstract Builder protectedArtifactLocationId(String protectedArtifactLocationId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder protectedArtifactLocationId(Optional protectedArtifactLocationId); + + /** Clears the value of protectedArtifactLocationId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearProtectedArtifactLocationId() { + return protectedArtifactLocationId(Optional.empty()); + } + + /** + * Setter for pscInterfaceConfig. + * + *

pscInterfaceConfig: Optional. Configuration for PSC-I for CustomJob. + */ + @JsonProperty("pscInterfaceConfig") + public abstract Builder pscInterfaceConfig(PscInterfaceConfig pscInterfaceConfig); + + /** + * Setter for pscInterfaceConfig builder. + * + *

pscInterfaceConfig: Optional. Configuration for PSC-I for CustomJob. + */ + @CanIgnoreReturnValue + public Builder pscInterfaceConfig(PscInterfaceConfig.Builder pscInterfaceConfigBuilder) { + return pscInterfaceConfig(pscInterfaceConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder pscInterfaceConfig(Optional pscInterfaceConfig); + + /** Clears the value of pscInterfaceConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPscInterfaceConfig() { + return pscInterfaceConfig(Optional.empty()); + } + + /** + * Setter for reservedIpRanges. + * + *

reservedIpRanges: Optional. A list of names for the reserved ip ranges under the VPC + * network that can be used for this job. If set, we will deploy the job within the provided ip + * ranges. Otherwise, the job will be deployed to any ip ranges under the provided VPC network. + * Example: ['vertex-ai-ip-range']. + */ + @JsonProperty("reservedIpRanges") + public abstract Builder reservedIpRanges(List reservedIpRanges); + + /** + * Setter for reservedIpRanges. + * + *

reservedIpRanges: Optional. A list of names for the reserved ip ranges under the VPC + * network that can be used for this job. If set, we will deploy the job within the provided ip + * ranges. Otherwise, the job will be deployed to any ip ranges under the provided VPC network. + * Example: ['vertex-ai-ip-range']. + */ + @CanIgnoreReturnValue + public Builder reservedIpRanges(String... reservedIpRanges) { + return reservedIpRanges(Arrays.asList(reservedIpRanges)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder reservedIpRanges(Optional> reservedIpRanges); + + /** Clears the value of reservedIpRanges field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReservedIpRanges() { + return reservedIpRanges(Optional.empty()); + } + + /** + * Setter for scheduling. + * + *

scheduling: Scheduling options for a CustomJob. + */ + @JsonProperty("scheduling") + public abstract Builder scheduling(Scheduling scheduling); + + /** + * Setter for scheduling builder. + * + *

scheduling: Scheduling options for a CustomJob. + */ + @CanIgnoreReturnValue + public Builder scheduling(Scheduling.Builder schedulingBuilder) { + return scheduling(schedulingBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder scheduling(Optional scheduling); + + /** Clears the value of scheduling field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScheduling() { + return scheduling(Optional.empty()); + } + + /** + * Setter for serviceAccount. + * + *

serviceAccount: Specifies the service account for workload run-as account. Users + * submitting jobs must have act-as permission on this run-as account. If unspecified, the + * [Vertex AI Custom Code Service + * Agent](https://cloud.google.com/vertex-ai/docs/general/access-control#service-agents) for the + * CustomJob's project is used. + */ + @JsonProperty("serviceAccount") + public abstract Builder serviceAccount(String serviceAccount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder serviceAccount(Optional serviceAccount); + + /** Clears the value of serviceAccount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearServiceAccount() { + return serviceAccount(Optional.empty()); + } + + /** + * Setter for tensorboard. + * + *

tensorboard: Optional. The name of a Vertex AI Tensorboard resource to which this + * CustomJob will upload Tensorboard logs. Format: + * `projects/{project}/locations/{location}/tensorboards/{tensorboard}` + */ + @JsonProperty("tensorboard") + public abstract Builder tensorboard(String tensorboard); + + @ExcludeFromGeneratedCoverageReport + abstract Builder tensorboard(Optional tensorboard); + + /** Clears the value of tensorboard field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTensorboard() { + return tensorboard(Optional.empty()); + } + + /** + * Setter for workerPoolSpecs. + * + *

workerPoolSpecs: Required. The spec of the worker pools including machine type and Docker + * image. All worker pools except the first one are optional and can be skipped by providing an + * empty value. + */ + @JsonProperty("workerPoolSpecs") + public abstract Builder workerPoolSpecs(List workerPoolSpecs); + + /** + * Setter for workerPoolSpecs. + * + *

workerPoolSpecs: Required. The spec of the worker pools including machine type and Docker + * image. All worker pools except the first one are optional and can be skipped by providing an + * empty value. + */ + @CanIgnoreReturnValue + public Builder workerPoolSpecs(WorkerPoolSpec... workerPoolSpecs) { + return workerPoolSpecs(Arrays.asList(workerPoolSpecs)); + } + + /** + * Setter for workerPoolSpecs builder. + * + *

workerPoolSpecs: Required. The spec of the worker pools including machine type and Docker + * image. All worker pools except the first one are optional and can be skipped by providing an + * empty value. + */ + @CanIgnoreReturnValue + public Builder workerPoolSpecs(WorkerPoolSpec.Builder... workerPoolSpecsBuilders) { + return workerPoolSpecs( + Arrays.asList(workerPoolSpecsBuilders).stream() + .map(WorkerPoolSpec.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder workerPoolSpecs(Optional> workerPoolSpecs); + + /** Clears the value of workerPoolSpecs field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWorkerPoolSpecs() { + return workerPoolSpecs(Optional.empty()); + } + + public abstract CustomJobSpec build(); + } + + /** Deserializes a JSON string to a CustomJobSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static CustomJobSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CustomJobSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CustomOutput.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CustomOutput.java new file mode 100644 index 000000000000..384de6ccd3f0 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/CustomOutput.java @@ -0,0 +1,91 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Spec for custom output. */ +@AutoValue +@JsonDeserialize(builder = CustomOutput.Builder.class) +public abstract class CustomOutput extends JsonSerializable { + /** Output only. List of raw output strings. */ + @JsonProperty("rawOutputs") + public abstract Optional rawOutputs(); + + /** Instantiates a builder for CustomOutput. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_CustomOutput.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for CustomOutput. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `CustomOutput.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_CustomOutput.Builder(); + } + + /** + * Setter for rawOutputs. + * + *

rawOutputs: Output only. List of raw output strings. + */ + @JsonProperty("rawOutputs") + public abstract Builder rawOutputs(RawOutput rawOutputs); + + /** + * Setter for rawOutputs builder. + * + *

rawOutputs: Output only. List of raw output strings. + */ + @CanIgnoreReturnValue + public Builder rawOutputs(RawOutput.Builder rawOutputsBuilder) { + return rawOutputs(rawOutputsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rawOutputs(Optional rawOutputs); + + /** Clears the value of rawOutputs field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRawOutputs() { + return rawOutputs(Optional.empty()); + } + + public abstract CustomOutput build(); + } + + /** Deserializes a JSON string to a CustomOutput object. */ + @ExcludeFromGeneratedCoverageReport + public static CustomOutput fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, CustomOutput.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Dataset.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Dataset.java new file mode 100644 index 000000000000..82ba9f1e0e40 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Dataset.java @@ -0,0 +1,522 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.EncryptionSpec; +import java.time.Instant; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** Represents a dataset resource to store prompts. */ +@AutoValue +@JsonDeserialize(builder = Dataset.Builder.class) +public abstract class Dataset extends JsonSerializable { + /** Required. Additional information about the Dataset. */ + @JsonProperty("metadata") + public abstract Optional metadata(); + + /** + * Customer-managed encryption key spec for a Dataset. If set, this Dataset and all sub-resources + * of this Dataset will be secured by this key. + */ + @JsonProperty("encryptionSpec") + public abstract Optional encryptionSpec(); + + /** Output only. Timestamp when this Dataset was created. */ + @JsonProperty("createTime") + public abstract Optional createTime(); + + /** + * Output only. The number of DataItems in this Dataset. Only apply for non-structured Dataset. + */ + @JsonProperty("dataItemCount") + public abstract Optional dataItemCount(); + + /** The description of the Dataset. */ + @JsonProperty("description") + public abstract Optional description(); + + /** + * Required. The user-defined name of the Dataset. The name can be up to 128 characters long and + * can consist of any UTF-8 characters. + */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** + * Used to perform consistent read-modify-write updates. If not set, a blind "overwrite" update + * happens. + */ + @JsonProperty("etag") + public abstract Optional etag(); + + /** + * The labels with user-defined metadata to organize your Datasets. Label keys and values can be + * no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. No more than 64 user + * labels can be associated with one Dataset (System labels are excluded). See + * https://goo.gl/xmQnxf for more information and examples of labels. System reserved label keys + * are prefixed with "aiplatform.googleapis.com/" and are immutable. Following system labels exist + * for each Dataset: * "aiplatform.googleapis.com/dataset_metadata_schema": output only, its value + * is the metadata_schema's title. + */ + @JsonProperty("labels") + public abstract Optional> labels(); + + /** + * Output only. The resource name of the Artifact that was created in MetadataStore when creating + * the Dataset. The Artifact resource name pattern is + * `projects/{project}/locations/{location}/metadataStores/{metadata_store}/artifacts/{artifact}`. + */ + @JsonProperty("metadataArtifact") + public abstract Optional metadataArtifact(); + + /** + * Required. Points to a YAML file stored on Google Cloud Storage describing additional + * information about the Dataset. The schema is defined as an OpenAPI 3.0.2 Schema Object. The + * schema files that can be used here are found in + * gs://google-cloud-aiplatform/schema/dataset/metadata/. + */ + @JsonProperty("metadataSchemaUri") + public abstract Optional metadataSchemaUri(); + + /** + * Optional. Reference to the public base model last used by the dataset. Only set for prompt + * datasets. + */ + @JsonProperty("modelReference") + public abstract Optional modelReference(); + + /** + * Output only. Identifier. The resource name of the Dataset. Format: + * `projects/{project}/locations/{location}/datasets/{dataset}` + */ + @JsonProperty("name") + public abstract Optional name(); + + /** Output only. Reserved for future use. */ + @JsonProperty("satisfiesPzi") + public abstract Optional satisfiesPzi(); + + /** Output only. Reserved for future use. */ + @JsonProperty("satisfiesPzs") + public abstract Optional satisfiesPzs(); + + /** + * All SavedQueries belong to the Dataset will be returned in List/Get Dataset response. The + * annotation_specs field will not be populated except for UI cases which will only use + * annotation_spec_count. In CreateDataset request, a SavedQuery is created together if this field + * is set, up to one SavedQuery can be set in CreateDatasetRequest. The SavedQuery should not + * contain any AnnotationSpec. + */ + @JsonProperty("savedQueries") + public abstract Optional> savedQueries(); + + /** Output only. Timestamp when this Dataset was last updated. */ + @JsonProperty("updateTime") + public abstract Optional updateTime(); + + /** Instantiates a builder for Dataset. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_Dataset.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for Dataset. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `Dataset.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_Dataset.Builder(); + } + + /** + * Setter for metadata. + * + *

metadata: Required. Additional information about the Dataset. + */ + @JsonProperty("metadata") + public abstract Builder metadata(SchemaTextPromptDatasetMetadata metadata); + + /** + * Setter for metadata builder. + * + *

metadata: Required. Additional information about the Dataset. + */ + @CanIgnoreReturnValue + public Builder metadata(SchemaTextPromptDatasetMetadata.Builder metadataBuilder) { + return metadata(metadataBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for encryptionSpec. + * + *

encryptionSpec: Customer-managed encryption key spec for a Dataset. If set, this Dataset + * and all sub-resources of this Dataset will be secured by this key. + */ + @JsonProperty("encryptionSpec") + public abstract Builder encryptionSpec(EncryptionSpec encryptionSpec); + + @ExcludeFromGeneratedCoverageReport + abstract Builder encryptionSpec(Optional encryptionSpec); + + /** Clears the value of encryptionSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEncryptionSpec() { + return encryptionSpec(Optional.empty()); + } + + /** + * Setter for createTime. + * + *

createTime: Output only. Timestamp when this Dataset was created. + */ + @JsonProperty("createTime") + public abstract Builder createTime(Instant createTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder createTime(Optional createTime); + + /** Clears the value of createTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCreateTime() { + return createTime(Optional.empty()); + } + + /** + * Setter for dataItemCount. + * + *

dataItemCount: Output only. The number of DataItems in this Dataset. Only apply for + * non-structured Dataset. + */ + @JsonProperty("dataItemCount") + public abstract Builder dataItemCount(Long dataItemCount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder dataItemCount(Optional dataItemCount); + + /** Clears the value of dataItemCount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDataItemCount() { + return dataItemCount(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: The description of the Dataset. + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: Required. The user-defined name of the Dataset. The name can be up to 128 + * characters long and can consist of any UTF-8 characters. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for etag. + * + *

etag: Used to perform consistent read-modify-write updates. If not set, a blind + * "overwrite" update happens. + */ + @JsonProperty("etag") + public abstract Builder etag(String etag); + + @ExcludeFromGeneratedCoverageReport + abstract Builder etag(Optional etag); + + /** Clears the value of etag field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEtag() { + return etag(Optional.empty()); + } + + /** + * Setter for labels. + * + *

labels: The labels with user-defined metadata to organize your Datasets. Label keys and + * values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase + * letters, numeric characters, underscores and dashes. International characters are allowed. No + * more than 64 user labels can be associated with one Dataset (System labels are excluded). See + * https://goo.gl/xmQnxf for more information and examples of labels. System reserved label keys + * are prefixed with "aiplatform.googleapis.com/" and are immutable. Following system labels + * exist for each Dataset: * "aiplatform.googleapis.com/dataset_metadata_schema": output only, + * its value is the metadata_schema's title. + */ + @JsonProperty("labels") + public abstract Builder labels(Map labels); + + @ExcludeFromGeneratedCoverageReport + abstract Builder labels(Optional> labels); + + /** Clears the value of labels field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLabels() { + return labels(Optional.empty()); + } + + /** + * Setter for metadataArtifact. + * + *

metadataArtifact: Output only. The resource name of the Artifact that was created in + * MetadataStore when creating the Dataset. The Artifact resource name pattern is + * `projects/{project}/locations/{location}/metadataStores/{metadata_store}/artifacts/{artifact}`. + */ + @JsonProperty("metadataArtifact") + public abstract Builder metadataArtifact(String metadataArtifact); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadataArtifact(Optional metadataArtifact); + + /** Clears the value of metadataArtifact field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadataArtifact() { + return metadataArtifact(Optional.empty()); + } + + /** + * Setter for metadataSchemaUri. + * + *

metadataSchemaUri: Required. Points to a YAML file stored on Google Cloud Storage + * describing additional information about the Dataset. The schema is defined as an OpenAPI + * 3.0.2 Schema Object. The schema files that can be used here are found in + * gs://google-cloud-aiplatform/schema/dataset/metadata/. + */ + @JsonProperty("metadataSchemaUri") + public abstract Builder metadataSchemaUri(String metadataSchemaUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadataSchemaUri(Optional metadataSchemaUri); + + /** Clears the value of metadataSchemaUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadataSchemaUri() { + return metadataSchemaUri(Optional.empty()); + } + + /** + * Setter for modelReference. + * + *

modelReference: Optional. Reference to the public base model last used by the dataset. + * Only set for prompt datasets. + */ + @JsonProperty("modelReference") + public abstract Builder modelReference(String modelReference); + + @ExcludeFromGeneratedCoverageReport + abstract Builder modelReference(Optional modelReference); + + /** Clears the value of modelReference field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearModelReference() { + return modelReference(Optional.empty()); + } + + /** + * Setter for name. + * + *

name: Output only. Identifier. The resource name of the Dataset. Format: + * `projects/{project}/locations/{location}/datasets/{dataset}` + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for satisfiesPzi. + * + *

satisfiesPzi: Output only. Reserved for future use. + */ + @JsonProperty("satisfiesPzi") + public abstract Builder satisfiesPzi(boolean satisfiesPzi); + + @ExcludeFromGeneratedCoverageReport + abstract Builder satisfiesPzi(Optional satisfiesPzi); + + /** Clears the value of satisfiesPzi field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSatisfiesPzi() { + return satisfiesPzi(Optional.empty()); + } + + /** + * Setter for satisfiesPzs. + * + *

satisfiesPzs: Output only. Reserved for future use. + */ + @JsonProperty("satisfiesPzs") + public abstract Builder satisfiesPzs(boolean satisfiesPzs); + + @ExcludeFromGeneratedCoverageReport + abstract Builder satisfiesPzs(Optional satisfiesPzs); + + /** Clears the value of satisfiesPzs field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSatisfiesPzs() { + return satisfiesPzs(Optional.empty()); + } + + /** + * Setter for savedQueries. + * + *

savedQueries: All SavedQueries belong to the Dataset will be returned in List/Get Dataset + * response. The annotation_specs field will not be populated except for UI cases which will + * only use annotation_spec_count. In CreateDataset request, a SavedQuery is created together if + * this field is set, up to one SavedQuery can be set in CreateDatasetRequest. The SavedQuery + * should not contain any AnnotationSpec. + */ + @JsonProperty("savedQueries") + public abstract Builder savedQueries(List savedQueries); + + /** + * Setter for savedQueries. + * + *

savedQueries: All SavedQueries belong to the Dataset will be returned in List/Get Dataset + * response. The annotation_specs field will not be populated except for UI cases which will + * only use annotation_spec_count. In CreateDataset request, a SavedQuery is created together if + * this field is set, up to one SavedQuery can be set in CreateDatasetRequest. The SavedQuery + * should not contain any AnnotationSpec. + */ + @CanIgnoreReturnValue + public Builder savedQueries(SavedQuery... savedQueries) { + return savedQueries(Arrays.asList(savedQueries)); + } + + /** + * Setter for savedQueries builder. + * + *

savedQueries: All SavedQueries belong to the Dataset will be returned in List/Get Dataset + * response. The annotation_specs field will not be populated except for UI cases which will + * only use annotation_spec_count. In CreateDataset request, a SavedQuery is created together if + * this field is set, up to one SavedQuery can be set in CreateDatasetRequest. The SavedQuery + * should not contain any AnnotationSpec. + */ + @CanIgnoreReturnValue + public Builder savedQueries(SavedQuery.Builder... savedQueriesBuilders) { + return savedQueries( + Arrays.asList(savedQueriesBuilders).stream() + .map(SavedQuery.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder savedQueries(Optional> savedQueries); + + /** Clears the value of savedQueries field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSavedQueries() { + return savedQueries(Optional.empty()); + } + + /** + * Setter for updateTime. + * + *

updateTime: Output only. Timestamp when this Dataset was last updated. + */ + @JsonProperty("updateTime") + public abstract Builder updateTime(Instant updateTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder updateTime(Optional updateTime); + + /** Clears the value of updateTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUpdateTime() { + return updateTime(Optional.empty()); + } + + public abstract Dataset build(); + } + + /** Deserializes a JSON string to a Dataset object. */ + @ExcludeFromGeneratedCoverageReport + public static Dataset fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, Dataset.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DatasetOperation.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DatasetOperation.java new file mode 100644 index 000000000000..c1a01d066121 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DatasetOperation.java @@ -0,0 +1,188 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Represents the create dataset operation. */ +@AutoValue +@JsonDeserialize(builder = DatasetOperation.Builder.class) +public abstract class DatasetOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** The result of the dataset operation. */ + @JsonProperty("response") + public abstract Optional> response(); + + /** Instantiates a builder for DatasetOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DatasetOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DatasetOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `DatasetOperation.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_DatasetOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + /** + * Setter for response. + * + *

response: The result of the dataset operation. + */ + @JsonProperty("response") + public abstract Builder response(Map response); + + @ExcludeFromGeneratedCoverageReport + abstract Builder response(Optional> response); + + /** Clears the value of response field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResponse() { + return response(Optional.empty()); + } + + public abstract DatasetOperation build(); + } + + /** Deserializes a JSON string to a DatasetOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static DatasetOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DatasetOperation.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DatasetSchema.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DatasetSchema.java new file mode 100644 index 000000000000..68652cef85ce --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DatasetSchema.java @@ -0,0 +1,113 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** + * The schema to use for the dataset. If not specified, the dataset schema will be inferred from the + * first example in the dataset. + */ +public class DatasetSchema { + + /** Enum representing the known values for DatasetSchema. */ + public enum Known { + GEMINI, + + FLATTEN, + + OPENAI, + + DATASET_SCHEMA_UNSPECIFIED + } + + private Known datasetSchemaEnum; + private final String value; + + @JsonCreator + public DatasetSchema(String value) { + this.value = value; + for (Known datasetSchemaEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(datasetSchemaEnum.toString(), value)) { + this.datasetSchemaEnum = datasetSchemaEnum; + break; + } + } + if (this.datasetSchemaEnum == null) { + this.datasetSchemaEnum = Known.DATASET_SCHEMA_UNSPECIFIED; + } + } + + public DatasetSchema(Known knownValue) { + this.datasetSchemaEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof DatasetSchema)) { + return false; + } + + DatasetSchema other = (DatasetSchema) o; + + if (this.datasetSchemaEnum != Known.DATASET_SCHEMA_UNSPECIFIED + && other.datasetSchemaEnum != Known.DATASET_SCHEMA_UNSPECIFIED) { + return this.datasetSchemaEnum == other.datasetSchemaEnum; + } else if (this.datasetSchemaEnum == Known.DATASET_SCHEMA_UNSPECIFIED + && other.datasetSchemaEnum == Known.DATASET_SCHEMA_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.datasetSchemaEnum != Known.DATASET_SCHEMA_UNSPECIFIED) { + return this.datasetSchemaEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.datasetSchemaEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DatasetVersion.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DatasetVersion.java new file mode 100644 index 000000000000..c493933de38d --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DatasetVersion.java @@ -0,0 +1,306 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.time.Instant; +import java.util.Optional; + +/** Represents a dataset version resource to store prompts. */ +@AutoValue +@JsonDeserialize(builder = DatasetVersion.Builder.class) +public abstract class DatasetVersion extends JsonSerializable { + /** Required. Output only. Additional information about the DatasetVersion. */ + @JsonProperty("metadata") + public abstract Optional metadata(); + + /** Output only. Name of the associated BigQuery dataset. */ + @JsonProperty("bigQueryDatasetName") + public abstract Optional bigQueryDatasetName(); + + /** Output only. Timestamp when this DatasetVersion was created. */ + @JsonProperty("createTime") + public abstract Optional createTime(); + + /** + * The user-defined name of the DatasetVersion. The name can be up to 128 characters long and can + * consist of any UTF-8 characters. + */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** + * Used to perform consistent read-modify-write updates. If not set, a blind "overwrite" update + * happens. + */ + @JsonProperty("etag") + public abstract Optional etag(); + + /** + * Output only. Reference to the public base model last used by the dataset version. Only set for + * prompt dataset versions. + */ + @JsonProperty("modelReference") + public abstract Optional modelReference(); + + /** + * Output only. Identifier. The resource name of the DatasetVersion. Format: + * `projects/{project}/locations/{location}/datasets/{dataset}/datasetVersions/{dataset_version}` + */ + @JsonProperty("name") + public abstract Optional name(); + + /** Output only. Reserved for future use. */ + @JsonProperty("satisfiesPzi") + public abstract Optional satisfiesPzi(); + + /** Output only. Reserved for future use. */ + @JsonProperty("satisfiesPzs") + public abstract Optional satisfiesPzs(); + + /** Output only. Timestamp when this DatasetVersion was last updated. */ + @JsonProperty("updateTime") + public abstract Optional updateTime(); + + /** Instantiates a builder for DatasetVersion. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DatasetVersion.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DatasetVersion. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `DatasetVersion.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_DatasetVersion.Builder(); + } + + /** + * Setter for metadata. + * + *

metadata: Required. Output only. Additional information about the DatasetVersion. + */ + @JsonProperty("metadata") + public abstract Builder metadata(SchemaTextPromptDatasetMetadata metadata); + + /** + * Setter for metadata builder. + * + *

metadata: Required. Output only. Additional information about the DatasetVersion. + */ + @CanIgnoreReturnValue + public Builder metadata(SchemaTextPromptDatasetMetadata.Builder metadataBuilder) { + return metadata(metadataBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for bigQueryDatasetName. + * + *

bigQueryDatasetName: Output only. Name of the associated BigQuery dataset. + */ + @JsonProperty("bigQueryDatasetName") + public abstract Builder bigQueryDatasetName(String bigQueryDatasetName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder bigQueryDatasetName(Optional bigQueryDatasetName); + + /** Clears the value of bigQueryDatasetName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBigQueryDatasetName() { + return bigQueryDatasetName(Optional.empty()); + } + + /** + * Setter for createTime. + * + *

createTime: Output only. Timestamp when this DatasetVersion was created. + */ + @JsonProperty("createTime") + public abstract Builder createTime(Instant createTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder createTime(Optional createTime); + + /** Clears the value of createTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCreateTime() { + return createTime(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: The user-defined name of the DatasetVersion. The name can be up to 128 + * characters long and can consist of any UTF-8 characters. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for etag. + * + *

etag: Used to perform consistent read-modify-write updates. If not set, a blind + * "overwrite" update happens. + */ + @JsonProperty("etag") + public abstract Builder etag(String etag); + + @ExcludeFromGeneratedCoverageReport + abstract Builder etag(Optional etag); + + /** Clears the value of etag field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEtag() { + return etag(Optional.empty()); + } + + /** + * Setter for modelReference. + * + *

modelReference: Output only. Reference to the public base model last used by the dataset + * version. Only set for prompt dataset versions. + */ + @JsonProperty("modelReference") + public abstract Builder modelReference(String modelReference); + + @ExcludeFromGeneratedCoverageReport + abstract Builder modelReference(Optional modelReference); + + /** Clears the value of modelReference field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearModelReference() { + return modelReference(Optional.empty()); + } + + /** + * Setter for name. + * + *

name: Output only. Identifier. The resource name of the DatasetVersion. Format: + * `projects/{project}/locations/{location}/datasets/{dataset}/datasetVersions/{dataset_version}` + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for satisfiesPzi. + * + *

satisfiesPzi: Output only. Reserved for future use. + */ + @JsonProperty("satisfiesPzi") + public abstract Builder satisfiesPzi(boolean satisfiesPzi); + + @ExcludeFromGeneratedCoverageReport + abstract Builder satisfiesPzi(Optional satisfiesPzi); + + /** Clears the value of satisfiesPzi field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSatisfiesPzi() { + return satisfiesPzi(Optional.empty()); + } + + /** + * Setter for satisfiesPzs. + * + *

satisfiesPzs: Output only. Reserved for future use. + */ + @JsonProperty("satisfiesPzs") + public abstract Builder satisfiesPzs(boolean satisfiesPzs); + + @ExcludeFromGeneratedCoverageReport + abstract Builder satisfiesPzs(Optional satisfiesPzs); + + /** Clears the value of satisfiesPzs field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSatisfiesPzs() { + return satisfiesPzs(Optional.empty()); + } + + /** + * Setter for updateTime. + * + *

updateTime: Output only. Timestamp when this DatasetVersion was last updated. + */ + @JsonProperty("updateTime") + public abstract Builder updateTime(Instant updateTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder updateTime(Optional updateTime); + + /** Clears the value of updateTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUpdateTime() { + return updateTime(Optional.empty()); + } + + public abstract DatasetVersion build(); + } + + /** Deserializes a JSON string to a DatasetVersion object. */ + @ExcludeFromGeneratedCoverageReport + public static DatasetVersion fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DatasetVersion.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineConfig.java new file mode 100644 index 000000000000..0c57e9afcdc5 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for deleting agent engine. */ +@AutoValue +@JsonDeserialize(builder = DeleteAgentEngineConfig.Builder.class) +public abstract class DeleteAgentEngineConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for DeleteAgentEngineConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteAgentEngineConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteAgentEngineConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `DeleteAgentEngineConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteAgentEngineConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract DeleteAgentEngineConfig build(); + } + + /** Deserializes a JSON string to a DeleteAgentEngineConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteAgentEngineConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DeleteAgentEngineConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryConfig.java new file mode 100644 index 000000000000..f58296e44e0d --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryConfig.java @@ -0,0 +1,84 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for deleting an Agent Engine Memory. */ +@AutoValue +@JsonDeserialize(builder = DeleteAgentEngineMemoryConfig.Builder.class) +public abstract class DeleteAgentEngineMemoryConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for DeleteAgentEngineMemoryConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteAgentEngineMemoryConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteAgentEngineMemoryConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeleteAgentEngineMemoryConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteAgentEngineMemoryConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract DeleteAgentEngineMemoryConfig build(); + } + + /** Deserializes a JSON string to a DeleteAgentEngineMemoryConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteAgentEngineMemoryConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DeleteAgentEngineMemoryConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryOperation.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryOperation.java new file mode 100644 index 000000000000..9e9375165bb3 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryOperation.java @@ -0,0 +1,169 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Operation for deleting agent engines. */ +@AutoValue +@JsonDeserialize(builder = DeleteAgentEngineMemoryOperation.Builder.class) +public abstract class DeleteAgentEngineMemoryOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** Instantiates a builder for DeleteAgentEngineMemoryOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteAgentEngineMemoryOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteAgentEngineMemoryOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeleteAgentEngineMemoryOperation.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteAgentEngineMemoryOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + public abstract DeleteAgentEngineMemoryOperation build(); + } + + /** Deserializes a JSON string to a DeleteAgentEngineMemoryOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteAgentEngineMemoryOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DeleteAgentEngineMemoryOperation.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryRequestParameters.java new file mode 100644 index 000000000000..7eee923d3535 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineMemoryRequestParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for deleting agent engines. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = DeleteAgentEngineMemoryRequestParameters.Builder.class) +public abstract class DeleteAgentEngineMemoryRequestParameters extends JsonSerializable { + /** Name of the agent engine memory to delete. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for DeleteAgentEngineMemoryRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteAgentEngineMemoryRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteAgentEngineMemoryRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeleteAgentEngineMemoryRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteAgentEngineMemoryRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine memory to delete. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(DeleteAgentEngineMemoryConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(DeleteAgentEngineMemoryConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract DeleteAgentEngineMemoryRequestParameters build(); + } + + /** Deserializes a JSON string to a DeleteAgentEngineMemoryRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteAgentEngineMemoryRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, DeleteAgentEngineMemoryRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineOperation.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineOperation.java new file mode 100644 index 000000000000..28a5024847aa --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineOperation.java @@ -0,0 +1,166 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Operation for deleting agent engines. */ +@AutoValue +@JsonDeserialize(builder = DeleteAgentEngineOperation.Builder.class) +public abstract class DeleteAgentEngineOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** Instantiates a builder for DeleteAgentEngineOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteAgentEngineOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteAgentEngineOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `DeleteAgentEngineOperation.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteAgentEngineOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + public abstract DeleteAgentEngineOperation build(); + } + + /** Deserializes a JSON string to a DeleteAgentEngineOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteAgentEngineOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DeleteAgentEngineOperation.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineRequestParameters.java new file mode 100644 index 000000000000..6e79c7607572 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineRequestParameters.java @@ -0,0 +1,140 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for deleting agent engines. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = DeleteAgentEngineRequestParameters.Builder.class) +public abstract class DeleteAgentEngineRequestParameters extends JsonSerializable { + /** Name of the agent engine. */ + @JsonProperty("name") + public abstract Optional name(); + + /** If set to true, any child resources will also be deleted. */ + @JsonProperty("force") + public abstract Optional force(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for DeleteAgentEngineRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteAgentEngineRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteAgentEngineRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeleteAgentEngineRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteAgentEngineRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for force. + * + *

force: If set to true, any child resources will also be deleted. + */ + @JsonProperty("force") + public abstract Builder force(boolean force); + + @ExcludeFromGeneratedCoverageReport + abstract Builder force(Optional force); + + /** Clears the value of force field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearForce() { + return force(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(DeleteAgentEngineConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(DeleteAgentEngineConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract DeleteAgentEngineRequestParameters build(); + } + + /** Deserializes a JSON string to a DeleteAgentEngineRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteAgentEngineRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DeleteAgentEngineRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxConfig.java new file mode 100644 index 000000000000..b6b588433f65 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxConfig.java @@ -0,0 +1,84 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for deleting an Agent Engine Sandbox. */ +@AutoValue +@JsonDeserialize(builder = DeleteAgentEngineSandboxConfig.Builder.class) +public abstract class DeleteAgentEngineSandboxConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for DeleteAgentEngineSandboxConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteAgentEngineSandboxConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteAgentEngineSandboxConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeleteAgentEngineSandboxConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteAgentEngineSandboxConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract DeleteAgentEngineSandboxConfig build(); + } + + /** Deserializes a JSON string to a DeleteAgentEngineSandboxConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteAgentEngineSandboxConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DeleteAgentEngineSandboxConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxOperation.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxOperation.java new file mode 100644 index 000000000000..3fbe570a7235 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxOperation.java @@ -0,0 +1,169 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Operation for deleting agent engines. */ +@AutoValue +@JsonDeserialize(builder = DeleteAgentEngineSandboxOperation.Builder.class) +public abstract class DeleteAgentEngineSandboxOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** Instantiates a builder for DeleteAgentEngineSandboxOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteAgentEngineSandboxOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteAgentEngineSandboxOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeleteAgentEngineSandboxOperation.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteAgentEngineSandboxOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + public abstract DeleteAgentEngineSandboxOperation build(); + } + + /** Deserializes a JSON string to a DeleteAgentEngineSandboxOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteAgentEngineSandboxOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DeleteAgentEngineSandboxOperation.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxRequestParameters.java new file mode 100644 index 000000000000..8b2647686239 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSandboxRequestParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for deleting agent engines. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = DeleteAgentEngineSandboxRequestParameters.Builder.class) +public abstract class DeleteAgentEngineSandboxRequestParameters extends JsonSerializable { + /** Name of the agent engine sandbox to delete. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for DeleteAgentEngineSandboxRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteAgentEngineSandboxRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteAgentEngineSandboxRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeleteAgentEngineSandboxRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteAgentEngineSandboxRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine sandbox to delete. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(DeleteAgentEngineSandboxConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(DeleteAgentEngineSandboxConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract DeleteAgentEngineSandboxRequestParameters build(); + } + + /** Deserializes a JSON string to a DeleteAgentEngineSandboxRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteAgentEngineSandboxRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, DeleteAgentEngineSandboxRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSessionConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSessionConfig.java new file mode 100644 index 000000000000..e2d2ca8c8982 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSessionConfig.java @@ -0,0 +1,84 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for deleting an Agent Engine Session. */ +@AutoValue +@JsonDeserialize(builder = DeleteAgentEngineSessionConfig.Builder.class) +public abstract class DeleteAgentEngineSessionConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for DeleteAgentEngineSessionConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteAgentEngineSessionConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteAgentEngineSessionConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeleteAgentEngineSessionConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteAgentEngineSessionConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract DeleteAgentEngineSessionConfig build(); + } + + /** Deserializes a JSON string to a DeleteAgentEngineSessionConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteAgentEngineSessionConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DeleteAgentEngineSessionConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSessionOperation.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSessionOperation.java new file mode 100644 index 000000000000..72f7eb9b7578 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSessionOperation.java @@ -0,0 +1,169 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Operation for deleting agent engine sessions. */ +@AutoValue +@JsonDeserialize(builder = DeleteAgentEngineSessionOperation.Builder.class) +public abstract class DeleteAgentEngineSessionOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** Instantiates a builder for DeleteAgentEngineSessionOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteAgentEngineSessionOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteAgentEngineSessionOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeleteAgentEngineSessionOperation.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteAgentEngineSessionOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + public abstract DeleteAgentEngineSessionOperation build(); + } + + /** Deserializes a JSON string to a DeleteAgentEngineSessionOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteAgentEngineSessionOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DeleteAgentEngineSessionOperation.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSessionRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSessionRequestParameters.java new file mode 100644 index 000000000000..ac5040148c37 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteAgentEngineSessionRequestParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for deleting agent engine sessions. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = DeleteAgentEngineSessionRequestParameters.Builder.class) +public abstract class DeleteAgentEngineSessionRequestParameters extends JsonSerializable { + /** Name of the agent engine session to delete. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for DeleteAgentEngineSessionRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteAgentEngineSessionRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteAgentEngineSessionRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeleteAgentEngineSessionRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteAgentEngineSessionRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine session to delete. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(DeleteAgentEngineSessionConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(DeleteAgentEngineSessionConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract DeleteAgentEngineSessionRequestParameters build(); + } + + /** Deserializes a JSON string to a DeleteAgentEngineSessionRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteAgentEngineSessionRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, DeleteAgentEngineSessionRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteDatasetRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteDatasetRequestParameters.java new file mode 100644 index 000000000000..78148a2469cb --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteDatasetRequestParameters.java @@ -0,0 +1,117 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for deleting a prompt dataset. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = DeleteDatasetRequestParameters.Builder.class) +public abstract class DeleteDatasetRequestParameters extends JsonSerializable { + /** ID of the prompt dataset to be deleted. */ + @JsonProperty("promptId") + public abstract Optional promptId(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for DeleteDatasetRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteDatasetRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteDatasetRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeleteDatasetRequestParameters.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteDatasetRequestParameters.Builder(); + } + + /** + * Setter for promptId. + * + *

promptId: ID of the prompt dataset to be deleted. + */ + @JsonProperty("promptId") + public abstract Builder promptId(String promptId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder promptId(Optional promptId); + + /** Clears the value of promptId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPromptId() { + return promptId(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(DeletePromptConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(DeletePromptConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract DeleteDatasetRequestParameters build(); + } + + /** Deserializes a JSON string to a DeleteDatasetRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteDatasetRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DeleteDatasetRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteMultimodalDatasetRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteMultimodalDatasetRequestParameters.java new file mode 100644 index 000000000000..c6cd1c3fc95e --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeleteMultimodalDatasetRequestParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for deleting a multimodal dataset. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = DeleteMultimodalDatasetRequestParameters.Builder.class) +public abstract class DeleteMultimodalDatasetRequestParameters extends JsonSerializable { + /** ID of the dataset to be deleted. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for DeleteMultimodalDatasetRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeleteMultimodalDatasetRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeleteMultimodalDatasetRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeleteMultimodalDatasetRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeleteMultimodalDatasetRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: ID of the dataset to be deleted. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(VertexBaseConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(VertexBaseConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract DeleteMultimodalDatasetRequestParameters build(); + } + + /** Deserializes a JSON string to a DeleteMultimodalDatasetRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static DeleteMultimodalDatasetRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, DeleteMultimodalDatasetRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeletePromptConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeletePromptConfig.java new file mode 100644 index 000000000000..033a1114d779 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeletePromptConfig.java @@ -0,0 +1,104 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for deleting a prompt. */ +@AutoValue +@JsonDeserialize(builder = DeletePromptConfig.Builder.class) +public abstract class DeletePromptConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Timeout for the delete prompt operation in seconds. Defaults to 90. */ + @JsonProperty("timeout") + public abstract Optional timeout(); + + /** Instantiates a builder for DeletePromptConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeletePromptConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeletePromptConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `DeletePromptConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeletePromptConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for timeout. + * + *

timeout: Timeout for the delete prompt operation in seconds. Defaults to 90. + */ + @JsonProperty("timeout") + public abstract Builder timeout(Integer timeout); + + @ExcludeFromGeneratedCoverageReport + abstract Builder timeout(Optional timeout); + + /** Clears the value of timeout field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTimeout() { + return timeout(Optional.empty()); + } + + public abstract DeletePromptConfig build(); + } + + /** Deserializes a JSON string to a DeletePromptConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static DeletePromptConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DeletePromptConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeletePromptOperation.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeletePromptOperation.java new file mode 100644 index 000000000000..c704f41166c1 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeletePromptOperation.java @@ -0,0 +1,166 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Operation for deleting prompts. */ +@AutoValue +@JsonDeserialize(builder = DeletePromptOperation.Builder.class) +public abstract class DeletePromptOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** Instantiates a builder for DeletePromptOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeletePromptOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeletePromptOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `DeletePromptOperation.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeletePromptOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + public abstract DeletePromptOperation build(); + } + + /** Deserializes a JSON string to a DeletePromptOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static DeletePromptOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DeletePromptOperation.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeletePromptVersionOperation.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeletePromptVersionOperation.java new file mode 100644 index 000000000000..efb63963e284 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeletePromptVersionOperation.java @@ -0,0 +1,168 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Operation for deleting prompt versions. */ +@AutoValue +@JsonDeserialize(builder = DeletePromptVersionOperation.Builder.class) +public abstract class DeletePromptVersionOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** Instantiates a builder for DeletePromptVersionOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeletePromptVersionOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeletePromptVersionOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeletePromptVersionOperation.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeletePromptVersionOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + public abstract DeletePromptVersionOperation build(); + } + + /** Deserializes a JSON string to a DeletePromptVersionOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static DeletePromptVersionOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DeletePromptVersionOperation.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeletePromptVersionRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeletePromptVersionRequestParameters.java new file mode 100644 index 000000000000..2a7d982d14c3 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DeletePromptVersionRequestParameters.java @@ -0,0 +1,140 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for deleting a prompt version. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = DeletePromptVersionRequestParameters.Builder.class) +public abstract class DeletePromptVersionRequestParameters extends JsonSerializable { + /** ID of the prompt to be deleted. */ + @JsonProperty("promptId") + public abstract Optional promptId(); + + /** ID of the prompt version to be deleted within the provided prompt_id. */ + @JsonProperty("versionId") + public abstract Optional versionId(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for DeletePromptVersionRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DeletePromptVersionRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DeletePromptVersionRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `DeletePromptVersionRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_DeletePromptVersionRequestParameters.Builder(); + } + + /** + * Setter for promptId. + * + *

promptId: ID of the prompt to be deleted. + */ + @JsonProperty("promptId") + public abstract Builder promptId(String promptId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder promptId(Optional promptId); + + /** Clears the value of promptId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPromptId() { + return promptId(Optional.empty()); + } + + /** + * Setter for versionId. + * + *

versionId: ID of the prompt version to be deleted within the provided prompt_id. + */ + @JsonProperty("versionId") + public abstract Builder versionId(String versionId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder versionId(Optional versionId); + + /** Clears the value of versionId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearVersionId() { + return versionId(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(DeletePromptConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(DeletePromptConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract DeletePromptVersionRequestParameters build(); + } + + /** Deserializes a JSON string to a DeletePromptVersionRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static DeletePromptVersionRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DeletePromptVersionRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DiskSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DiskSpec.java new file mode 100644 index 000000000000..151fa070360f --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DiskSpec.java @@ -0,0 +1,110 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents the spec of disk options. */ +@AutoValue +@JsonDeserialize(builder = DiskSpec.Builder.class) +public abstract class DiskSpec extends JsonSerializable { + /** Size in GB of the boot disk (default is 100GB). */ + @JsonProperty("bootDiskSizeGb") + public abstract Optional bootDiskSizeGb(); + + /** + * Type of the boot disk. For non-A3U machines, the default value is "pd-ssd", for A3U machines, + * the default value is "hyperdisk-balanced". Valid values: "pd-ssd" (Persistent Disk Solid State + * Drive), "pd-standard" (Persistent Disk Hard Disk Drive) or "hyperdisk-balanced". + */ + @JsonProperty("bootDiskType") + public abstract Optional bootDiskType(); + + /** Instantiates a builder for DiskSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DiskSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DiskSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `DiskSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_DiskSpec.Builder(); + } + + /** + * Setter for bootDiskSizeGb. + * + *

bootDiskSizeGb: Size in GB of the boot disk (default is 100GB). + */ + @JsonProperty("bootDiskSizeGb") + public abstract Builder bootDiskSizeGb(Integer bootDiskSizeGb); + + @ExcludeFromGeneratedCoverageReport + abstract Builder bootDiskSizeGb(Optional bootDiskSizeGb); + + /** Clears the value of bootDiskSizeGb field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBootDiskSizeGb() { + return bootDiskSizeGb(Optional.empty()); + } + + /** + * Setter for bootDiskType. + * + *

bootDiskType: Type of the boot disk. For non-A3U machines, the default value is "pd-ssd", + * for A3U machines, the default value is "hyperdisk-balanced". Valid values: "pd-ssd" + * (Persistent Disk Solid State Drive), "pd-standard" (Persistent Disk Hard Disk Drive) or + * "hyperdisk-balanced". + */ + @JsonProperty("bootDiskType") + public abstract Builder bootDiskType(String bootDiskType); + + @ExcludeFromGeneratedCoverageReport + abstract Builder bootDiskType(Optional bootDiskType); + + /** Clears the value of bootDiskType field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBootDiskType() { + return bootDiskType(Optional.empty()); + } + + public abstract DiskSpec build(); + } + + /** Deserializes a JSON string to a DiskSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static DiskSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DiskSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DnsPeeringConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DnsPeeringConfig.java new file mode 100644 index 000000000000..6525ba069502 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/DnsPeeringConfig.java @@ -0,0 +1,141 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** + * DNS peering configuration. These configurations are used to create DNS peering zones in the + * Vertex tenant project VPC, enabling resolution of records within the specified domain hosted in + * the target network's Cloud DNS. + */ +@AutoValue +@JsonDeserialize(builder = DnsPeeringConfig.Builder.class) +public abstract class DnsPeeringConfig extends JsonSerializable { + /** + * Required. The DNS name suffix of the zone being peered to, e.g., "my-internal-domain.corp.". + * Must end with a dot. + */ + @JsonProperty("domain") + public abstract Optional domain(); + + /** + * Required. The VPC network name in the target_project where the DNS zone specified by 'domain' + * is visible. + */ + @JsonProperty("targetNetwork") + public abstract Optional targetNetwork(); + + /** + * Required. The project ID hosting the Cloud DNS managed zone that contains the 'domain'. The + * Vertex AI Service Agent requires the dns.peer role on this project. + */ + @JsonProperty("targetProject") + public abstract Optional targetProject(); + + /** Instantiates a builder for DnsPeeringConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_DnsPeeringConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for DnsPeeringConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `DnsPeeringConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_DnsPeeringConfig.Builder(); + } + + /** + * Setter for domain. + * + *

domain: Required. The DNS name suffix of the zone being peered to, e.g., + * "my-internal-domain.corp.". Must end with a dot. + */ + @JsonProperty("domain") + public abstract Builder domain(String domain); + + @ExcludeFromGeneratedCoverageReport + abstract Builder domain(Optional domain); + + /** Clears the value of domain field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDomain() { + return domain(Optional.empty()); + } + + /** + * Setter for targetNetwork. + * + *

targetNetwork: Required. The VPC network name in the target_project where the DNS zone + * specified by 'domain' is visible. + */ + @JsonProperty("targetNetwork") + public abstract Builder targetNetwork(String targetNetwork); + + @ExcludeFromGeneratedCoverageReport + abstract Builder targetNetwork(Optional targetNetwork); + + /** Clears the value of targetNetwork field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTargetNetwork() { + return targetNetwork(Optional.empty()); + } + + /** + * Setter for targetProject. + * + *

targetProject: Required. The project ID hosting the Cloud DNS managed zone that contains + * the 'domain'. The Vertex AI Service Agent requires the dns.peer role on this project. + */ + @JsonProperty("targetProject") + public abstract Builder targetProject(String targetProject); + + @ExcludeFromGeneratedCoverageReport + abstract Builder targetProject(Optional targetProject); + + /** Clears the value of targetProject field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTargetProject() { + return targetProject(Optional.empty()); + } + + public abstract DnsPeeringConfig build(); + } + + /** Deserializes a JSON string to a DnsPeeringConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static DnsPeeringConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, DnsPeeringConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EnvVar.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EnvVar.java new file mode 100644 index 000000000000..9a7289e86baf --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EnvVar.java @@ -0,0 +1,113 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents an environment variable present in a Container or Python Module. */ +@AutoValue +@JsonDeserialize(builder = EnvVar.Builder.class) +public abstract class EnvVar extends JsonSerializable { + /** Required. Name of the environment variable. Must be a valid C identifier. */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Required. Variables that reference a $(VAR_NAME) are expanded using the previous defined + * environment variables in the container and any service environment variables. If a variable + * cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax + * can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, + * regardless of whether the variable exists or not. + */ + @JsonProperty("value") + public abstract Optional value(); + + /** Instantiates a builder for EnvVar. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EnvVar.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EnvVar. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EnvVar.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EnvVar.Builder(); + } + + /** + * Setter for name. + * + *

name: Required. Name of the environment variable. Must be a valid C identifier. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for value. + * + *

value: Required. Variables that reference a $(VAR_NAME) are expanded using the previous + * defined environment variables in the container and any service environment variables. If a + * variable cannot be resolved, the reference in the input string will be unchanged. The + * $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will + * never be expanded, regardless of whether the variable exists or not. + */ + @JsonProperty("value") + public abstract Builder value(String value); + + @ExcludeFromGeneratedCoverageReport + abstract Builder value(Optional value); + + /** Clears the value of value field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearValue() { + return value(Optional.empty()); + } + + public abstract EnvVar build(); + } + + /** Deserializes a JSON string to a EnvVar object. */ + @ExcludeFromGeneratedCoverageReport + public static EnvVar fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EnvVar.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvalCase.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvalCase.java new file mode 100644 index 000000000000..cdba182b29db --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvalCase.java @@ -0,0 +1,381 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** A comprehensive representation of a GenAI interaction for evaluation. */ +@AutoValue +@JsonDeserialize(builder = EvalCase.Builder.class) +public abstract class EvalCase extends JsonSerializable { + /** The most recent user message (current input). */ + @JsonProperty("prompt") + public abstract Optional prompt(); + + /** + * Model-generated replies to the last user message in a conversation. Multiple responses are + * allowed to support use cases such as comparing different model outputs. + */ + @JsonProperty("responses") + public abstract Optional> responses(); + + /** + * User-provided, golden reference model reply to prompt in context of chat history; Reference for + * last response in a conversation. + */ + @JsonProperty("reference") + public abstract Optional reference(); + + /** System instruction for the model. */ + @JsonProperty("systemInstruction") + public abstract Optional systemInstruction(); + + /** List of all prior messages in the conversation (chat history). */ + @JsonProperty("conversationHistory") + public abstract Optional> conversationHistory(); + + /** + * Named groups of rubrics associated with this prompt. The key is a user-defined name for the + * rubric group. + */ + @JsonProperty("rubricGroups") + public abstract Optional> rubricGroups(); + + /** Unique identifier for the evaluation case. */ + @JsonProperty("evalCaseId") + public abstract Optional evalCaseId(); + + /** + * This field is experimental and may change in future versions. Intermediate events of a single + * turn in an agent run or intermediate events of the last turn for multi-turn an agent run. + */ + @JsonProperty("intermediateEvents") + public abstract Optional> intermediateEvents(); + + /** + * This field is experimental and may change in future versions. The agent info of the agent under + * evaluation. This can be extended for multi-agent evaluation. + */ + @JsonProperty("agentInfo") + public abstract Optional agentInfo(); + + /** Instantiates a builder for EvalCase. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvalCase.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvalCase. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvalCase.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvalCase.Builder(); + } + + /** + * Setter for prompt. + * + *

prompt: The most recent user message (current input). + */ + @JsonProperty("prompt") + public abstract Builder prompt(Content prompt); + + @ExcludeFromGeneratedCoverageReport + abstract Builder prompt(Optional prompt); + + /** Clears the value of prompt field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPrompt() { + return prompt(Optional.empty()); + } + + /** + * Setter for responses. + * + *

responses: Model-generated replies to the last user message in a conversation. Multiple + * responses are allowed to support use cases such as comparing different model outputs. + */ + @JsonProperty("responses") + public abstract Builder responses(List responses); + + /** + * Setter for responses. + * + *

responses: Model-generated replies to the last user message in a conversation. Multiple + * responses are allowed to support use cases such as comparing different model outputs. + */ + @CanIgnoreReturnValue + public Builder responses(ResponseCandidate... responses) { + return responses(Arrays.asList(responses)); + } + + /** + * Setter for responses builder. + * + *

responses: Model-generated replies to the last user message in a conversation. Multiple + * responses are allowed to support use cases such as comparing different model outputs. + */ + @CanIgnoreReturnValue + public Builder responses(ResponseCandidate.Builder... responsesBuilders) { + return responses( + Arrays.asList(responsesBuilders).stream() + .map(ResponseCandidate.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder responses(Optional> responses); + + /** Clears the value of responses field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResponses() { + return responses(Optional.empty()); + } + + /** + * Setter for reference. + * + *

reference: User-provided, golden reference model reply to prompt in context of chat + * history; Reference for last response in a conversation. + */ + @JsonProperty("reference") + public abstract Builder reference(ResponseCandidate reference); + + /** + * Setter for reference builder. + * + *

reference: User-provided, golden reference model reply to prompt in context of chat + * history; Reference for last response in a conversation. + */ + @CanIgnoreReturnValue + public Builder reference(ResponseCandidate.Builder referenceBuilder) { + return reference(referenceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder reference(Optional reference); + + /** Clears the value of reference field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReference() { + return reference(Optional.empty()); + } + + /** + * Setter for systemInstruction. + * + *

systemInstruction: System instruction for the model. + */ + @JsonProperty("systemInstruction") + public abstract Builder systemInstruction(Content systemInstruction); + + @ExcludeFromGeneratedCoverageReport + abstract Builder systemInstruction(Optional systemInstruction); + + /** Clears the value of systemInstruction field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSystemInstruction() { + return systemInstruction(Optional.empty()); + } + + /** + * Setter for conversationHistory. + * + *

conversationHistory: List of all prior messages in the conversation (chat history). + */ + @JsonProperty("conversationHistory") + public abstract Builder conversationHistory(List conversationHistory); + + /** + * Setter for conversationHistory. + * + *

conversationHistory: List of all prior messages in the conversation (chat history). + */ + @CanIgnoreReturnValue + public Builder conversationHistory(Message... conversationHistory) { + return conversationHistory(Arrays.asList(conversationHistory)); + } + + /** + * Setter for conversationHistory builder. + * + *

conversationHistory: List of all prior messages in the conversation (chat history). + */ + @CanIgnoreReturnValue + public Builder conversationHistory(Message.Builder... conversationHistoryBuilders) { + return conversationHistory( + Arrays.asList(conversationHistoryBuilders).stream() + .map(Message.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder conversationHistory(Optional> conversationHistory); + + /** Clears the value of conversationHistory field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConversationHistory() { + return conversationHistory(Optional.empty()); + } + + /** + * Setter for rubricGroups. + * + *

rubricGroups: Named groups of rubrics associated with this prompt. The key is a + * user-defined name for the rubric group. + */ + @JsonProperty("rubricGroups") + public abstract Builder rubricGroups(Map rubricGroups); + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubricGroups(Optional> rubricGroups); + + /** Clears the value of rubricGroups field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubricGroups() { + return rubricGroups(Optional.empty()); + } + + /** + * Setter for evalCaseId. + * + *

evalCaseId: Unique identifier for the evaluation case. + */ + @JsonProperty("evalCaseId") + public abstract Builder evalCaseId(String evalCaseId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder evalCaseId(Optional evalCaseId); + + /** Clears the value of evalCaseId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvalCaseId() { + return evalCaseId(Optional.empty()); + } + + /** + * Setter for intermediateEvents. + * + *

intermediateEvents: This field is experimental and may change in future versions. + * Intermediate events of a single turn in an agent run or intermediate events of the last turn + * for multi-turn an agent run. + */ + @JsonProperty("intermediateEvents") + public abstract Builder intermediateEvents(List intermediateEvents); + + /** + * Setter for intermediateEvents. + * + *

intermediateEvents: This field is experimental and may change in future versions. + * Intermediate events of a single turn in an agent run or intermediate events of the last turn + * for multi-turn an agent run. + */ + @CanIgnoreReturnValue + public Builder intermediateEvents(Event... intermediateEvents) { + return intermediateEvents(Arrays.asList(intermediateEvents)); + } + + /** + * Setter for intermediateEvents builder. + * + *

intermediateEvents: This field is experimental and may change in future versions. + * Intermediate events of a single turn in an agent run or intermediate events of the last turn + * for multi-turn an agent run. + */ + @CanIgnoreReturnValue + public Builder intermediateEvents(Event.Builder... intermediateEventsBuilders) { + return intermediateEvents( + Arrays.asList(intermediateEventsBuilders).stream() + .map(Event.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder intermediateEvents(Optional> intermediateEvents); + + /** Clears the value of intermediateEvents field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearIntermediateEvents() { + return intermediateEvents(Optional.empty()); + } + + /** + * Setter for agentInfo. + * + *

agentInfo: This field is experimental and may change in future versions. The agent info of + * the agent under evaluation. This can be extended for multi-agent evaluation. + */ + @JsonProperty("agentInfo") + public abstract Builder agentInfo(AgentInfo agentInfo); + + /** + * Setter for agentInfo builder. + * + *

agentInfo: This field is experimental and may change in future versions. The agent info of + * the agent under evaluation. This can be extended for multi-agent evaluation. + */ + @CanIgnoreReturnValue + public Builder agentInfo(AgentInfo.Builder agentInfoBuilder) { + return agentInfo(agentInfoBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder agentInfo(Optional agentInfo); + + /** Clears the value of agentInfo field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAgentInfo() { + return agentInfo(Optional.empty()); + } + + public abstract EvalCase build(); + } + + /** Deserializes a JSON string to a EvalCase object. */ + @ExcludeFromGeneratedCoverageReport + public static EvalCase fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvalCase.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvalCaseMetricResult.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvalCaseMetricResult.java new file mode 100644 index 000000000000..c58265d48b28 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvalCaseMetricResult.java @@ -0,0 +1,231 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Evaluation result for a single evaluation case for a single metric. */ +@AutoValue +@JsonDeserialize(builder = EvalCaseMetricResult.Builder.class) +public abstract class EvalCaseMetricResult extends JsonSerializable { + /** Name of the metric. */ + @JsonProperty("metricName") + public abstract Optional metricName(); + + /** Score of the metric. */ + @JsonProperty("score") + public abstract Optional score(); + + /** Explanation of the metric. */ + @JsonProperty("explanation") + public abstract Optional explanation(); + + /** The details of all the rubrics and their verdicts for rubric-based metrics. */ + @JsonProperty("rubricVerdicts") + public abstract Optional> rubricVerdicts(); + + /** Raw output of the metric. */ + @JsonProperty("rawOutput") + public abstract Optional> rawOutput(); + + /** Error message for the metric. */ + @JsonProperty("errorMessage") + public abstract Optional errorMessage(); + + /** Instantiates a builder for EvalCaseMetricResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvalCaseMetricResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvalCaseMetricResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvalCaseMetricResult.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvalCaseMetricResult.Builder(); + } + + /** + * Setter for metricName. + * + *

metricName: Name of the metric. + */ + @JsonProperty("metricName") + public abstract Builder metricName(String metricName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metricName(Optional metricName); + + /** Clears the value of metricName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetricName() { + return metricName(Optional.empty()); + } + + /** + * Setter for score. + * + *

score: Score of the metric. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + @ExcludeFromGeneratedCoverageReport + abstract Builder score(Optional score); + + /** Clears the value of score field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScore() { + return score(Optional.empty()); + } + + /** + * Setter for explanation. + * + *

explanation: Explanation of the metric. + */ + @JsonProperty("explanation") + public abstract Builder explanation(String explanation); + + @ExcludeFromGeneratedCoverageReport + abstract Builder explanation(Optional explanation); + + /** Clears the value of explanation field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExplanation() { + return explanation(Optional.empty()); + } + + /** + * Setter for rubricVerdicts. + * + *

rubricVerdicts: The details of all the rubrics and their verdicts for rubric-based + * metrics. + */ + @JsonProperty("rubricVerdicts") + public abstract Builder rubricVerdicts(List rubricVerdicts); + + /** + * Setter for rubricVerdicts. + * + *

rubricVerdicts: The details of all the rubrics and their verdicts for rubric-based + * metrics. + */ + @CanIgnoreReturnValue + public Builder rubricVerdicts(RubricVerdict... rubricVerdicts) { + return rubricVerdicts(Arrays.asList(rubricVerdicts)); + } + + /** + * Setter for rubricVerdicts builder. + * + *

rubricVerdicts: The details of all the rubrics and their verdicts for rubric-based + * metrics. + */ + @CanIgnoreReturnValue + public Builder rubricVerdicts(RubricVerdict.Builder... rubricVerdictsBuilders) { + return rubricVerdicts( + Arrays.asList(rubricVerdictsBuilders).stream() + .map(RubricVerdict.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubricVerdicts(Optional> rubricVerdicts); + + /** Clears the value of rubricVerdicts field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubricVerdicts() { + return rubricVerdicts(Optional.empty()); + } + + /** + * Setter for rawOutput. + * + *

rawOutput: Raw output of the metric. + */ + @JsonProperty("rawOutput") + public abstract Builder rawOutput(List rawOutput); + + /** + * Setter for rawOutput. + * + *

rawOutput: Raw output of the metric. + */ + @CanIgnoreReturnValue + public Builder rawOutput(String... rawOutput) { + return rawOutput(Arrays.asList(rawOutput)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rawOutput(Optional> rawOutput); + + /** Clears the value of rawOutput field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRawOutput() { + return rawOutput(Optional.empty()); + } + + /** + * Setter for errorMessage. + * + *

errorMessage: Error message for the metric. + */ + @JsonProperty("errorMessage") + public abstract Builder errorMessage(String errorMessage); + + @ExcludeFromGeneratedCoverageReport + abstract Builder errorMessage(Optional errorMessage); + + /** Clears the value of errorMessage field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearErrorMessage() { + return errorMessage(Optional.empty()); + } + + public abstract EvalCaseMetricResult build(); + } + + /** Deserializes a JSON string to a EvalCaseMetricResult object. */ + @ExcludeFromGeneratedCoverageReport + public static EvalCaseMetricResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvalCaseMetricResult.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvalCaseResult.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvalCaseResult.java new file mode 100644 index 000000000000..02ecab1d0c1f --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvalCaseResult.java @@ -0,0 +1,136 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Eval result for a single evaluation case. */ +@AutoValue +@JsonDeserialize(builder = EvalCaseResult.Builder.class) +public abstract class EvalCaseResult extends JsonSerializable { + /** Index of the evaluation case. */ + @JsonProperty("evalCaseIndex") + public abstract Optional evalCaseIndex(); + + /** A list of results, one for each response candidate of the EvalCase. */ + @JsonProperty("responseCandidateResults") + public abstract Optional> responseCandidateResults(); + + /** Instantiates a builder for EvalCaseResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvalCaseResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvalCaseResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvalCaseResult.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvalCaseResult.Builder(); + } + + /** + * Setter for evalCaseIndex. + * + *

evalCaseIndex: Index of the evaluation case. + */ + @JsonProperty("evalCaseIndex") + public abstract Builder evalCaseIndex(Integer evalCaseIndex); + + @ExcludeFromGeneratedCoverageReport + abstract Builder evalCaseIndex(Optional evalCaseIndex); + + /** Clears the value of evalCaseIndex field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvalCaseIndex() { + return evalCaseIndex(Optional.empty()); + } + + /** + * Setter for responseCandidateResults. + * + *

responseCandidateResults: A list of results, one for each response candidate of the + * EvalCase. + */ + @JsonProperty("responseCandidateResults") + public abstract Builder responseCandidateResults( + List responseCandidateResults); + + /** + * Setter for responseCandidateResults. + * + *

responseCandidateResults: A list of results, one for each response candidate of the + * EvalCase. + */ + @CanIgnoreReturnValue + public Builder responseCandidateResults(ResponseCandidateResult... responseCandidateResults) { + return responseCandidateResults(Arrays.asList(responseCandidateResults)); + } + + /** + * Setter for responseCandidateResults builder. + * + *

responseCandidateResults: A list of results, one for each response candidate of the + * EvalCase. + */ + @CanIgnoreReturnValue + public Builder responseCandidateResults( + ResponseCandidateResult.Builder... responseCandidateResultsBuilders) { + return responseCandidateResults( + Arrays.asList(responseCandidateResultsBuilders).stream() + .map(ResponseCandidateResult.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder responseCandidateResults( + Optional> responseCandidateResults); + + /** Clears the value of responseCandidateResults field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResponseCandidateResults() { + return responseCandidateResults(Optional.empty()); + } + + public abstract EvalCaseResult build(); + } + + /** Deserializes a JSON string to a EvalCaseResult object. */ + @ExcludeFromGeneratedCoverageReport + public static EvalCaseResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvalCaseResult.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvalRunInferenceConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvalRunInferenceConfig.java new file mode 100644 index 000000000000..5649480635ad --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvalRunInferenceConfig.java @@ -0,0 +1,126 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.GenerateContentConfig; +import java.util.Optional; + +/** Optional parameters for inference. */ +@AutoValue +@JsonDeserialize(builder = EvalRunInferenceConfig.Builder.class) +public abstract class EvalRunInferenceConfig extends JsonSerializable { + /** The destination path for the inference results. */ + @JsonProperty("dest") + public abstract Optional dest(); + + /** The prompt template to use for inference. */ + @JsonProperty("promptTemplate") + public abstract Optional promptTemplate(); + + /** The config for the generate content call. */ + @JsonProperty("generateContentConfig") + public abstract Optional generateContentConfig(); + + /** Instantiates a builder for EvalRunInferenceConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvalRunInferenceConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvalRunInferenceConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvalRunInferenceConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvalRunInferenceConfig.Builder(); + } + + /** + * Setter for dest. + * + *

dest: The destination path for the inference results. + */ + @JsonProperty("dest") + public abstract Builder dest(String dest); + + @ExcludeFromGeneratedCoverageReport + abstract Builder dest(Optional dest); + + /** Clears the value of dest field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDest() { + return dest(Optional.empty()); + } + + /** + * Setter for promptTemplate. + * + *

promptTemplate: The prompt template to use for inference. + */ + @JsonProperty("promptTemplate") + public abstract Builder promptTemplate(String promptTemplate); + + @ExcludeFromGeneratedCoverageReport + abstract Builder promptTemplate(Optional promptTemplate); + + /** Clears the value of promptTemplate field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPromptTemplate() { + return promptTemplate(Optional.empty()); + } + + /** + * Setter for generateContentConfig. + * + *

generateContentConfig: The config for the generate content call. + */ + @JsonProperty("generateContentConfig") + public abstract Builder generateContentConfig(GenerateContentConfig generateContentConfig); + + @ExcludeFromGeneratedCoverageReport + abstract Builder generateContentConfig(Optional generateContentConfig); + + /** Clears the value of generateContentConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGenerateContentConfig() { + return generateContentConfig(Optional.empty()); + } + + public abstract EvalRunInferenceConfig build(); + } + + /** Deserializes a JSON string to a EvalRunInferenceConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static EvalRunInferenceConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvalRunInferenceConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateDatasetConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateDatasetConfig.java new file mode 100644 index 000000000000..ce1941a4b9a9 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateDatasetConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for evaluate instances. */ +@AutoValue +@JsonDeserialize(builder = EvaluateDatasetConfig.Builder.class) +public abstract class EvaluateDatasetConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for EvaluateDatasetConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluateDatasetConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluateDatasetConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluateDatasetConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluateDatasetConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract EvaluateDatasetConfig build(); + } + + /** Deserializes a JSON string to a EvaluateDatasetConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluateDatasetConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluateDatasetConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateDatasetOperation.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateDatasetOperation.java new file mode 100644 index 000000000000..d2f4923dc3ea --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateDatasetOperation.java @@ -0,0 +1,198 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** None */ +@AutoValue +@JsonDeserialize(builder = EvaluateDatasetOperation.Builder.class) +public abstract class EvaluateDatasetOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** */ + @JsonProperty("response") + public abstract Optional response(); + + /** Instantiates a builder for EvaluateDatasetOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluateDatasetOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluateDatasetOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluateDatasetOperation.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluateDatasetOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + /** + * Setter for response. + * + *

response: + */ + @JsonProperty("response") + public abstract Builder response(EvaluationDataset response); + + /** + * Setter for response builder. + * + *

response: + */ + @CanIgnoreReturnValue + public Builder response(EvaluationDataset.Builder responseBuilder) { + return response(responseBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder response(Optional response); + + /** Clears the value of response field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResponse() { + return response(Optional.empty()); + } + + public abstract EvaluateDatasetOperation build(); + } + + /** Deserializes a JSON string to a EvaluateDatasetOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluateDatasetOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluateDatasetOperation.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateDatasetRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateDatasetRequestParameters.java new file mode 100644 index 000000000000..fc80c7277254 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateDatasetRequestParameters.java @@ -0,0 +1,223 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.AutoraterConfig; +import com.google.genai.types.OutputConfig; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Parameters for batch dataset evaluation. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = EvaluateDatasetRequestParameters.Builder.class) +public abstract class EvaluateDatasetRequestParameters extends JsonSerializable { + /** */ + @JsonProperty("dataset") + public abstract Optional dataset(); + + /** */ + @JsonProperty("metrics") + public abstract Optional> metrics(); + + /** */ + @JsonProperty("outputConfig") + public abstract Optional outputConfig(); + + /** */ + @JsonProperty("autoraterConfig") + public abstract Optional autoraterConfig(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for EvaluateDatasetRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluateDatasetRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluateDatasetRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `EvaluateDatasetRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluateDatasetRequestParameters.Builder(); + } + + /** + * Setter for dataset. + * + *

dataset: + */ + @JsonProperty("dataset") + public abstract Builder dataset(EvaluationDataset dataset); + + /** + * Setter for dataset builder. + * + *

dataset: + */ + @CanIgnoreReturnValue + public Builder dataset(EvaluationDataset.Builder datasetBuilder) { + return dataset(datasetBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder dataset(Optional dataset); + + /** Clears the value of dataset field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDataset() { + return dataset(Optional.empty()); + } + + /** + * Setter for metrics. + * + *

metrics: + */ + @JsonProperty("metrics") + public abstract Builder metrics(List metrics); + + /** + * Setter for metrics. + * + *

metrics: + */ + @CanIgnoreReturnValue + public Builder metrics(Metric... metrics) { + return metrics(Arrays.asList(metrics)); + } + + /** + * Setter for metrics builder. + * + *

metrics: + */ + @CanIgnoreReturnValue + public Builder metrics(Metric.Builder... metricsBuilders) { + return metrics( + Arrays.asList(metricsBuilders).stream() + .map(Metric.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metrics(Optional> metrics); + + /** Clears the value of metrics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetrics() { + return metrics(Optional.empty()); + } + + /** + * Setter for outputConfig. + * + *

outputConfig: + */ + @JsonProperty("outputConfig") + public abstract Builder outputConfig(OutputConfig outputConfig); + + @ExcludeFromGeneratedCoverageReport + abstract Builder outputConfig(Optional outputConfig); + + /** Clears the value of outputConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOutputConfig() { + return outputConfig(Optional.empty()); + } + + /** + * Setter for autoraterConfig. + * + *

autoraterConfig: + */ + @JsonProperty("autoraterConfig") + public abstract Builder autoraterConfig(AutoraterConfig autoraterConfig); + + @ExcludeFromGeneratedCoverageReport + abstract Builder autoraterConfig(Optional autoraterConfig); + + /** Clears the value of autoraterConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAutoraterConfig() { + return autoraterConfig(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(EvaluateDatasetConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(EvaluateDatasetConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract EvaluateDatasetRequestParameters build(); + } + + /** Deserializes a JSON string to a EvaluateDatasetRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluateDatasetRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluateDatasetRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateInstancesConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateInstancesConfig.java new file mode 100644 index 000000000000..677524285729 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateInstancesConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for evaluate instances. */ +@AutoValue +@JsonDeserialize(builder = EvaluateInstancesConfig.Builder.class) +public abstract class EvaluateInstancesConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for EvaluateInstancesConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluateInstancesConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluateInstancesConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluateInstancesConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluateInstancesConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract EvaluateInstancesConfig build(); + } + + /** Deserializes a JSON string to a EvaluateInstancesConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluateInstancesConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluateInstancesConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateInstancesRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateInstancesRequestParameters.java new file mode 100644 index 000000000000..20989208c926 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateInstancesRequestParameters.java @@ -0,0 +1,534 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.AutoraterConfig; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Parameters for evaluating instances. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = EvaluateInstancesRequestParameters.Builder.class) +public abstract class EvaluateInstancesRequestParameters extends JsonSerializable { + /** */ + @JsonProperty("bleuInput") + public abstract Optional bleuInput(); + + /** */ + @JsonProperty("exactMatchInput") + public abstract Optional exactMatchInput(); + + /** */ + @JsonProperty("rougeInput") + public abstract Optional rougeInput(); + + /** */ + @JsonProperty("pointwiseMetricInput") + public abstract Optional pointwiseMetricInput(); + + /** */ + @JsonProperty("pairwiseMetricInput") + public abstract Optional pairwiseMetricInput(); + + /** */ + @JsonProperty("toolCallValidInput") + public abstract Optional toolCallValidInput(); + + /** */ + @JsonProperty("toolNameMatchInput") + public abstract Optional toolNameMatchInput(); + + /** */ + @JsonProperty("toolParameterKeyMatchInput") + public abstract Optional toolParameterKeyMatchInput(); + + /** */ + @JsonProperty("toolParameterKvMatchInput") + public abstract Optional toolParameterKvMatchInput(); + + /** */ + @JsonProperty("rubricBasedMetricInput") + public abstract Optional rubricBasedMetricInput(); + + /** */ + @JsonProperty("autoraterConfig") + public abstract Optional autoraterConfig(); + + /** + * The metrics used for evaluation. Currently, we only support evaluating a single metric. If + * multiple metrics are provided, only the first one will be evaluated. + */ + @JsonProperty("metrics") + public abstract Optional> metrics(); + + /** The instance to be evaluated. */ + @JsonProperty("instance") + public abstract Optional instance(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for EvaluateInstancesRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluateInstancesRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluateInstancesRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `EvaluateInstancesRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluateInstancesRequestParameters.Builder(); + } + + /** + * Setter for bleuInput. + * + *

bleuInput: + */ + @JsonProperty("bleuInput") + public abstract Builder bleuInput(BleuInput bleuInput); + + /** + * Setter for bleuInput builder. + * + *

bleuInput: + */ + @CanIgnoreReturnValue + public Builder bleuInput(BleuInput.Builder bleuInputBuilder) { + return bleuInput(bleuInputBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder bleuInput(Optional bleuInput); + + /** Clears the value of bleuInput field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBleuInput() { + return bleuInput(Optional.empty()); + } + + /** + * Setter for exactMatchInput. + * + *

exactMatchInput: + */ + @JsonProperty("exactMatchInput") + public abstract Builder exactMatchInput(ExactMatchInput exactMatchInput); + + /** + * Setter for exactMatchInput builder. + * + *

exactMatchInput: + */ + @CanIgnoreReturnValue + public Builder exactMatchInput(ExactMatchInput.Builder exactMatchInputBuilder) { + return exactMatchInput(exactMatchInputBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder exactMatchInput(Optional exactMatchInput); + + /** Clears the value of exactMatchInput field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExactMatchInput() { + return exactMatchInput(Optional.empty()); + } + + /** + * Setter for rougeInput. + * + *

rougeInput: + */ + @JsonProperty("rougeInput") + public abstract Builder rougeInput(RougeInput rougeInput); + + /** + * Setter for rougeInput builder. + * + *

rougeInput: + */ + @CanIgnoreReturnValue + public Builder rougeInput(RougeInput.Builder rougeInputBuilder) { + return rougeInput(rougeInputBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rougeInput(Optional rougeInput); + + /** Clears the value of rougeInput field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRougeInput() { + return rougeInput(Optional.empty()); + } + + /** + * Setter for pointwiseMetricInput. + * + *

pointwiseMetricInput: + */ + @JsonProperty("pointwiseMetricInput") + public abstract Builder pointwiseMetricInput(PointwiseMetricInput pointwiseMetricInput); + + /** + * Setter for pointwiseMetricInput builder. + * + *

pointwiseMetricInput: + */ + @CanIgnoreReturnValue + public Builder pointwiseMetricInput(PointwiseMetricInput.Builder pointwiseMetricInputBuilder) { + return pointwiseMetricInput(pointwiseMetricInputBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder pointwiseMetricInput(Optional pointwiseMetricInput); + + /** Clears the value of pointwiseMetricInput field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPointwiseMetricInput() { + return pointwiseMetricInput(Optional.empty()); + } + + /** + * Setter for pairwiseMetricInput. + * + *

pairwiseMetricInput: + */ + @JsonProperty("pairwiseMetricInput") + public abstract Builder pairwiseMetricInput(PairwiseMetricInput pairwiseMetricInput); + + /** + * Setter for pairwiseMetricInput builder. + * + *

pairwiseMetricInput: + */ + @CanIgnoreReturnValue + public Builder pairwiseMetricInput(PairwiseMetricInput.Builder pairwiseMetricInputBuilder) { + return pairwiseMetricInput(pairwiseMetricInputBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder pairwiseMetricInput(Optional pairwiseMetricInput); + + /** Clears the value of pairwiseMetricInput field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPairwiseMetricInput() { + return pairwiseMetricInput(Optional.empty()); + } + + /** + * Setter for toolCallValidInput. + * + *

toolCallValidInput: + */ + @JsonProperty("toolCallValidInput") + public abstract Builder toolCallValidInput(ToolCallValidInput toolCallValidInput); + + /** + * Setter for toolCallValidInput builder. + * + *

toolCallValidInput: + */ + @CanIgnoreReturnValue + public Builder toolCallValidInput(ToolCallValidInput.Builder toolCallValidInputBuilder) { + return toolCallValidInput(toolCallValidInputBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder toolCallValidInput(Optional toolCallValidInput); + + /** Clears the value of toolCallValidInput field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearToolCallValidInput() { + return toolCallValidInput(Optional.empty()); + } + + /** + * Setter for toolNameMatchInput. + * + *

toolNameMatchInput: + */ + @JsonProperty("toolNameMatchInput") + public abstract Builder toolNameMatchInput(ToolNameMatchInput toolNameMatchInput); + + /** + * Setter for toolNameMatchInput builder. + * + *

toolNameMatchInput: + */ + @CanIgnoreReturnValue + public Builder toolNameMatchInput(ToolNameMatchInput.Builder toolNameMatchInputBuilder) { + return toolNameMatchInput(toolNameMatchInputBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder toolNameMatchInput(Optional toolNameMatchInput); + + /** Clears the value of toolNameMatchInput field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearToolNameMatchInput() { + return toolNameMatchInput(Optional.empty()); + } + + /** + * Setter for toolParameterKeyMatchInput. + * + *

toolParameterKeyMatchInput: + */ + @JsonProperty("toolParameterKeyMatchInput") + public abstract Builder toolParameterKeyMatchInput( + ToolParameterKeyMatchInput toolParameterKeyMatchInput); + + /** + * Setter for toolParameterKeyMatchInput builder. + * + *

toolParameterKeyMatchInput: + */ + @CanIgnoreReturnValue + public Builder toolParameterKeyMatchInput( + ToolParameterKeyMatchInput.Builder toolParameterKeyMatchInputBuilder) { + return toolParameterKeyMatchInput(toolParameterKeyMatchInputBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder toolParameterKeyMatchInput( + Optional toolParameterKeyMatchInput); + + /** Clears the value of toolParameterKeyMatchInput field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearToolParameterKeyMatchInput() { + return toolParameterKeyMatchInput(Optional.empty()); + } + + /** + * Setter for toolParameterKvMatchInput. + * + *

toolParameterKvMatchInput: + */ + @JsonProperty("toolParameterKvMatchInput") + public abstract Builder toolParameterKvMatchInput( + ToolParameterKVMatchInput toolParameterKvMatchInput); + + /** + * Setter for toolParameterKvMatchInput builder. + * + *

toolParameterKvMatchInput: + */ + @CanIgnoreReturnValue + public Builder toolParameterKvMatchInput( + ToolParameterKVMatchInput.Builder toolParameterKvMatchInputBuilder) { + return toolParameterKvMatchInput(toolParameterKvMatchInputBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder toolParameterKvMatchInput( + Optional toolParameterKvMatchInput); + + /** Clears the value of toolParameterKvMatchInput field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearToolParameterKvMatchInput() { + return toolParameterKvMatchInput(Optional.empty()); + } + + /** + * Setter for rubricBasedMetricInput. + * + *

rubricBasedMetricInput: + */ + @JsonProperty("rubricBasedMetricInput") + public abstract Builder rubricBasedMetricInput(RubricBasedMetricInput rubricBasedMetricInput); + + /** + * Setter for rubricBasedMetricInput builder. + * + *

rubricBasedMetricInput: + */ + @CanIgnoreReturnValue + public Builder rubricBasedMetricInput( + RubricBasedMetricInput.Builder rubricBasedMetricInputBuilder) { + return rubricBasedMetricInput(rubricBasedMetricInputBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubricBasedMetricInput( + Optional rubricBasedMetricInput); + + /** Clears the value of rubricBasedMetricInput field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubricBasedMetricInput() { + return rubricBasedMetricInput(Optional.empty()); + } + + /** + * Setter for autoraterConfig. + * + *

autoraterConfig: + */ + @JsonProperty("autoraterConfig") + public abstract Builder autoraterConfig(AutoraterConfig autoraterConfig); + + @ExcludeFromGeneratedCoverageReport + abstract Builder autoraterConfig(Optional autoraterConfig); + + /** Clears the value of autoraterConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAutoraterConfig() { + return autoraterConfig(Optional.empty()); + } + + /** + * Setter for metrics. + * + *

metrics: The metrics used for evaluation. Currently, we only support evaluating a single + * metric. If multiple metrics are provided, only the first one will be evaluated. + */ + @JsonProperty("metrics") + public abstract Builder metrics(List metrics); + + /** + * Setter for metrics. + * + *

metrics: The metrics used for evaluation. Currently, we only support evaluating a single + * metric. If multiple metrics are provided, only the first one will be evaluated. + */ + @CanIgnoreReturnValue + public Builder metrics(Metric... metrics) { + return metrics(Arrays.asList(metrics)); + } + + /** + * Setter for metrics builder. + * + *

metrics: The metrics used for evaluation. Currently, we only support evaluating a single + * metric. If multiple metrics are provided, only the first one will be evaluated. + */ + @CanIgnoreReturnValue + public Builder metrics(Metric.Builder... metricsBuilders) { + return metrics( + Arrays.asList(metricsBuilders).stream() + .map(Metric.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metrics(Optional> metrics); + + /** Clears the value of metrics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetrics() { + return metrics(Optional.empty()); + } + + /** + * Setter for instance. + * + *

instance: The instance to be evaluated. + */ + @JsonProperty("instance") + public abstract Builder instance(EvaluationInstance instance); + + /** + * Setter for instance builder. + * + *

instance: The instance to be evaluated. + */ + @CanIgnoreReturnValue + public Builder instance(EvaluationInstance.Builder instanceBuilder) { + return instance(instanceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder instance(Optional instance); + + /** Clears the value of instance field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInstance() { + return instance(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(EvaluateInstancesConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(EvaluateInstancesConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract EvaluateInstancesRequestParameters build(); + } + + /** Deserializes a JSON string to a EvaluateInstancesRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluateInstancesRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluateInstancesRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateInstancesResponse.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateInstancesResponse.java new file mode 100644 index 000000000000..6f45dcca13c6 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateInstancesResponse.java @@ -0,0 +1,508 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Result of evaluating an LLM metric. */ +@AutoValue +@JsonDeserialize(builder = EvaluateInstancesResponse.Builder.class) +public abstract class EvaluateInstancesResponse extends JsonSerializable { + /** Result for rubric based metric. */ + @JsonProperty("rubricBasedMetricResult") + public abstract Optional rubricBasedMetricResult(); + + /** + * A list of metric results for each evaluation case. The order of the metric results is + * guaranteed to be the same as the order of the instances in the request. + */ + @JsonProperty("metricResults") + public abstract Optional> metricResults(); + + /** Results for bleu metric. */ + @JsonProperty("bleuResults") + public abstract Optional bleuResults(); + + /** Translation metrics. Result for Comet metric. */ + @JsonProperty("cometResult") + public abstract Optional cometResult(); + + /** Auto metric evaluation results. Results for exact match metric. */ + @JsonProperty("exactMatchResults") + public abstract Optional exactMatchResults(); + + /** Result for Metricx metric. */ + @JsonProperty("metricxResult") + public abstract Optional metricxResult(); + + /** Result for pairwise metric. */ + @JsonProperty("pairwiseMetricResult") + public abstract Optional pairwiseMetricResult(); + + /** Generic metrics. Result for pointwise metric. */ + @JsonProperty("pointwiseMetricResult") + public abstract Optional pointwiseMetricResult(); + + /** Results for rouge metric. */ + @JsonProperty("rougeResults") + public abstract Optional rougeResults(); + + /** Tool call metrics. Results for tool call valid metric. */ + @JsonProperty("toolCallValidResults") + public abstract Optional toolCallValidResults(); + + /** Results for tool name match metric. */ + @JsonProperty("toolNameMatchResults") + public abstract Optional toolNameMatchResults(); + + /** Results for tool parameter key match metric. */ + @JsonProperty("toolParameterKeyMatchResults") + public abstract Optional toolParameterKeyMatchResults(); + + /** Results for tool parameter key value match metric. */ + @JsonProperty("toolParameterKvMatchResults") + public abstract Optional toolParameterKvMatchResults(); + + /** Instantiates a builder for EvaluateInstancesResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluateInstancesResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluateInstancesResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluateInstancesResponse.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluateInstancesResponse.Builder(); + } + + /** + * Setter for rubricBasedMetricResult. + * + *

rubricBasedMetricResult: Result for rubric based metric. + */ + @JsonProperty("rubricBasedMetricResult") + public abstract Builder rubricBasedMetricResult( + RubricBasedMetricResult rubricBasedMetricResult); + + /** + * Setter for rubricBasedMetricResult builder. + * + *

rubricBasedMetricResult: Result for rubric based metric. + */ + @CanIgnoreReturnValue + public Builder rubricBasedMetricResult( + RubricBasedMetricResult.Builder rubricBasedMetricResultBuilder) { + return rubricBasedMetricResult(rubricBasedMetricResultBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubricBasedMetricResult( + Optional rubricBasedMetricResult); + + /** Clears the value of rubricBasedMetricResult field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubricBasedMetricResult() { + return rubricBasedMetricResult(Optional.empty()); + } + + /** + * Setter for metricResults. + * + *

metricResults: A list of metric results for each evaluation case. The order of the metric + * results is guaranteed to be the same as the order of the instances in the request. + */ + @JsonProperty("metricResults") + public abstract Builder metricResults(List metricResults); + + /** + * Setter for metricResults. + * + *

metricResults: A list of metric results for each evaluation case. The order of the metric + * results is guaranteed to be the same as the order of the instances in the request. + */ + @CanIgnoreReturnValue + public Builder metricResults(MetricResult... metricResults) { + return metricResults(Arrays.asList(metricResults)); + } + + /** + * Setter for metricResults builder. + * + *

metricResults: A list of metric results for each evaluation case. The order of the metric + * results is guaranteed to be the same as the order of the instances in the request. + */ + @CanIgnoreReturnValue + public Builder metricResults(MetricResult.Builder... metricResultsBuilders) { + return metricResults( + Arrays.asList(metricResultsBuilders).stream() + .map(MetricResult.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metricResults(Optional> metricResults); + + /** Clears the value of metricResults field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetricResults() { + return metricResults(Optional.empty()); + } + + /** + * Setter for bleuResults. + * + *

bleuResults: Results for bleu metric. + */ + @JsonProperty("bleuResults") + public abstract Builder bleuResults(BleuResults bleuResults); + + /** + * Setter for bleuResults builder. + * + *

bleuResults: Results for bleu metric. + */ + @CanIgnoreReturnValue + public Builder bleuResults(BleuResults.Builder bleuResultsBuilder) { + return bleuResults(bleuResultsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder bleuResults(Optional bleuResults); + + /** Clears the value of bleuResults field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBleuResults() { + return bleuResults(Optional.empty()); + } + + /** + * Setter for cometResult. + * + *

cometResult: Translation metrics. Result for Comet metric. + */ + @JsonProperty("cometResult") + public abstract Builder cometResult(CometResult cometResult); + + /** + * Setter for cometResult builder. + * + *

cometResult: Translation metrics. Result for Comet metric. + */ + @CanIgnoreReturnValue + public Builder cometResult(CometResult.Builder cometResultBuilder) { + return cometResult(cometResultBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder cometResult(Optional cometResult); + + /** Clears the value of cometResult field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCometResult() { + return cometResult(Optional.empty()); + } + + /** + * Setter for exactMatchResults. + * + *

exactMatchResults: Auto metric evaluation results. Results for exact match metric. + */ + @JsonProperty("exactMatchResults") + public abstract Builder exactMatchResults(ExactMatchResults exactMatchResults); + + /** + * Setter for exactMatchResults builder. + * + *

exactMatchResults: Auto metric evaluation results. Results for exact match metric. + */ + @CanIgnoreReturnValue + public Builder exactMatchResults(ExactMatchResults.Builder exactMatchResultsBuilder) { + return exactMatchResults(exactMatchResultsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder exactMatchResults(Optional exactMatchResults); + + /** Clears the value of exactMatchResults field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExactMatchResults() { + return exactMatchResults(Optional.empty()); + } + + /** + * Setter for metricxResult. + * + *

metricxResult: Result for Metricx metric. + */ + @JsonProperty("metricxResult") + public abstract Builder metricxResult(MetricxResult metricxResult); + + /** + * Setter for metricxResult builder. + * + *

metricxResult: Result for Metricx metric. + */ + @CanIgnoreReturnValue + public Builder metricxResult(MetricxResult.Builder metricxResultBuilder) { + return metricxResult(metricxResultBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metricxResult(Optional metricxResult); + + /** Clears the value of metricxResult field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetricxResult() { + return metricxResult(Optional.empty()); + } + + /** + * Setter for pairwiseMetricResult. + * + *

pairwiseMetricResult: Result for pairwise metric. + */ + @JsonProperty("pairwiseMetricResult") + public abstract Builder pairwiseMetricResult(PairwiseMetricResult pairwiseMetricResult); + + /** + * Setter for pairwiseMetricResult builder. + * + *

pairwiseMetricResult: Result for pairwise metric. + */ + @CanIgnoreReturnValue + public Builder pairwiseMetricResult(PairwiseMetricResult.Builder pairwiseMetricResultBuilder) { + return pairwiseMetricResult(pairwiseMetricResultBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder pairwiseMetricResult(Optional pairwiseMetricResult); + + /** Clears the value of pairwiseMetricResult field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPairwiseMetricResult() { + return pairwiseMetricResult(Optional.empty()); + } + + /** + * Setter for pointwiseMetricResult. + * + *

pointwiseMetricResult: Generic metrics. Result for pointwise metric. + */ + @JsonProperty("pointwiseMetricResult") + public abstract Builder pointwiseMetricResult(PointwiseMetricResult pointwiseMetricResult); + + /** + * Setter for pointwiseMetricResult builder. + * + *

pointwiseMetricResult: Generic metrics. Result for pointwise metric. + */ + @CanIgnoreReturnValue + public Builder pointwiseMetricResult( + PointwiseMetricResult.Builder pointwiseMetricResultBuilder) { + return pointwiseMetricResult(pointwiseMetricResultBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder pointwiseMetricResult(Optional pointwiseMetricResult); + + /** Clears the value of pointwiseMetricResult field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPointwiseMetricResult() { + return pointwiseMetricResult(Optional.empty()); + } + + /** + * Setter for rougeResults. + * + *

rougeResults: Results for rouge metric. + */ + @JsonProperty("rougeResults") + public abstract Builder rougeResults(RougeResults rougeResults); + + /** + * Setter for rougeResults builder. + * + *

rougeResults: Results for rouge metric. + */ + @CanIgnoreReturnValue + public Builder rougeResults(RougeResults.Builder rougeResultsBuilder) { + return rougeResults(rougeResultsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rougeResults(Optional rougeResults); + + /** Clears the value of rougeResults field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRougeResults() { + return rougeResults(Optional.empty()); + } + + /** + * Setter for toolCallValidResults. + * + *

toolCallValidResults: Tool call metrics. Results for tool call valid metric. + */ + @JsonProperty("toolCallValidResults") + public abstract Builder toolCallValidResults(ToolCallValidResults toolCallValidResults); + + /** + * Setter for toolCallValidResults builder. + * + *

toolCallValidResults: Tool call metrics. Results for tool call valid metric. + */ + @CanIgnoreReturnValue + public Builder toolCallValidResults(ToolCallValidResults.Builder toolCallValidResultsBuilder) { + return toolCallValidResults(toolCallValidResultsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder toolCallValidResults(Optional toolCallValidResults); + + /** Clears the value of toolCallValidResults field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearToolCallValidResults() { + return toolCallValidResults(Optional.empty()); + } + + /** + * Setter for toolNameMatchResults. + * + *

toolNameMatchResults: Results for tool name match metric. + */ + @JsonProperty("toolNameMatchResults") + public abstract Builder toolNameMatchResults(ToolNameMatchResults toolNameMatchResults); + + /** + * Setter for toolNameMatchResults builder. + * + *

toolNameMatchResults: Results for tool name match metric. + */ + @CanIgnoreReturnValue + public Builder toolNameMatchResults(ToolNameMatchResults.Builder toolNameMatchResultsBuilder) { + return toolNameMatchResults(toolNameMatchResultsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder toolNameMatchResults(Optional toolNameMatchResults); + + /** Clears the value of toolNameMatchResults field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearToolNameMatchResults() { + return toolNameMatchResults(Optional.empty()); + } + + /** + * Setter for toolParameterKeyMatchResults. + * + *

toolParameterKeyMatchResults: Results for tool parameter key match metric. + */ + @JsonProperty("toolParameterKeyMatchResults") + public abstract Builder toolParameterKeyMatchResults( + ToolParameterKeyMatchResults toolParameterKeyMatchResults); + + /** + * Setter for toolParameterKeyMatchResults builder. + * + *

toolParameterKeyMatchResults: Results for tool parameter key match metric. + */ + @CanIgnoreReturnValue + public Builder toolParameterKeyMatchResults( + ToolParameterKeyMatchResults.Builder toolParameterKeyMatchResultsBuilder) { + return toolParameterKeyMatchResults(toolParameterKeyMatchResultsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder toolParameterKeyMatchResults( + Optional toolParameterKeyMatchResults); + + /** Clears the value of toolParameterKeyMatchResults field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearToolParameterKeyMatchResults() { + return toolParameterKeyMatchResults(Optional.empty()); + } + + /** + * Setter for toolParameterKvMatchResults. + * + *

toolParameterKvMatchResults: Results for tool parameter key value match metric. + */ + @JsonProperty("toolParameterKvMatchResults") + public abstract Builder toolParameterKvMatchResults( + ToolParameterKVMatchResults toolParameterKvMatchResults); + + /** + * Setter for toolParameterKvMatchResults builder. + * + *

toolParameterKvMatchResults: Results for tool parameter key value match metric. + */ + @CanIgnoreReturnValue + public Builder toolParameterKvMatchResults( + ToolParameterKVMatchResults.Builder toolParameterKvMatchResultsBuilder) { + return toolParameterKvMatchResults(toolParameterKvMatchResultsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder toolParameterKvMatchResults( + Optional toolParameterKvMatchResults); + + /** Clears the value of toolParameterKvMatchResults field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearToolParameterKvMatchResults() { + return toolParameterKvMatchResults(Optional.empty()); + } + + public abstract EvaluateInstancesResponse build(); + } + + /** Deserializes a JSON string to a EvaluateInstancesResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluateInstancesResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluateInstancesResponse.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateMethodConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateMethodConfig.java new file mode 100644 index 000000000000..0b17d364b0f0 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluateMethodConfig.java @@ -0,0 +1,152 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Optional parameters for the evaluate method. */ +@AutoValue +@JsonDeserialize(builder = EvaluateMethodConfig.Builder.class) +public abstract class EvaluateMethodConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** + * The schema to use for the dataset. If not specified, the dataset schema will be inferred from + * the first example in the dataset. + */ + @JsonProperty("datasetSchema") + public abstract Optional datasetSchema(); + + /** The destination path for the evaluation results. */ + @JsonProperty("dest") + public abstract Optional dest(); + + /** Instantiates a builder for EvaluateMethodConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluateMethodConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluateMethodConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluateMethodConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluateMethodConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for datasetSchema. + * + *

datasetSchema: The schema to use for the dataset. If not specified, the dataset schema + * will be inferred from the first example in the dataset. + */ + @JsonProperty("datasetSchema") + public abstract Builder datasetSchema(DatasetSchema datasetSchema); + + @ExcludeFromGeneratedCoverageReport + abstract Builder datasetSchema(Optional datasetSchema); + + /** Clears the value of datasetSchema field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDatasetSchema() { + return datasetSchema(Optional.empty()); + } + + /** + * Setter for datasetSchema given a known enum. + * + *

datasetSchema: The schema to use for the dataset. If not specified, the dataset schema + * will be inferred from the first example in the dataset. + */ + @CanIgnoreReturnValue + public Builder datasetSchema(DatasetSchema.Known knownType) { + return datasetSchema(new DatasetSchema(knownType)); + } + + /** + * Setter for datasetSchema given a string. + * + *

datasetSchema: The schema to use for the dataset. If not specified, the dataset schema + * will be inferred from the first example in the dataset. + */ + @CanIgnoreReturnValue + public Builder datasetSchema(String datasetSchema) { + return datasetSchema(new DatasetSchema(datasetSchema)); + } + + /** + * Setter for dest. + * + *

dest: The destination path for the evaluation results. + */ + @JsonProperty("dest") + public abstract Builder dest(String dest); + + @ExcludeFromGeneratedCoverageReport + abstract Builder dest(Optional dest); + + /** Clears the value of dest field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDest() { + return dest(Optional.empty()); + } + + public abstract EvaluateMethodConfig build(); + } + + /** Deserializes a JSON string to a EvaluateMethodConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluateMethodConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluateMethodConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationDataset.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationDataset.java new file mode 100644 index 000000000000..a7341b4a0be5 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationDataset.java @@ -0,0 +1,194 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The dataset used for evaluation. */ +@AutoValue +@JsonDeserialize(builder = EvaluationDataset.Builder.class) +public abstract class EvaluationDataset extends JsonSerializable { + /** The evaluation cases to be evaluated. */ + @JsonProperty("evalCases") + public abstract Optional> evalCases(); + + /** The name of the candidate model or agent for this evaluation dataset. */ + @JsonProperty("candidateName") + public abstract Optional candidateName(); + + /** The GCS source for the evaluation dataset. */ + @JsonProperty("gcsSource") + public abstract Optional gcsSource(); + + /** The BigQuery source for the evaluation dataset. */ + @JsonProperty("bigquerySource") + public abstract Optional bigquerySource(); + + /** Instantiates a builder for EvaluationDataset. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluationDataset.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluationDataset. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluationDataset.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluationDataset.Builder(); + } + + /** + * Setter for evalCases. + * + *

evalCases: The evaluation cases to be evaluated. + */ + @JsonProperty("evalCases") + public abstract Builder evalCases(List evalCases); + + /** + * Setter for evalCases. + * + *

evalCases: The evaluation cases to be evaluated. + */ + @CanIgnoreReturnValue + public Builder evalCases(EvalCase... evalCases) { + return evalCases(Arrays.asList(evalCases)); + } + + /** + * Setter for evalCases builder. + * + *

evalCases: The evaluation cases to be evaluated. + */ + @CanIgnoreReturnValue + public Builder evalCases(EvalCase.Builder... evalCasesBuilders) { + return evalCases( + Arrays.asList(evalCasesBuilders).stream() + .map(EvalCase.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder evalCases(Optional> evalCases); + + /** Clears the value of evalCases field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvalCases() { + return evalCases(Optional.empty()); + } + + /** + * Setter for candidateName. + * + *

candidateName: The name of the candidate model or agent for this evaluation dataset. + */ + @JsonProperty("candidateName") + public abstract Builder candidateName(String candidateName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder candidateName(Optional candidateName); + + /** Clears the value of candidateName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCandidateName() { + return candidateName(Optional.empty()); + } + + /** + * Setter for gcsSource. + * + *

gcsSource: The GCS source for the evaluation dataset. + */ + @JsonProperty("gcsSource") + public abstract Builder gcsSource(GcsSource gcsSource); + + /** + * Setter for gcsSource builder. + * + *

gcsSource: The GCS source for the evaluation dataset. + */ + @CanIgnoreReturnValue + public Builder gcsSource(GcsSource.Builder gcsSourceBuilder) { + return gcsSource(gcsSourceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder gcsSource(Optional gcsSource); + + /** Clears the value of gcsSource field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGcsSource() { + return gcsSource(Optional.empty()); + } + + /** + * Setter for bigquerySource. + * + *

bigquerySource: The BigQuery source for the evaluation dataset. + */ + @JsonProperty("bigquerySource") + public abstract Builder bigquerySource(BigQuerySource bigquerySource); + + /** + * Setter for bigquerySource builder. + * + *

bigquerySource: The BigQuery source for the evaluation dataset. + */ + @CanIgnoreReturnValue + public Builder bigquerySource(BigQuerySource.Builder bigquerySourceBuilder) { + return bigquerySource(bigquerySourceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder bigquerySource(Optional bigquerySource); + + /** Clears the value of bigquerySource field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBigquerySource() { + return bigquerySource(Optional.empty()); + } + + public abstract EvaluationDataset build(); + } + + /** Deserializes a JSON string to a EvaluationDataset object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluationDataset fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluationDataset.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationInstance.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationInstance.java new file mode 100644 index 000000000000..af93d6e221c1 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationInstance.java @@ -0,0 +1,246 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** A single instance to be evaluated. */ +@AutoValue +@JsonDeserialize(builder = EvaluationInstance.Builder.class) +public abstract class EvaluationInstance extends JsonSerializable { + /** Data used to populate placeholder `prompt` in a metric prompt template. */ + @JsonProperty("prompt") + public abstract Optional prompt(); + + /** Data used to populate placeholder `response` in a metric prompt template. */ + @JsonProperty("response") + public abstract Optional response(); + + /** Data used to populate placeholder `reference` in a metric prompt template. */ + @JsonProperty("reference") + public abstract Optional reference(); + + /** Other data used to populate placeholders based on their key. */ + @JsonProperty("otherData") + public abstract Optional otherData(); + + /** Data used for agent evaluation. */ + @JsonProperty("agentData") + public abstract Optional agentData(); + + /** + * Named groups of rubrics associated with this prompt. The key is a user-defined name for the + * rubric group. + */ + @JsonProperty("rubricGroups") + public abstract Optional> rubricGroups(); + + /** Instantiates a builder for EvaluationInstance. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluationInstance.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluationInstance. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluationInstance.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluationInstance.Builder(); + } + + /** + * Setter for prompt. + * + *

prompt: Data used to populate placeholder `prompt` in a metric prompt template. + */ + @JsonProperty("prompt") + public abstract Builder prompt(InstanceData prompt); + + /** + * Setter for prompt builder. + * + *

prompt: Data used to populate placeholder `prompt` in a metric prompt template. + */ + @CanIgnoreReturnValue + public Builder prompt(InstanceData.Builder promptBuilder) { + return prompt(promptBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder prompt(Optional prompt); + + /** Clears the value of prompt field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPrompt() { + return prompt(Optional.empty()); + } + + /** + * Setter for response. + * + *

response: Data used to populate placeholder `response` in a metric prompt template. + */ + @JsonProperty("response") + public abstract Builder response(InstanceData response); + + /** + * Setter for response builder. + * + *

response: Data used to populate placeholder `response` in a metric prompt template. + */ + @CanIgnoreReturnValue + public Builder response(InstanceData.Builder responseBuilder) { + return response(responseBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder response(Optional response); + + /** Clears the value of response field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResponse() { + return response(Optional.empty()); + } + + /** + * Setter for reference. + * + *

reference: Data used to populate placeholder `reference` in a metric prompt template. + */ + @JsonProperty("reference") + public abstract Builder reference(InstanceData reference); + + /** + * Setter for reference builder. + * + *

reference: Data used to populate placeholder `reference` in a metric prompt template. + */ + @CanIgnoreReturnValue + public Builder reference(InstanceData.Builder referenceBuilder) { + return reference(referenceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder reference(Optional reference); + + /** Clears the value of reference field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReference() { + return reference(Optional.empty()); + } + + /** + * Setter for otherData. + * + *

otherData: Other data used to populate placeholders based on their key. + */ + @JsonProperty("otherData") + public abstract Builder otherData(MapInstance otherData); + + /** + * Setter for otherData builder. + * + *

otherData: Other data used to populate placeholders based on their key. + */ + @CanIgnoreReturnValue + public Builder otherData(MapInstance.Builder otherDataBuilder) { + return otherData(otherDataBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder otherData(Optional otherData); + + /** Clears the value of otherData field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOtherData() { + return otherData(Optional.empty()); + } + + /** + * Setter for agentData. + * + *

agentData: Data used for agent evaluation. + */ + @JsonProperty("agentData") + public abstract Builder agentData(AgentData agentData); + + /** + * Setter for agentData builder. + * + *

agentData: Data used for agent evaluation. + */ + @CanIgnoreReturnValue + public Builder agentData(AgentData.Builder agentDataBuilder) { + return agentData(agentDataBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder agentData(Optional agentData); + + /** Clears the value of agentData field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAgentData() { + return agentData(Optional.empty()); + } + + /** + * Setter for rubricGroups. + * + *

rubricGroups: Named groups of rubrics associated with this prompt. The key is a + * user-defined name for the rubric group. + */ + @JsonProperty("rubricGroups") + public abstract Builder rubricGroups(Map rubricGroups); + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubricGroups(Optional> rubricGroups); + + /** Clears the value of rubricGroups field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubricGroups() { + return rubricGroups(Optional.empty()); + } + + public abstract EvaluationInstance build(); + } + + /** Deserializes a JSON string to a EvaluationInstance object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluationInstance fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluationInstance.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationItem.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationItem.java new file mode 100644 index 000000000000..b3724387a87a --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationItem.java @@ -0,0 +1,327 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.GoogleRpcStatus; +import java.time.Instant; +import java.util.Map; +import java.util.Optional; + +/** + * EvaluationItem is a single evaluation request or result. + * + *

The content of an EvaluationItem is immutable - it cannot be updated once created. + * EvaluationItems can be deleted when no longer needed. + */ +@AutoValue +@JsonDeserialize(builder = EvaluationItem.Builder.class) +public abstract class EvaluationItem extends JsonSerializable { + /** The resource name of the EvaluationItem. */ + @JsonProperty("name") + public abstract Optional name(); + + /** The display name of the EvaluationItem. */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** Metadata for the EvaluationItem. */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** Labels for the EvaluationItem. */ + @JsonProperty("labels") + public abstract Optional> labels(); + + /** The type of the EvaluationItem. */ + @JsonProperty("evaluationItemType") + public abstract Optional evaluationItemType(); + + /** The request to evaluate. */ + @JsonProperty("evaluationRequest") + public abstract Optional evaluationRequest(); + + /** The response from evaluation. */ + @JsonProperty("evaluationResponse") + public abstract Optional evaluationResponse(); + + /** The Cloud Storage object where the request or response is stored. */ + @JsonProperty("gcsUri") + public abstract Optional gcsUri(); + + /** Timestamp when this item was created. */ + @JsonProperty("createTime") + public abstract Optional createTime(); + + /** Error for the evaluation item. */ + @JsonProperty("error") + public abstract Optional error(); + + /** Instantiates a builder for EvaluationItem. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluationItem.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluationItem. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluationItem.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluationItem.Builder(); + } + + /** + * Setter for name. + * + *

name: The resource name of the EvaluationItem. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: The display name of the EvaluationItem. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Metadata for the EvaluationItem. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for labels. + * + *

labels: Labels for the EvaluationItem. + */ + @JsonProperty("labels") + public abstract Builder labels(Map labels); + + @ExcludeFromGeneratedCoverageReport + abstract Builder labels(Optional> labels); + + /** Clears the value of labels field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLabels() { + return labels(Optional.empty()); + } + + /** + * Setter for evaluationItemType. + * + *

evaluationItemType: The type of the EvaluationItem. + */ + @JsonProperty("evaluationItemType") + public abstract Builder evaluationItemType(EvaluationItemType evaluationItemType); + + @ExcludeFromGeneratedCoverageReport + abstract Builder evaluationItemType(Optional evaluationItemType); + + /** Clears the value of evaluationItemType field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvaluationItemType() { + return evaluationItemType(Optional.empty()); + } + + /** + * Setter for evaluationItemType given a known enum. + * + *

evaluationItemType: The type of the EvaluationItem. + */ + @CanIgnoreReturnValue + public Builder evaluationItemType(EvaluationItemType.Known knownType) { + return evaluationItemType(new EvaluationItemType(knownType)); + } + + /** + * Setter for evaluationItemType given a string. + * + *

evaluationItemType: The type of the EvaluationItem. + */ + @CanIgnoreReturnValue + public Builder evaluationItemType(String evaluationItemType) { + return evaluationItemType(new EvaluationItemType(evaluationItemType)); + } + + /** + * Setter for evaluationRequest. + * + *

evaluationRequest: The request to evaluate. + */ + @JsonProperty("evaluationRequest") + public abstract Builder evaluationRequest(EvaluationItemRequest evaluationRequest); + + /** + * Setter for evaluationRequest builder. + * + *

evaluationRequest: The request to evaluate. + */ + @CanIgnoreReturnValue + public Builder evaluationRequest(EvaluationItemRequest.Builder evaluationRequestBuilder) { + return evaluationRequest(evaluationRequestBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder evaluationRequest(Optional evaluationRequest); + + /** Clears the value of evaluationRequest field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvaluationRequest() { + return evaluationRequest(Optional.empty()); + } + + /** + * Setter for evaluationResponse. + * + *

evaluationResponse: The response from evaluation. + */ + @JsonProperty("evaluationResponse") + public abstract Builder evaluationResponse(EvaluationItemResult evaluationResponse); + + /** + * Setter for evaluationResponse builder. + * + *

evaluationResponse: The response from evaluation. + */ + @CanIgnoreReturnValue + public Builder evaluationResponse(EvaluationItemResult.Builder evaluationResponseBuilder) { + return evaluationResponse(evaluationResponseBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder evaluationResponse(Optional evaluationResponse); + + /** Clears the value of evaluationResponse field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvaluationResponse() { + return evaluationResponse(Optional.empty()); + } + + /** + * Setter for gcsUri. + * + *

gcsUri: The Cloud Storage object where the request or response is stored. + */ + @JsonProperty("gcsUri") + public abstract Builder gcsUri(String gcsUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder gcsUri(Optional gcsUri); + + /** Clears the value of gcsUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGcsUri() { + return gcsUri(Optional.empty()); + } + + /** + * Setter for createTime. + * + *

createTime: Timestamp when this item was created. + */ + @JsonProperty("createTime") + public abstract Builder createTime(Instant createTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder createTime(Optional createTime); + + /** Clears the value of createTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCreateTime() { + return createTime(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: Error for the evaluation item. + */ + @JsonProperty("error") + public abstract Builder error(GoogleRpcStatus error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + public abstract EvaluationItem build(); + } + + /** Deserializes a JSON string to a EvaluationItem object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluationItem fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluationItem.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationItemRequest.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationItemRequest.java new file mode 100644 index 000000000000..37127adb5e7f --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationItemRequest.java @@ -0,0 +1,202 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** Single evaluation request. */ +@AutoValue +@JsonDeserialize(builder = EvaluationItemRequest.Builder.class) +public abstract class EvaluationItemRequest extends JsonSerializable { + /** The request/prompt to evaluate. */ + @JsonProperty("prompt") + public abstract Optional prompt(); + + /** The ideal response or ground truth. */ + @JsonProperty("goldenResponse") + public abstract Optional goldenResponse(); + + /** + * Named groups of rubrics associated with this prompt. The key is a user-defined name for the + * rubric group. + */ + @JsonProperty("rubrics") + public abstract Optional> rubrics(); + + /** Responses from model under test and other baseline models for comparison. */ + @JsonProperty("candidateResponses") + public abstract Optional> candidateResponses(); + + /** Instantiates a builder for EvaluationItemRequest. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluationItemRequest.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluationItemRequest. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluationItemRequest.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluationItemRequest.Builder(); + } + + /** + * Setter for prompt. + * + *

prompt: The request/prompt to evaluate. + */ + @JsonProperty("prompt") + public abstract Builder prompt(EvaluationPrompt prompt); + + /** + * Setter for prompt builder. + * + *

prompt: The request/prompt to evaluate. + */ + @CanIgnoreReturnValue + public Builder prompt(EvaluationPrompt.Builder promptBuilder) { + return prompt(promptBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder prompt(Optional prompt); + + /** Clears the value of prompt field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPrompt() { + return prompt(Optional.empty()); + } + + /** + * Setter for goldenResponse. + * + *

goldenResponse: The ideal response or ground truth. + */ + @JsonProperty("goldenResponse") + public abstract Builder goldenResponse(CandidateResponse goldenResponse); + + /** + * Setter for goldenResponse builder. + * + *

goldenResponse: The ideal response or ground truth. + */ + @CanIgnoreReturnValue + public Builder goldenResponse(CandidateResponse.Builder goldenResponseBuilder) { + return goldenResponse(goldenResponseBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder goldenResponse(Optional goldenResponse); + + /** Clears the value of goldenResponse field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGoldenResponse() { + return goldenResponse(Optional.empty()); + } + + /** + * Setter for rubrics. + * + *

rubrics: Named groups of rubrics associated with this prompt. The key is a user-defined + * name for the rubric group. + */ + @JsonProperty("rubrics") + public abstract Builder rubrics(Map rubrics); + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubrics(Optional> rubrics); + + /** Clears the value of rubrics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubrics() { + return rubrics(Optional.empty()); + } + + /** + * Setter for candidateResponses. + * + *

candidateResponses: Responses from model under test and other baseline models for + * comparison. + */ + @JsonProperty("candidateResponses") + public abstract Builder candidateResponses(List candidateResponses); + + /** + * Setter for candidateResponses. + * + *

candidateResponses: Responses from model under test and other baseline models for + * comparison. + */ + @CanIgnoreReturnValue + public Builder candidateResponses(CandidateResponse... candidateResponses) { + return candidateResponses(Arrays.asList(candidateResponses)); + } + + /** + * Setter for candidateResponses builder. + * + *

candidateResponses: Responses from model under test and other baseline models for + * comparison. + */ + @CanIgnoreReturnValue + public Builder candidateResponses(CandidateResponse.Builder... candidateResponsesBuilders) { + return candidateResponses( + Arrays.asList(candidateResponsesBuilders).stream() + .map(CandidateResponse.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder candidateResponses(Optional> candidateResponses); + + /** Clears the value of candidateResponses field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCandidateResponses() { + return candidateResponses(Optional.empty()); + } + + public abstract EvaluationItemRequest build(); + } + + /** Deserializes a JSON string to a EvaluationItemRequest object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluationItemRequest fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluationItemRequest.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationItemResult.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationItemResult.java new file mode 100644 index 000000000000..9f5bb70e3cd3 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationItemResult.java @@ -0,0 +1,229 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** Represents the result of an evaluation item. */ +@AutoValue +@JsonDeserialize(builder = EvaluationItemResult.Builder.class) +public abstract class EvaluationItemResult extends JsonSerializable { + /** The request item that was evaluated. */ + @JsonProperty("evaluationRequest") + public abstract Optional evaluationRequest(); + + /** The evaluation run that was used to generate the result. */ + @JsonProperty("evaluationRun") + public abstract Optional evaluationRun(); + + /** The request that was evaluated. */ + @JsonProperty("request") + public abstract Optional request(); + + /** The metric that was evaluated. */ + @JsonProperty("metric") + public abstract Optional metric(); + + /** TThe results for the metric. */ + @JsonProperty("candidateResults") + public abstract Optional> candidateResults(); + + /** Metadata about the evaluation result. */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** Instantiates a builder for EvaluationItemResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluationItemResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluationItemResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluationItemResult.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluationItemResult.Builder(); + } + + /** + * Setter for evaluationRequest. + * + *

evaluationRequest: The request item that was evaluated. + */ + @JsonProperty("evaluationRequest") + public abstract Builder evaluationRequest(String evaluationRequest); + + @ExcludeFromGeneratedCoverageReport + abstract Builder evaluationRequest(Optional evaluationRequest); + + /** Clears the value of evaluationRequest field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvaluationRequest() { + return evaluationRequest(Optional.empty()); + } + + /** + * Setter for evaluationRun. + * + *

evaluationRun: The evaluation run that was used to generate the result. + */ + @JsonProperty("evaluationRun") + public abstract Builder evaluationRun(String evaluationRun); + + @ExcludeFromGeneratedCoverageReport + abstract Builder evaluationRun(Optional evaluationRun); + + /** Clears the value of evaluationRun field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvaluationRun() { + return evaluationRun(Optional.empty()); + } + + /** + * Setter for request. + * + *

request: The request that was evaluated. + */ + @JsonProperty("request") + public abstract Builder request(EvaluationItemRequest request); + + /** + * Setter for request builder. + * + *

request: The request that was evaluated. + */ + @CanIgnoreReturnValue + public Builder request(EvaluationItemRequest.Builder requestBuilder) { + return request(requestBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder request(Optional request); + + /** Clears the value of request field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRequest() { + return request(Optional.empty()); + } + + /** + * Setter for metric. + * + *

metric: The metric that was evaluated. + */ + @JsonProperty("metric") + public abstract Builder metric(String metric); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metric(Optional metric); + + /** Clears the value of metric field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetric() { + return metric(Optional.empty()); + } + + /** + * Setter for candidateResults. + * + *

candidateResults: TThe results for the metric. + */ + @JsonProperty("candidateResults") + public abstract Builder candidateResults(List candidateResults); + + /** + * Setter for candidateResults. + * + *

candidateResults: TThe results for the metric. + */ + @CanIgnoreReturnValue + public Builder candidateResults(CandidateResult... candidateResults) { + return candidateResults(Arrays.asList(candidateResults)); + } + + /** + * Setter for candidateResults builder. + * + *

candidateResults: TThe results for the metric. + */ + @CanIgnoreReturnValue + public Builder candidateResults(CandidateResult.Builder... candidateResultsBuilders) { + return candidateResults( + Arrays.asList(candidateResultsBuilders).stream() + .map(CandidateResult.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder candidateResults(Optional> candidateResults); + + /** Clears the value of candidateResults field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCandidateResults() { + return candidateResults(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Metadata about the evaluation result. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + public abstract EvaluationItemResult build(); + } + + /** Deserializes a JSON string to a EvaluationItemResult object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluationItemResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluationItemResult.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationItemType.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationItemType.java new file mode 100644 index 000000000000..4cc56bf87c11 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationItemType.java @@ -0,0 +1,111 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** The type of the EvaluationItem. */ +public class EvaluationItemType { + + /** Enum representing the known values for EvaluationItemType. */ + public enum Known { + /** The default value. This value is unused. */ + EVALUATION_ITEM_TYPE_UNSPECIFIED, + + /** The EvaluationItem is a request to evaluate. */ + REQUEST, + + /** The EvaluationItem is the result of evaluation. */ + RESULT + } + + private Known evaluationItemTypeEnum; + private final String value; + + @JsonCreator + public EvaluationItemType(String value) { + this.value = value; + for (Known evaluationItemTypeEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(evaluationItemTypeEnum.toString(), value)) { + this.evaluationItemTypeEnum = evaluationItemTypeEnum; + break; + } + } + if (this.evaluationItemTypeEnum == null) { + this.evaluationItemTypeEnum = Known.EVALUATION_ITEM_TYPE_UNSPECIFIED; + } + } + + public EvaluationItemType(Known knownValue) { + this.evaluationItemTypeEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof EvaluationItemType)) { + return false; + } + + EvaluationItemType other = (EvaluationItemType) o; + + if (this.evaluationItemTypeEnum != Known.EVALUATION_ITEM_TYPE_UNSPECIFIED + && other.evaluationItemTypeEnum != Known.EVALUATION_ITEM_TYPE_UNSPECIFIED) { + return this.evaluationItemTypeEnum == other.evaluationItemTypeEnum; + } else if (this.evaluationItemTypeEnum == Known.EVALUATION_ITEM_TYPE_UNSPECIFIED + && other.evaluationItemTypeEnum == Known.EVALUATION_ITEM_TYPE_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.evaluationItemTypeEnum != Known.EVALUATION_ITEM_TYPE_UNSPECIFIED) { + return this.evaluationItemTypeEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.evaluationItemTypeEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationPrompt.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationPrompt.java new file mode 100644 index 000000000000..94323897e266 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationPrompt.java @@ -0,0 +1,136 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Represents the prompt to be evaluated. */ +@AutoValue +@JsonDeserialize(builder = EvaluationPrompt.Builder.class) +public abstract class EvaluationPrompt extends JsonSerializable { + /** Text prompt. */ + @JsonProperty("text") + public abstract Optional text(); + + /** Fields and values that can be used to populate the prompt template. */ + @JsonProperty("value") + public abstract Optional> value(); + + /** Prompt template data. */ + @JsonProperty("promptTemplateData") + public abstract Optional promptTemplateData(); + + /** Instantiates a builder for EvaluationPrompt. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluationPrompt.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluationPrompt. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluationPrompt.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluationPrompt.Builder(); + } + + /** + * Setter for text. + * + *

text: Text prompt. + */ + @JsonProperty("text") + public abstract Builder text(String text); + + @ExcludeFromGeneratedCoverageReport + abstract Builder text(Optional text); + + /** Clears the value of text field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearText() { + return text(Optional.empty()); + } + + /** + * Setter for value. + * + *

value: Fields and values that can be used to populate the prompt template. + */ + @JsonProperty("value") + public abstract Builder value(Map value); + + @ExcludeFromGeneratedCoverageReport + abstract Builder value(Optional> value); + + /** Clears the value of value field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearValue() { + return value(Optional.empty()); + } + + /** + * Setter for promptTemplateData. + * + *

promptTemplateData: Prompt template data. + */ + @JsonProperty("promptTemplateData") + public abstract Builder promptTemplateData(PromptTemplateData promptTemplateData); + + /** + * Setter for promptTemplateData builder. + * + *

promptTemplateData: Prompt template data. + */ + @CanIgnoreReturnValue + public Builder promptTemplateData(PromptTemplateData.Builder promptTemplateDataBuilder) { + return promptTemplateData(promptTemplateDataBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder promptTemplateData(Optional promptTemplateData); + + /** Clears the value of promptTemplateData field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPromptTemplateData() { + return promptTemplateData(Optional.empty()); + } + + public abstract EvaluationPrompt build(); + } + + /** Deserializes a JSON string to a EvaluationPrompt object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluationPrompt fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluationPrompt.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationResult.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationResult.java new file mode 100644 index 000000000000..c304c4af7183 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationResult.java @@ -0,0 +1,293 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** Result of an evaluation run for an evaluation dataset. */ +@AutoValue +@JsonDeserialize(builder = EvaluationResult.Builder.class) +public abstract class EvaluationResult extends JsonSerializable { + /** A list of evaluation results for each evaluation case. */ + @JsonProperty("evalCaseResults") + public abstract Optional> evalCaseResults(); + + /** A list of summary-level evaluation results for each metric. */ + @JsonProperty("summaryMetrics") + public abstract Optional> summaryMetrics(); + + /** + * A dictionary of win rates for each metric, only populated for multi-response evaluation runs. + */ + @JsonProperty("winRates") + public abstract Optional> winRates(); + + /** The input evaluation dataset(s) for the evaluation run. */ + @JsonProperty("evaluationDataset") + public abstract Optional> evaluationDataset(); + + /** Metadata for the evaluation run. */ + @JsonProperty("metadata") + public abstract Optional metadata(); + + /** + * This field is experimental and may change in future versions. The agent info of the agent under + * evaluation. This can be extended for multi-agent evaluation. + */ + @JsonProperty("agentInfo") + public abstract Optional agentInfo(); + + /** Instantiates a builder for EvaluationResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluationResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluationResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluationResult.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluationResult.Builder(); + } + + /** + * Setter for evalCaseResults. + * + *

evalCaseResults: A list of evaluation results for each evaluation case. + */ + @JsonProperty("evalCaseResults") + public abstract Builder evalCaseResults(List evalCaseResults); + + /** + * Setter for evalCaseResults. + * + *

evalCaseResults: A list of evaluation results for each evaluation case. + */ + @CanIgnoreReturnValue + public Builder evalCaseResults(EvalCaseResult... evalCaseResults) { + return evalCaseResults(Arrays.asList(evalCaseResults)); + } + + /** + * Setter for evalCaseResults builder. + * + *

evalCaseResults: A list of evaluation results for each evaluation case. + */ + @CanIgnoreReturnValue + public Builder evalCaseResults(EvalCaseResult.Builder... evalCaseResultsBuilders) { + return evalCaseResults( + Arrays.asList(evalCaseResultsBuilders).stream() + .map(EvalCaseResult.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder evalCaseResults(Optional> evalCaseResults); + + /** Clears the value of evalCaseResults field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvalCaseResults() { + return evalCaseResults(Optional.empty()); + } + + /** + * Setter for summaryMetrics. + * + *

summaryMetrics: A list of summary-level evaluation results for each metric. + */ + @JsonProperty("summaryMetrics") + public abstract Builder summaryMetrics(List summaryMetrics); + + /** + * Setter for summaryMetrics. + * + *

summaryMetrics: A list of summary-level evaluation results for each metric. + */ + @CanIgnoreReturnValue + public Builder summaryMetrics(AggregatedMetricResult... summaryMetrics) { + return summaryMetrics(Arrays.asList(summaryMetrics)); + } + + /** + * Setter for summaryMetrics builder. + * + *

summaryMetrics: A list of summary-level evaluation results for each metric. + */ + @CanIgnoreReturnValue + public Builder summaryMetrics(AggregatedMetricResult.Builder... summaryMetricsBuilders) { + return summaryMetrics( + Arrays.asList(summaryMetricsBuilders).stream() + .map(AggregatedMetricResult.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder summaryMetrics(Optional> summaryMetrics); + + /** Clears the value of summaryMetrics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSummaryMetrics() { + return summaryMetrics(Optional.empty()); + } + + /** + * Setter for winRates. + * + *

winRates: A dictionary of win rates for each metric, only populated for multi-response + * evaluation runs. + */ + @JsonProperty("winRates") + public abstract Builder winRates(Map winRates); + + @ExcludeFromGeneratedCoverageReport + abstract Builder winRates(Optional> winRates); + + /** Clears the value of winRates field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWinRates() { + return winRates(Optional.empty()); + } + + /** + * Setter for evaluationDataset. + * + *

evaluationDataset: The input evaluation dataset(s) for the evaluation run. + */ + @JsonProperty("evaluationDataset") + public abstract Builder evaluationDataset(List evaluationDataset); + + /** + * Setter for evaluationDataset. + * + *

evaluationDataset: The input evaluation dataset(s) for the evaluation run. + */ + @CanIgnoreReturnValue + public Builder evaluationDataset(EvaluationDataset... evaluationDataset) { + return evaluationDataset(Arrays.asList(evaluationDataset)); + } + + /** + * Setter for evaluationDataset builder. + * + *

evaluationDataset: The input evaluation dataset(s) for the evaluation run. + */ + @CanIgnoreReturnValue + public Builder evaluationDataset(EvaluationDataset.Builder... evaluationDatasetBuilders) { + return evaluationDataset( + Arrays.asList(evaluationDatasetBuilders).stream() + .map(EvaluationDataset.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder evaluationDataset(Optional> evaluationDataset); + + /** Clears the value of evaluationDataset field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvaluationDataset() { + return evaluationDataset(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Metadata for the evaluation run. + */ + @JsonProperty("metadata") + public abstract Builder metadata(EvaluationRunMetadata metadata); + + /** + * Setter for metadata builder. + * + *

metadata: Metadata for the evaluation run. + */ + @CanIgnoreReturnValue + public Builder metadata(EvaluationRunMetadata.Builder metadataBuilder) { + return metadata(metadataBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for agentInfo. + * + *

agentInfo: This field is experimental and may change in future versions. The agent info of + * the agent under evaluation. This can be extended for multi-agent evaluation. + */ + @JsonProperty("agentInfo") + public abstract Builder agentInfo(AgentInfo agentInfo); + + /** + * Setter for agentInfo builder. + * + *

agentInfo: This field is experimental and may change in future versions. The agent info of + * the agent under evaluation. This can be extended for multi-agent evaluation. + */ + @CanIgnoreReturnValue + public Builder agentInfo(AgentInfo.Builder agentInfoBuilder) { + return agentInfo(agentInfoBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder agentInfo(Optional agentInfo); + + /** Clears the value of agentInfo field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAgentInfo() { + return agentInfo(Optional.empty()); + } + + public abstract EvaluationResult build(); + } + + /** Deserializes a JSON string to a EvaluationResult object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluationResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluationResult.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRun.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRun.java new file mode 100644 index 000000000000..fc08a6b80246 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRun.java @@ -0,0 +1,441 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.GoogleRpcStatus; +import java.time.Instant; +import java.util.Map; +import java.util.Optional; + +/** Represents an evaluation run. */ +@AutoValue +@JsonDeserialize(builder = EvaluationRun.Builder.class) +public abstract class EvaluationRun extends JsonSerializable { + /** */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** */ + @JsonProperty("createTime") + public abstract Optional createTime(); + + /** */ + @JsonProperty("completionTime") + public abstract Optional completionTime(); + + /** */ + @JsonProperty("state") + public abstract Optional state(); + + /** */ + @JsonProperty("evaluationSetSnapshot") + public abstract Optional evaluationSetSnapshot(); + + /** */ + @JsonProperty("error") + public abstract Optional error(); + + /** */ + @JsonProperty("dataSource") + public abstract Optional dataSource(); + + /** The evaluation run formatted results. */ + @JsonProperty("evaluationRunResults") + public abstract Optional evaluationRunResults(); + + /** + * The parsed EvaluationItem results for the evaluation run. This is only populated when + * include_evaluation_items is set to True. + */ + @JsonProperty("evaluationItemResults") + public abstract Optional evaluationItemResults(); + + /** The evaluation config for the evaluation run. */ + @JsonProperty("evaluationConfig") + public abstract Optional evaluationConfig(); + + /** + * This field is experimental and may change in future versions. The inference configs for the + * evaluation run. + */ + @JsonProperty("inferenceConfigs") + public abstract Optional> inferenceConfigs(); + + /** */ + @JsonProperty("labels") + public abstract Optional> labels(); + + /** Instantiates a builder for EvaluationRun. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluationRun.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluationRun. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluationRun.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluationRun.Builder(); + } + + /** + * Setter for name. + * + *

name: + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for createTime. + * + *

createTime: + */ + @JsonProperty("createTime") + public abstract Builder createTime(Instant createTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder createTime(Optional createTime); + + /** Clears the value of createTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCreateTime() { + return createTime(Optional.empty()); + } + + /** + * Setter for completionTime. + * + *

completionTime: + */ + @JsonProperty("completionTime") + public abstract Builder completionTime(Instant completionTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder completionTime(Optional completionTime); + + /** Clears the value of completionTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCompletionTime() { + return completionTime(Optional.empty()); + } + + /** + * Setter for state. + * + *

state: + */ + @JsonProperty("state") + public abstract Builder state(EvaluationRunState state); + + @ExcludeFromGeneratedCoverageReport + abstract Builder state(Optional state); + + /** Clears the value of state field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearState() { + return state(Optional.empty()); + } + + /** + * Setter for state given a known enum. + * + *

state: + */ + @CanIgnoreReturnValue + public Builder state(EvaluationRunState.Known knownType) { + return state(new EvaluationRunState(knownType)); + } + + /** + * Setter for state given a string. + * + *

state: + */ + @CanIgnoreReturnValue + public Builder state(String state) { + return state(new EvaluationRunState(state)); + } + + /** + * Setter for evaluationSetSnapshot. + * + *

evaluationSetSnapshot: + */ + @JsonProperty("evaluationSetSnapshot") + public abstract Builder evaluationSetSnapshot(String evaluationSetSnapshot); + + @ExcludeFromGeneratedCoverageReport + abstract Builder evaluationSetSnapshot(Optional evaluationSetSnapshot); + + /** Clears the value of evaluationSetSnapshot field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvaluationSetSnapshot() { + return evaluationSetSnapshot(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: + */ + @JsonProperty("error") + public abstract Builder error(GoogleRpcStatus error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + /** + * Setter for dataSource. + * + *

dataSource: + */ + @JsonProperty("dataSource") + public abstract Builder dataSource(EvaluationRunDataSource dataSource); + + /** + * Setter for dataSource builder. + * + *

dataSource: + */ + @CanIgnoreReturnValue + public Builder dataSource(EvaluationRunDataSource.Builder dataSourceBuilder) { + return dataSource(dataSourceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder dataSource(Optional dataSource); + + /** Clears the value of dataSource field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDataSource() { + return dataSource(Optional.empty()); + } + + /** + * Setter for evaluationRunResults. + * + *

evaluationRunResults: The evaluation run formatted results. + */ + @JsonProperty("evaluationRunResults") + public abstract Builder evaluationRunResults(EvaluationRunResults evaluationRunResults); + + /** + * Setter for evaluationRunResults builder. + * + *

evaluationRunResults: The evaluation run formatted results. + */ + @CanIgnoreReturnValue + public Builder evaluationRunResults(EvaluationRunResults.Builder evaluationRunResultsBuilder) { + return evaluationRunResults(evaluationRunResultsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder evaluationRunResults(Optional evaluationRunResults); + + /** Clears the value of evaluationRunResults field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvaluationRunResults() { + return evaluationRunResults(Optional.empty()); + } + + /** + * Setter for evaluationItemResults. + * + *

evaluationItemResults: The parsed EvaluationItem results for the evaluation run. This is + * only populated when include_evaluation_items is set to True. + */ + @JsonProperty("evaluationItemResults") + public abstract Builder evaluationItemResults(EvaluationResult evaluationItemResults); + + /** + * Setter for evaluationItemResults builder. + * + *

evaluationItemResults: The parsed EvaluationItem results for the evaluation run. This is + * only populated when include_evaluation_items is set to True. + */ + @CanIgnoreReturnValue + public Builder evaluationItemResults(EvaluationResult.Builder evaluationItemResultsBuilder) { + return evaluationItemResults(evaluationItemResultsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder evaluationItemResults(Optional evaluationItemResults); + + /** Clears the value of evaluationItemResults field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvaluationItemResults() { + return evaluationItemResults(Optional.empty()); + } + + /** + * Setter for evaluationConfig. + * + *

evaluationConfig: The evaluation config for the evaluation run. + */ + @JsonProperty("evaluationConfig") + public abstract Builder evaluationConfig(EvaluationRunConfig evaluationConfig); + + /** + * Setter for evaluationConfig builder. + * + *

evaluationConfig: The evaluation config for the evaluation run. + */ + @CanIgnoreReturnValue + public Builder evaluationConfig(EvaluationRunConfig.Builder evaluationConfigBuilder) { + return evaluationConfig(evaluationConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder evaluationConfig(Optional evaluationConfig); + + /** Clears the value of evaluationConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvaluationConfig() { + return evaluationConfig(Optional.empty()); + } + + /** + * Setter for inferenceConfigs. + * + *

inferenceConfigs: This field is experimental and may change in future versions. The + * inference configs for the evaluation run. + */ + @JsonProperty("inferenceConfigs") + public abstract Builder inferenceConfigs( + Map inferenceConfigs); + + @ExcludeFromGeneratedCoverageReport + abstract Builder inferenceConfigs( + Optional> inferenceConfigs); + + /** Clears the value of inferenceConfigs field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInferenceConfigs() { + return inferenceConfigs(Optional.empty()); + } + + /** + * Setter for labels. + * + *

labels: + */ + @JsonProperty("labels") + public abstract Builder labels(Map labels); + + @ExcludeFromGeneratedCoverageReport + abstract Builder labels(Optional> labels); + + /** Clears the value of labels field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLabels() { + return labels(Optional.empty()); + } + + public abstract EvaluationRun build(); + } + + /** Deserializes a JSON string to a EvaluationRun object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluationRun fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluationRun.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunAgentConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunAgentConfig.java new file mode 100644 index 000000000000..75451d772b75 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunAgentConfig.java @@ -0,0 +1,121 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import com.google.genai.types.Tool; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** + * This field is experimental and may change in future versions. + * + *

Agent config for an evaluation run. + */ +@AutoValue +@JsonDeserialize(builder = EvaluationRunAgentConfig.Builder.class) +public abstract class EvaluationRunAgentConfig extends JsonSerializable { + /** The developer instruction for the agent. */ + @JsonProperty("developerInstruction") + public abstract Optional developerInstruction(); + + /** The tools available to the agent. */ + @JsonProperty("tools") + public abstract Optional> tools(); + + /** Instantiates a builder for EvaluationRunAgentConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluationRunAgentConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluationRunAgentConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluationRunAgentConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluationRunAgentConfig.Builder(); + } + + /** + * Setter for developerInstruction. + * + *

developerInstruction: The developer instruction for the agent. + */ + @JsonProperty("developerInstruction") + public abstract Builder developerInstruction(Content developerInstruction); + + @ExcludeFromGeneratedCoverageReport + abstract Builder developerInstruction(Optional developerInstruction); + + /** Clears the value of developerInstruction field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDeveloperInstruction() { + return developerInstruction(Optional.empty()); + } + + /** + * Setter for tools. + * + *

tools: The tools available to the agent. + */ + @JsonProperty("tools") + public abstract Builder tools(List tools); + + /** + * Setter for tools. + * + *

tools: The tools available to the agent. + */ + @CanIgnoreReturnValue + public Builder tools(Tool... tools) { + return tools(Arrays.asList(tools)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder tools(Optional> tools); + + /** Clears the value of tools field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTools() { + return tools(Optional.empty()); + } + + public abstract EvaluationRunAgentConfig build(); + } + + /** Deserializes a JSON string to a EvaluationRunAgentConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluationRunAgentConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluationRunAgentConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunConfig.java new file mode 100644 index 000000000000..bc2f6c55e10b --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunConfig.java @@ -0,0 +1,154 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.AutoraterConfig; +import com.google.genai.types.OutputConfig; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The evaluation configuration used for the evaluation run. */ +@AutoValue +@JsonDeserialize(builder = EvaluationRunConfig.Builder.class) +public abstract class EvaluationRunConfig extends JsonSerializable { + /** The metrics to be calculated in the evaluation run. */ + @JsonProperty("metrics") + public abstract Optional> metrics(); + + /** The output config for the evaluation run. */ + @JsonProperty("outputConfig") + public abstract Optional outputConfig(); + + /** The autorater config for the evaluation run. */ + @JsonProperty("autoraterConfig") + public abstract Optional autoraterConfig(); + + /** Instantiates a builder for EvaluationRunConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluationRunConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluationRunConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluationRunConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluationRunConfig.Builder(); + } + + /** + * Setter for metrics. + * + *

metrics: The metrics to be calculated in the evaluation run. + */ + @JsonProperty("metrics") + public abstract Builder metrics(List metrics); + + /** + * Setter for metrics. + * + *

metrics: The metrics to be calculated in the evaluation run. + */ + @CanIgnoreReturnValue + public Builder metrics(EvaluationRunMetric... metrics) { + return metrics(Arrays.asList(metrics)); + } + + /** + * Setter for metrics builder. + * + *

metrics: The metrics to be calculated in the evaluation run. + */ + @CanIgnoreReturnValue + public Builder metrics(EvaluationRunMetric.Builder... metricsBuilders) { + return metrics( + Arrays.asList(metricsBuilders).stream() + .map(EvaluationRunMetric.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metrics(Optional> metrics); + + /** Clears the value of metrics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetrics() { + return metrics(Optional.empty()); + } + + /** + * Setter for outputConfig. + * + *

outputConfig: The output config for the evaluation run. + */ + @JsonProperty("outputConfig") + public abstract Builder outputConfig(OutputConfig outputConfig); + + @ExcludeFromGeneratedCoverageReport + abstract Builder outputConfig(Optional outputConfig); + + /** Clears the value of outputConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOutputConfig() { + return outputConfig(Optional.empty()); + } + + /** + * Setter for autoraterConfig. + * + *

autoraterConfig: The autorater config for the evaluation run. + */ + @JsonProperty("autoraterConfig") + public abstract Builder autoraterConfig(AutoraterConfig autoraterConfig); + + @ExcludeFromGeneratedCoverageReport + abstract Builder autoraterConfig(Optional autoraterConfig); + + /** Clears the value of autoraterConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAutoraterConfig() { + return autoraterConfig(Optional.empty()); + } + + public abstract EvaluationRunConfig build(); + } + + /** Deserializes a JSON string to a EvaluationRunConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluationRunConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluationRunConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunDataSource.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunDataSource.java new file mode 100644 index 000000000000..149d8534c73e --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunDataSource.java @@ -0,0 +1,113 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents an evaluation run data source. */ +@AutoValue +@JsonDeserialize(builder = EvaluationRunDataSource.Builder.class) +public abstract class EvaluationRunDataSource extends JsonSerializable { + /** */ + @JsonProperty("evaluationSet") + public abstract Optional evaluationSet(); + + /** */ + @JsonProperty("bigqueryRequestSet") + public abstract Optional bigqueryRequestSet(); + + /** Instantiates a builder for EvaluationRunDataSource. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluationRunDataSource.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluationRunDataSource. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluationRunDataSource.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluationRunDataSource.Builder(); + } + + /** + * Setter for evaluationSet. + * + *

evaluationSet: + */ + @JsonProperty("evaluationSet") + public abstract Builder evaluationSet(String evaluationSet); + + @ExcludeFromGeneratedCoverageReport + abstract Builder evaluationSet(Optional evaluationSet); + + /** Clears the value of evaluationSet field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvaluationSet() { + return evaluationSet(Optional.empty()); + } + + /** + * Setter for bigqueryRequestSet. + * + *

bigqueryRequestSet: + */ + @JsonProperty("bigqueryRequestSet") + public abstract Builder bigqueryRequestSet(BigQueryRequestSet bigqueryRequestSet); + + /** + * Setter for bigqueryRequestSet builder. + * + *

bigqueryRequestSet: + */ + @CanIgnoreReturnValue + public Builder bigqueryRequestSet(BigQueryRequestSet.Builder bigqueryRequestSetBuilder) { + return bigqueryRequestSet(bigqueryRequestSetBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder bigqueryRequestSet(Optional bigqueryRequestSet); + + /** Clears the value of bigqueryRequestSet field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBigqueryRequestSet() { + return bigqueryRequestSet(Optional.empty()); + } + + public abstract EvaluationRunDataSource build(); + } + + /** Deserializes a JSON string to a EvaluationRunDataSource object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluationRunDataSource fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluationRunDataSource.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunInferenceConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunInferenceConfig.java new file mode 100644 index 000000000000..c23b76e48f36 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunInferenceConfig.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** + * This field is experimental and may change in future versions. + * + *

Configuration that describes an agent. + */ +@AutoValue +@JsonDeserialize(builder = EvaluationRunInferenceConfig.Builder.class) +public abstract class EvaluationRunInferenceConfig extends JsonSerializable { + /** The agent config. */ + @JsonProperty("agentConfig") + public abstract Optional agentConfig(); + + /** The fully qualified name of the publisher model or endpoint to use for inference. */ + @JsonProperty("model") + public abstract Optional model(); + + /** Instantiates a builder for EvaluationRunInferenceConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluationRunInferenceConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluationRunInferenceConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `EvaluationRunInferenceConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluationRunInferenceConfig.Builder(); + } + + /** + * Setter for agentConfig. + * + *

agentConfig: The agent config. + */ + @JsonProperty("agentConfig") + public abstract Builder agentConfig(EvaluationRunAgentConfig agentConfig); + + /** + * Setter for agentConfig builder. + * + *

agentConfig: The agent config. + */ + @CanIgnoreReturnValue + public Builder agentConfig(EvaluationRunAgentConfig.Builder agentConfigBuilder) { + return agentConfig(agentConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder agentConfig(Optional agentConfig); + + /** Clears the value of agentConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAgentConfig() { + return agentConfig(Optional.empty()); + } + + /** + * Setter for model. + * + *

model: The fully qualified name of the publisher model or endpoint to use for inference. + */ + @JsonProperty("model") + public abstract Builder model(String model); + + @ExcludeFromGeneratedCoverageReport + abstract Builder model(Optional model); + + /** Clears the value of model field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearModel() { + return model(Optional.empty()); + } + + public abstract EvaluationRunInferenceConfig build(); + } + + /** Deserializes a JSON string to a EvaluationRunInferenceConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluationRunInferenceConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluationRunInferenceConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunMetadata.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunMetadata.java new file mode 100644 index 000000000000..6e19f04cb39c --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunMetadata.java @@ -0,0 +1,160 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.time.Instant; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Metadata for an evaluation run. */ +@AutoValue +@JsonDeserialize(builder = EvaluationRunMetadata.Builder.class) +public abstract class EvaluationRunMetadata extends JsonSerializable { + /** Name of the candidate(s) being evaluated in the evaluation run. */ + @JsonProperty("candidateNames") + public abstract Optional> candidateNames(); + + /** Name of the evaluation dataset used for the evaluation run. */ + @JsonProperty("datasetName") + public abstract Optional datasetName(); + + /** Unique identifier for the evaluation dataset used for the evaluation run. */ + @JsonProperty("datasetId") + public abstract Optional datasetId(); + + /** Creation timestamp of the evaluation run. */ + @JsonProperty("creationTimestamp") + public abstract Optional creationTimestamp(); + + /** Instantiates a builder for EvaluationRunMetadata. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluationRunMetadata.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluationRunMetadata. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluationRunMetadata.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluationRunMetadata.Builder(); + } + + /** + * Setter for candidateNames. + * + *

candidateNames: Name of the candidate(s) being evaluated in the evaluation run. + */ + @JsonProperty("candidateNames") + public abstract Builder candidateNames(List candidateNames); + + /** + * Setter for candidateNames. + * + *

candidateNames: Name of the candidate(s) being evaluated in the evaluation run. + */ + @CanIgnoreReturnValue + public Builder candidateNames(String... candidateNames) { + return candidateNames(Arrays.asList(candidateNames)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder candidateNames(Optional> candidateNames); + + /** Clears the value of candidateNames field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCandidateNames() { + return candidateNames(Optional.empty()); + } + + /** + * Setter for datasetName. + * + *

datasetName: Name of the evaluation dataset used for the evaluation run. + */ + @JsonProperty("datasetName") + public abstract Builder datasetName(String datasetName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder datasetName(Optional datasetName); + + /** Clears the value of datasetName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDatasetName() { + return datasetName(Optional.empty()); + } + + /** + * Setter for datasetId. + * + *

datasetId: Unique identifier for the evaluation dataset used for the evaluation run. + */ + @JsonProperty("datasetId") + public abstract Builder datasetId(String datasetId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder datasetId(Optional datasetId); + + /** Clears the value of datasetId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDatasetId() { + return datasetId(Optional.empty()); + } + + /** + * Setter for creationTimestamp. + * + *

creationTimestamp: Creation timestamp of the evaluation run. + */ + @JsonProperty("creationTimestamp") + public abstract Builder creationTimestamp(Instant creationTimestamp); + + @ExcludeFromGeneratedCoverageReport + abstract Builder creationTimestamp(Optional creationTimestamp); + + /** Clears the value of creationTimestamp field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCreationTimestamp() { + return creationTimestamp(Optional.empty()); + } + + public abstract EvaluationRunMetadata build(); + } + + /** Deserializes a JSON string to a EvaluationRunMetadata object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluationRunMetadata fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluationRunMetadata.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunMetric.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunMetric.java new file mode 100644 index 000000000000..8abafdf7628c --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunMetric.java @@ -0,0 +1,113 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** The metric used for evaluation run. */ +@AutoValue +@JsonDeserialize(builder = EvaluationRunMetric.Builder.class) +public abstract class EvaluationRunMetric extends JsonSerializable { + /** The name of the metric. */ + @JsonProperty("metric") + public abstract Optional metric(); + + /** The unified metric used for evaluation run. */ + @JsonProperty("metricConfig") + public abstract Optional metricConfig(); + + /** Instantiates a builder for EvaluationRunMetric. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluationRunMetric.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluationRunMetric. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluationRunMetric.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluationRunMetric.Builder(); + } + + /** + * Setter for metric. + * + *

metric: The name of the metric. + */ + @JsonProperty("metric") + public abstract Builder metric(String metric); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metric(Optional metric); + + /** Clears the value of metric field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetric() { + return metric(Optional.empty()); + } + + /** + * Setter for metricConfig. + * + *

metricConfig: The unified metric used for evaluation run. + */ + @JsonProperty("metricConfig") + public abstract Builder metricConfig(UnifiedMetric metricConfig); + + /** + * Setter for metricConfig builder. + * + *

metricConfig: The unified metric used for evaluation run. + */ + @CanIgnoreReturnValue + public Builder metricConfig(UnifiedMetric.Builder metricConfigBuilder) { + return metricConfig(metricConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metricConfig(Optional metricConfig); + + /** Clears the value of metricConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetricConfig() { + return metricConfig(Optional.empty()); + } + + public abstract EvaluationRunMetric build(); + } + + /** Deserializes a JSON string to a EvaluationRunMetric object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluationRunMetric fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluationRunMetric.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunResults.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunResults.java new file mode 100644 index 000000000000..9fbc7e715d30 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunResults.java @@ -0,0 +1,113 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents the results of an evaluation run. */ +@AutoValue +@JsonDeserialize(builder = EvaluationRunResults.Builder.class) +public abstract class EvaluationRunResults extends JsonSerializable { + /** The evaluation set where item level results are stored. */ + @JsonProperty("evaluationSet") + public abstract Optional evaluationSet(); + + /** The summary metrics for the evaluation run. */ + @JsonProperty("summaryMetrics") + public abstract Optional summaryMetrics(); + + /** Instantiates a builder for EvaluationRunResults. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluationRunResults.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluationRunResults. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluationRunResults.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluationRunResults.Builder(); + } + + /** + * Setter for evaluationSet. + * + *

evaluationSet: The evaluation set where item level results are stored. + */ + @JsonProperty("evaluationSet") + public abstract Builder evaluationSet(String evaluationSet); + + @ExcludeFromGeneratedCoverageReport + abstract Builder evaluationSet(Optional evaluationSet); + + /** Clears the value of evaluationSet field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvaluationSet() { + return evaluationSet(Optional.empty()); + } + + /** + * Setter for summaryMetrics. + * + *

summaryMetrics: The summary metrics for the evaluation run. + */ + @JsonProperty("summaryMetrics") + public abstract Builder summaryMetrics(SummaryMetric summaryMetrics); + + /** + * Setter for summaryMetrics builder. + * + *

summaryMetrics: The summary metrics for the evaluation run. + */ + @CanIgnoreReturnValue + public Builder summaryMetrics(SummaryMetric.Builder summaryMetricsBuilder) { + return summaryMetrics(summaryMetricsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder summaryMetrics(Optional summaryMetrics); + + /** Clears the value of summaryMetrics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSummaryMetrics() { + return summaryMetrics(Optional.empty()); + } + + public abstract EvaluationRunResults build(); + } + + /** Deserializes a JSON string to a EvaluationRunResults object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluationRunResults fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluationRunResults.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunState.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunState.java new file mode 100644 index 000000000000..b7007364f73c --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationRunState.java @@ -0,0 +1,128 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** Represents the state of an evaluation run. */ +public class EvaluationRunState { + + /** Enum representing the known values for EvaluationRunState. */ + public enum Known { + /** Evaluation run state is unspecified. */ + UNSPECIFIED, + + /** Evaluation run is pending. */ + PENDING, + + /** Evaluation run is in progress. */ + RUNNING, + + /** Evaluation run has succeeded. */ + SUCCEEDED, + + /** Evaluation run failed. */ + FAILED, + + /** Evaluation run was cancelled. */ + CANCELLED, + + /** Evaluation run is performing inference. */ + INFERENCE, + + /** Evaluation run is performing rubric generation. */ + GENERATING_RUBRICS, + + EVALUATION_RUN_STATE_UNSPECIFIED + } + + private Known evaluationRunStateEnum; + private final String value; + + @JsonCreator + public EvaluationRunState(String value) { + this.value = value; + for (Known evaluationRunStateEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(evaluationRunStateEnum.toString(), value)) { + this.evaluationRunStateEnum = evaluationRunStateEnum; + break; + } + } + if (this.evaluationRunStateEnum == null) { + this.evaluationRunStateEnum = Known.EVALUATION_RUN_STATE_UNSPECIFIED; + } + } + + public EvaluationRunState(Known knownValue) { + this.evaluationRunStateEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof EvaluationRunState)) { + return false; + } + + EvaluationRunState other = (EvaluationRunState) o; + + if (this.evaluationRunStateEnum != Known.EVALUATION_RUN_STATE_UNSPECIFIED + && other.evaluationRunStateEnum != Known.EVALUATION_RUN_STATE_UNSPECIFIED) { + return this.evaluationRunStateEnum == other.evaluationRunStateEnum; + } else if (this.evaluationRunStateEnum == Known.EVALUATION_RUN_STATE_UNSPECIFIED + && other.evaluationRunStateEnum == Known.EVALUATION_RUN_STATE_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.evaluationRunStateEnum != Known.EVALUATION_RUN_STATE_UNSPECIFIED) { + return this.evaluationRunStateEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.evaluationRunStateEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationSet.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationSet.java new file mode 100644 index 000000000000..947d296c557f --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/EvaluationSet.java @@ -0,0 +1,205 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.time.Instant; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** Represents an evaluation set. */ +@AutoValue +@JsonDeserialize(builder = EvaluationSet.Builder.class) +public abstract class EvaluationSet extends JsonSerializable { + /** The resource name of the evaluation set. */ + @JsonProperty("name") + public abstract Optional name(); + + /** The display name of the evaluation set. */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** The EvaluationItems that are part of this dataset. */ + @JsonProperty("evaluationItems") + public abstract Optional> evaluationItems(); + + /** The create time of the evaluation set. */ + @JsonProperty("createTime") + public abstract Optional createTime(); + + /** The update time of the evaluation set. */ + @JsonProperty("updateTime") + public abstract Optional updateTime(); + + /** The metadata of the evaluation set. */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** Instantiates a builder for EvaluationSet. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_EvaluationSet.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for EvaluationSet. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `EvaluationSet.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_EvaluationSet.Builder(); + } + + /** + * Setter for name. + * + *

name: The resource name of the evaluation set. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: The display name of the evaluation set. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for evaluationItems. + * + *

evaluationItems: The EvaluationItems that are part of this dataset. + */ + @JsonProperty("evaluationItems") + public abstract Builder evaluationItems(List evaluationItems); + + /** + * Setter for evaluationItems. + * + *

evaluationItems: The EvaluationItems that are part of this dataset. + */ + @CanIgnoreReturnValue + public Builder evaluationItems(String... evaluationItems) { + return evaluationItems(Arrays.asList(evaluationItems)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder evaluationItems(Optional> evaluationItems); + + /** Clears the value of evaluationItems field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvaluationItems() { + return evaluationItems(Optional.empty()); + } + + /** + * Setter for createTime. + * + *

createTime: The create time of the evaluation set. + */ + @JsonProperty("createTime") + public abstract Builder createTime(Instant createTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder createTime(Optional createTime); + + /** Clears the value of createTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCreateTime() { + return createTime(Optional.empty()); + } + + /** + * Setter for updateTime. + * + *

updateTime: The update time of the evaluation set. + */ + @JsonProperty("updateTime") + public abstract Builder updateTime(Instant updateTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder updateTime(Optional updateTime); + + /** Clears the value of updateTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUpdateTime() { + return updateTime(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: The metadata of the evaluation set. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + public abstract EvaluationSet build(); + } + + /** Deserializes a JSON string to a EvaluationSet object. */ + @ExcludeFromGeneratedCoverageReport + public static EvaluationSet fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, EvaluationSet.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Event.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Event.java new file mode 100644 index 000000000000..be891c1abcc6 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Event.java @@ -0,0 +1,154 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import java.time.Instant; +import java.util.Optional; + +/** + * Represents an event in a conversation between agents and users. + * + *

It is used to store the content of the conversation, as well as the actions taken by the + * agents like function calls, function responses, intermediate NL responses etc. + */ +@AutoValue +@JsonDeserialize(builder = Event.Builder.class) +public abstract class Event extends JsonSerializable { + /** Unique identifier for the agent event. */ + @JsonProperty("eventId") + public abstract Optional eventId(); + + /** Content of the event. */ + @JsonProperty("content") + public abstract Optional content(); + + /** The creation timestamp of the event. */ + @JsonProperty("creationTimestamp") + public abstract Optional creationTimestamp(); + + /** Name of the entity that produced the event. */ + @JsonProperty("author") + public abstract Optional author(); + + /** Instantiates a builder for Event. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_Event.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for Event. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `Event.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_Event.Builder(); + } + + /** + * Setter for eventId. + * + *

eventId: Unique identifier for the agent event. + */ + @JsonProperty("eventId") + public abstract Builder eventId(String eventId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder eventId(Optional eventId); + + /** Clears the value of eventId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEventId() { + return eventId(Optional.empty()); + } + + /** + * Setter for content. + * + *

content: Content of the event. + */ + @JsonProperty("content") + public abstract Builder content(Content content); + + @ExcludeFromGeneratedCoverageReport + abstract Builder content(Optional content); + + /** Clears the value of content field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContent() { + return content(Optional.empty()); + } + + /** + * Setter for creationTimestamp. + * + *

creationTimestamp: The creation timestamp of the event. + */ + @JsonProperty("creationTimestamp") + public abstract Builder creationTimestamp(Instant creationTimestamp); + + @ExcludeFromGeneratedCoverageReport + abstract Builder creationTimestamp(Optional creationTimestamp); + + /** Clears the value of creationTimestamp field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCreationTimestamp() { + return creationTimestamp(Optional.empty()); + } + + /** + * Setter for author. + * + *

author: Name of the entity that produced the event. + */ + @JsonProperty("author") + public abstract Builder author(String author); + + @ExcludeFromGeneratedCoverageReport + abstract Builder author(Optional author); + + /** Clears the value of author field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAuthor() { + return author(Optional.empty()); + } + + public abstract Event build(); + } + + /** Deserializes a JSON string to a Event object. */ + @ExcludeFromGeneratedCoverageReport + public static Event fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, Event.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Events.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Events.java new file mode 100644 index 000000000000..00999bb56535 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Events.java @@ -0,0 +1,94 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Represents a list of events for an agent. */ +@AutoValue +@JsonDeserialize(builder = Events.Builder.class) +public abstract class Events extends JsonSerializable { + /** A list of events. */ + @JsonProperty("event") + public abstract Optional> event(); + + /** Instantiates a builder for Events. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_Events.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for Events. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `Events.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_Events.Builder(); + } + + /** + * Setter for event. + * + *

event: A list of events. + */ + @JsonProperty("event") + public abstract Builder event(List event); + + /** + * Setter for event. + * + *

event: A list of events. + */ + @CanIgnoreReturnValue + public Builder event(Content... event) { + return event(Arrays.asList(event)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder event(Optional> event); + + /** Clears the value of event field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvent() { + return event(Optional.empty()); + } + + public abstract Events build(); + } + + /** Deserializes a JSON string to a Events object. */ + @ExcludeFromGeneratedCoverageReport + public static Events fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, Events.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchInput.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchInput.java new file mode 100644 index 000000000000..e8309e385bac --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchInput.java @@ -0,0 +1,140 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** None */ +@AutoValue +@JsonDeserialize(builder = ExactMatchInput.Builder.class) +public abstract class ExactMatchInput extends JsonSerializable { + /** Required. Repeated exact match instances. */ + @JsonProperty("instances") + public abstract Optional> instances(); + + /** Required. Spec for exact match metric. */ + @JsonProperty("metricSpec") + public abstract Optional metricSpec(); + + /** Instantiates a builder for ExactMatchInput. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ExactMatchInput.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ExactMatchInput. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ExactMatchInput.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ExactMatchInput.Builder(); + } + + /** + * Setter for instances. + * + *

instances: Required. Repeated exact match instances. + */ + @JsonProperty("instances") + public abstract Builder instances(List instances); + + /** + * Setter for instances. + * + *

instances: Required. Repeated exact match instances. + */ + @CanIgnoreReturnValue + public Builder instances(ExactMatchInstance... instances) { + return instances(Arrays.asList(instances)); + } + + /** + * Setter for instances builder. + * + *

instances: Required. Repeated exact match instances. + */ + @CanIgnoreReturnValue + public Builder instances(ExactMatchInstance.Builder... instancesBuilders) { + return instances( + Arrays.asList(instancesBuilders).stream() + .map(ExactMatchInstance.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder instances(Optional> instances); + + /** Clears the value of instances field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInstances() { + return instances(Optional.empty()); + } + + /** + * Setter for metricSpec. + * + *

metricSpec: Required. Spec for exact match metric. + */ + @JsonProperty("metricSpec") + public abstract Builder metricSpec(ExactMatchSpec metricSpec); + + /** + * Setter for metricSpec builder. + * + *

metricSpec: Required. Spec for exact match metric. + */ + @CanIgnoreReturnValue + public Builder metricSpec(ExactMatchSpec.Builder metricSpecBuilder) { + return metricSpec(metricSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metricSpec(Optional metricSpec); + + /** Clears the value of metricSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetricSpec() { + return metricSpec(Optional.empty()); + } + + public abstract ExactMatchInput build(); + } + + /** Deserializes a JSON string to a ExactMatchInput object. */ + @ExcludeFromGeneratedCoverageReport + public static ExactMatchInput fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ExactMatchInput.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchInstance.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchInstance.java new file mode 100644 index 000000000000..47e7af493236 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchInstance.java @@ -0,0 +1,103 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Exact match instance. */ +@AutoValue +@JsonDeserialize(builder = ExactMatchInstance.Builder.class) +public abstract class ExactMatchInstance extends JsonSerializable { + /** Required. Output of the evaluated model. */ + @JsonProperty("prediction") + public abstract Optional prediction(); + + /** Required. Ground truth used to compare against the prediction. */ + @JsonProperty("reference") + public abstract Optional reference(); + + /** Instantiates a builder for ExactMatchInstance. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ExactMatchInstance.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ExactMatchInstance. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ExactMatchInstance.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ExactMatchInstance.Builder(); + } + + /** + * Setter for prediction. + * + *

prediction: Required. Output of the evaluated model. + */ + @JsonProperty("prediction") + public abstract Builder prediction(String prediction); + + @ExcludeFromGeneratedCoverageReport + abstract Builder prediction(Optional prediction); + + /** Clears the value of prediction field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPrediction() { + return prediction(Optional.empty()); + } + + /** + * Setter for reference. + * + *

reference: Required. Ground truth used to compare against the prediction. + */ + @JsonProperty("reference") + public abstract Builder reference(String reference); + + @ExcludeFromGeneratedCoverageReport + abstract Builder reference(Optional reference); + + /** Clears the value of reference field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReference() { + return reference(Optional.empty()); + } + + public abstract ExactMatchInstance build(); + } + + /** Deserializes a JSON string to a ExactMatchInstance object. */ + @ExcludeFromGeneratedCoverageReport + public static ExactMatchInstance fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ExactMatchInstance.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchMetricValue.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchMetricValue.java new file mode 100644 index 000000000000..132522b948ad --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchMetricValue.java @@ -0,0 +1,81 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Exact match metric value for an instance. */ +@AutoValue +@JsonDeserialize(builder = ExactMatchMetricValue.Builder.class) +public abstract class ExactMatchMetricValue extends JsonSerializable { + /** Output only. Exact match score. */ + @JsonProperty("score") + public abstract Optional score(); + + /** Instantiates a builder for ExactMatchMetricValue. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ExactMatchMetricValue.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ExactMatchMetricValue. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ExactMatchMetricValue.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ExactMatchMetricValue.Builder(); + } + + /** + * Setter for score. + * + *

score: Output only. Exact match score. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + @ExcludeFromGeneratedCoverageReport + abstract Builder score(Optional score); + + /** Clears the value of score field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScore() { + return score(Optional.empty()); + } + + public abstract ExactMatchMetricValue build(); + } + + /** Deserializes a JSON string to a ExactMatchMetricValue object. */ + @ExcludeFromGeneratedCoverageReport + public static ExactMatchMetricValue fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ExactMatchMetricValue.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchResults.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchResults.java new file mode 100644 index 000000000000..2a3b0a5ea52c --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchResults.java @@ -0,0 +1,111 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Results for exact match metric. */ +@AutoValue +@JsonDeserialize(builder = ExactMatchResults.Builder.class) +public abstract class ExactMatchResults extends JsonSerializable { + /** Output only. Exact match metric values. */ + @JsonProperty("exactMatchMetricValues") + public abstract Optional> exactMatchMetricValues(); + + /** Instantiates a builder for ExactMatchResults. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ExactMatchResults.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ExactMatchResults. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ExactMatchResults.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ExactMatchResults.Builder(); + } + + /** + * Setter for exactMatchMetricValues. + * + *

exactMatchMetricValues: Output only. Exact match metric values. + */ + @JsonProperty("exactMatchMetricValues") + public abstract Builder exactMatchMetricValues( + List exactMatchMetricValues); + + /** + * Setter for exactMatchMetricValues. + * + *

exactMatchMetricValues: Output only. Exact match metric values. + */ + @CanIgnoreReturnValue + public Builder exactMatchMetricValues(ExactMatchMetricValue... exactMatchMetricValues) { + return exactMatchMetricValues(Arrays.asList(exactMatchMetricValues)); + } + + /** + * Setter for exactMatchMetricValues builder. + * + *

exactMatchMetricValues: Output only. Exact match metric values. + */ + @CanIgnoreReturnValue + public Builder exactMatchMetricValues( + ExactMatchMetricValue.Builder... exactMatchMetricValuesBuilders) { + return exactMatchMetricValues( + Arrays.asList(exactMatchMetricValuesBuilders).stream() + .map(ExactMatchMetricValue.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder exactMatchMetricValues( + Optional> exactMatchMetricValues); + + /** Clears the value of exactMatchMetricValues field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExactMatchMetricValues() { + return exactMatchMetricValues(Optional.empty()); + } + + public abstract ExactMatchResults build(); + } + + /** Deserializes a JSON string to a ExactMatchResults object. */ + @ExcludeFromGeneratedCoverageReport + public static ExactMatchResults fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ExactMatchResults.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchSpec.java new file mode 100644 index 000000000000..a4fe2809041b --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExactMatchSpec.java @@ -0,0 +1,56 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.genai.JsonSerializable; + +/** Spec for exact match metric. */ +@AutoValue +@JsonDeserialize(builder = ExactMatchSpec.Builder.class) +public abstract class ExactMatchSpec extends JsonSerializable { + /** Instantiates a builder for ExactMatchSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ExactMatchSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ExactMatchSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ExactMatchSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ExactMatchSpec.Builder(); + } + + public abstract ExactMatchSpec build(); + } + + /** Deserializes a JSON string to a ExactMatchSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static ExactMatchSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ExactMatchSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExcludeFromGeneratedCoverageReport.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExcludeFromGeneratedCoverageReport.java new file mode 100644 index 000000000000..9f3fe0483cc9 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExcludeFromGeneratedCoverageReport.java @@ -0,0 +1,31 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +package com.google.cloud.vertexai.genai.types; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation to exclude a method or constructor from the Jacoco coverage report. + * + *

Jacoco will exclude methods that have an annotation with the word "generated" in it. + */ +@Retention(RetentionPolicy.CLASS) +@Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.TYPE}) +@interface ExcludeFromGeneratedCoverageReport {} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteCodeAgentEngineSandboxConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteCodeAgentEngineSandboxConfig.java new file mode 100644 index 000000000000..93fbf163eb5b --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteCodeAgentEngineSandboxConfig.java @@ -0,0 +1,85 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for executing code in an Agent Engine sandbox. */ +@AutoValue +@JsonDeserialize(builder = ExecuteCodeAgentEngineSandboxConfig.Builder.class) +public abstract class ExecuteCodeAgentEngineSandboxConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for ExecuteCodeAgentEngineSandboxConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ExecuteCodeAgentEngineSandboxConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ExecuteCodeAgentEngineSandboxConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ExecuteCodeAgentEngineSandboxConfig.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ExecuteCodeAgentEngineSandboxConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract ExecuteCodeAgentEngineSandboxConfig build(); + } + + /** Deserializes a JSON string to a ExecuteCodeAgentEngineSandboxConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static ExecuteCodeAgentEngineSandboxConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ExecuteCodeAgentEngineSandboxConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteCodeAgentEngineSandboxRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteCodeAgentEngineSandboxRequestParameters.java new file mode 100644 index 000000000000..10faf25417c3 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteCodeAgentEngineSandboxRequestParameters.java @@ -0,0 +1,168 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Parameters for executing code in an agent engine sandbox. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = ExecuteCodeAgentEngineSandboxRequestParameters.Builder.class) +public abstract class ExecuteCodeAgentEngineSandboxRequestParameters extends JsonSerializable { + /** Name of the agent engine sandbox to execute code in. */ + @JsonProperty("name") + public abstract Optional name(); + + /** Inputs to the code execution. */ + @JsonProperty("inputs") + public abstract Optional> inputs(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for ExecuteCodeAgentEngineSandboxRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ExecuteCodeAgentEngineSandboxRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ExecuteCodeAgentEngineSandboxRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ExecuteCodeAgentEngineSandboxRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ExecuteCodeAgentEngineSandboxRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine sandbox to execute code in. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for inputs. + * + *

inputs: Inputs to the code execution. + */ + @JsonProperty("inputs") + public abstract Builder inputs(List inputs); + + /** + * Setter for inputs. + * + *

inputs: Inputs to the code execution. + */ + @CanIgnoreReturnValue + public Builder inputs(Chunk... inputs) { + return inputs(Arrays.asList(inputs)); + } + + /** + * Setter for inputs builder. + * + *

inputs: Inputs to the code execution. + */ + @CanIgnoreReturnValue + public Builder inputs(Chunk.Builder... inputsBuilders) { + return inputs( + Arrays.asList(inputsBuilders).stream() + .map(Chunk.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder inputs(Optional> inputs); + + /** Clears the value of inputs field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInputs() { + return inputs(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(ExecuteCodeAgentEngineSandboxConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(ExecuteCodeAgentEngineSandboxConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract ExecuteCodeAgentEngineSandboxRequestParameters build(); + } + + /** Deserializes a JSON string to a ExecuteCodeAgentEngineSandboxRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static ExecuteCodeAgentEngineSandboxRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, ExecuteCodeAgentEngineSandboxRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteSandboxEnvironmentResponse.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteSandboxEnvironmentResponse.java new file mode 100644 index 000000000000..5908af17d2a7 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ExecuteSandboxEnvironmentResponse.java @@ -0,0 +1,111 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The response for executing a sandbox environment. */ +@AutoValue +@JsonDeserialize(builder = ExecuteSandboxEnvironmentResponse.Builder.class) +public abstract class ExecuteSandboxEnvironmentResponse extends JsonSerializable { + /** The outputs from the sandbox environment. */ + @JsonProperty("outputs") + public abstract Optional> outputs(); + + /** Instantiates a builder for ExecuteSandboxEnvironmentResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ExecuteSandboxEnvironmentResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ExecuteSandboxEnvironmentResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ExecuteSandboxEnvironmentResponse.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ExecuteSandboxEnvironmentResponse.Builder(); + } + + /** + * Setter for outputs. + * + *

outputs: The outputs from the sandbox environment. + */ + @JsonProperty("outputs") + public abstract Builder outputs(List outputs); + + /** + * Setter for outputs. + * + *

outputs: The outputs from the sandbox environment. + */ + @CanIgnoreReturnValue + public Builder outputs(Chunk... outputs) { + return outputs(Arrays.asList(outputs)); + } + + /** + * Setter for outputs builder. + * + *

outputs: The outputs from the sandbox environment. + */ + @CanIgnoreReturnValue + public Builder outputs(Chunk.Builder... outputsBuilders) { + return outputs( + Arrays.asList(outputsBuilders).stream() + .map(Chunk.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder outputs(Optional> outputs); + + /** Clears the value of outputs field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOutputs() { + return outputs(Optional.empty()); + } + + public abstract ExecuteSandboxEnvironmentResponse build(); + } + + /** Deserializes a JSON string to a ExecuteSandboxEnvironmentResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static ExecuteSandboxEnvironmentResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ExecuteSandboxEnvironmentResponse.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GcsSource.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GcsSource.java new file mode 100644 index 000000000000..83880ae90987 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GcsSource.java @@ -0,0 +1,102 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** + * Cloud storage source holds the dataset. + * + *

Currently only one Cloud Storage file path is supported. + */ +@AutoValue +@JsonDeserialize(builder = GcsSource.Builder.class) +public abstract class GcsSource extends JsonSerializable { + /** + * Required. Google Cloud Storage URI(-s) to the input file(s). May contain wildcards. For more + * information on wildcards, see https://cloud.google.com/storage/docs/wildcards. + */ + @JsonProperty("uris") + public abstract Optional> uris(); + + /** Instantiates a builder for GcsSource. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GcsSource.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GcsSource. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GcsSource.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GcsSource.Builder(); + } + + /** + * Setter for uris. + * + *

uris: Required. Google Cloud Storage URI(-s) to the input file(s). May contain wildcards. + * For more information on wildcards, see https://cloud.google.com/storage/docs/wildcards. + */ + @JsonProperty("uris") + public abstract Builder uris(List uris); + + /** + * Setter for uris. + * + *

uris: Required. Google Cloud Storage URI(-s) to the input file(s). May contain wildcards. + * For more information on wildcards, see https://cloud.google.com/storage/docs/wildcards. + */ + @CanIgnoreReturnValue + public Builder uris(String... uris) { + return uris(Arrays.asList(uris)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder uris(Optional> uris); + + /** Clears the value of uris field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUris() { + return uris(Optional.empty()); + } + + public abstract GcsSource build(); + } + + /** Deserializes a JSON string to a GcsSource object. */ + @ExcludeFromGeneratedCoverageReport + public static GcsSource fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GcsSource.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GeminiExample.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GeminiExample.java new file mode 100644 index 000000000000..4f3d7cc457a4 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GeminiExample.java @@ -0,0 +1,275 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import com.google.genai.types.GenerationConfig; +import com.google.genai.types.SafetySetting; +import com.google.genai.types.Tool; +import com.google.genai.types.ToolConfig; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** Represents a Gemini example. */ +@AutoValue +@JsonDeserialize(builder = GeminiExample.Builder.class) +public abstract class GeminiExample extends JsonSerializable { + /** The model used to generate the Gemini example. */ + @JsonProperty("model") + public abstract Optional model(); + + /** Contents of the Gemini example. */ + @JsonProperty("contents") + public abstract Optional> contents(); + + /** System instruction for the Gemini example. */ + @JsonProperty("systemInstruction") + public abstract Optional systemInstruction(); + + /** Cached content for the Gemini example. */ + @JsonProperty("cachedContent") + public abstract Optional cachedContent(); + + /** Tools for the Gemini example. */ + @JsonProperty("tools") + public abstract Optional tools(); + + /** Tools for the Gemini example. */ + @JsonProperty("toolConfig") + public abstract Optional toolConfig(); + + /** Safety settings for the Gemini example. */ + @JsonProperty("safetySettings") + public abstract Optional safetySettings(); + + /** Labels for the Gemini example. */ + @JsonProperty("labels") + public abstract Optional> labels(); + + /** Generation config for the Gemini example. */ + @JsonProperty("generationConfig") + public abstract Optional generationConfig(); + + /** Instantiates a builder for GeminiExample. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GeminiExample.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GeminiExample. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GeminiExample.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GeminiExample.Builder(); + } + + /** + * Setter for model. + * + *

model: The model used to generate the Gemini example. + */ + @JsonProperty("model") + public abstract Builder model(String model); + + @ExcludeFromGeneratedCoverageReport + abstract Builder model(Optional model); + + /** Clears the value of model field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearModel() { + return model(Optional.empty()); + } + + /** + * Setter for contents. + * + *

contents: Contents of the Gemini example. + */ + @JsonProperty("contents") + public abstract Builder contents(List contents); + + /** + * Setter for contents. + * + *

contents: Contents of the Gemini example. + */ + @CanIgnoreReturnValue + public Builder contents(Content... contents) { + return contents(Arrays.asList(contents)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder contents(Optional> contents); + + /** Clears the value of contents field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContents() { + return contents(Optional.empty()); + } + + /** + * Setter for systemInstruction. + * + *

systemInstruction: System instruction for the Gemini example. + */ + @JsonProperty("systemInstruction") + public abstract Builder systemInstruction(Content systemInstruction); + + @ExcludeFromGeneratedCoverageReport + abstract Builder systemInstruction(Optional systemInstruction); + + /** Clears the value of systemInstruction field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSystemInstruction() { + return systemInstruction(Optional.empty()); + } + + /** + * Setter for cachedContent. + * + *

cachedContent: Cached content for the Gemini example. + */ + @JsonProperty("cachedContent") + public abstract Builder cachedContent(String cachedContent); + + @ExcludeFromGeneratedCoverageReport + abstract Builder cachedContent(Optional cachedContent); + + /** Clears the value of cachedContent field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCachedContent() { + return cachedContent(Optional.empty()); + } + + /** + * Setter for tools. + * + *

tools: Tools for the Gemini example. + */ + @JsonProperty("tools") + public abstract Builder tools(Tool tools); + + @ExcludeFromGeneratedCoverageReport + abstract Builder tools(Optional tools); + + /** Clears the value of tools field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTools() { + return tools(Optional.empty()); + } + + /** + * Setter for toolConfig. + * + *

toolConfig: Tools for the Gemini example. + */ + @JsonProperty("toolConfig") + public abstract Builder toolConfig(ToolConfig toolConfig); + + @ExcludeFromGeneratedCoverageReport + abstract Builder toolConfig(Optional toolConfig); + + /** Clears the value of toolConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearToolConfig() { + return toolConfig(Optional.empty()); + } + + /** + * Setter for safetySettings. + * + *

safetySettings: Safety settings for the Gemini example. + */ + @JsonProperty("safetySettings") + public abstract Builder safetySettings(SafetySetting safetySettings); + + @ExcludeFromGeneratedCoverageReport + abstract Builder safetySettings(Optional safetySettings); + + /** Clears the value of safetySettings field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSafetySettings() { + return safetySettings(Optional.empty()); + } + + /** + * Setter for labels. + * + *

labels: Labels for the Gemini example. + */ + @JsonProperty("labels") + public abstract Builder labels(Map labels); + + @ExcludeFromGeneratedCoverageReport + abstract Builder labels(Optional> labels); + + /** Clears the value of labels field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLabels() { + return labels(Optional.empty()); + } + + /** + * Setter for generationConfig. + * + *

generationConfig: Generation config for the Gemini example. + */ + @JsonProperty("generationConfig") + public abstract Builder generationConfig(GenerationConfig generationConfig); + + @ExcludeFromGeneratedCoverageReport + abstract Builder generationConfig(Optional generationConfig); + + /** Clears the value of generationConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGenerationConfig() { + return generationConfig(Optional.empty()); + } + + public abstract GeminiExample build(); + } + + /** Deserializes a JSON string to a GeminiExample object. */ + @ExcludeFromGeneratedCoverageReport + public static GeminiExample fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GeminiExample.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GeminiRequestReadConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GeminiRequestReadConfig.java new file mode 100644 index 000000000000..caca54af8182 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GeminiRequestReadConfig.java @@ -0,0 +1,117 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents the config for reading Gemini requests. */ +@AutoValue +@JsonDeserialize(builder = GeminiRequestReadConfig.Builder.class) +public abstract class GeminiRequestReadConfig extends JsonSerializable { + /** Gemini request template with placeholders. */ + @JsonProperty("templateConfig") + public abstract Optional templateConfig(); + + /** + * Optional. Column name in the dataset table that contains already fully assembled Gemini + * requests. + */ + @JsonProperty("assembledRequestColumnName") + public abstract Optional assembledRequestColumnName(); + + /** Instantiates a builder for GeminiRequestReadConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GeminiRequestReadConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GeminiRequestReadConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GeminiRequestReadConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GeminiRequestReadConfig.Builder(); + } + + /** + * Setter for templateConfig. + * + *

templateConfig: Gemini request template with placeholders. + */ + @JsonProperty("templateConfig") + public abstract Builder templateConfig(GeminiTemplateConfig templateConfig); + + /** + * Setter for templateConfig builder. + * + *

templateConfig: Gemini request template with placeholders. + */ + @CanIgnoreReturnValue + public Builder templateConfig(GeminiTemplateConfig.Builder templateConfigBuilder) { + return templateConfig(templateConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder templateConfig(Optional templateConfig); + + /** Clears the value of templateConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTemplateConfig() { + return templateConfig(Optional.empty()); + } + + /** + * Setter for assembledRequestColumnName. + * + *

assembledRequestColumnName: Optional. Column name in the dataset table that contains + * already fully assembled Gemini requests. + */ + @JsonProperty("assembledRequestColumnName") + public abstract Builder assembledRequestColumnName(String assembledRequestColumnName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder assembledRequestColumnName(Optional assembledRequestColumnName); + + /** Clears the value of assembledRequestColumnName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAssembledRequestColumnName() { + return assembledRequestColumnName(Optional.empty()); + } + + public abstract GeminiRequestReadConfig build(); + } + + /** Deserializes a JSON string to a GeminiRequestReadConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static GeminiRequestReadConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GeminiRequestReadConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GeminiTemplateConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GeminiTemplateConfig.java new file mode 100644 index 000000000000..b6f1359b586e --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GeminiTemplateConfig.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Represents a Gemini template config. */ +@AutoValue +@JsonDeserialize(builder = GeminiTemplateConfig.Builder.class) +public abstract class GeminiTemplateConfig extends JsonSerializable { + /** + * Required. The template that will be used for assembling the request to use for downstream + * applications. + */ + @JsonProperty("geminiExample") + public abstract Optional geminiExample(); + + /** Required. Map of template parameters to the columns in the dataset table. */ + @JsonProperty("fieldMapping") + public abstract Optional> fieldMapping(); + + /** Instantiates a builder for GeminiTemplateConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GeminiTemplateConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GeminiTemplateConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GeminiTemplateConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GeminiTemplateConfig.Builder(); + } + + /** + * Setter for geminiExample. + * + *

geminiExample: Required. The template that will be used for assembling the request to use + * for downstream applications. + */ + @JsonProperty("geminiExample") + public abstract Builder geminiExample(GeminiExample geminiExample); + + /** + * Setter for geminiExample builder. + * + *

geminiExample: Required. The template that will be used for assembling the request to use + * for downstream applications. + */ + @CanIgnoreReturnValue + public Builder geminiExample(GeminiExample.Builder geminiExampleBuilder) { + return geminiExample(geminiExampleBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder geminiExample(Optional geminiExample); + + /** Clears the value of geminiExample field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGeminiExample() { + return geminiExample(Optional.empty()); + } + + /** + * Setter for fieldMapping. + * + *

fieldMapping: Required. Map of template parameters to the columns in the dataset table. + */ + @JsonProperty("fieldMapping") + public abstract Builder fieldMapping(Map fieldMapping); + + @ExcludeFromGeneratedCoverageReport + abstract Builder fieldMapping(Optional> fieldMapping); + + /** Clears the value of fieldMapping field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFieldMapping() { + return fieldMapping(Optional.empty()); + } + + public abstract GeminiTemplateConfig build(); + } + + /** Deserializes a JSON string to a GeminiTemplateConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static GeminiTemplateConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GeminiTemplateConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateAgentEngineMemoriesConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateAgentEngineMemoriesConfig.java new file mode 100644 index 000000000000..361f5c9ff973 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateAgentEngineMemoriesConfig.java @@ -0,0 +1,240 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.time.Duration; +import java.time.Instant; +import java.util.Map; +import java.util.Optional; + +/** Config for generating memories. */ +@AutoValue +@JsonDeserialize(builder = GenerateAgentEngineMemoriesConfig.Builder.class) +public abstract class GenerateAgentEngineMemoriesConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** + * Whether to disable consolidation of memories. + * + *

If true, generated memories will not be consolidated with existing memories; all generated + * memories will be added as new memories regardless of whether they are duplicates of or + * contradictory to existing memories. By default, memory consolidation is enabled. + */ + @JsonProperty("disableConsolidation") + public abstract Optional disableConsolidation(); + + /** Waits for the operation to complete before returning. */ + @JsonProperty("waitForCompletion") + public abstract Optional waitForCompletion(); + + /** + * Labels to apply to the memory revision. For example, you can use this to label a revision with + * its data source. + */ + @JsonProperty("revisionLabels") + public abstract Optional> revisionLabels(); + + /** + * Optional. Input only. Timestamp of when the revision is considered expired. If not set, the + * memory revision will be kept until manually deleted. + */ + @JsonProperty("revisionExpireTime") + public abstract Optional revisionExpireTime(); + + /** Optional. Input only. The TTL for the revision. The expiration time is computed: now + TTL. */ + @JsonProperty("revisionTtl") + public abstract Optional revisionTtl(); + + /** Optional. Input only. If true, no revisions will be created for this request. */ + @JsonProperty("disableMemoryRevisions") + public abstract Optional disableMemoryRevisions(); + + /** Instantiates a builder for GenerateAgentEngineMemoriesConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateAgentEngineMemoriesConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateAgentEngineMemoriesConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GenerateAgentEngineMemoriesConfig.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateAgentEngineMemoriesConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for disableConsolidation. + * + *

disableConsolidation: Whether to disable consolidation of memories. + * + *

If true, generated memories will not be consolidated with existing memories; all generated + * memories will be added as new memories regardless of whether they are duplicates of or + * contradictory to existing memories. By default, memory consolidation is enabled. + */ + @JsonProperty("disableConsolidation") + public abstract Builder disableConsolidation(boolean disableConsolidation); + + @ExcludeFromGeneratedCoverageReport + abstract Builder disableConsolidation(Optional disableConsolidation); + + /** Clears the value of disableConsolidation field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisableConsolidation() { + return disableConsolidation(Optional.empty()); + } + + /** + * Setter for waitForCompletion. + * + *

waitForCompletion: Waits for the operation to complete before returning. + */ + @JsonProperty("waitForCompletion") + public abstract Builder waitForCompletion(boolean waitForCompletion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder waitForCompletion(Optional waitForCompletion); + + /** Clears the value of waitForCompletion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWaitForCompletion() { + return waitForCompletion(Optional.empty()); + } + + /** + * Setter for revisionLabels. + * + *

revisionLabels: Labels to apply to the memory revision. For example, you can use this to + * label a revision with its data source. + */ + @JsonProperty("revisionLabels") + public abstract Builder revisionLabels(Map revisionLabels); + + @ExcludeFromGeneratedCoverageReport + abstract Builder revisionLabels(Optional> revisionLabels); + + /** Clears the value of revisionLabels field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRevisionLabels() { + return revisionLabels(Optional.empty()); + } + + /** + * Setter for revisionExpireTime. + * + *

revisionExpireTime: Optional. Input only. Timestamp of when the revision is considered + * expired. If not set, the memory revision will be kept until manually deleted. + */ + @JsonProperty("revisionExpireTime") + public abstract Builder revisionExpireTime(Instant revisionExpireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder revisionExpireTime(Optional revisionExpireTime); + + /** Clears the value of revisionExpireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRevisionExpireTime() { + return revisionExpireTime(Optional.empty()); + } + + /** + * Setter for revisionTtl. + * + *

revisionTtl: Optional. Input only. The TTL for the revision. The expiration time is + * computed: now + TTL. + */ + @JsonProperty("revisionTtl") + public abstract Builder revisionTtl(Duration revisionTtl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder revisionTtl(Optional revisionTtl); + + /** Clears the value of revisionTtl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRevisionTtl() { + return revisionTtl(Optional.empty()); + } + + /** + * Setter for disableMemoryRevisions. + * + *

disableMemoryRevisions: Optional. Input only. If true, no revisions will be created for + * this request. + */ + @JsonProperty("disableMemoryRevisions") + public abstract Builder disableMemoryRevisions(boolean disableMemoryRevisions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder disableMemoryRevisions(Optional disableMemoryRevisions); + + /** Clears the value of disableMemoryRevisions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisableMemoryRevisions() { + return disableMemoryRevisions(Optional.empty()); + } + + public abstract GenerateAgentEngineMemoriesConfig build(); + } + + /** Deserializes a JSON string to a GenerateAgentEngineMemoriesConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static GenerateAgentEngineMemoriesConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GenerateAgentEngineMemoriesConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateAgentEngineMemoriesRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateAgentEngineMemoriesRequestParameters.java new file mode 100644 index 000000000000..21f325b561a3 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateAgentEngineMemoriesRequestParameters.java @@ -0,0 +1,257 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Parameters for generating agent engine memories. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GenerateAgentEngineMemoriesRequestParameters.Builder.class) +public abstract class GenerateAgentEngineMemoriesRequestParameters extends JsonSerializable { + /** Name of the agent engine to generate memories for. */ + @JsonProperty("name") + public abstract Optional name(); + + /** The vertex session source of the memories that should be generated. */ + @JsonProperty("vertexSessionSource") + public abstract Optional vertexSessionSource(); + + /** The direct contents source of the memories that should be generated. */ + @JsonProperty("directContentsSource") + public abstract Optional directContentsSource(); + + /** The direct memories source of the memories that should be generated. */ + @JsonProperty("directMemoriesSource") + public abstract Optional directMemoriesSource(); + + /** + * The scope of the memories that should be generated. + * + *

Memories will be consolidated across memories with the same scope. Must be provided unless + * the scope is defined in the source content. If `scope` is provided, it will override the scope + * defined in the source content. Scope values cannot contain the wildcard character '*'. + */ + @JsonProperty("scope") + public abstract Optional> scope(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GenerateAgentEngineMemoriesRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateAgentEngineMemoriesRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateAgentEngineMemoriesRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GenerateAgentEngineMemoriesRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateAgentEngineMemoriesRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine to generate memories for. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for vertexSessionSource. + * + *

vertexSessionSource: The vertex session source of the memories that should be generated. + */ + @JsonProperty("vertexSessionSource") + public abstract Builder vertexSessionSource( + GenerateMemoriesRequestVertexSessionSource vertexSessionSource); + + /** + * Setter for vertexSessionSource builder. + * + *

vertexSessionSource: The vertex session source of the memories that should be generated. + */ + @CanIgnoreReturnValue + public Builder vertexSessionSource( + GenerateMemoriesRequestVertexSessionSource.Builder vertexSessionSourceBuilder) { + return vertexSessionSource(vertexSessionSourceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder vertexSessionSource( + Optional vertexSessionSource); + + /** Clears the value of vertexSessionSource field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearVertexSessionSource() { + return vertexSessionSource(Optional.empty()); + } + + /** + * Setter for directContentsSource. + * + *

directContentsSource: The direct contents source of the memories that should be generated. + */ + @JsonProperty("directContentsSource") + public abstract Builder directContentsSource( + GenerateMemoriesRequestDirectContentsSource directContentsSource); + + /** + * Setter for directContentsSource builder. + * + *

directContentsSource: The direct contents source of the memories that should be generated. + */ + @CanIgnoreReturnValue + public Builder directContentsSource( + GenerateMemoriesRequestDirectContentsSource.Builder directContentsSourceBuilder) { + return directContentsSource(directContentsSourceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder directContentsSource( + Optional directContentsSource); + + /** Clears the value of directContentsSource field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDirectContentsSource() { + return directContentsSource(Optional.empty()); + } + + /** + * Setter for directMemoriesSource. + * + *

directMemoriesSource: The direct memories source of the memories that should be generated. + */ + @JsonProperty("directMemoriesSource") + public abstract Builder directMemoriesSource( + GenerateMemoriesRequestDirectMemoriesSource directMemoriesSource); + + /** + * Setter for directMemoriesSource builder. + * + *

directMemoriesSource: The direct memories source of the memories that should be generated. + */ + @CanIgnoreReturnValue + public Builder directMemoriesSource( + GenerateMemoriesRequestDirectMemoriesSource.Builder directMemoriesSourceBuilder) { + return directMemoriesSource(directMemoriesSourceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder directMemoriesSource( + Optional directMemoriesSource); + + /** Clears the value of directMemoriesSource field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDirectMemoriesSource() { + return directMemoriesSource(Optional.empty()); + } + + /** + * Setter for scope. + * + *

scope: The scope of the memories that should be generated. + * + *

Memories will be consolidated across memories with the same scope. Must be provided unless + * the scope is defined in the source content. If `scope` is provided, it will override the + * scope defined in the source content. Scope values cannot contain the wildcard character '*'. + */ + @JsonProperty("scope") + public abstract Builder scope(Map scope); + + @ExcludeFromGeneratedCoverageReport + abstract Builder scope(Optional> scope); + + /** Clears the value of scope field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScope() { + return scope(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(GenerateAgentEngineMemoriesConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(GenerateAgentEngineMemoriesConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GenerateAgentEngineMemoriesRequestParameters build(); + } + + /** Deserializes a JSON string to a GenerateAgentEngineMemoriesRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GenerateAgentEngineMemoriesRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GenerateAgentEngineMemoriesRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateInstanceRubricsRequest.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateInstanceRubricsRequest.java new file mode 100644 index 000000000000..b30b7bbb8042 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateInstanceRubricsRequest.java @@ -0,0 +1,216 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Parameters for generating rubrics. */ +@AutoValue +@JsonDeserialize(builder = GenerateInstanceRubricsRequest.Builder.class) +public abstract class GenerateInstanceRubricsRequest extends JsonSerializable { + /** + * The prompt to generate rubrics from. For single-turn queries, this is a single instance. For + * multi-turn queries, this is a repeated field that contains conversation history + latest + * request. + */ + @JsonProperty("contents") + public abstract Optional> contents(); + + /** + * Specification for using the rubric generation configs of a pre-defined metric, e.g. + * "generic_quality_v1" and "instruction_following_v1". Some of the configs may be only used in + * rubric generation and not supporting evaluation, e.g. "fully_customized_generic_quality_v1". If + * this field is set, the `rubric_generation_spec` field will be ignored. + */ + @JsonProperty("predefinedRubricGenerationSpec") + public abstract Optional predefinedRubricGenerationSpec(); + + /** Specification for how the rubrics should be generated. */ + @JsonProperty("rubricGenerationSpec") + public abstract Optional rubricGenerationSpec(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GenerateInstanceRubricsRequest. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateInstanceRubricsRequest.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateInstanceRubricsRequest. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GenerateInstanceRubricsRequest.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateInstanceRubricsRequest.Builder(); + } + + /** + * Setter for contents. + * + *

contents: The prompt to generate rubrics from. For single-turn queries, this is a single + * instance. For multi-turn queries, this is a repeated field that contains conversation history + * + latest request. + */ + @JsonProperty("contents") + public abstract Builder contents(List contents); + + /** + * Setter for contents. + * + *

contents: The prompt to generate rubrics from. For single-turn queries, this is a single + * instance. For multi-turn queries, this is a repeated field that contains conversation history + * + latest request. + */ + @CanIgnoreReturnValue + public Builder contents(Content... contents) { + return contents(Arrays.asList(contents)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder contents(Optional> contents); + + /** Clears the value of contents field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContents() { + return contents(Optional.empty()); + } + + /** + * Setter for predefinedRubricGenerationSpec. + * + *

predefinedRubricGenerationSpec: Specification for using the rubric generation configs of a + * pre-defined metric, e.g. "generic_quality_v1" and "instruction_following_v1". Some of the + * configs may be only used in rubric generation and not supporting evaluation, e.g. + * "fully_customized_generic_quality_v1". If this field is set, the `rubric_generation_spec` + * field will be ignored. + */ + @JsonProperty("predefinedRubricGenerationSpec") + public abstract Builder predefinedRubricGenerationSpec( + PredefinedMetricSpec predefinedRubricGenerationSpec); + + /** + * Setter for predefinedRubricGenerationSpec builder. + * + *

predefinedRubricGenerationSpec: Specification for using the rubric generation configs of a + * pre-defined metric, e.g. "generic_quality_v1" and "instruction_following_v1". Some of the + * configs may be only used in rubric generation and not supporting evaluation, e.g. + * "fully_customized_generic_quality_v1". If this field is set, the `rubric_generation_spec` + * field will be ignored. + */ + @CanIgnoreReturnValue + public Builder predefinedRubricGenerationSpec( + PredefinedMetricSpec.Builder predefinedRubricGenerationSpecBuilder) { + return predefinedRubricGenerationSpec(predefinedRubricGenerationSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder predefinedRubricGenerationSpec( + Optional predefinedRubricGenerationSpec); + + /** Clears the value of predefinedRubricGenerationSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPredefinedRubricGenerationSpec() { + return predefinedRubricGenerationSpec(Optional.empty()); + } + + /** + * Setter for rubricGenerationSpec. + * + *

rubricGenerationSpec: Specification for how the rubrics should be generated. + */ + @JsonProperty("rubricGenerationSpec") + public abstract Builder rubricGenerationSpec(RubricGenerationSpec rubricGenerationSpec); + + /** + * Setter for rubricGenerationSpec builder. + * + *

rubricGenerationSpec: Specification for how the rubrics should be generated. + */ + @CanIgnoreReturnValue + public Builder rubricGenerationSpec(RubricGenerationSpec.Builder rubricGenerationSpecBuilder) { + return rubricGenerationSpec(rubricGenerationSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubricGenerationSpec(Optional rubricGenerationSpec); + + /** Clears the value of rubricGenerationSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubricGenerationSpec() { + return rubricGenerationSpec(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(RubricGenerationConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(RubricGenerationConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GenerateInstanceRubricsRequest build(); + } + + /** Deserializes a JSON string to a GenerateInstanceRubricsRequest object. */ + @ExcludeFromGeneratedCoverageReport + public static GenerateInstanceRubricsRequest fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GenerateInstanceRubricsRequest.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateInstanceRubricsResponse.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateInstanceRubricsResponse.java new file mode 100644 index 000000000000..adde663c224b --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateInstanceRubricsResponse.java @@ -0,0 +1,110 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Response for generating rubrics. */ +@AutoValue +@JsonDeserialize(builder = GenerateInstanceRubricsResponse.Builder.class) +public abstract class GenerateInstanceRubricsResponse extends JsonSerializable { + /** A list of generated rubrics. */ + @JsonProperty("generatedRubrics") + public abstract Optional> generatedRubrics(); + + /** Instantiates a builder for GenerateInstanceRubricsResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateInstanceRubricsResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateInstanceRubricsResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GenerateInstanceRubricsResponse.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateInstanceRubricsResponse.Builder(); + } + + /** + * Setter for generatedRubrics. + * + *

generatedRubrics: A list of generated rubrics. + */ + @JsonProperty("generatedRubrics") + public abstract Builder generatedRubrics(List generatedRubrics); + + /** + * Setter for generatedRubrics. + * + *

generatedRubrics: A list of generated rubrics. + */ + @CanIgnoreReturnValue + public Builder generatedRubrics(Rubric... generatedRubrics) { + return generatedRubrics(Arrays.asList(generatedRubrics)); + } + + /** + * Setter for generatedRubrics builder. + * + *

generatedRubrics: A list of generated rubrics. + */ + @CanIgnoreReturnValue + public Builder generatedRubrics(Rubric.Builder... generatedRubricsBuilders) { + return generatedRubrics( + Arrays.asList(generatedRubricsBuilders).stream() + .map(Rubric.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder generatedRubrics(Optional> generatedRubrics); + + /** Clears the value of generatedRubrics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGeneratedRubrics() { + return generatedRubrics(Optional.empty()); + } + + public abstract GenerateInstanceRubricsResponse build(); + } + + /** Deserializes a JSON string to a GenerateInstanceRubricsResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static GenerateInstanceRubricsResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GenerateInstanceRubricsResponse.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectContentsSource.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectContentsSource.java new file mode 100644 index 000000000000..2063e0421d20 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectContentsSource.java @@ -0,0 +1,114 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The direct contents source for generating memories. */ +@AutoValue +@JsonDeserialize(builder = GenerateMemoriesRequestDirectContentsSource.Builder.class) +public abstract class GenerateMemoriesRequestDirectContentsSource extends JsonSerializable { + /** Required. The source content (i.e. chat history) to generate memories from. */ + @JsonProperty("events") + public abstract Optional> events(); + + /** Instantiates a builder for GenerateMemoriesRequestDirectContentsSource. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateMemoriesRequestDirectContentsSource.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateMemoriesRequestDirectContentsSource. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GenerateMemoriesRequestDirectContentsSource.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateMemoriesRequestDirectContentsSource.Builder(); + } + + /** + * Setter for events. + * + *

events: Required. The source content (i.e. chat history) to generate memories from. + */ + @JsonProperty("events") + public abstract Builder events(List events); + + /** + * Setter for events. + * + *

events: Required. The source content (i.e. chat history) to generate memories from. + */ + @CanIgnoreReturnValue + public Builder events(GenerateMemoriesRequestDirectContentsSourceEvent... events) { + return events(Arrays.asList(events)); + } + + /** + * Setter for events builder. + * + *

events: Required. The source content (i.e. chat history) to generate memories from. + */ + @CanIgnoreReturnValue + public Builder events( + GenerateMemoriesRequestDirectContentsSourceEvent.Builder... eventsBuilders) { + return events( + Arrays.asList(eventsBuilders).stream() + .map(GenerateMemoriesRequestDirectContentsSourceEvent.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder events( + Optional> events); + + /** Clears the value of events field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvents() { + return events(Optional.empty()); + } + + public abstract GenerateMemoriesRequestDirectContentsSource build(); + } + + /** Deserializes a JSON string to a GenerateMemoriesRequestDirectContentsSource object. */ + @ExcludeFromGeneratedCoverageReport + public static GenerateMemoriesRequestDirectContentsSource fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GenerateMemoriesRequestDirectContentsSource.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectContentsSourceEvent.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectContentsSourceEvent.java new file mode 100644 index 000000000000..d853943baab3 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectContentsSourceEvent.java @@ -0,0 +1,86 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import java.util.Optional; + +/** None */ +@AutoValue +@JsonDeserialize(builder = GenerateMemoriesRequestDirectContentsSourceEvent.Builder.class) +public abstract class GenerateMemoriesRequestDirectContentsSourceEvent extends JsonSerializable { + /** Required. A single piece of content from which to generate memories. */ + @JsonProperty("content") + public abstract Optional content(); + + /** Instantiates a builder for GenerateMemoriesRequestDirectContentsSourceEvent. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateMemoriesRequestDirectContentsSourceEvent.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateMemoriesRequestDirectContentsSourceEvent. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GenerateMemoriesRequestDirectContentsSourceEvent.builder()` + * for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateMemoriesRequestDirectContentsSourceEvent.Builder(); + } + + /** + * Setter for content. + * + *

content: Required. A single piece of content from which to generate memories. + */ + @JsonProperty("content") + public abstract Builder content(Content content); + + @ExcludeFromGeneratedCoverageReport + abstract Builder content(Optional content); + + /** Clears the value of content field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContent() { + return content(Optional.empty()); + } + + public abstract GenerateMemoriesRequestDirectContentsSourceEvent build(); + } + + /** Deserializes a JSON string to a GenerateMemoriesRequestDirectContentsSourceEvent object. */ + @ExcludeFromGeneratedCoverageReport + public static GenerateMemoriesRequestDirectContentsSourceEvent fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GenerateMemoriesRequestDirectContentsSourceEvent.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectMemoriesSource.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectMemoriesSource.java new file mode 100644 index 000000000000..357b34dd2611 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectMemoriesSource.java @@ -0,0 +1,123 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The direct memories source for generating memories. */ +@AutoValue +@JsonDeserialize(builder = GenerateMemoriesRequestDirectMemoriesSource.Builder.class) +public abstract class GenerateMemoriesRequestDirectMemoriesSource extends JsonSerializable { + /** + * Required. The direct memories to upload to Memory Bank. At most 5 direct memories are allowed + * per request. + */ + @JsonProperty("directMemories") + public abstract Optional> + directMemories(); + + /** Instantiates a builder for GenerateMemoriesRequestDirectMemoriesSource. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateMemoriesRequestDirectMemoriesSource.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateMemoriesRequestDirectMemoriesSource. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GenerateMemoriesRequestDirectMemoriesSource.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateMemoriesRequestDirectMemoriesSource.Builder(); + } + + /** + * Setter for directMemories. + * + *

directMemories: Required. The direct memories to upload to Memory Bank. At most 5 direct + * memories are allowed per request. + */ + @JsonProperty("directMemories") + public abstract Builder directMemories( + List directMemories); + + /** + * Setter for directMemories. + * + *

directMemories: Required. The direct memories to upload to Memory Bank. At most 5 direct + * memories are allowed per request. + */ + @CanIgnoreReturnValue + public Builder directMemories( + GenerateMemoriesRequestDirectMemoriesSourceDirectMemory... directMemories) { + return directMemories(Arrays.asList(directMemories)); + } + + /** + * Setter for directMemories builder. + * + *

directMemories: Required. The direct memories to upload to Memory Bank. At most 5 direct + * memories are allowed per request. + */ + @CanIgnoreReturnValue + public Builder directMemories( + GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.Builder... directMemoriesBuilders) { + return directMemories( + Arrays.asList(directMemoriesBuilders).stream() + .map(GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder directMemories( + Optional> directMemories); + + /** Clears the value of directMemories field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDirectMemories() { + return directMemories(Optional.empty()); + } + + public abstract GenerateMemoriesRequestDirectMemoriesSource build(); + } + + /** Deserializes a JSON string to a GenerateMemoriesRequestDirectMemoriesSource object. */ + @ExcludeFromGeneratedCoverageReport + public static GenerateMemoriesRequestDirectMemoriesSource fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GenerateMemoriesRequestDirectMemoriesSource.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.java new file mode 100644 index 000000000000..460ce3eab0ca --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.java @@ -0,0 +1,138 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** A direct memory to upload to Memory Bank. */ +@AutoValue +@JsonDeserialize(builder = GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.Builder.class) +public abstract class GenerateMemoriesRequestDirectMemoriesSourceDirectMemory + extends JsonSerializable { + /** Required. The fact to consolidate with existing memories. */ + @JsonProperty("fact") + public abstract Optional fact(); + + /** Optional. The topics that the consolidated memories should be associated with. */ + @JsonProperty("topics") + public abstract Optional> topics(); + + /** Instantiates a builder for GenerateMemoriesRequestDirectMemoriesSourceDirectMemory. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateMemoriesRequestDirectMemoriesSourceDirectMemory. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use + * `GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.Builder(); + } + + /** + * Setter for fact. + * + *

fact: Required. The fact to consolidate with existing memories. + */ + @JsonProperty("fact") + public abstract Builder fact(String fact); + + @ExcludeFromGeneratedCoverageReport + abstract Builder fact(Optional fact); + + /** Clears the value of fact field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFact() { + return fact(Optional.empty()); + } + + /** + * Setter for topics. + * + *

topics: Optional. The topics that the consolidated memories should be associated with. + */ + @JsonProperty("topics") + public abstract Builder topics(List topics); + + /** + * Setter for topics. + * + *

topics: Optional. The topics that the consolidated memories should be associated with. + */ + @CanIgnoreReturnValue + public Builder topics(MemoryTopicId... topics) { + return topics(Arrays.asList(topics)); + } + + /** + * Setter for topics builder. + * + *

topics: Optional. The topics that the consolidated memories should be associated with. + */ + @CanIgnoreReturnValue + public Builder topics(MemoryTopicId.Builder... topicsBuilders) { + return topics( + Arrays.asList(topicsBuilders).stream() + .map(MemoryTopicId.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder topics(Optional> topics); + + /** Clears the value of topics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTopics() { + return topics(Optional.empty()); + } + + public abstract GenerateMemoriesRequestDirectMemoriesSourceDirectMemory build(); + } + + /** + * Deserializes a JSON string to a GenerateMemoriesRequestDirectMemoriesSourceDirectMemory object. + */ + @ExcludeFromGeneratedCoverageReport + public static GenerateMemoriesRequestDirectMemoriesSourceDirectMemory fromJson( + String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GenerateMemoriesRequestDirectMemoriesSourceDirectMemory.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestVertexSessionSource.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestVertexSessionSource.java new file mode 100644 index 000000000000..f9f94076f56d --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesRequestVertexSessionSource.java @@ -0,0 +1,139 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.time.Instant; +import java.util.Optional; + +/** The vertex session source for generating memories. */ +@AutoValue +@JsonDeserialize(builder = GenerateMemoriesRequestVertexSessionSource.Builder.class) +public abstract class GenerateMemoriesRequestVertexSessionSource extends JsonSerializable { + /** Optional. End time (exclusive) of the time range. If not set, the end time is unbounded. */ + @JsonProperty("endTime") + public abstract Optional endTime(); + + /** + * Required. The resource name of the Session to generate memories for. Format: + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}` + */ + @JsonProperty("session") + public abstract Optional session(); + + /** + * Optional. Time range to define which session events should be used to generate memories. Start + * time (inclusive) of the time range. If not set, the start time is unbounded. + */ + @JsonProperty("startTime") + public abstract Optional startTime(); + + /** Instantiates a builder for GenerateMemoriesRequestVertexSessionSource. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateMemoriesRequestVertexSessionSource.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateMemoriesRequestVertexSessionSource. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GenerateMemoriesRequestVertexSessionSource.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateMemoriesRequestVertexSessionSource.Builder(); + } + + /** + * Setter for endTime. + * + *

endTime: Optional. End time (exclusive) of the time range. If not set, the end time is + * unbounded. + */ + @JsonProperty("endTime") + public abstract Builder endTime(Instant endTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder endTime(Optional endTime); + + /** Clears the value of endTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEndTime() { + return endTime(Optional.empty()); + } + + /** + * Setter for session. + * + *

session: Required. The resource name of the Session to generate memories for. Format: + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}` + */ + @JsonProperty("session") + public abstract Builder session(String session); + + @ExcludeFromGeneratedCoverageReport + abstract Builder session(Optional session); + + /** Clears the value of session field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSession() { + return session(Optional.empty()); + } + + /** + * Setter for startTime. + * + *

startTime: Optional. Time range to define which session events should be used to generate + * memories. Start time (inclusive) of the time range. If not set, the start time is unbounded. + */ + @JsonProperty("startTime") + public abstract Builder startTime(Instant startTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder startTime(Optional startTime); + + /** Clears the value of startTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearStartTime() { + return startTime(Optional.empty()); + } + + public abstract GenerateMemoriesRequestVertexSessionSource build(); + } + + /** Deserializes a JSON string to a GenerateMemoriesRequestVertexSessionSource object. */ + @ExcludeFromGeneratedCoverageReport + public static GenerateMemoriesRequestVertexSessionSource fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GenerateMemoriesRequestVertexSessionSource.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponse.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponse.java new file mode 100644 index 000000000000..64eb75615c46 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponse.java @@ -0,0 +1,111 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The response for generating memories. */ +@AutoValue +@JsonDeserialize(builder = GenerateMemoriesResponse.Builder.class) +public abstract class GenerateMemoriesResponse extends JsonSerializable { + /** The generated memories. */ + @JsonProperty("generatedMemories") + public abstract Optional> generatedMemories(); + + /** Instantiates a builder for GenerateMemoriesResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateMemoriesResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateMemoriesResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GenerateMemoriesResponse.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateMemoriesResponse.Builder(); + } + + /** + * Setter for generatedMemories. + * + *

generatedMemories: The generated memories. + */ + @JsonProperty("generatedMemories") + public abstract Builder generatedMemories( + List generatedMemories); + + /** + * Setter for generatedMemories. + * + *

generatedMemories: The generated memories. + */ + @CanIgnoreReturnValue + public Builder generatedMemories(GenerateMemoriesResponseGeneratedMemory... generatedMemories) { + return generatedMemories(Arrays.asList(generatedMemories)); + } + + /** + * Setter for generatedMemories builder. + * + *

generatedMemories: The generated memories. + */ + @CanIgnoreReturnValue + public Builder generatedMemories( + GenerateMemoriesResponseGeneratedMemory.Builder... generatedMemoriesBuilders) { + return generatedMemories( + Arrays.asList(generatedMemoriesBuilders).stream() + .map(GenerateMemoriesResponseGeneratedMemory.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder generatedMemories( + Optional> generatedMemories); + + /** Clears the value of generatedMemories field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGeneratedMemories() { + return generatedMemories(Optional.empty()); + } + + public abstract GenerateMemoriesResponse build(); + } + + /** Deserializes a JSON string to a GenerateMemoriesResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static GenerateMemoriesResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GenerateMemoriesResponse.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponseGeneratedMemory.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponseGeneratedMemory.java new file mode 100644 index 000000000000..4e9f5e159cb7 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponseGeneratedMemory.java @@ -0,0 +1,167 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** A memory that was generated. */ +@AutoValue +@JsonDeserialize(builder = GenerateMemoriesResponseGeneratedMemory.Builder.class) +public abstract class GenerateMemoriesResponseGeneratedMemory extends JsonSerializable { + /** The generated memory. */ + @JsonProperty("memory") + public abstract Optional memory(); + + /** The action to take. */ + @JsonProperty("action") + public abstract Optional action(); + + /** + * The previous revision of the Memory before the action was performed. This field is only set if + * the action is `UPDATED` or `DELETED`. You can use this to rollback the Memory to the previous + * revision, undoing the action. Format: + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}/revisions/{revision}` + */ + @JsonProperty("previousRevision") + public abstract Optional previousRevision(); + + /** Instantiates a builder for GenerateMemoriesResponseGeneratedMemory. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GenerateMemoriesResponseGeneratedMemory.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GenerateMemoriesResponseGeneratedMemory. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GenerateMemoriesResponseGeneratedMemory.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GenerateMemoriesResponseGeneratedMemory.Builder(); + } + + /** + * Setter for memory. + * + *

memory: The generated memory. + */ + @JsonProperty("memory") + public abstract Builder memory(Memory memory); + + /** + * Setter for memory builder. + * + *

memory: The generated memory. + */ + @CanIgnoreReturnValue + public Builder memory(Memory.Builder memoryBuilder) { + return memory(memoryBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder memory(Optional memory); + + /** Clears the value of memory field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMemory() { + return memory(Optional.empty()); + } + + /** + * Setter for action. + * + *

action: The action to take. + */ + @JsonProperty("action") + public abstract Builder action(GenerateMemoriesResponseGeneratedMemoryAction action); + + @ExcludeFromGeneratedCoverageReport + abstract Builder action(Optional action); + + /** Clears the value of action field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAction() { + return action(Optional.empty()); + } + + /** + * Setter for action given a known enum. + * + *

action: The action to take. + */ + @CanIgnoreReturnValue + public Builder action(GenerateMemoriesResponseGeneratedMemoryAction.Known knownType) { + return action(new GenerateMemoriesResponseGeneratedMemoryAction(knownType)); + } + + /** + * Setter for action given a string. + * + *

action: The action to take. + */ + @CanIgnoreReturnValue + public Builder action(String action) { + return action(new GenerateMemoriesResponseGeneratedMemoryAction(action)); + } + + /** + * Setter for previousRevision. + * + *

previousRevision: The previous revision of the Memory before the action was performed. + * This field is only set if the action is `UPDATED` or `DELETED`. You can use this to rollback + * the Memory to the previous revision, undoing the action. Format: + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}/revisions/{revision}` + */ + @JsonProperty("previousRevision") + public abstract Builder previousRevision(String previousRevision); + + @ExcludeFromGeneratedCoverageReport + abstract Builder previousRevision(Optional previousRevision); + + /** Clears the value of previousRevision field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPreviousRevision() { + return previousRevision(Optional.empty()); + } + + public abstract GenerateMemoriesResponseGeneratedMemory build(); + } + + /** Deserializes a JSON string to a GenerateMemoriesResponseGeneratedMemory object. */ + @ExcludeFromGeneratedCoverageReport + public static GenerateMemoriesResponseGeneratedMemory fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GenerateMemoriesResponseGeneratedMemory.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponseGeneratedMemoryAction.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponseGeneratedMemoryAction.java new file mode 100644 index 000000000000..9acd5115c4d4 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GenerateMemoriesResponseGeneratedMemoryAction.java @@ -0,0 +1,130 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** The action to take. */ +public class GenerateMemoriesResponseGeneratedMemoryAction { + + /** Enum representing the known values for GenerateMemoriesResponseGeneratedMemoryAction. */ + public enum Known { + /** The action is unspecified. */ + ACTION_UNSPECIFIED, + + /** The memory was created. */ + CREATED, + + /** + * The memory was updated. + * + *

The `fact` field may not be updated if the existing fact is still accurate. + */ + UPDATED, + + /** The memory was deleted. */ + DELETED, + + GENERATE_MEMORIES_RESPONSE_GENERATED_MEMORY_ACTION_UNSPECIFIED + } + + private Known generateMemoriesResponseGeneratedMemoryActionEnum; + private final String value; + + @JsonCreator + public GenerateMemoriesResponseGeneratedMemoryAction(String value) { + this.value = value; + for (Known generateMemoriesResponseGeneratedMemoryActionEnum : Known.values()) { + if (Ascii.equalsIgnoreCase( + generateMemoriesResponseGeneratedMemoryActionEnum.toString(), value)) { + this.generateMemoriesResponseGeneratedMemoryActionEnum = + generateMemoriesResponseGeneratedMemoryActionEnum; + break; + } + } + if (this.generateMemoriesResponseGeneratedMemoryActionEnum == null) { + this.generateMemoriesResponseGeneratedMemoryActionEnum = + Known.GENERATE_MEMORIES_RESPONSE_GENERATED_MEMORY_ACTION_UNSPECIFIED; + } + } + + public GenerateMemoriesResponseGeneratedMemoryAction(Known knownValue) { + this.generateMemoriesResponseGeneratedMemoryActionEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof GenerateMemoriesResponseGeneratedMemoryAction)) { + return false; + } + + GenerateMemoriesResponseGeneratedMemoryAction other = + (GenerateMemoriesResponseGeneratedMemoryAction) o; + + if (this.generateMemoriesResponseGeneratedMemoryActionEnum + != Known.GENERATE_MEMORIES_RESPONSE_GENERATED_MEMORY_ACTION_UNSPECIFIED + && other.generateMemoriesResponseGeneratedMemoryActionEnum + != Known.GENERATE_MEMORIES_RESPONSE_GENERATED_MEMORY_ACTION_UNSPECIFIED) { + return this.generateMemoriesResponseGeneratedMemoryActionEnum + == other.generateMemoriesResponseGeneratedMemoryActionEnum; + } else if (this.generateMemoriesResponseGeneratedMemoryActionEnum + == Known.GENERATE_MEMORIES_RESPONSE_GENERATED_MEMORY_ACTION_UNSPECIFIED + && other.generateMemoriesResponseGeneratedMemoryActionEnum + == Known.GENERATE_MEMORIES_RESPONSE_GENERATED_MEMORY_ACTION_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.generateMemoriesResponseGeneratedMemoryActionEnum + != Known.GENERATE_MEMORIES_RESPONSE_GENERATED_MEMORY_ACTION_UNSPECIFIED) { + return this.generateMemoriesResponseGeneratedMemoryActionEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.generateMemoriesResponseGeneratedMemoryActionEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineConfig.java new file mode 100644 index 000000000000..753a2f4e1634 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for create agent engine. */ +@AutoValue +@JsonDeserialize(builder = GetAgentEngineConfig.Builder.class) +public abstract class GetAgentEngineConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for GetAgentEngineConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GetAgentEngineConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract GetAgentEngineConfig build(); + } + + /** Deserializes a JSON string to a GetAgentEngineConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetAgentEngineConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineGenerateMemoriesOperationParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineGenerateMemoriesOperationParameters.java new file mode 100644 index 000000000000..56d17981ea2e --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineGenerateMemoriesOperationParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting an operation with generated memories as a response. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetAgentEngineGenerateMemoriesOperationParameters.Builder.class) +public abstract class GetAgentEngineGenerateMemoriesOperationParameters extends JsonSerializable { + /** The server-assigned name for the operation. */ + @JsonProperty("operationName") + public abstract Optional operationName(); + + /** Used to override the default configuration. */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetAgentEngineGenerateMemoriesOperationParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineGenerateMemoriesOperationParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineGenerateMemoriesOperationParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetAgentEngineGenerateMemoriesOperationParameters.builder()` + * for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineGenerateMemoriesOperationParameters.Builder(); + } + + /** + * Setter for operationName. + * + *

operationName: The server-assigned name for the operation. + */ + @JsonProperty("operationName") + public abstract Builder operationName(String operationName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder operationName(Optional operationName); + + /** Clears the value of operationName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOperationName() { + return operationName(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: Used to override the default configuration. + */ + @JsonProperty("config") + public abstract Builder config(GetAgentEngineOperationConfig config); + + /** + * Setter for config builder. + * + *

config: Used to override the default configuration. + */ + @CanIgnoreReturnValue + public Builder config(GetAgentEngineOperationConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GetAgentEngineGenerateMemoriesOperationParameters build(); + } + + /** Deserializes a JSON string to a GetAgentEngineGenerateMemoriesOperationParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineGenerateMemoriesOperationParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GetAgentEngineGenerateMemoriesOperationParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryConfig.java new file mode 100644 index 000000000000..2df0f8184bc0 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for getting an Agent Engine Memory. */ +@AutoValue +@JsonDeserialize(builder = GetAgentEngineMemoryConfig.Builder.class) +public abstract class GetAgentEngineMemoryConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for GetAgentEngineMemoryConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineMemoryConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineMemoryConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GetAgentEngineMemoryConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineMemoryConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract GetAgentEngineMemoryConfig build(); + } + + /** Deserializes a JSON string to a GetAgentEngineMemoryConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineMemoryConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetAgentEngineMemoryConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryOperationParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryOperationParameters.java new file mode 100644 index 000000000000..7c817c505966 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryOperationParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting an operation with a memory as a response. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetAgentEngineMemoryOperationParameters.Builder.class) +public abstract class GetAgentEngineMemoryOperationParameters extends JsonSerializable { + /** The server-assigned name for the operation. */ + @JsonProperty("operationName") + public abstract Optional operationName(); + + /** Used to override the default configuration. */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetAgentEngineMemoryOperationParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineMemoryOperationParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineMemoryOperationParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetAgentEngineMemoryOperationParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineMemoryOperationParameters.Builder(); + } + + /** + * Setter for operationName. + * + *

operationName: The server-assigned name for the operation. + */ + @JsonProperty("operationName") + public abstract Builder operationName(String operationName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder operationName(Optional operationName); + + /** Clears the value of operationName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOperationName() { + return operationName(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: Used to override the default configuration. + */ + @JsonProperty("config") + public abstract Builder config(GetAgentEngineOperationConfig config); + + /** + * Setter for config builder. + * + *

config: Used to override the default configuration. + */ + @CanIgnoreReturnValue + public Builder config(GetAgentEngineOperationConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GetAgentEngineMemoryOperationParameters build(); + } + + /** Deserializes a JSON string to a GetAgentEngineMemoryOperationParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineMemoryOperationParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GetAgentEngineMemoryOperationParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRequestParameters.java new file mode 100644 index 000000000000..322f5796693c --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRequestParameters.java @@ -0,0 +1,118 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting an agent engine. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetAgentEngineMemoryRequestParameters.Builder.class) +public abstract class GetAgentEngineMemoryRequestParameters extends JsonSerializable { + /** Name of the agent engine. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetAgentEngineMemoryRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineMemoryRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineMemoryRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetAgentEngineMemoryRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineMemoryRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(GetAgentEngineMemoryConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(GetAgentEngineMemoryConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GetAgentEngineMemoryRequestParameters build(); + } + + /** Deserializes a JSON string to a GetAgentEngineMemoryRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineMemoryRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetAgentEngineMemoryRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRevisionConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRevisionConfig.java new file mode 100644 index 000000000000..bc29604ca91f --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRevisionConfig.java @@ -0,0 +1,85 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for getting an Agent Engine Memory Revision. */ +@AutoValue +@JsonDeserialize(builder = GetAgentEngineMemoryRevisionConfig.Builder.class) +public abstract class GetAgentEngineMemoryRevisionConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for GetAgentEngineMemoryRevisionConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineMemoryRevisionConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineMemoryRevisionConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetAgentEngineMemoryRevisionConfig.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineMemoryRevisionConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract GetAgentEngineMemoryRevisionConfig build(); + } + + /** Deserializes a JSON string to a GetAgentEngineMemoryRevisionConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineMemoryRevisionConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetAgentEngineMemoryRevisionConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRevisionRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRevisionRequestParameters.java new file mode 100644 index 000000000000..fe338dd52a04 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineMemoryRevisionRequestParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting an Agent Engine memory revision. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetAgentEngineMemoryRevisionRequestParameters.Builder.class) +public abstract class GetAgentEngineMemoryRevisionRequestParameters extends JsonSerializable { + /** Name of the agent engine. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetAgentEngineMemoryRevisionRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineMemoryRevisionRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineMemoryRevisionRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetAgentEngineMemoryRevisionRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineMemoryRevisionRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(GetAgentEngineMemoryRevisionConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(GetAgentEngineMemoryRevisionConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GetAgentEngineMemoryRevisionRequestParameters build(); + } + + /** Deserializes a JSON string to a GetAgentEngineMemoryRevisionRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineMemoryRevisionRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GetAgentEngineMemoryRevisionRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineOperationConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineOperationConfig.java new file mode 100644 index 000000000000..febf6995e6b2 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineOperationConfig.java @@ -0,0 +1,84 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** None */ +@AutoValue +@JsonDeserialize(builder = GetAgentEngineOperationConfig.Builder.class) +public abstract class GetAgentEngineOperationConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for GetAgentEngineOperationConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineOperationConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineOperationConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetAgentEngineOperationConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineOperationConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract GetAgentEngineOperationConfig build(); + } + + /** Deserializes a JSON string to a GetAgentEngineOperationConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineOperationConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetAgentEngineOperationConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineOperationParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineOperationParameters.java new file mode 100644 index 000000000000..884325465353 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineOperationParameters.java @@ -0,0 +1,118 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting an operation with an agent engine as a response. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetAgentEngineOperationParameters.Builder.class) +public abstract class GetAgentEngineOperationParameters extends JsonSerializable { + /** The server-assigned name for the operation. */ + @JsonProperty("operationName") + public abstract Optional operationName(); + + /** Used to override the default configuration. */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetAgentEngineOperationParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineOperationParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineOperationParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetAgentEngineOperationParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineOperationParameters.Builder(); + } + + /** + * Setter for operationName. + * + *

operationName: The server-assigned name for the operation. + */ + @JsonProperty("operationName") + public abstract Builder operationName(String operationName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder operationName(Optional operationName); + + /** Clears the value of operationName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOperationName() { + return operationName(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: Used to override the default configuration. + */ + @JsonProperty("config") + public abstract Builder config(GetAgentEngineOperationConfig config); + + /** + * Setter for config builder. + * + *

config: Used to override the default configuration. + */ + @CanIgnoreReturnValue + public Builder config(GetAgentEngineOperationConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GetAgentEngineOperationParameters build(); + } + + /** Deserializes a JSON string to a GetAgentEngineOperationParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineOperationParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetAgentEngineOperationParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineRequestParameters.java new file mode 100644 index 000000000000..8564b9638d0f --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineRequestParameters.java @@ -0,0 +1,117 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting agent engines. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetAgentEngineRequestParameters.Builder.class) +public abstract class GetAgentEngineRequestParameters extends JsonSerializable { + /** Name of the agent engine. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetAgentEngineRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetAgentEngineRequestParameters.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(GetAgentEngineConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(GetAgentEngineConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GetAgentEngineRequestParameters build(); + } + + /** Deserializes a JSON string to a GetAgentEngineRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetAgentEngineRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxConfig.java new file mode 100644 index 000000000000..4165bffdad5b --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for getting an Agent Engine Memory. */ +@AutoValue +@JsonDeserialize(builder = GetAgentEngineSandboxConfig.Builder.class) +public abstract class GetAgentEngineSandboxConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for GetAgentEngineSandboxConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineSandboxConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineSandboxConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GetAgentEngineSandboxConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineSandboxConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract GetAgentEngineSandboxConfig build(); + } + + /** Deserializes a JSON string to a GetAgentEngineSandboxConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineSandboxConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetAgentEngineSandboxConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxOperationParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxOperationParameters.java new file mode 100644 index 000000000000..dbde41b3993d --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxOperationParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting an operation with a sandbox as a response. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetAgentEngineSandboxOperationParameters.Builder.class) +public abstract class GetAgentEngineSandboxOperationParameters extends JsonSerializable { + /** The server-assigned name for the operation. */ + @JsonProperty("operationName") + public abstract Optional operationName(); + + /** Used to override the default configuration. */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetAgentEngineSandboxOperationParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineSandboxOperationParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineSandboxOperationParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetAgentEngineSandboxOperationParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineSandboxOperationParameters.Builder(); + } + + /** + * Setter for operationName. + * + *

operationName: The server-assigned name for the operation. + */ + @JsonProperty("operationName") + public abstract Builder operationName(String operationName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder operationName(Optional operationName); + + /** Clears the value of operationName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOperationName() { + return operationName(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: Used to override the default configuration. + */ + @JsonProperty("config") + public abstract Builder config(GetAgentEngineOperationConfig config); + + /** + * Setter for config builder. + * + *

config: Used to override the default configuration. + */ + @CanIgnoreReturnValue + public Builder config(GetAgentEngineOperationConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GetAgentEngineSandboxOperationParameters build(); + } + + /** Deserializes a JSON string to a GetAgentEngineSandboxOperationParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineSandboxOperationParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GetAgentEngineSandboxOperationParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxRequestParameters.java new file mode 100644 index 000000000000..f96bf83d1aa9 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSandboxRequestParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting an agent engine sandbox. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetAgentEngineSandboxRequestParameters.Builder.class) +public abstract class GetAgentEngineSandboxRequestParameters extends JsonSerializable { + /** Name of the agent engine sandbox. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetAgentEngineSandboxRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineSandboxRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineSandboxRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetAgentEngineSandboxRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineSandboxRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine sandbox. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(GetAgentEngineSandboxConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(GetAgentEngineSandboxConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GetAgentEngineSandboxRequestParameters build(); + } + + /** Deserializes a JSON string to a GetAgentEngineSandboxRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineSandboxRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GetAgentEngineSandboxRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSessionConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSessionConfig.java new file mode 100644 index 000000000000..b11bd3958572 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSessionConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for getting an Agent Engine Session. */ +@AutoValue +@JsonDeserialize(builder = GetAgentEngineSessionConfig.Builder.class) +public abstract class GetAgentEngineSessionConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for GetAgentEngineSessionConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineSessionConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineSessionConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GetAgentEngineSessionConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineSessionConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract GetAgentEngineSessionConfig build(); + } + + /** Deserializes a JSON string to a GetAgentEngineSessionConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineSessionConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetAgentEngineSessionConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSessionOperationParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSessionOperationParameters.java new file mode 100644 index 000000000000..6ece566e4b17 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSessionOperationParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting an operation with a session as a response. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetAgentEngineSessionOperationParameters.Builder.class) +public abstract class GetAgentEngineSessionOperationParameters extends JsonSerializable { + /** The server-assigned name for the operation. */ + @JsonProperty("operationName") + public abstract Optional operationName(); + + /** Used to override the default configuration. */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetAgentEngineSessionOperationParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineSessionOperationParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineSessionOperationParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetAgentEngineSessionOperationParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineSessionOperationParameters.Builder(); + } + + /** + * Setter for operationName. + * + *

operationName: The server-assigned name for the operation. + */ + @JsonProperty("operationName") + public abstract Builder operationName(String operationName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder operationName(Optional operationName); + + /** Clears the value of operationName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOperationName() { + return operationName(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: Used to override the default configuration. + */ + @JsonProperty("config") + public abstract Builder config(GetAgentEngineOperationConfig config); + + /** + * Setter for config builder. + * + *

config: Used to override the default configuration. + */ + @CanIgnoreReturnValue + public Builder config(GetAgentEngineOperationConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GetAgentEngineSessionOperationParameters build(); + } + + /** Deserializes a JSON string to a GetAgentEngineSessionOperationParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineSessionOperationParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GetAgentEngineSessionOperationParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSessionRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSessionRequestParameters.java new file mode 100644 index 000000000000..0bc0523b5ef9 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetAgentEngineSessionRequestParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting an agent engine session. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetAgentEngineSessionRequestParameters.Builder.class) +public abstract class GetAgentEngineSessionRequestParameters extends JsonSerializable { + /** Name of the agent engine session. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetAgentEngineSessionRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetAgentEngineSessionRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetAgentEngineSessionRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetAgentEngineSessionRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetAgentEngineSessionRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine session. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(GetAgentEngineSessionConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(GetAgentEngineSessionConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GetAgentEngineSessionRequestParameters build(); + } + + /** Deserializes a JSON string to a GetAgentEngineSessionRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetAgentEngineSessionRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GetAgentEngineSessionRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetCustomJobParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetCustomJobParameters.java new file mode 100644 index 000000000000..fec95dc13146 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetCustomJobParameters.java @@ -0,0 +1,115 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents a job that runs custom workloads such as a Docker container or a Python package. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetCustomJobParameters.Builder.class) +public abstract class GetCustomJobParameters extends JsonSerializable { + /** */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetCustomJobParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetCustomJobParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetCustomJobParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GetCustomJobParameters.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetCustomJobParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(VertexBaseConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(VertexBaseConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GetCustomJobParameters build(); + } + + /** Deserializes a JSON string to a GetCustomJobParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetCustomJobParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetCustomJobParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetDatasetOperationConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetDatasetOperationConfig.java new file mode 100644 index 000000000000..d657cf3f328d --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetDatasetOperationConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for getting a dataset version operation. */ +@AutoValue +@JsonDeserialize(builder = GetDatasetOperationConfig.Builder.class) +public abstract class GetDatasetOperationConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for GetDatasetOperationConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetDatasetOperationConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetDatasetOperationConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GetDatasetOperationConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetDatasetOperationConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract GetDatasetOperationConfig build(); + } + + /** Deserializes a JSON string to a GetDatasetOperationConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static GetDatasetOperationConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetDatasetOperationConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetDatasetOperationParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetDatasetOperationParameters.java new file mode 100644 index 000000000000..ce78225afc30 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetDatasetOperationParameters.java @@ -0,0 +1,139 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting a dataset operation. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetDatasetOperationParameters.Builder.class) +public abstract class GetDatasetOperationParameters extends JsonSerializable { + /** */ + @JsonProperty("datasetId") + public abstract Optional datasetId(); + + /** */ + @JsonProperty("operationId") + public abstract Optional operationId(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetDatasetOperationParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetDatasetOperationParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetDatasetOperationParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetDatasetOperationParameters.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetDatasetOperationParameters.Builder(); + } + + /** + * Setter for datasetId. + * + *

datasetId: + */ + @JsonProperty("datasetId") + public abstract Builder datasetId(String datasetId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder datasetId(Optional datasetId); + + /** Clears the value of datasetId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDatasetId() { + return datasetId(Optional.empty()); + } + + /** + * Setter for operationId. + * + *

operationId: + */ + @JsonProperty("operationId") + public abstract Builder operationId(String operationId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder operationId(Optional operationId); + + /** Clears the value of operationId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOperationId() { + return operationId(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(GetDatasetOperationConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(GetDatasetOperationConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GetDatasetOperationParameters build(); + } + + /** Deserializes a JSON string to a GetDatasetOperationParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetDatasetOperationParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetDatasetOperationParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetDatasetParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetDatasetParameters.java new file mode 100644 index 000000000000..bd1e6237df43 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetDatasetParameters.java @@ -0,0 +1,115 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting a dataset resource to store prompts. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetDatasetParameters.Builder.class) +public abstract class GetDatasetParameters extends JsonSerializable { + /** */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetDatasetParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetDatasetParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetDatasetParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GetDatasetParameters.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetDatasetParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(VertexBaseConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(VertexBaseConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GetDatasetParameters build(); + } + + /** Deserializes a JSON string to a GetDatasetParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetDatasetParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetDatasetParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetDatasetVersionParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetDatasetVersionParameters.java new file mode 100644 index 000000000000..48709fe370f4 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetDatasetVersionParameters.java @@ -0,0 +1,137 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting a dataset resource to store prompts. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetDatasetVersionParameters.Builder.class) +public abstract class GetDatasetVersionParameters extends JsonSerializable { + /** */ + @JsonProperty("datasetId") + public abstract Optional datasetId(); + + /** */ + @JsonProperty("datasetVersionId") + public abstract Optional datasetVersionId(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetDatasetVersionParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetDatasetVersionParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetDatasetVersionParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GetDatasetVersionParameters.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetDatasetVersionParameters.Builder(); + } + + /** + * Setter for datasetId. + * + *

datasetId: + */ + @JsonProperty("datasetId") + public abstract Builder datasetId(String datasetId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder datasetId(Optional datasetId); + + /** Clears the value of datasetId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDatasetId() { + return datasetId(Optional.empty()); + } + + /** + * Setter for datasetVersionId. + * + *

datasetVersionId: + */ + @JsonProperty("datasetVersionId") + public abstract Builder datasetVersionId(String datasetVersionId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder datasetVersionId(Optional datasetVersionId); + + /** Clears the value of datasetVersionId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDatasetVersionId() { + return datasetVersionId(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(VertexBaseConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(VertexBaseConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GetDatasetVersionParameters build(); + } + + /** Deserializes a JSON string to a GetDatasetVersionParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetDatasetVersionParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetDatasetVersionParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationItemConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationItemConfig.java new file mode 100644 index 000000000000..fe228e7b7f5b --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationItemConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for get evaluation item. */ +@AutoValue +@JsonDeserialize(builder = GetEvaluationItemConfig.Builder.class) +public abstract class GetEvaluationItemConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for GetEvaluationItemConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetEvaluationItemConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetEvaluationItemConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GetEvaluationItemConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetEvaluationItemConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract GetEvaluationItemConfig build(); + } + + /** Deserializes a JSON string to a GetEvaluationItemConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static GetEvaluationItemConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetEvaluationItemConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationItemParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationItemParameters.java new file mode 100644 index 000000000000..9d6a09e90ecd --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationItemParameters.java @@ -0,0 +1,115 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents a job that gets an evaluation item. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetEvaluationItemParameters.Builder.class) +public abstract class GetEvaluationItemParameters extends JsonSerializable { + /** */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetEvaluationItemParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetEvaluationItemParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetEvaluationItemParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GetEvaluationItemParameters.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetEvaluationItemParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(GetEvaluationItemConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(GetEvaluationItemConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GetEvaluationItemParameters build(); + } + + /** Deserializes a JSON string to a GetEvaluationItemParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetEvaluationItemParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetEvaluationItemParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationRunConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationRunConfig.java new file mode 100644 index 000000000000..ba888940864d --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationRunConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for get evaluation run. */ +@AutoValue +@JsonDeserialize(builder = GetEvaluationRunConfig.Builder.class) +public abstract class GetEvaluationRunConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for GetEvaluationRunConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetEvaluationRunConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetEvaluationRunConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GetEvaluationRunConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetEvaluationRunConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract GetEvaluationRunConfig build(); + } + + /** Deserializes a JSON string to a GetEvaluationRunConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static GetEvaluationRunConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetEvaluationRunConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationRunParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationRunParameters.java new file mode 100644 index 000000000000..c88884be6565 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationRunParameters.java @@ -0,0 +1,115 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents a job that runs evaluation. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetEvaluationRunParameters.Builder.class) +public abstract class GetEvaluationRunParameters extends JsonSerializable { + /** */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetEvaluationRunParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetEvaluationRunParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetEvaluationRunParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GetEvaluationRunParameters.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetEvaluationRunParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(GetEvaluationRunConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(GetEvaluationRunConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GetEvaluationRunParameters build(); + } + + /** Deserializes a JSON string to a GetEvaluationRunParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetEvaluationRunParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetEvaluationRunParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationSetConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationSetConfig.java new file mode 100644 index 000000000000..feb2dc76bc24 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationSetConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for get evaluation set. */ +@AutoValue +@JsonDeserialize(builder = GetEvaluationSetConfig.Builder.class) +public abstract class GetEvaluationSetConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for GetEvaluationSetConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetEvaluationSetConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetEvaluationSetConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GetEvaluationSetConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetEvaluationSetConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract GetEvaluationSetConfig build(); + } + + /** Deserializes a JSON string to a GetEvaluationSetConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static GetEvaluationSetConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetEvaluationSetConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationSetParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationSetParameters.java new file mode 100644 index 000000000000..647b4f0039a1 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetEvaluationSetParameters.java @@ -0,0 +1,115 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents a job that gets an evaluation set. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetEvaluationSetParameters.Builder.class) +public abstract class GetEvaluationSetParameters extends JsonSerializable { + /** */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetEvaluationSetParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetEvaluationSetParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetEvaluationSetParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GetEvaluationSetParameters.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetEvaluationSetParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(GetEvaluationSetConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(GetEvaluationSetConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GetEvaluationSetParameters build(); + } + + /** Deserializes a JSON string to a GetEvaluationSetParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetEvaluationSetParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetEvaluationSetParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetMultimodalDatasetOperationConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetMultimodalDatasetOperationConfig.java new file mode 100644 index 000000000000..4e0ba4fb5469 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetMultimodalDatasetOperationConfig.java @@ -0,0 +1,85 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for getting a multimodal dataset operation. */ +@AutoValue +@JsonDeserialize(builder = GetMultimodalDatasetOperationConfig.Builder.class) +public abstract class GetMultimodalDatasetOperationConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for GetMultimodalDatasetOperationConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetMultimodalDatasetOperationConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetMultimodalDatasetOperationConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetMultimodalDatasetOperationConfig.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetMultimodalDatasetOperationConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract GetMultimodalDatasetOperationConfig build(); + } + + /** Deserializes a JSON string to a GetMultimodalDatasetOperationConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static GetMultimodalDatasetOperationConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetMultimodalDatasetOperationConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetMultimodalDatasetOperationParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetMultimodalDatasetOperationParameters.java new file mode 100644 index 000000000000..e196701fc1fc --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetMultimodalDatasetOperationParameters.java @@ -0,0 +1,141 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting a dataset operation. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetMultimodalDatasetOperationParameters.Builder.class) +public abstract class GetMultimodalDatasetOperationParameters extends JsonSerializable { + /** */ + @JsonProperty("datasetId") + public abstract Optional datasetId(); + + /** */ + @JsonProperty("operationId") + public abstract Optional operationId(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetMultimodalDatasetOperationParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetMultimodalDatasetOperationParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetMultimodalDatasetOperationParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetMultimodalDatasetOperationParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetMultimodalDatasetOperationParameters.Builder(); + } + + /** + * Setter for datasetId. + * + *

datasetId: + */ + @JsonProperty("datasetId") + public abstract Builder datasetId(String datasetId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder datasetId(Optional datasetId); + + /** Clears the value of datasetId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDatasetId() { + return datasetId(Optional.empty()); + } + + /** + * Setter for operationId. + * + *

operationId: + */ + @JsonProperty("operationId") + public abstract Builder operationId(String operationId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder operationId(Optional operationId); + + /** Clears the value of operationId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOperationId() { + return operationId(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(GetMultimodalDatasetOperationConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(GetMultimodalDatasetOperationConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GetMultimodalDatasetOperationParameters build(); + } + + /** Deserializes a JSON string to a GetMultimodalDatasetOperationParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetMultimodalDatasetOperationParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, GetMultimodalDatasetOperationParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetMultimodalDatasetParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetMultimodalDatasetParameters.java new file mode 100644 index 000000000000..186c52f7ac11 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetMultimodalDatasetParameters.java @@ -0,0 +1,117 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for getting a multimodal dataset resource. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = GetMultimodalDatasetParameters.Builder.class) +public abstract class GetMultimodalDatasetParameters extends JsonSerializable { + /** */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for GetMultimodalDatasetParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetMultimodalDatasetParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetMultimodalDatasetParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `GetMultimodalDatasetParameters.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetMultimodalDatasetParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(VertexBaseConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(VertexBaseConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract GetMultimodalDatasetParameters build(); + } + + /** Deserializes a JSON string to a GetMultimodalDatasetParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static GetMultimodalDatasetParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetMultimodalDatasetParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetPromptConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetPromptConfig.java new file mode 100644 index 000000000000..5200726fe2ee --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/GetPromptConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for getting a prompt. */ +@AutoValue +@JsonDeserialize(builder = GetPromptConfig.Builder.class) +public abstract class GetPromptConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for GetPromptConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_GetPromptConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for GetPromptConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `GetPromptConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_GetPromptConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract GetPromptConfig build(); + } + + /** Deserializes a JSON string to a GetPromptConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static GetPromptConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, GetPromptConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/IdentityType.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/IdentityType.java new file mode 100644 index 000000000000..f94cea45b2f6 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/IdentityType.java @@ -0,0 +1,122 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** + * The identity type to use for the Reasoning Engine. If not specified, the `service_account` field + * will be used if set, otherwise the default Vertex AI Reasoning Engine Service Agent in the + * project will be used. + */ +public class IdentityType { + + /** Enum representing the known values for IdentityType. */ + public enum Known { + /** + * Default value. Use a custom service account if the `service_account` field is set, otherwise + * use the default Vertex AI Reasoning Engine Service Agent in the project. Same behavior as + * SERVICE_ACCOUNT. + */ + IDENTITY_TYPE_UNSPECIFIED, + + /** + * Use a custom service account if the `service_account` field is set, otherwise use the default + * Vertex AI Reasoning Engine Service Agent in the project. + */ + SERVICE_ACCOUNT, + + /** Use Agent Identity. The `service_account` field must not be set. */ + AGENT_IDENTITY + } + + private Known identityTypeEnum; + private final String value; + + @JsonCreator + public IdentityType(String value) { + this.value = value; + for (Known identityTypeEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(identityTypeEnum.toString(), value)) { + this.identityTypeEnum = identityTypeEnum; + break; + } + } + if (this.identityTypeEnum == null) { + this.identityTypeEnum = Known.IDENTITY_TYPE_UNSPECIFIED; + } + } + + public IdentityType(Known knownValue) { + this.identityTypeEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof IdentityType)) { + return false; + } + + IdentityType other = (IdentityType) o; + + if (this.identityTypeEnum != Known.IDENTITY_TYPE_UNSPECIFIED + && other.identityTypeEnum != Known.IDENTITY_TYPE_UNSPECIFIED) { + return this.identityTypeEnum == other.identityTypeEnum; + } else if (this.identityTypeEnum == Known.IDENTITY_TYPE_UNSPECIFIED + && other.identityTypeEnum == Known.IDENTITY_TYPE_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.identityTypeEnum != Known.IDENTITY_TYPE_UNSPECIFIED) { + return this.identityTypeEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.identityTypeEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Importance.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Importance.java new file mode 100644 index 000000000000..cc00d90c1347 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Importance.java @@ -0,0 +1,114 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** Importance level of the rubric. */ +public class Importance { + + /** Enum representing the known values for Importance. */ + public enum Known { + /** Importance is not specified. */ + IMPORTANCE_UNSPECIFIED, + + /** High importance. */ + HIGH, + + /** Medium importance. */ + MEDIUM, + + /** Low importance. */ + LOW + } + + private Known importanceEnum; + private final String value; + + @JsonCreator + public Importance(String value) { + this.value = value; + for (Known importanceEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(importanceEnum.toString(), value)) { + this.importanceEnum = importanceEnum; + break; + } + } + if (this.importanceEnum == null) { + this.importanceEnum = Known.IMPORTANCE_UNSPECIFIED; + } + } + + public Importance(Known knownValue) { + this.importanceEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof Importance)) { + return false; + } + + Importance other = (Importance) o; + + if (this.importanceEnum != Known.IMPORTANCE_UNSPECIFIED + && other.importanceEnum != Known.IMPORTANCE_UNSPECIFIED) { + return this.importanceEnum == other.importanceEnum; + } else if (this.importanceEnum == Known.IMPORTANCE_UNSPECIFIED + && other.importanceEnum == Known.IMPORTANCE_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.importanceEnum != Known.IMPORTANCE_UNSPECIFIED) { + return this.importanceEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.importanceEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/InstanceData.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/InstanceData.java new file mode 100644 index 000000000000..4562fe1bc4f4 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/InstanceData.java @@ -0,0 +1,113 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Instance data used to populate placeholders in a metric prompt template. */ +@AutoValue +@JsonDeserialize(builder = InstanceData.Builder.class) +public abstract class InstanceData extends JsonSerializable { + /** Text data. */ + @JsonProperty("text") + public abstract Optional text(); + + /** List of Gemini content data. */ + @JsonProperty("contents") + public abstract Optional contents(); + + /** Instantiates a builder for InstanceData. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_InstanceData.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for InstanceData. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `InstanceData.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_InstanceData.Builder(); + } + + /** + * Setter for text. + * + *

text: Text data. + */ + @JsonProperty("text") + public abstract Builder text(String text); + + @ExcludeFromGeneratedCoverageReport + abstract Builder text(Optional text); + + /** Clears the value of text field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearText() { + return text(Optional.empty()); + } + + /** + * Setter for contents. + * + *

contents: List of Gemini content data. + */ + @JsonProperty("contents") + public abstract Builder contents(InstanceDataContents contents); + + /** + * Setter for contents builder. + * + *

contents: List of Gemini content data. + */ + @CanIgnoreReturnValue + public Builder contents(InstanceDataContents.Builder contentsBuilder) { + return contents(contentsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder contents(Optional contents); + + /** Clears the value of contents field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContents() { + return contents(Optional.empty()); + } + + public abstract InstanceData build(); + } + + /** Deserializes a JSON string to a InstanceData object. */ + @ExcludeFromGeneratedCoverageReport + public static InstanceData fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, InstanceData.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/InstanceDataContents.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/InstanceDataContents.java new file mode 100644 index 000000000000..95a83734fc6d --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/InstanceDataContents.java @@ -0,0 +1,94 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** List of standard Content messages from Gemini API. */ +@AutoValue +@JsonDeserialize(builder = InstanceDataContents.Builder.class) +public abstract class InstanceDataContents extends JsonSerializable { + /** Repeated contents. */ + @JsonProperty("contents") + public abstract Optional> contents(); + + /** Instantiates a builder for InstanceDataContents. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_InstanceDataContents.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for InstanceDataContents. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `InstanceDataContents.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_InstanceDataContents.Builder(); + } + + /** + * Setter for contents. + * + *

contents: Repeated contents. + */ + @JsonProperty("contents") + public abstract Builder contents(List contents); + + /** + * Setter for contents. + * + *

contents: Repeated contents. + */ + @CanIgnoreReturnValue + public Builder contents(Content... contents) { + return contents(Arrays.asList(contents)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder contents(Optional> contents); + + /** Clears the value of contents field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContents() { + return contents(Optional.empty()); + } + + public abstract InstanceDataContents build(); + } + + /** Deserializes a JSON string to a InstanceDataContents object. */ + @ExcludeFromGeneratedCoverageReport + public static InstanceDataContents fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, InstanceDataContents.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/IntermediateExtractedMemory.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/IntermediateExtractedMemory.java new file mode 100644 index 000000000000..c413cdef7a92 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/IntermediateExtractedMemory.java @@ -0,0 +1,81 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** An extracted memory that is the intermediate result before consolidation. */ +@AutoValue +@JsonDeserialize(builder = IntermediateExtractedMemory.Builder.class) +public abstract class IntermediateExtractedMemory extends JsonSerializable { + /** Output only. The fact of the extracted memory. */ + @JsonProperty("fact") + public abstract Optional fact(); + + /** Instantiates a builder for IntermediateExtractedMemory. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_IntermediateExtractedMemory.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for IntermediateExtractedMemory. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `IntermediateExtractedMemory.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_IntermediateExtractedMemory.Builder(); + } + + /** + * Setter for fact. + * + *

fact: Output only. The fact of the extracted memory. + */ + @JsonProperty("fact") + public abstract Builder fact(String fact); + + @ExcludeFromGeneratedCoverageReport + abstract Builder fact(Optional fact); + + /** Clears the value of fact field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFact() { + return fact(Optional.empty()); + } + + public abstract IntermediateExtractedMemory build(); + } + + /** Deserializes a JSON string to a IntermediateExtractedMemory object. */ + @ExcludeFromGeneratedCoverageReport + public static IntermediateExtractedMemory fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, IntermediateExtractedMemory.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/JobState.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/JobState.java new file mode 100644 index 000000000000..d6b635462626 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/JobState.java @@ -0,0 +1,144 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** Output only. The detailed state of the job. */ +public class JobState { + + /** Enum representing the known values for JobState. */ + public enum Known { + /** The job state is unspecified. */ + JOB_STATE_UNSPECIFIED, + + /** The job has been just created or resumed and processing has not yet begun. */ + JOB_STATE_QUEUED, + + /** The service is preparing to run the job. */ + JOB_STATE_PENDING, + + /** The job is in progress. */ + JOB_STATE_RUNNING, + + /** The job completed successfully. */ + JOB_STATE_SUCCEEDED, + + /** The job failed. */ + JOB_STATE_FAILED, + + /** + * The job is being cancelled. From this state the job may only go to either + * `JOB_STATE_SUCCEEDED`, `JOB_STATE_FAILED` or `JOB_STATE_CANCELLED`. + */ + JOB_STATE_CANCELLING, + + /** The job has been cancelled. */ + JOB_STATE_CANCELLED, + + /** The job has been stopped, and can be resumed. */ + JOB_STATE_PAUSED, + + /** The job has expired. */ + JOB_STATE_EXPIRED, + + /** + * The job is being updated. Only jobs in the `RUNNING` state can be updated. After updating, + * the job goes back to the `RUNNING` state. + */ + JOB_STATE_UPDATING, + + /** The job is partially succeeded, some results may be missing due to errors. */ + JOB_STATE_PARTIALLY_SUCCEEDED + } + + private Known jobStateEnum; + private final String value; + + @JsonCreator + public JobState(String value) { + this.value = value; + for (Known jobStateEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(jobStateEnum.toString(), value)) { + this.jobStateEnum = jobStateEnum; + break; + } + } + if (this.jobStateEnum == null) { + this.jobStateEnum = Known.JOB_STATE_UNSPECIFIED; + } + } + + public JobState(Known knownValue) { + this.jobStateEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof JobState)) { + return false; + } + + JobState other = (JobState) o; + + if (this.jobStateEnum != Known.JOB_STATE_UNSPECIFIED + && other.jobStateEnum != Known.JOB_STATE_UNSPECIFIED) { + return this.jobStateEnum == other.jobStateEnum; + } else if (this.jobStateEnum == Known.JOB_STATE_UNSPECIFIED + && other.jobStateEnum == Known.JOB_STATE_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.jobStateEnum != Known.JOB_STATE_UNSPECIFIED) { + return this.jobStateEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.jobStateEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/LLMBasedMetricSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/LLMBasedMetricSpec.java new file mode 100644 index 000000000000..958903674aa2 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/LLMBasedMetricSpec.java @@ -0,0 +1,219 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.AutoraterConfig; +import java.util.Optional; + +/** Specification for an LLM based metric. */ +@AutoValue +@JsonDeserialize(builder = LLMBasedMetricSpec.Builder.class) +public abstract class LLMBasedMetricSpec extends JsonSerializable { + /** Template for the prompt sent to the judge model. */ + @JsonProperty("metricPromptTemplate") + public abstract Optional metricPromptTemplate(); + + /** System instruction for the judge model. */ + @JsonProperty("systemInstruction") + public abstract Optional systemInstruction(); + + /** Optional configuration for the judge LLM (Autorater). */ + @JsonProperty("judgeAutoraterConfig") + public abstract Optional judgeAutoraterConfig(); + + /** + * Use a pre-defined group of rubrics associated with the input. Refers to a key in the + * rubric_groups map of EvaluationInstance. + */ + @JsonProperty("rubricGroupKey") + public abstract Optional rubricGroupKey(); + + /** Dynamically generate rubrics using a predefined spec. */ + @JsonProperty("predefinedRubricGenerationSpec") + public abstract Optional predefinedRubricGenerationSpec(); + + /** Dynamically generate rubrics using this specification. */ + @JsonProperty("rubricGenerationSpec") + public abstract Optional rubricGenerationSpec(); + + /** Instantiates a builder for LLMBasedMetricSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_LLMBasedMetricSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for LLMBasedMetricSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `LLMBasedMetricSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_LLMBasedMetricSpec.Builder(); + } + + /** + * Setter for metricPromptTemplate. + * + *

metricPromptTemplate: Template for the prompt sent to the judge model. + */ + @JsonProperty("metricPromptTemplate") + public abstract Builder metricPromptTemplate(String metricPromptTemplate); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metricPromptTemplate(Optional metricPromptTemplate); + + /** Clears the value of metricPromptTemplate field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetricPromptTemplate() { + return metricPromptTemplate(Optional.empty()); + } + + /** + * Setter for systemInstruction. + * + *

systemInstruction: System instruction for the judge model. + */ + @JsonProperty("systemInstruction") + public abstract Builder systemInstruction(String systemInstruction); + + @ExcludeFromGeneratedCoverageReport + abstract Builder systemInstruction(Optional systemInstruction); + + /** Clears the value of systemInstruction field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSystemInstruction() { + return systemInstruction(Optional.empty()); + } + + /** + * Setter for judgeAutoraterConfig. + * + *

judgeAutoraterConfig: Optional configuration for the judge LLM (Autorater). + */ + @JsonProperty("judgeAutoraterConfig") + public abstract Builder judgeAutoraterConfig(AutoraterConfig judgeAutoraterConfig); + + @ExcludeFromGeneratedCoverageReport + abstract Builder judgeAutoraterConfig(Optional judgeAutoraterConfig); + + /** Clears the value of judgeAutoraterConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearJudgeAutoraterConfig() { + return judgeAutoraterConfig(Optional.empty()); + } + + /** + * Setter for rubricGroupKey. + * + *

rubricGroupKey: Use a pre-defined group of rubrics associated with the input. Refers to a + * key in the rubric_groups map of EvaluationInstance. + */ + @JsonProperty("rubricGroupKey") + public abstract Builder rubricGroupKey(String rubricGroupKey); + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubricGroupKey(Optional rubricGroupKey); + + /** Clears the value of rubricGroupKey field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubricGroupKey() { + return rubricGroupKey(Optional.empty()); + } + + /** + * Setter for predefinedRubricGenerationSpec. + * + *

predefinedRubricGenerationSpec: Dynamically generate rubrics using a predefined spec. + */ + @JsonProperty("predefinedRubricGenerationSpec") + public abstract Builder predefinedRubricGenerationSpec( + PredefinedMetricSpec predefinedRubricGenerationSpec); + + /** + * Setter for predefinedRubricGenerationSpec builder. + * + *

predefinedRubricGenerationSpec: Dynamically generate rubrics using a predefined spec. + */ + @CanIgnoreReturnValue + public Builder predefinedRubricGenerationSpec( + PredefinedMetricSpec.Builder predefinedRubricGenerationSpecBuilder) { + return predefinedRubricGenerationSpec(predefinedRubricGenerationSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder predefinedRubricGenerationSpec( + Optional predefinedRubricGenerationSpec); + + /** Clears the value of predefinedRubricGenerationSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPredefinedRubricGenerationSpec() { + return predefinedRubricGenerationSpec(Optional.empty()); + } + + /** + * Setter for rubricGenerationSpec. + * + *

rubricGenerationSpec: Dynamically generate rubrics using this specification. + */ + @JsonProperty("rubricGenerationSpec") + public abstract Builder rubricGenerationSpec(RubricGenerationSpec rubricGenerationSpec); + + /** + * Setter for rubricGenerationSpec builder. + * + *

rubricGenerationSpec: Dynamically generate rubrics using this specification. + */ + @CanIgnoreReturnValue + public Builder rubricGenerationSpec(RubricGenerationSpec.Builder rubricGenerationSpecBuilder) { + return rubricGenerationSpec(rubricGenerationSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubricGenerationSpec(Optional rubricGenerationSpec); + + /** Clears the value of rubricGenerationSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubricGenerationSpec() { + return rubricGenerationSpec(Optional.empty()); + } + + public abstract LLMBasedMetricSpec build(); + } + + /** Deserializes a JSON string to a LLMBasedMetricSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static LLMBasedMetricSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, LLMBasedMetricSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Language.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Language.java new file mode 100644 index 000000000000..a81c5885869f --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Language.java @@ -0,0 +1,111 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** The coding language supported in this environment. */ +public class Language { + + /** Enum representing the known values for Language. */ + public enum Known { + /** The default value. This value is unused. */ + LANGUAGE_UNSPECIFIED, + + /** The coding language is Python. */ + LANGUAGE_PYTHON, + + /** The coding language is JavaScript. */ + LANGUAGE_JAVASCRIPT + } + + private Known languageEnum; + private final String value; + + @JsonCreator + public Language(String value) { + this.value = value; + for (Known languageEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(languageEnum.toString(), value)) { + this.languageEnum = languageEnum; + break; + } + } + if (this.languageEnum == null) { + this.languageEnum = Known.LANGUAGE_UNSPECIFIED; + } + } + + public Language(Known knownValue) { + this.languageEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof Language)) { + return false; + } + + Language other = (Language) o; + + if (this.languageEnum != Known.LANGUAGE_UNSPECIFIED + && other.languageEnum != Known.LANGUAGE_UNSPECIFIED) { + return this.languageEnum == other.languageEnum; + } else if (this.languageEnum == Known.LANGUAGE_UNSPECIFIED + && other.languageEnum == Known.LANGUAGE_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.languageEnum != Known.LANGUAGE_UNSPECIFIED) { + return this.languageEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.languageEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineConfig.java new file mode 100644 index 000000000000..91d3112adf11 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineConfig.java @@ -0,0 +1,152 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for listing agent engines. */ +@AutoValue +@JsonDeserialize(builder = ListAgentEngineConfig.Builder.class) +public abstract class ListAgentEngineConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** */ + @JsonProperty("pageSize") + public abstract Optional pageSize(); + + /** */ + @JsonProperty("pageToken") + public abstract Optional pageToken(); + + /** + * An expression for filtering the results of the request. For field names both snake_case and + * camelCase are supported. + */ + @JsonProperty("filter") + public abstract Optional filter(); + + /** Instantiates a builder for ListAgentEngineConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ListAgentEngineConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for pageSize. + * + *

pageSize: + */ + @JsonProperty("pageSize") + public abstract Builder pageSize(Integer pageSize); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageSize(Optional pageSize); + + /** Clears the value of pageSize field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageSize() { + return pageSize(Optional.empty()); + } + + /** + * Setter for pageToken. + * + *

pageToken: + */ + @JsonProperty("pageToken") + public abstract Builder pageToken(String pageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageToken(Optional pageToken); + + /** Clears the value of pageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageToken() { + return pageToken(Optional.empty()); + } + + /** + * Setter for filter. + * + *

filter: An expression for filtering the results of the request. For field names both + * snake_case and camelCase are supported. + */ + @JsonProperty("filter") + public abstract Builder filter(String filter); + + @ExcludeFromGeneratedCoverageReport + abstract Builder filter(Optional filter); + + /** Clears the value of filter field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFilter() { + return filter(Optional.empty()); + } + + public abstract ListAgentEngineConfig build(); + } + + /** Deserializes a JSON string to a ListAgentEngineConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListAgentEngineConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryConfig.java new file mode 100644 index 000000000000..af124c02dca2 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryConfig.java @@ -0,0 +1,184 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for listing agent engine memories. */ +@AutoValue +@JsonDeserialize(builder = ListAgentEngineMemoryConfig.Builder.class) +public abstract class ListAgentEngineMemoryConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** */ + @JsonProperty("pageSize") + public abstract Optional pageSize(); + + /** */ + @JsonProperty("pageToken") + public abstract Optional pageToken(); + + /** + * An expression for filtering the results of the request. For field names both snake_case and + * camelCase are supported. + */ + @JsonProperty("filter") + public abstract Optional filter(); + + /** + * The standard list order by string. If not specified, the default order is `create_time desc`. + * If specified, the default sorting order of provided fields is ascending. More detail in + * [AIP-132](https://google.aip.dev/132). + * + *

Supported fields: `create_time` `update_time` + */ + @JsonProperty("orderBy") + public abstract Optional orderBy(); + + /** Instantiates a builder for ListAgentEngineMemoryConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineMemoryConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineMemoryConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ListAgentEngineMemoryConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineMemoryConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for pageSize. + * + *

pageSize: + */ + @JsonProperty("pageSize") + public abstract Builder pageSize(Integer pageSize); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageSize(Optional pageSize); + + /** Clears the value of pageSize field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageSize() { + return pageSize(Optional.empty()); + } + + /** + * Setter for pageToken. + * + *

pageToken: + */ + @JsonProperty("pageToken") + public abstract Builder pageToken(String pageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageToken(Optional pageToken); + + /** Clears the value of pageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageToken() { + return pageToken(Optional.empty()); + } + + /** + * Setter for filter. + * + *

filter: An expression for filtering the results of the request. For field names both + * snake_case and camelCase are supported. + */ + @JsonProperty("filter") + public abstract Builder filter(String filter); + + @ExcludeFromGeneratedCoverageReport + abstract Builder filter(Optional filter); + + /** Clears the value of filter field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFilter() { + return filter(Optional.empty()); + } + + /** + * Setter for orderBy. + * + *

orderBy: The standard list order by string. If not specified, the default order is + * `create_time desc`. If specified, the default sorting order of provided fields is ascending. + * More detail in [AIP-132](https://google.aip.dev/132). + * + *

Supported fields: `create_time` `update_time` + */ + @JsonProperty("orderBy") + public abstract Builder orderBy(String orderBy); + + @ExcludeFromGeneratedCoverageReport + abstract Builder orderBy(Optional orderBy); + + /** Clears the value of orderBy field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOrderBy() { + return orderBy(Optional.empty()); + } + + public abstract ListAgentEngineMemoryConfig build(); + } + + /** Deserializes a JSON string to a ListAgentEngineMemoryConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineMemoryConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListAgentEngineMemoryConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRequestParameters.java new file mode 100644 index 000000000000..aca27ac9545b --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRequestParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for listing agent engines. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = ListAgentEngineMemoryRequestParameters.Builder.class) +public abstract class ListAgentEngineMemoryRequestParameters extends JsonSerializable { + /** Name of the agent engine. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for ListAgentEngineMemoryRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineMemoryRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineMemoryRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListAgentEngineMemoryRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineMemoryRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(ListAgentEngineMemoryConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(ListAgentEngineMemoryConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract ListAgentEngineMemoryRequestParameters build(); + } + + /** Deserializes a JSON string to a ListAgentEngineMemoryRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineMemoryRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, ListAgentEngineMemoryRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsConfig.java new file mode 100644 index 000000000000..2323be0a45f6 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsConfig.java @@ -0,0 +1,155 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for listing Agent Engine memory revisions. */ +@AutoValue +@JsonDeserialize(builder = ListAgentEngineMemoryRevisionsConfig.Builder.class) +public abstract class ListAgentEngineMemoryRevisionsConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** */ + @JsonProperty("pageSize") + public abstract Optional pageSize(); + + /** */ + @JsonProperty("pageToken") + public abstract Optional pageToken(); + + /** + * An expression for filtering the results of the request. For field names both snake_case and + * camelCase are supported. + */ + @JsonProperty("filter") + public abstract Optional filter(); + + /** Instantiates a builder for ListAgentEngineMemoryRevisionsConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineMemoryRevisionsConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineMemoryRevisionsConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListAgentEngineMemoryRevisionsConfig.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineMemoryRevisionsConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for pageSize. + * + *

pageSize: + */ + @JsonProperty("pageSize") + public abstract Builder pageSize(Integer pageSize); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageSize(Optional pageSize); + + /** Clears the value of pageSize field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageSize() { + return pageSize(Optional.empty()); + } + + /** + * Setter for pageToken. + * + *

pageToken: + */ + @JsonProperty("pageToken") + public abstract Builder pageToken(String pageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageToken(Optional pageToken); + + /** Clears the value of pageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageToken() { + return pageToken(Optional.empty()); + } + + /** + * Setter for filter. + * + *

filter: An expression for filtering the results of the request. For field names both + * snake_case and camelCase are supported. + */ + @JsonProperty("filter") + public abstract Builder filter(String filter); + + @ExcludeFromGeneratedCoverageReport + abstract Builder filter(Optional filter); + + /** Clears the value of filter field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFilter() { + return filter(Optional.empty()); + } + + public abstract ListAgentEngineMemoryRevisionsConfig build(); + } + + /** Deserializes a JSON string to a ListAgentEngineMemoryRevisionsConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineMemoryRevisionsConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListAgentEngineMemoryRevisionsConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsRequestParameters.java new file mode 100644 index 000000000000..19667b7616e2 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsRequestParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for listing Agent Engine memory revisions. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = ListAgentEngineMemoryRevisionsRequestParameters.Builder.class) +public abstract class ListAgentEngineMemoryRevisionsRequestParameters extends JsonSerializable { + /** Name of the Agent Engine memory */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for ListAgentEngineMemoryRevisionsRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineMemoryRevisionsRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineMemoryRevisionsRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListAgentEngineMemoryRevisionsRequestParameters.builder()` + * for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineMemoryRevisionsRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the Agent Engine memory + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(ListAgentEngineMemoryRevisionsConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(ListAgentEngineMemoryRevisionsConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract ListAgentEngineMemoryRevisionsRequestParameters build(); + } + + /** Deserializes a JSON string to a ListAgentEngineMemoryRevisionsRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineMemoryRevisionsRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, ListAgentEngineMemoryRevisionsRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsResponse.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsResponse.java new file mode 100644 index 000000000000..0c5bc56511c6 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineMemoryRevisionsResponse.java @@ -0,0 +1,157 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpResponse; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Response for listing agent engine memory revisions. */ +@AutoValue +@JsonDeserialize(builder = ListAgentEngineMemoryRevisionsResponse.Builder.class) +public abstract class ListAgentEngineMemoryRevisionsResponse extends JsonSerializable { + /** Used to retain the full HTTP response. */ + @JsonProperty("sdkHttpResponse") + public abstract Optional sdkHttpResponse(); + + /** */ + @JsonProperty("nextPageToken") + public abstract Optional nextPageToken(); + + /** List of memory revisions. */ + @JsonProperty("memoryRevisions") + public abstract Optional> memoryRevisions(); + + /** Instantiates a builder for ListAgentEngineMemoryRevisionsResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineMemoryRevisionsResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineMemoryRevisionsResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListAgentEngineMemoryRevisionsResponse.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineMemoryRevisionsResponse.Builder(); + } + + /** + * Setter for sdkHttpResponse. + * + *

sdkHttpResponse: Used to retain the full HTTP response. + */ + @JsonProperty("sdkHttpResponse") + public abstract Builder sdkHttpResponse(HttpResponse sdkHttpResponse); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sdkHttpResponse(Optional sdkHttpResponse); + + /** Clears the value of sdkHttpResponse field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSdkHttpResponse() { + return sdkHttpResponse(Optional.empty()); + } + + /** + * Setter for nextPageToken. + * + *

nextPageToken: + */ + @JsonProperty("nextPageToken") + public abstract Builder nextPageToken(String nextPageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder nextPageToken(Optional nextPageToken); + + /** Clears the value of nextPageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNextPageToken() { + return nextPageToken(Optional.empty()); + } + + /** + * Setter for memoryRevisions. + * + *

memoryRevisions: List of memory revisions. + */ + @JsonProperty("memoryRevisions") + public abstract Builder memoryRevisions(List memoryRevisions); + + /** + * Setter for memoryRevisions. + * + *

memoryRevisions: List of memory revisions. + */ + @CanIgnoreReturnValue + public Builder memoryRevisions(MemoryRevision... memoryRevisions) { + return memoryRevisions(Arrays.asList(memoryRevisions)); + } + + /** + * Setter for memoryRevisions builder. + * + *

memoryRevisions: List of memory revisions. + */ + @CanIgnoreReturnValue + public Builder memoryRevisions(MemoryRevision.Builder... memoryRevisionsBuilders) { + return memoryRevisions( + Arrays.asList(memoryRevisionsBuilders).stream() + .map(MemoryRevision.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder memoryRevisions(Optional> memoryRevisions); + + /** Clears the value of memoryRevisions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMemoryRevisions() { + return memoryRevisions(Optional.empty()); + } + + public abstract ListAgentEngineMemoryRevisionsResponse build(); + } + + /** Deserializes a JSON string to a ListAgentEngineMemoryRevisionsResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineMemoryRevisionsResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, ListAgentEngineMemoryRevisionsResponse.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineRequestParameters.java new file mode 100644 index 000000000000..1578ce4083f7 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineRequestParameters.java @@ -0,0 +1,96 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for listing agent engines. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = ListAgentEngineRequestParameters.Builder.class) +public abstract class ListAgentEngineRequestParameters extends JsonSerializable { + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for ListAgentEngineRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListAgentEngineRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineRequestParameters.Builder(); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(ListAgentEngineConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(ListAgentEngineConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract ListAgentEngineRequestParameters build(); + } + + /** Deserializes a JSON string to a ListAgentEngineRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListAgentEngineRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesConfig.java new file mode 100644 index 000000000000..f3685ea9e2cb --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesConfig.java @@ -0,0 +1,154 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for listing agent engine sandboxes. */ +@AutoValue +@JsonDeserialize(builder = ListAgentEngineSandboxesConfig.Builder.class) +public abstract class ListAgentEngineSandboxesConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** */ + @JsonProperty("pageSize") + public abstract Optional pageSize(); + + /** */ + @JsonProperty("pageToken") + public abstract Optional pageToken(); + + /** + * An expression for filtering the results of the request. For field names both snake_case and + * camelCase are supported. + */ + @JsonProperty("filter") + public abstract Optional filter(); + + /** Instantiates a builder for ListAgentEngineSandboxesConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineSandboxesConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineSandboxesConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListAgentEngineSandboxesConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineSandboxesConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for pageSize. + * + *

pageSize: + */ + @JsonProperty("pageSize") + public abstract Builder pageSize(Integer pageSize); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageSize(Optional pageSize); + + /** Clears the value of pageSize field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageSize() { + return pageSize(Optional.empty()); + } + + /** + * Setter for pageToken. + * + *

pageToken: + */ + @JsonProperty("pageToken") + public abstract Builder pageToken(String pageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageToken(Optional pageToken); + + /** Clears the value of pageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageToken() { + return pageToken(Optional.empty()); + } + + /** + * Setter for filter. + * + *

filter: An expression for filtering the results of the request. For field names both + * snake_case and camelCase are supported. + */ + @JsonProperty("filter") + public abstract Builder filter(String filter); + + @ExcludeFromGeneratedCoverageReport + abstract Builder filter(Optional filter); + + /** Clears the value of filter field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFilter() { + return filter(Optional.empty()); + } + + public abstract ListAgentEngineSandboxesConfig build(); + } + + /** Deserializes a JSON string to a ListAgentEngineSandboxesConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineSandboxesConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListAgentEngineSandboxesConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesRequestParameters.java new file mode 100644 index 000000000000..5359497c2761 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesRequestParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for listing agent engine sandboxes. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = ListAgentEngineSandboxesRequestParameters.Builder.class) +public abstract class ListAgentEngineSandboxesRequestParameters extends JsonSerializable { + /** Name of the agent engine. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for ListAgentEngineSandboxesRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineSandboxesRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineSandboxesRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListAgentEngineSandboxesRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineSandboxesRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(ListAgentEngineSandboxesConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(ListAgentEngineSandboxesConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract ListAgentEngineSandboxesRequestParameters build(); + } + + /** Deserializes a JSON string to a ListAgentEngineSandboxesRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineSandboxesRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, ListAgentEngineSandboxesRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesResponse.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesResponse.java new file mode 100644 index 000000000000..ec0a2d2b36dc --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSandboxesResponse.java @@ -0,0 +1,156 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpResponse; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Response for listing agent engine sandboxes. */ +@AutoValue +@JsonDeserialize(builder = ListAgentEngineSandboxesResponse.Builder.class) +public abstract class ListAgentEngineSandboxesResponse extends JsonSerializable { + /** Used to retain the full HTTP response. */ + @JsonProperty("sdkHttpResponse") + public abstract Optional sdkHttpResponse(); + + /** */ + @JsonProperty("nextPageToken") + public abstract Optional nextPageToken(); + + /** List of agent engine sandboxes. */ + @JsonProperty("sandboxEnvironments") + public abstract Optional> sandboxEnvironments(); + + /** Instantiates a builder for ListAgentEngineSandboxesResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineSandboxesResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineSandboxesResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListAgentEngineSandboxesResponse.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineSandboxesResponse.Builder(); + } + + /** + * Setter for sdkHttpResponse. + * + *

sdkHttpResponse: Used to retain the full HTTP response. + */ + @JsonProperty("sdkHttpResponse") + public abstract Builder sdkHttpResponse(HttpResponse sdkHttpResponse); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sdkHttpResponse(Optional sdkHttpResponse); + + /** Clears the value of sdkHttpResponse field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSdkHttpResponse() { + return sdkHttpResponse(Optional.empty()); + } + + /** + * Setter for nextPageToken. + * + *

nextPageToken: + */ + @JsonProperty("nextPageToken") + public abstract Builder nextPageToken(String nextPageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder nextPageToken(Optional nextPageToken); + + /** Clears the value of nextPageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNextPageToken() { + return nextPageToken(Optional.empty()); + } + + /** + * Setter for sandboxEnvironments. + * + *

sandboxEnvironments: List of agent engine sandboxes. + */ + @JsonProperty("sandboxEnvironments") + public abstract Builder sandboxEnvironments(List sandboxEnvironments); + + /** + * Setter for sandboxEnvironments. + * + *

sandboxEnvironments: List of agent engine sandboxes. + */ + @CanIgnoreReturnValue + public Builder sandboxEnvironments(SandboxEnvironment... sandboxEnvironments) { + return sandboxEnvironments(Arrays.asList(sandboxEnvironments)); + } + + /** + * Setter for sandboxEnvironments builder. + * + *

sandboxEnvironments: List of agent engine sandboxes. + */ + @CanIgnoreReturnValue + public Builder sandboxEnvironments(SandboxEnvironment.Builder... sandboxEnvironmentsBuilders) { + return sandboxEnvironments( + Arrays.asList(sandboxEnvironmentsBuilders).stream() + .map(SandboxEnvironment.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder sandboxEnvironments(Optional> sandboxEnvironments); + + /** Clears the value of sandboxEnvironments field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSandboxEnvironments() { + return sandboxEnvironments(Optional.empty()); + } + + public abstract ListAgentEngineSandboxesResponse build(); + } + + /** Deserializes a JSON string to a ListAgentEngineSandboxesResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineSandboxesResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListAgentEngineSandboxesResponse.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSessionsConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSessionsConfig.java new file mode 100644 index 000000000000..81d78e1ccb16 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSessionsConfig.java @@ -0,0 +1,154 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for listing agent engine sessions. */ +@AutoValue +@JsonDeserialize(builder = ListAgentEngineSessionsConfig.Builder.class) +public abstract class ListAgentEngineSessionsConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** */ + @JsonProperty("pageSize") + public abstract Optional pageSize(); + + /** */ + @JsonProperty("pageToken") + public abstract Optional pageToken(); + + /** + * An expression for filtering the results of the request. For field names both snake_case and + * camelCase are supported. + */ + @JsonProperty("filter") + public abstract Optional filter(); + + /** Instantiates a builder for ListAgentEngineSessionsConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineSessionsConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineSessionsConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListAgentEngineSessionsConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineSessionsConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for pageSize. + * + *

pageSize: + */ + @JsonProperty("pageSize") + public abstract Builder pageSize(Integer pageSize); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageSize(Optional pageSize); + + /** Clears the value of pageSize field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageSize() { + return pageSize(Optional.empty()); + } + + /** + * Setter for pageToken. + * + *

pageToken: + */ + @JsonProperty("pageToken") + public abstract Builder pageToken(String pageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageToken(Optional pageToken); + + /** Clears the value of pageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageToken() { + return pageToken(Optional.empty()); + } + + /** + * Setter for filter. + * + *

filter: An expression for filtering the results of the request. For field names both + * snake_case and camelCase are supported. + */ + @JsonProperty("filter") + public abstract Builder filter(String filter); + + @ExcludeFromGeneratedCoverageReport + abstract Builder filter(Optional filter); + + /** Clears the value of filter field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFilter() { + return filter(Optional.empty()); + } + + public abstract ListAgentEngineSessionsConfig build(); + } + + /** Deserializes a JSON string to a ListAgentEngineSessionsConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineSessionsConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListAgentEngineSessionsConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSessionsRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSessionsRequestParameters.java new file mode 100644 index 000000000000..8c9916632a84 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListAgentEngineSessionsRequestParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for listing agent engines. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = ListAgentEngineSessionsRequestParameters.Builder.class) +public abstract class ListAgentEngineSessionsRequestParameters extends JsonSerializable { + /** Name of the agent engine. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for ListAgentEngineSessionsRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListAgentEngineSessionsRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListAgentEngineSessionsRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListAgentEngineSessionsRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListAgentEngineSessionsRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(ListAgentEngineSessionsConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(ListAgentEngineSessionsConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract ListAgentEngineSessionsRequestParameters build(); + } + + /** Deserializes a JSON string to a ListAgentEngineSessionsRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static ListAgentEngineSessionsRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, ListAgentEngineSessionsRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListDatasetVersionsRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListDatasetVersionsRequestParameters.java new file mode 100644 index 000000000000..4196138caf96 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListDatasetVersionsRequestParameters.java @@ -0,0 +1,140 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for listing dataset versions. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = ListDatasetVersionsRequestParameters.Builder.class) +public abstract class ListDatasetVersionsRequestParameters extends JsonSerializable { + /** */ + @JsonProperty("readMask") + public abstract Optional readMask(); + + /** */ + @JsonProperty("datasetId") + public abstract Optional datasetId(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for ListDatasetVersionsRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListDatasetVersionsRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListDatasetVersionsRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListDatasetVersionsRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListDatasetVersionsRequestParameters.Builder(); + } + + /** + * Setter for readMask. + * + *

readMask: + */ + @JsonProperty("readMask") + public abstract Builder readMask(String readMask); + + @ExcludeFromGeneratedCoverageReport + abstract Builder readMask(Optional readMask); + + /** Clears the value of readMask field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReadMask() { + return readMask(Optional.empty()); + } + + /** + * Setter for datasetId. + * + *

datasetId: + */ + @JsonProperty("datasetId") + public abstract Builder datasetId(String datasetId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder datasetId(Optional datasetId); + + /** Clears the value of datasetId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDatasetId() { + return datasetId(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(ListPromptsConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(ListPromptsConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract ListDatasetVersionsRequestParameters build(); + } + + /** Deserializes a JSON string to a ListDatasetVersionsRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static ListDatasetVersionsRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListDatasetVersionsRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListDatasetVersionsResponse.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListDatasetVersionsResponse.java new file mode 100644 index 000000000000..c18d86b8942d --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListDatasetVersionsResponse.java @@ -0,0 +1,153 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpResponse; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Response for listing prompt datasets. */ +@AutoValue +@JsonDeserialize(builder = ListDatasetVersionsResponse.Builder.class) +public abstract class ListDatasetVersionsResponse extends JsonSerializable { + /** Used to retain the full HTTP response. */ + @JsonProperty("sdkHttpResponse") + public abstract Optional sdkHttpResponse(); + + /** */ + @JsonProperty("nextPageToken") + public abstract Optional nextPageToken(); + + /** List of datasets for the project. */ + @JsonProperty("datasetVersions") + public abstract Optional> datasetVersions(); + + /** Instantiates a builder for ListDatasetVersionsResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListDatasetVersionsResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListDatasetVersionsResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ListDatasetVersionsResponse.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListDatasetVersionsResponse.Builder(); + } + + /** + * Setter for sdkHttpResponse. + * + *

sdkHttpResponse: Used to retain the full HTTP response. + */ + @JsonProperty("sdkHttpResponse") + public abstract Builder sdkHttpResponse(HttpResponse sdkHttpResponse); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sdkHttpResponse(Optional sdkHttpResponse); + + /** Clears the value of sdkHttpResponse field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSdkHttpResponse() { + return sdkHttpResponse(Optional.empty()); + } + + /** + * Setter for nextPageToken. + * + *

nextPageToken: + */ + @JsonProperty("nextPageToken") + public abstract Builder nextPageToken(String nextPageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder nextPageToken(Optional nextPageToken); + + /** Clears the value of nextPageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNextPageToken() { + return nextPageToken(Optional.empty()); + } + + /** + * Setter for datasetVersions. + * + *

datasetVersions: List of datasets for the project. + */ + @JsonProperty("datasetVersions") + public abstract Builder datasetVersions(List datasetVersions); + + /** + * Setter for datasetVersions. + * + *

datasetVersions: List of datasets for the project. + */ + @CanIgnoreReturnValue + public Builder datasetVersions(DatasetVersion... datasetVersions) { + return datasetVersions(Arrays.asList(datasetVersions)); + } + + /** + * Setter for datasetVersions builder. + * + *

datasetVersions: List of datasets for the project. + */ + @CanIgnoreReturnValue + public Builder datasetVersions(DatasetVersion.Builder... datasetVersionsBuilders) { + return datasetVersions( + Arrays.asList(datasetVersionsBuilders).stream() + .map(DatasetVersion.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder datasetVersions(Optional> datasetVersions); + + /** Clears the value of datasetVersions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDatasetVersions() { + return datasetVersions(Optional.empty()); + } + + public abstract ListDatasetVersionsResponse build(); + } + + /** Deserializes a JSON string to a ListDatasetVersionsResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static ListDatasetVersionsResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListDatasetVersionsResponse.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListDatasetsRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListDatasetsRequestParameters.java new file mode 100644 index 000000000000..1b5bd647dcbe --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListDatasetsRequestParameters.java @@ -0,0 +1,95 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for listing prompt datasets. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = ListDatasetsRequestParameters.Builder.class) +public abstract class ListDatasetsRequestParameters extends JsonSerializable { + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for ListDatasetsRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListDatasetsRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListDatasetsRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListDatasetsRequestParameters.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListDatasetsRequestParameters.Builder(); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(ListPromptsConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(ListPromptsConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract ListDatasetsRequestParameters build(); + } + + /** Deserializes a JSON string to a ListDatasetsRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static ListDatasetsRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListDatasetsRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListDatasetsResponse.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListDatasetsResponse.java new file mode 100644 index 000000000000..e15410dc7c7e --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListDatasetsResponse.java @@ -0,0 +1,153 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpResponse; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Response for listing prompt datasets. */ +@AutoValue +@JsonDeserialize(builder = ListDatasetsResponse.Builder.class) +public abstract class ListDatasetsResponse extends JsonSerializable { + /** Used to retain the full HTTP response. */ + @JsonProperty("sdkHttpResponse") + public abstract Optional sdkHttpResponse(); + + /** */ + @JsonProperty("nextPageToken") + public abstract Optional nextPageToken(); + + /** List of datasets for the project. */ + @JsonProperty("datasets") + public abstract Optional> datasets(); + + /** Instantiates a builder for ListDatasetsResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListDatasetsResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListDatasetsResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ListDatasetsResponse.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListDatasetsResponse.Builder(); + } + + /** + * Setter for sdkHttpResponse. + * + *

sdkHttpResponse: Used to retain the full HTTP response. + */ + @JsonProperty("sdkHttpResponse") + public abstract Builder sdkHttpResponse(HttpResponse sdkHttpResponse); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sdkHttpResponse(Optional sdkHttpResponse); + + /** Clears the value of sdkHttpResponse field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSdkHttpResponse() { + return sdkHttpResponse(Optional.empty()); + } + + /** + * Setter for nextPageToken. + * + *

nextPageToken: + */ + @JsonProperty("nextPageToken") + public abstract Builder nextPageToken(String nextPageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder nextPageToken(Optional nextPageToken); + + /** Clears the value of nextPageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNextPageToken() { + return nextPageToken(Optional.empty()); + } + + /** + * Setter for datasets. + * + *

datasets: List of datasets for the project. + */ + @JsonProperty("datasets") + public abstract Builder datasets(List datasets); + + /** + * Setter for datasets. + * + *

datasets: List of datasets for the project. + */ + @CanIgnoreReturnValue + public Builder datasets(Dataset... datasets) { + return datasets(Arrays.asList(datasets)); + } + + /** + * Setter for datasets builder. + * + *

datasets: List of datasets for the project. + */ + @CanIgnoreReturnValue + public Builder datasets(Dataset.Builder... datasetsBuilders) { + return datasets( + Arrays.asList(datasetsBuilders).stream() + .map(Dataset.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder datasets(Optional> datasets); + + /** Clears the value of datasets field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDatasets() { + return datasets(Optional.empty()); + } + + public abstract ListDatasetsResponse build(); + } + + /** Deserializes a JSON string to a ListDatasetsResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static ListDatasetsResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListDatasetsResponse.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListMultimodalDatasetsConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListMultimodalDatasetsConfig.java new file mode 100644 index 000000000000..fca550ac792e --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListMultimodalDatasetsConfig.java @@ -0,0 +1,154 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for listing multimodal datasets. */ +@AutoValue +@JsonDeserialize(builder = ListMultimodalDatasetsConfig.Builder.class) +public abstract class ListMultimodalDatasetsConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** */ + @JsonProperty("pageSize") + public abstract Optional pageSize(); + + /** */ + @JsonProperty("pageToken") + public abstract Optional pageToken(); + + /** + * An expression for filtering the results of the request. For field names both snake_case and + * camelCase are supported. + */ + @JsonProperty("filter") + public abstract Optional filter(); + + /** Instantiates a builder for ListMultimodalDatasetsConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListMultimodalDatasetsConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListMultimodalDatasetsConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListMultimodalDatasetsConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListMultimodalDatasetsConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for pageSize. + * + *

pageSize: + */ + @JsonProperty("pageSize") + public abstract Builder pageSize(Integer pageSize); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageSize(Optional pageSize); + + /** Clears the value of pageSize field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageSize() { + return pageSize(Optional.empty()); + } + + /** + * Setter for pageToken. + * + *

pageToken: + */ + @JsonProperty("pageToken") + public abstract Builder pageToken(String pageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageToken(Optional pageToken); + + /** Clears the value of pageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageToken() { + return pageToken(Optional.empty()); + } + + /** + * Setter for filter. + * + *

filter: An expression for filtering the results of the request. For field names both + * snake_case and camelCase are supported. + */ + @JsonProperty("filter") + public abstract Builder filter(String filter); + + @ExcludeFromGeneratedCoverageReport + abstract Builder filter(Optional filter); + + /** Clears the value of filter field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFilter() { + return filter(Optional.empty()); + } + + public abstract ListMultimodalDatasetsConfig build(); + } + + /** Deserializes a JSON string to a ListMultimodalDatasetsConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static ListMultimodalDatasetsConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListMultimodalDatasetsConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListMultimodalDatasetsRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListMultimodalDatasetsRequestParameters.java new file mode 100644 index 000000000000..5b05c55468a0 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListMultimodalDatasetsRequestParameters.java @@ -0,0 +1,97 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for listing multimodal datasets. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = ListMultimodalDatasetsRequestParameters.Builder.class) +public abstract class ListMultimodalDatasetsRequestParameters extends JsonSerializable { + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for ListMultimodalDatasetsRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListMultimodalDatasetsRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListMultimodalDatasetsRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListMultimodalDatasetsRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListMultimodalDatasetsRequestParameters.Builder(); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(ListMultimodalDatasetsConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(ListMultimodalDatasetsConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract ListMultimodalDatasetsRequestParameters build(); + } + + /** Deserializes a JSON string to a ListMultimodalDatasetsRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static ListMultimodalDatasetsRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, ListMultimodalDatasetsRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListMultimodalDatasetsResponse.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListMultimodalDatasetsResponse.java new file mode 100644 index 000000000000..d440b6a7b876 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListMultimodalDatasetsResponse.java @@ -0,0 +1,181 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpResponse; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Response for listing multimodal datasets. */ +@AutoValue +@JsonDeserialize(builder = ListMultimodalDatasetsResponse.Builder.class) +public abstract class ListMultimodalDatasetsResponse extends JsonSerializable { + /** Used to retain the full HTTP response. */ + @JsonProperty("sdkHttpResponse") + public abstract Optional sdkHttpResponse(); + + /** */ + @JsonProperty("nextPageToken") + public abstract Optional nextPageToken(); + + /** + * The timeout for the list datasets request in seconds. If not set, the default timeout is 90 + * seconds. + */ + @JsonProperty("timeout") + public abstract Optional timeout(); + + /** List of datasets for the project. */ + @JsonProperty("datasets") + public abstract Optional> datasets(); + + /** Instantiates a builder for ListMultimodalDatasetsResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListMultimodalDatasetsResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListMultimodalDatasetsResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListMultimodalDatasetsResponse.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListMultimodalDatasetsResponse.Builder(); + } + + /** + * Setter for sdkHttpResponse. + * + *

sdkHttpResponse: Used to retain the full HTTP response. + */ + @JsonProperty("sdkHttpResponse") + public abstract Builder sdkHttpResponse(HttpResponse sdkHttpResponse); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sdkHttpResponse(Optional sdkHttpResponse); + + /** Clears the value of sdkHttpResponse field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSdkHttpResponse() { + return sdkHttpResponse(Optional.empty()); + } + + /** + * Setter for nextPageToken. + * + *

nextPageToken: + */ + @JsonProperty("nextPageToken") + public abstract Builder nextPageToken(String nextPageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder nextPageToken(Optional nextPageToken); + + /** Clears the value of nextPageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNextPageToken() { + return nextPageToken(Optional.empty()); + } + + /** + * Setter for timeout. + * + *

timeout: The timeout for the list datasets request in seconds. If not set, the default + * timeout is 90 seconds. + */ + @JsonProperty("timeout") + public abstract Builder timeout(Integer timeout); + + @ExcludeFromGeneratedCoverageReport + abstract Builder timeout(Optional timeout); + + /** Clears the value of timeout field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTimeout() { + return timeout(Optional.empty()); + } + + /** + * Setter for datasets. + * + *

datasets: List of datasets for the project. + */ + @JsonProperty("datasets") + public abstract Builder datasets(List datasets); + + /** + * Setter for datasets. + * + *

datasets: List of datasets for the project. + */ + @CanIgnoreReturnValue + public Builder datasets(MultimodalDataset... datasets) { + return datasets(Arrays.asList(datasets)); + } + + /** + * Setter for datasets builder. + * + *

datasets: List of datasets for the project. + */ + @CanIgnoreReturnValue + public Builder datasets(MultimodalDataset.Builder... datasetsBuilders) { + return datasets( + Arrays.asList(datasetsBuilders).stream() + .map(MultimodalDataset.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder datasets(Optional> datasets); + + /** Clears the value of datasets field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDatasets() { + return datasets(Optional.empty()); + } + + public abstract ListMultimodalDatasetsResponse build(); + } + + /** Deserializes a JSON string to a ListMultimodalDatasetsResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static ListMultimodalDatasetsResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListMultimodalDatasetsResponse.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListPromptsConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListPromptsConfig.java new file mode 100644 index 000000000000..22eadc5f817c --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListPromptsConfig.java @@ -0,0 +1,152 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for listing prompt datasets and dataset versions. */ +@AutoValue +@JsonDeserialize(builder = ListPromptsConfig.Builder.class) +public abstract class ListPromptsConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** */ + @JsonProperty("pageSize") + public abstract Optional pageSize(); + + /** */ + @JsonProperty("pageToken") + public abstract Optional pageToken(); + + /** + * An expression for filtering the results of the request. For field names both snake_case and + * camelCase are supported. + */ + @JsonProperty("filter") + public abstract Optional filter(); + + /** Instantiates a builder for ListPromptsConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListPromptsConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListPromptsConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ListPromptsConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListPromptsConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for pageSize. + * + *

pageSize: + */ + @JsonProperty("pageSize") + public abstract Builder pageSize(Integer pageSize); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageSize(Optional pageSize); + + /** Clears the value of pageSize field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageSize() { + return pageSize(Optional.empty()); + } + + /** + * Setter for pageToken. + * + *

pageToken: + */ + @JsonProperty("pageToken") + public abstract Builder pageToken(String pageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageToken(Optional pageToken); + + /** Clears the value of pageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageToken() { + return pageToken(Optional.empty()); + } + + /** + * Setter for filter. + * + *

filter: An expression for filtering the results of the request. For field names both + * snake_case and camelCase are supported. + */ + @JsonProperty("filter") + public abstract Builder filter(String filter); + + @ExcludeFromGeneratedCoverageReport + abstract Builder filter(Optional filter); + + /** Clears the value of filter field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFilter() { + return filter(Optional.empty()); + } + + public abstract ListPromptsConfig build(); + } + + /** Deserializes a JSON string to a ListPromptsConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static ListPromptsConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListPromptsConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListReasoningEnginesMemoriesResponse.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListReasoningEnginesMemoriesResponse.java new file mode 100644 index 000000000000..07e1aeb8c719 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListReasoningEnginesMemoriesResponse.java @@ -0,0 +1,156 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpResponse; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Response for listing agent engine memories. */ +@AutoValue +@JsonDeserialize(builder = ListReasoningEnginesMemoriesResponse.Builder.class) +public abstract class ListReasoningEnginesMemoriesResponse extends JsonSerializable { + /** Used to retain the full HTTP response. */ + @JsonProperty("sdkHttpResponse") + public abstract Optional sdkHttpResponse(); + + /** */ + @JsonProperty("nextPageToken") + public abstract Optional nextPageToken(); + + /** List of agent engine memories. */ + @JsonProperty("memories") + public abstract Optional> memories(); + + /** Instantiates a builder for ListReasoningEnginesMemoriesResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListReasoningEnginesMemoriesResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListReasoningEnginesMemoriesResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListReasoningEnginesMemoriesResponse.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListReasoningEnginesMemoriesResponse.Builder(); + } + + /** + * Setter for sdkHttpResponse. + * + *

sdkHttpResponse: Used to retain the full HTTP response. + */ + @JsonProperty("sdkHttpResponse") + public abstract Builder sdkHttpResponse(HttpResponse sdkHttpResponse); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sdkHttpResponse(Optional sdkHttpResponse); + + /** Clears the value of sdkHttpResponse field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSdkHttpResponse() { + return sdkHttpResponse(Optional.empty()); + } + + /** + * Setter for nextPageToken. + * + *

nextPageToken: + */ + @JsonProperty("nextPageToken") + public abstract Builder nextPageToken(String nextPageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder nextPageToken(Optional nextPageToken); + + /** Clears the value of nextPageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNextPageToken() { + return nextPageToken(Optional.empty()); + } + + /** + * Setter for memories. + * + *

memories: List of agent engine memories. + */ + @JsonProperty("memories") + public abstract Builder memories(List memories); + + /** + * Setter for memories. + * + *

memories: List of agent engine memories. + */ + @CanIgnoreReturnValue + public Builder memories(Memory... memories) { + return memories(Arrays.asList(memories)); + } + + /** + * Setter for memories builder. + * + *

memories: List of agent engine memories. + */ + @CanIgnoreReturnValue + public Builder memories(Memory.Builder... memoriesBuilders) { + return memories( + Arrays.asList(memoriesBuilders).stream() + .map(Memory.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder memories(Optional> memories); + + /** Clears the value of memories field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMemories() { + return memories(Optional.empty()); + } + + public abstract ListReasoningEnginesMemoriesResponse build(); + } + + /** Deserializes a JSON string to a ListReasoningEnginesMemoriesResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static ListReasoningEnginesMemoriesResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListReasoningEnginesMemoriesResponse.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListReasoningEnginesResponse.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListReasoningEnginesResponse.java new file mode 100644 index 000000000000..c846b9b649d8 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListReasoningEnginesResponse.java @@ -0,0 +1,155 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpResponse; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Response for listing agent engines. */ +@AutoValue +@JsonDeserialize(builder = ListReasoningEnginesResponse.Builder.class) +public abstract class ListReasoningEnginesResponse extends JsonSerializable { + /** Used to retain the full HTTP response. */ + @JsonProperty("sdkHttpResponse") + public abstract Optional sdkHttpResponse(); + + /** */ + @JsonProperty("nextPageToken") + public abstract Optional nextPageToken(); + + /** List of agent engines. */ + @JsonProperty("reasoningEngines") + public abstract Optional> reasoningEngines(); + + /** Instantiates a builder for ListReasoningEnginesResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListReasoningEnginesResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListReasoningEnginesResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListReasoningEnginesResponse.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListReasoningEnginesResponse.Builder(); + } + + /** + * Setter for sdkHttpResponse. + * + *

sdkHttpResponse: Used to retain the full HTTP response. + */ + @JsonProperty("sdkHttpResponse") + public abstract Builder sdkHttpResponse(HttpResponse sdkHttpResponse); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sdkHttpResponse(Optional sdkHttpResponse); + + /** Clears the value of sdkHttpResponse field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSdkHttpResponse() { + return sdkHttpResponse(Optional.empty()); + } + + /** + * Setter for nextPageToken. + * + *

nextPageToken: + */ + @JsonProperty("nextPageToken") + public abstract Builder nextPageToken(String nextPageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder nextPageToken(Optional nextPageToken); + + /** Clears the value of nextPageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNextPageToken() { + return nextPageToken(Optional.empty()); + } + + /** + * Setter for reasoningEngines. + * + *

reasoningEngines: List of agent engines. + */ + @JsonProperty("reasoningEngines") + public abstract Builder reasoningEngines(List reasoningEngines); + + /** + * Setter for reasoningEngines. + * + *

reasoningEngines: List of agent engines. + */ + @CanIgnoreReturnValue + public Builder reasoningEngines(ReasoningEngine... reasoningEngines) { + return reasoningEngines(Arrays.asList(reasoningEngines)); + } + + /** + * Setter for reasoningEngines builder. + * + *

reasoningEngines: List of agent engines. + */ + @CanIgnoreReturnValue + public Builder reasoningEngines(ReasoningEngine.Builder... reasoningEnginesBuilders) { + return reasoningEngines( + Arrays.asList(reasoningEnginesBuilders).stream() + .map(ReasoningEngine.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder reasoningEngines(Optional> reasoningEngines); + + /** Clears the value of reasoningEngines field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReasoningEngines() { + return reasoningEngines(Optional.empty()); + } + + public abstract ListReasoningEnginesResponse build(); + } + + /** Deserializes a JSON string to a ListReasoningEnginesResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static ListReasoningEnginesResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListReasoningEnginesResponse.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListReasoningEnginesSessionsResponse.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListReasoningEnginesSessionsResponse.java new file mode 100644 index 000000000000..f91282e39092 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ListReasoningEnginesSessionsResponse.java @@ -0,0 +1,156 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpResponse; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Response for listing agent engine sessions. */ +@AutoValue +@JsonDeserialize(builder = ListReasoningEnginesSessionsResponse.Builder.class) +public abstract class ListReasoningEnginesSessionsResponse extends JsonSerializable { + /** Used to retain the full HTTP response. */ + @JsonProperty("sdkHttpResponse") + public abstract Optional sdkHttpResponse(); + + /** */ + @JsonProperty("nextPageToken") + public abstract Optional nextPageToken(); + + /** List of agent engine sessions. */ + @JsonProperty("sessions") + public abstract Optional> sessions(); + + /** Instantiates a builder for ListReasoningEnginesSessionsResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ListReasoningEnginesSessionsResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ListReasoningEnginesSessionsResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ListReasoningEnginesSessionsResponse.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ListReasoningEnginesSessionsResponse.Builder(); + } + + /** + * Setter for sdkHttpResponse. + * + *

sdkHttpResponse: Used to retain the full HTTP response. + */ + @JsonProperty("sdkHttpResponse") + public abstract Builder sdkHttpResponse(HttpResponse sdkHttpResponse); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sdkHttpResponse(Optional sdkHttpResponse); + + /** Clears the value of sdkHttpResponse field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSdkHttpResponse() { + return sdkHttpResponse(Optional.empty()); + } + + /** + * Setter for nextPageToken. + * + *

nextPageToken: + */ + @JsonProperty("nextPageToken") + public abstract Builder nextPageToken(String nextPageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder nextPageToken(Optional nextPageToken); + + /** Clears the value of nextPageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNextPageToken() { + return nextPageToken(Optional.empty()); + } + + /** + * Setter for sessions. + * + *

sessions: List of agent engine sessions. + */ + @JsonProperty("sessions") + public abstract Builder sessions(List sessions); + + /** + * Setter for sessions. + * + *

sessions: List of agent engine sessions. + */ + @CanIgnoreReturnValue + public Builder sessions(Session... sessions) { + return sessions(Arrays.asList(sessions)); + } + + /** + * Setter for sessions builder. + * + *

sessions: List of agent engine sessions. + */ + @CanIgnoreReturnValue + public Builder sessions(Session.Builder... sessionsBuilders) { + return sessions( + Arrays.asList(sessionsBuilders).stream() + .map(Session.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder sessions(Optional> sessions); + + /** Clears the value of sessions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSessions() { + return sessions(Optional.empty()); + } + + public abstract ListReasoningEnginesSessionsResponse build(); + } + + /** Deserializes a JSON string to a ListReasoningEnginesSessionsResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static ListReasoningEnginesSessionsResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ListReasoningEnginesSessionsResponse.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/LustreMount.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/LustreMount.java new file mode 100644 index 000000000000..128773139704 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/LustreMount.java @@ -0,0 +1,151 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents a mount configuration for Lustre file system. */ +@AutoValue +@JsonDeserialize(builder = LustreMount.Builder.class) +public abstract class LustreMount extends JsonSerializable { + /** Required. The name of the Lustre filesystem. */ + @JsonProperty("filesystem") + public abstract Optional filesystem(); + + /** Required. IP address of the Lustre instance. */ + @JsonProperty("instanceIp") + public abstract Optional instanceIp(); + + /** + * Required. Destination mount path. The Lustre file system will be mounted for the user under + * /mnt/lustre/ + */ + @JsonProperty("mountPoint") + public abstract Optional mountPoint(); + + /** Required. The unique identifier of the Lustre volume. */ + @JsonProperty("volumeHandle") + public abstract Optional volumeHandle(); + + /** Instantiates a builder for LustreMount. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_LustreMount.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for LustreMount. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `LustreMount.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_LustreMount.Builder(); + } + + /** + * Setter for filesystem. + * + *

filesystem: Required. The name of the Lustre filesystem. + */ + @JsonProperty("filesystem") + public abstract Builder filesystem(String filesystem); + + @ExcludeFromGeneratedCoverageReport + abstract Builder filesystem(Optional filesystem); + + /** Clears the value of filesystem field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFilesystem() { + return filesystem(Optional.empty()); + } + + /** + * Setter for instanceIp. + * + *

instanceIp: Required. IP address of the Lustre instance. + */ + @JsonProperty("instanceIp") + public abstract Builder instanceIp(String instanceIp); + + @ExcludeFromGeneratedCoverageReport + abstract Builder instanceIp(Optional instanceIp); + + /** Clears the value of instanceIp field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInstanceIp() { + return instanceIp(Optional.empty()); + } + + /** + * Setter for mountPoint. + * + *

mountPoint: Required. Destination mount path. The Lustre file system will be mounted for + * the user under /mnt/lustre/ + */ + @JsonProperty("mountPoint") + public abstract Builder mountPoint(String mountPoint); + + @ExcludeFromGeneratedCoverageReport + abstract Builder mountPoint(Optional mountPoint); + + /** Clears the value of mountPoint field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMountPoint() { + return mountPoint(Optional.empty()); + } + + /** + * Setter for volumeHandle. + * + *

volumeHandle: Required. The unique identifier of the Lustre volume. + */ + @JsonProperty("volumeHandle") + public abstract Builder volumeHandle(String volumeHandle); + + @ExcludeFromGeneratedCoverageReport + abstract Builder volumeHandle(Optional volumeHandle); + + /** Clears the value of volumeHandle field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearVolumeHandle() { + return volumeHandle(Optional.empty()); + } + + public abstract LustreMount build(); + } + + /** Deserializes a JSON string to a LustreMount object. */ + @ExcludeFromGeneratedCoverageReport + public static LustreMount fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, LustreMount.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MachineConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MachineConfig.java new file mode 100644 index 000000000000..21593ea79822 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MachineConfig.java @@ -0,0 +1,108 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** The machine config of the code execution environment. */ +public class MachineConfig { + + /** Enum representing the known values for MachineConfig. */ + public enum Known { + /** The default value: milligcu 2000, memory 1.5Gib */ + MACHINE_CONFIG_UNSPECIFIED, + + /** The default value: milligcu 4000, memory 4 Gib */ + MACHINE_CONFIG_VCPU4_RAM4GIB + } + + private Known machineConfigEnum; + private final String value; + + @JsonCreator + public MachineConfig(String value) { + this.value = value; + for (Known machineConfigEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(machineConfigEnum.toString(), value)) { + this.machineConfigEnum = machineConfigEnum; + break; + } + } + if (this.machineConfigEnum == null) { + this.machineConfigEnum = Known.MACHINE_CONFIG_UNSPECIFIED; + } + } + + public MachineConfig(Known knownValue) { + this.machineConfigEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof MachineConfig)) { + return false; + } + + MachineConfig other = (MachineConfig) o; + + if (this.machineConfigEnum != Known.MACHINE_CONFIG_UNSPECIFIED + && other.machineConfigEnum != Known.MACHINE_CONFIG_UNSPECIFIED) { + return this.machineConfigEnum == other.machineConfigEnum; + } else if (this.machineConfigEnum == Known.MACHINE_CONFIG_UNSPECIFIED + && other.machineConfigEnum == Known.MACHINE_CONFIG_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.machineConfigEnum != Known.MACHINE_CONFIG_UNSPECIFIED) { + return this.machineConfigEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.machineConfigEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MachineSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MachineSpec.java new file mode 100644 index 000000000000..e012c4014f40 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MachineSpec.java @@ -0,0 +1,283 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Specification of a single machine. */ +@AutoValue +@JsonDeserialize(builder = MachineSpec.Builder.class) +public abstract class MachineSpec extends JsonSerializable { + /** The number of accelerators to attach to the machine. */ + @JsonProperty("acceleratorCount") + public abstract Optional acceleratorCount(); + + /** + * Immutable. The type of accelerator(s) that may be attached to the machine as per + * accelerator_count. + */ + @JsonProperty("acceleratorType") + public abstract Optional acceleratorType(); + + /** + * Optional. Immutable. The Nvidia GPU partition size. When specified, the requested accelerators + * will be partitioned into smaller GPU partitions. For example, if the request is for 8 units of + * NVIDIA A100 GPUs, and gpu_partition_size="1g.10gb", the service will create 8 * 7 = 56 + * partitioned MIG instances. The partition size must be a value supported by the requested + * accelerator. Refer to [Nvidia GPU + * Partitioning](https://cloud.google.com/kubernetes-engine/docs/how-to/gpus-multi#multi-instance_gpu_partitions) + * for the available partition sizes. If set, the accelerator_count should be set to 1. + */ + @JsonProperty("gpuPartitionSize") + public abstract Optional gpuPartitionSize(); + + /** + * Immutable. The type of the machine. See the [list of machine types supported for + * prediction](https://cloud.google.com/vertex-ai/docs/predictions/configure-compute#machine-types) + * See the [list of machine types supported for custom + * training](https://cloud.google.com/vertex-ai/docs/training/configure-compute#machine-types). + * For DeployedModel this field is optional, and the default value is `n1-standard-2`. For + * BatchPredictionJob or as part of WorkerPoolSpec this field is required. + */ + @JsonProperty("machineType") + public abstract Optional machineType(); + + /** Optional. Immutable. The number of nodes per replica for multihost GPU deployments. */ + @JsonProperty("multihostGpuNodeCount") + public abstract Optional multihostGpuNodeCount(); + + /** Optional. Immutable. Configuration controlling how this resource pool consumes reservation. */ + @JsonProperty("reservationAffinity") + public abstract Optional reservationAffinity(); + + /** + * Immutable. The topology of the TPUs. Corresponds to the TPU topologies available from GKE. + * (Example: tpu_topology: "2x2x1"). + */ + @JsonProperty("tpuTopology") + public abstract Optional tpuTopology(); + + /** Instantiates a builder for MachineSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MachineSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MachineSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `MachineSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_MachineSpec.Builder(); + } + + /** + * Setter for acceleratorCount. + * + *

acceleratorCount: The number of accelerators to attach to the machine. + */ + @JsonProperty("acceleratorCount") + public abstract Builder acceleratorCount(Integer acceleratorCount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder acceleratorCount(Optional acceleratorCount); + + /** Clears the value of acceleratorCount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAcceleratorCount() { + return acceleratorCount(Optional.empty()); + } + + /** + * Setter for acceleratorType. + * + *

acceleratorType: Immutable. The type of accelerator(s) that may be attached to the machine + * as per accelerator_count. + */ + @JsonProperty("acceleratorType") + public abstract Builder acceleratorType(AcceleratorType acceleratorType); + + @ExcludeFromGeneratedCoverageReport + abstract Builder acceleratorType(Optional acceleratorType); + + /** Clears the value of acceleratorType field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAcceleratorType() { + return acceleratorType(Optional.empty()); + } + + /** + * Setter for acceleratorType given a known enum. + * + *

acceleratorType: Immutable. The type of accelerator(s) that may be attached to the machine + * as per accelerator_count. + */ + @CanIgnoreReturnValue + public Builder acceleratorType(AcceleratorType.Known knownType) { + return acceleratorType(new AcceleratorType(knownType)); + } + + /** + * Setter for acceleratorType given a string. + * + *

acceleratorType: Immutable. The type of accelerator(s) that may be attached to the machine + * as per accelerator_count. + */ + @CanIgnoreReturnValue + public Builder acceleratorType(String acceleratorType) { + return acceleratorType(new AcceleratorType(acceleratorType)); + } + + /** + * Setter for gpuPartitionSize. + * + *

gpuPartitionSize: Optional. Immutable. The Nvidia GPU partition size. When specified, the + * requested accelerators will be partitioned into smaller GPU partitions. For example, if the + * request is for 8 units of NVIDIA A100 GPUs, and gpu_partition_size="1g.10gb", the service + * will create 8 * 7 = 56 partitioned MIG instances. The partition size must be a value + * supported by the requested accelerator. Refer to [Nvidia GPU + * Partitioning](https://cloud.google.com/kubernetes-engine/docs/how-to/gpus-multi#multi-instance_gpu_partitions) + * for the available partition sizes. If set, the accelerator_count should be set to 1. + */ + @JsonProperty("gpuPartitionSize") + public abstract Builder gpuPartitionSize(String gpuPartitionSize); + + @ExcludeFromGeneratedCoverageReport + abstract Builder gpuPartitionSize(Optional gpuPartitionSize); + + /** Clears the value of gpuPartitionSize field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGpuPartitionSize() { + return gpuPartitionSize(Optional.empty()); + } + + /** + * Setter for machineType. + * + *

machineType: Immutable. The type of the machine. See the [list of machine types supported + * for + * prediction](https://cloud.google.com/vertex-ai/docs/predictions/configure-compute#machine-types) + * See the [list of machine types supported for custom + * training](https://cloud.google.com/vertex-ai/docs/training/configure-compute#machine-types). + * For DeployedModel this field is optional, and the default value is `n1-standard-2`. For + * BatchPredictionJob or as part of WorkerPoolSpec this field is required. + */ + @JsonProperty("machineType") + public abstract Builder machineType(String machineType); + + @ExcludeFromGeneratedCoverageReport + abstract Builder machineType(Optional machineType); + + /** Clears the value of machineType field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMachineType() { + return machineType(Optional.empty()); + } + + /** + * Setter for multihostGpuNodeCount. + * + *

multihostGpuNodeCount: Optional. Immutable. The number of nodes per replica for multihost + * GPU deployments. + */ + @JsonProperty("multihostGpuNodeCount") + public abstract Builder multihostGpuNodeCount(Integer multihostGpuNodeCount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder multihostGpuNodeCount(Optional multihostGpuNodeCount); + + /** Clears the value of multihostGpuNodeCount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMultihostGpuNodeCount() { + return multihostGpuNodeCount(Optional.empty()); + } + + /** + * Setter for reservationAffinity. + * + *

reservationAffinity: Optional. Immutable. Configuration controlling how this resource pool + * consumes reservation. + */ + @JsonProperty("reservationAffinity") + public abstract Builder reservationAffinity(ReservationAffinity reservationAffinity); + + /** + * Setter for reservationAffinity builder. + * + *

reservationAffinity: Optional. Immutable. Configuration controlling how this resource pool + * consumes reservation. + */ + @CanIgnoreReturnValue + public Builder reservationAffinity(ReservationAffinity.Builder reservationAffinityBuilder) { + return reservationAffinity(reservationAffinityBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder reservationAffinity(Optional reservationAffinity); + + /** Clears the value of reservationAffinity field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReservationAffinity() { + return reservationAffinity(Optional.empty()); + } + + /** + * Setter for tpuTopology. + * + *

tpuTopology: Immutable. The topology of the TPUs. Corresponds to the TPU topologies + * available from GKE. (Example: tpu_topology: "2x2x1"). + */ + @JsonProperty("tpuTopology") + public abstract Builder tpuTopology(String tpuTopology); + + @ExcludeFromGeneratedCoverageReport + abstract Builder tpuTopology(Optional tpuTopology); + + /** Clears the value of tpuTopology field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTpuTopology() { + return tpuTopology(Optional.empty()); + } + + public abstract MachineSpec build(); + } + + /** Deserializes a JSON string to a MachineSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static MachineSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, MachineSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ManagedTopicEnum.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ManagedTopicEnum.java new file mode 100644 index 000000000000..333a15365ee5 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ManagedTopicEnum.java @@ -0,0 +1,120 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** The managed topic. */ +public class ManagedTopicEnum { + + /** Enum representing the known values for ManagedTopicEnum. */ + public enum Known { + /** Unspecified topic. This value should not be used. */ + MANAGED_TOPIC_ENUM_UNSPECIFIED, + + /** + * Significant personal information about the User like first names, relationships, hobbies, + * important dates. + */ + USER_PERSONAL_INFO, + + /** Stated or implied likes, dislikes, preferred styles, or patterns. */ + USER_PREFERENCES, + + /** Important milestones or conclusions within the dialogue. */ + KEY_CONVERSATION_DETAILS, + + /** Information that the user explicitly requested to remember or forget. */ + EXPLICIT_INSTRUCTIONS + } + + private Known managedTopicEnumEnum; + private final String value; + + @JsonCreator + public ManagedTopicEnum(String value) { + this.value = value; + for (Known managedTopicEnumEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(managedTopicEnumEnum.toString(), value)) { + this.managedTopicEnumEnum = managedTopicEnumEnum; + break; + } + } + if (this.managedTopicEnumEnum == null) { + this.managedTopicEnumEnum = Known.MANAGED_TOPIC_ENUM_UNSPECIFIED; + } + } + + public ManagedTopicEnum(Known knownValue) { + this.managedTopicEnumEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof ManagedTopicEnum)) { + return false; + } + + ManagedTopicEnum other = (ManagedTopicEnum) o; + + if (this.managedTopicEnumEnum != Known.MANAGED_TOPIC_ENUM_UNSPECIFIED + && other.managedTopicEnumEnum != Known.MANAGED_TOPIC_ENUM_UNSPECIFIED) { + return this.managedTopicEnumEnum == other.managedTopicEnumEnum; + } else if (this.managedTopicEnumEnum == Known.MANAGED_TOPIC_ENUM_UNSPECIFIED + && other.managedTopicEnumEnum == Known.MANAGED_TOPIC_ENUM_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.managedTopicEnumEnum != Known.MANAGED_TOPIC_ENUM_UNSPECIFIED) { + return this.managedTopicEnumEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.managedTopicEnumEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MapInstance.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MapInstance.java new file mode 100644 index 000000000000..593b80126be2 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MapInstance.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Instance data specified as a map. */ +@AutoValue +@JsonDeserialize(builder = MapInstance.Builder.class) +public abstract class MapInstance extends JsonSerializable { + /** Map of instance data. */ + @JsonProperty("mapInstance") + public abstract Optional> mapInstance(); + + /** Instantiates a builder for MapInstance. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MapInstance.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MapInstance. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `MapInstance.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_MapInstance.Builder(); + } + + /** + * Setter for mapInstance. + * + *

mapInstance: Map of instance data. + */ + @JsonProperty("mapInstance") + public abstract Builder mapInstance(Map mapInstance); + + @ExcludeFromGeneratedCoverageReport + abstract Builder mapInstance(Optional> mapInstance); + + /** Clears the value of mapInstance field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMapInstance() { + return mapInstance(Optional.empty()); + } + + public abstract MapInstance build(); + } + + /** Deserializes a JSON string to a MapInstance object. */ + @ExcludeFromGeneratedCoverageReport + public static MapInstance fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, MapInstance.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Memory.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Memory.java new file mode 100644 index 000000000000..32cbdcc3ab03 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Memory.java @@ -0,0 +1,400 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.time.Duration; +import java.time.Instant; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** A memory. */ +@AutoValue +@JsonDeserialize(builder = Memory.Builder.class) +public abstract class Memory extends JsonSerializable { + /** + * Optional. Timestamp of when this resource is considered expired. This is *always* provided on + * output when `expiration` is set on input, regardless of whether `expire_time` or `ttl` was + * provided. + */ + @JsonProperty("expireTime") + public abstract Optional expireTime(); + + /** + * Optional. Input only. The TTL for this resource. The expiration time is computed: now + TTL. + */ + @JsonProperty("ttl") + public abstract Optional ttl(); + + /** + * Optional. Input only. Timestamp of when the revision is considered expired. If not set, the + * memory revision will be kept until manually deleted. + */ + @JsonProperty("revisionExpireTime") + public abstract Optional revisionExpireTime(); + + /** Optional. Input only. The TTL for the revision. The expiration time is computed: now + TTL. */ + @JsonProperty("revisionTtl") + public abstract Optional revisionTtl(); + + /** Optional. Input only. If true, no revision will be created for this request. */ + @JsonProperty("disableMemoryRevisions") + public abstract Optional disableMemoryRevisions(); + + /** Output only. Timestamp when this Memory was created. */ + @JsonProperty("createTime") + public abstract Optional createTime(); + + /** Optional. Description of the Memory. */ + @JsonProperty("description") + public abstract Optional description(); + + /** Optional. Display name of the Memory. */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** Required. Semantic knowledge extracted from the source content. */ + @JsonProperty("fact") + public abstract Optional fact(); + + /** + * Identifier. The resource name of the Memory. Format: + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}` + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Required. Immutable. The scope of the Memory. Memories are isolated within their scope. The + * scope is defined when creating or generating memories. Scope values cannot contain the wildcard + * character '*'. + */ + @JsonProperty("scope") + public abstract Optional> scope(); + + /** Output only. Timestamp when this Memory was most recently updated. */ + @JsonProperty("updateTime") + public abstract Optional updateTime(); + + /** Optional. The Topics of the Memory. */ + @JsonProperty("topics") + public abstract Optional> topics(); + + /** Instantiates a builder for Memory. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_Memory.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for Memory. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `Memory.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_Memory.Builder(); + } + + /** + * Setter for expireTime. + * + *

expireTime: Optional. Timestamp of when this resource is considered expired. This is + * *always* provided on output when `expiration` is set on input, regardless of whether + * `expire_time` or `ttl` was provided. + */ + @JsonProperty("expireTime") + public abstract Builder expireTime(Instant expireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder expireTime(Optional expireTime); + + /** Clears the value of expireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExpireTime() { + return expireTime(Optional.empty()); + } + + /** + * Setter for ttl. + * + *

ttl: Optional. Input only. The TTL for this resource. The expiration time is computed: now + * + TTL. + */ + @JsonProperty("ttl") + public abstract Builder ttl(Duration ttl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder ttl(Optional ttl); + + /** Clears the value of ttl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTtl() { + return ttl(Optional.empty()); + } + + /** + * Setter for revisionExpireTime. + * + *

revisionExpireTime: Optional. Input only. Timestamp of when the revision is considered + * expired. If not set, the memory revision will be kept until manually deleted. + */ + @JsonProperty("revisionExpireTime") + public abstract Builder revisionExpireTime(Instant revisionExpireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder revisionExpireTime(Optional revisionExpireTime); + + /** Clears the value of revisionExpireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRevisionExpireTime() { + return revisionExpireTime(Optional.empty()); + } + + /** + * Setter for revisionTtl. + * + *

revisionTtl: Optional. Input only. The TTL for the revision. The expiration time is + * computed: now + TTL. + */ + @JsonProperty("revisionTtl") + public abstract Builder revisionTtl(Duration revisionTtl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder revisionTtl(Optional revisionTtl); + + /** Clears the value of revisionTtl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRevisionTtl() { + return revisionTtl(Optional.empty()); + } + + /** + * Setter for disableMemoryRevisions. + * + *

disableMemoryRevisions: Optional. Input only. If true, no revision will be created for + * this request. + */ + @JsonProperty("disableMemoryRevisions") + public abstract Builder disableMemoryRevisions(boolean disableMemoryRevisions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder disableMemoryRevisions(Optional disableMemoryRevisions); + + /** Clears the value of disableMemoryRevisions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisableMemoryRevisions() { + return disableMemoryRevisions(Optional.empty()); + } + + /** + * Setter for createTime. + * + *

createTime: Output only. Timestamp when this Memory was created. + */ + @JsonProperty("createTime") + public abstract Builder createTime(Instant createTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder createTime(Optional createTime); + + /** Clears the value of createTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCreateTime() { + return createTime(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: Optional. Description of the Memory. + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: Optional. Display name of the Memory. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for fact. + * + *

fact: Required. Semantic knowledge extracted from the source content. + */ + @JsonProperty("fact") + public abstract Builder fact(String fact); + + @ExcludeFromGeneratedCoverageReport + abstract Builder fact(Optional fact); + + /** Clears the value of fact field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFact() { + return fact(Optional.empty()); + } + + /** + * Setter for name. + * + *

name: Identifier. The resource name of the Memory. Format: + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}` + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for scope. + * + *

scope: Required. Immutable. The scope of the Memory. Memories are isolated within their + * scope. The scope is defined when creating or generating memories. Scope values cannot contain + * the wildcard character '*'. + */ + @JsonProperty("scope") + public abstract Builder scope(Map scope); + + @ExcludeFromGeneratedCoverageReport + abstract Builder scope(Optional> scope); + + /** Clears the value of scope field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScope() { + return scope(Optional.empty()); + } + + /** + * Setter for updateTime. + * + *

updateTime: Output only. Timestamp when this Memory was most recently updated. + */ + @JsonProperty("updateTime") + public abstract Builder updateTime(Instant updateTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder updateTime(Optional updateTime); + + /** Clears the value of updateTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUpdateTime() { + return updateTime(Optional.empty()); + } + + /** + * Setter for topics. + * + *

topics: Optional. The Topics of the Memory. + */ + @JsonProperty("topics") + public abstract Builder topics(List topics); + + /** + * Setter for topics. + * + *

topics: Optional. The Topics of the Memory. + */ + @CanIgnoreReturnValue + public Builder topics(MemoryTopicId... topics) { + return topics(Arrays.asList(topics)); + } + + /** + * Setter for topics builder. + * + *

topics: Optional. The Topics of the Memory. + */ + @CanIgnoreReturnValue + public Builder topics(MemoryTopicId.Builder... topicsBuilders) { + return topics( + Arrays.asList(topicsBuilders).stream() + .map(MemoryTopicId.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder topics(Optional> topics); + + /** Clears the value of topics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTopics() { + return topics(Optional.empty()); + } + + public abstract Memory build(); + } + + /** Deserializes a JSON string to a Memory object. */ + @ExcludeFromGeneratedCoverageReport + public static Memory fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, Memory.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfig.java new file mode 100644 index 000000000000..0e5f8c5fda5a --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfig.java @@ -0,0 +1,217 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Configuration for organizing memories for a particular scope. */ +@AutoValue +@JsonDeserialize(builder = MemoryBankCustomizationConfig.Builder.class) +public abstract class MemoryBankCustomizationConfig extends JsonSerializable { + /** + * Optional. The scope keys (i.e. 'user_id') for which to use this config. A request's scope must + * include all of the provided keys for the config to be used (order does not matter). If empty, + * then the config will be used for all requests that do not have a more specific config. Only one + * default config is allowed per Memory Bank. + */ + @JsonProperty("scopeKeys") + public abstract Optional> scopeKeys(); + + /** + * Optional. Topics of information that should be extracted from conversations and stored as + * memories. If not set, then Memory Bank's default topics will be used. + */ + @JsonProperty("memoryTopics") + public abstract Optional> memoryTopics(); + + /** Optional. Examples of how to generate memories for a particular scope. */ + @JsonProperty("generateMemoriesExamples") + public abstract Optional> + generateMemoriesExamples(); + + /** Instantiates a builder for MemoryBankCustomizationConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MemoryBankCustomizationConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MemoryBankCustomizationConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `MemoryBankCustomizationConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_MemoryBankCustomizationConfig.Builder(); + } + + /** + * Setter for scopeKeys. + * + *

scopeKeys: Optional. The scope keys (i.e. 'user_id') for which to use this config. A + * request's scope must include all of the provided keys for the config to be used (order does + * not matter). If empty, then the config will be used for all requests that do not have a more + * specific config. Only one default config is allowed per Memory Bank. + */ + @JsonProperty("scopeKeys") + public abstract Builder scopeKeys(List scopeKeys); + + /** + * Setter for scopeKeys. + * + *

scopeKeys: Optional. The scope keys (i.e. 'user_id') for which to use this config. A + * request's scope must include all of the provided keys for the config to be used (order does + * not matter). If empty, then the config will be used for all requests that do not have a more + * specific config. Only one default config is allowed per Memory Bank. + */ + @CanIgnoreReturnValue + public Builder scopeKeys(String... scopeKeys) { + return scopeKeys(Arrays.asList(scopeKeys)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder scopeKeys(Optional> scopeKeys); + + /** Clears the value of scopeKeys field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScopeKeys() { + return scopeKeys(Optional.empty()); + } + + /** + * Setter for memoryTopics. + * + *

memoryTopics: Optional. Topics of information that should be extracted from conversations + * and stored as memories. If not set, then Memory Bank's default topics will be used. + */ + @JsonProperty("memoryTopics") + public abstract Builder memoryTopics( + List memoryTopics); + + /** + * Setter for memoryTopics. + * + *

memoryTopics: Optional. Topics of information that should be extracted from conversations + * and stored as memories. If not set, then Memory Bank's default topics will be used. + */ + @CanIgnoreReturnValue + public Builder memoryTopics(MemoryBankCustomizationConfigMemoryTopic... memoryTopics) { + return memoryTopics(Arrays.asList(memoryTopics)); + } + + /** + * Setter for memoryTopics builder. + * + *

memoryTopics: Optional. Topics of information that should be extracted from conversations + * and stored as memories. If not set, then Memory Bank's default topics will be used. + */ + @CanIgnoreReturnValue + public Builder memoryTopics( + MemoryBankCustomizationConfigMemoryTopic.Builder... memoryTopicsBuilders) { + return memoryTopics( + Arrays.asList(memoryTopicsBuilders).stream() + .map(MemoryBankCustomizationConfigMemoryTopic.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder memoryTopics( + Optional> memoryTopics); + + /** Clears the value of memoryTopics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMemoryTopics() { + return memoryTopics(Optional.empty()); + } + + /** + * Setter for generateMemoriesExamples. + * + *

generateMemoriesExamples: Optional. Examples of how to generate memories for a particular + * scope. + */ + @JsonProperty("generateMemoriesExamples") + public abstract Builder generateMemoriesExamples( + List generateMemoriesExamples); + + /** + * Setter for generateMemoriesExamples. + * + *

generateMemoriesExamples: Optional. Examples of how to generate memories for a particular + * scope. + */ + @CanIgnoreReturnValue + public Builder generateMemoriesExamples( + MemoryBankCustomizationConfigGenerateMemoriesExample... generateMemoriesExamples) { + return generateMemoriesExamples(Arrays.asList(generateMemoriesExamples)); + } + + /** + * Setter for generateMemoriesExamples builder. + * + *

generateMemoriesExamples: Optional. Examples of how to generate memories for a particular + * scope. + */ + @CanIgnoreReturnValue + public Builder generateMemoriesExamples( + MemoryBankCustomizationConfigGenerateMemoriesExample.Builder... + generateMemoriesExamplesBuilders) { + return generateMemoriesExamples( + Arrays.asList(generateMemoriesExamplesBuilders).stream() + .map(MemoryBankCustomizationConfigGenerateMemoriesExample.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder generateMemoriesExamples( + Optional> + generateMemoriesExamples); + + /** Clears the value of generateMemoriesExamples field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGenerateMemoriesExamples() { + return generateMemoriesExamples(Optional.empty()); + } + + public abstract MemoryBankCustomizationConfig build(); + } + + /** Deserializes a JSON string to a MemoryBankCustomizationConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static MemoryBankCustomizationConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, MemoryBankCustomizationConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigGenerateMemoriesExample.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigGenerateMemoriesExample.java new file mode 100644 index 000000000000..b67553fb8264 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigGenerateMemoriesExample.java @@ -0,0 +1,173 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** An example of how to generate memories for a particular scope. */ +@AutoValue +@JsonDeserialize(builder = MemoryBankCustomizationConfigGenerateMemoriesExample.Builder.class) +public abstract class MemoryBankCustomizationConfigGenerateMemoriesExample + extends JsonSerializable { + /** A conversation source for the example. */ + @JsonProperty("conversationSource") + public abstract Optional + conversationSource(); + + /** + * Optional. The memories that are expected to be generated from the input conversation. An empty + * list indicates that no memories are expected to be generated for the input conversation. + */ + @JsonProperty("generatedMemories") + public abstract Optional< + List> + generatedMemories(); + + /** Instantiates a builder for MemoryBankCustomizationConfigGenerateMemoriesExample. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MemoryBankCustomizationConfigGenerateMemoriesExample.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MemoryBankCustomizationConfigGenerateMemoriesExample. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use + * `MemoryBankCustomizationConfigGenerateMemoriesExample.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_MemoryBankCustomizationConfigGenerateMemoriesExample.Builder(); + } + + /** + * Setter for conversationSource. + * + *

conversationSource: A conversation source for the example. + */ + @JsonProperty("conversationSource") + public abstract Builder conversationSource( + MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSource conversationSource); + + /** + * Setter for conversationSource builder. + * + *

conversationSource: A conversation source for the example. + */ + @CanIgnoreReturnValue + public Builder conversationSource( + MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSource.Builder + conversationSourceBuilder) { + return conversationSource(conversationSourceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder conversationSource( + Optional + conversationSource); + + /** Clears the value of conversationSource field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConversationSource() { + return conversationSource(Optional.empty()); + } + + /** + * Setter for generatedMemories. + * + *

generatedMemories: Optional. The memories that are expected to be generated from the input + * conversation. An empty list indicates that no memories are expected to be generated for the + * input conversation. + */ + @JsonProperty("generatedMemories") + public abstract Builder generatedMemories( + List + generatedMemories); + + /** + * Setter for generatedMemories. + * + *

generatedMemories: Optional. The memories that are expected to be generated from the input + * conversation. An empty list indicates that no memories are expected to be generated for the + * input conversation. + */ + @CanIgnoreReturnValue + public Builder generatedMemories( + MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory... generatedMemories) { + return generatedMemories(Arrays.asList(generatedMemories)); + } + + /** + * Setter for generatedMemories builder. + * + *

generatedMemories: Optional. The memories that are expected to be generated from the input + * conversation. An empty list indicates that no memories are expected to be generated for the + * input conversation. + */ + @CanIgnoreReturnValue + public Builder generatedMemories( + MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory.Builder... + generatedMemoriesBuilders) { + return generatedMemories( + Arrays.asList(generatedMemoriesBuilders).stream() + .map( + MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory.Builder + ::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder generatedMemories( + Optional> + generatedMemories); + + /** Clears the value of generatedMemories field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGeneratedMemories() { + return generatedMemories(Optional.empty()); + } + + public abstract MemoryBankCustomizationConfigGenerateMemoriesExample build(); + } + + /** + * Deserializes a JSON string to a MemoryBankCustomizationConfigGenerateMemoriesExample object. + */ + @ExcludeFromGeneratedCoverageReport + public static MemoryBankCustomizationConfigGenerateMemoriesExample fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, MemoryBankCustomizationConfigGenerateMemoriesExample.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSource.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSource.java new file mode 100644 index 000000000000..ebb22646cc65 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSource.java @@ -0,0 +1,135 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** A conversation source for the example. This is similar to `DirectContentsSource`. */ +@AutoValue +@JsonDeserialize( + builder = MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSource.Builder.class) +public abstract class MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSource + extends JsonSerializable { + /** Optional. The input conversation events for the example. */ + @JsonProperty("events") + public abstract Optional< + List> + events(); + + /** + * Instantiates a builder for + * MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSource. + */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSource + .Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSource. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use + * `MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSource.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSource + .Builder(); + } + + /** + * Setter for events. + * + *

events: Optional. The input conversation events for the example. + */ + @JsonProperty("events") + public abstract Builder events( + List events); + + /** + * Setter for events. + * + *

events: Optional. The input conversation events for the example. + */ + @CanIgnoreReturnValue + public Builder events( + MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent... events) { + return events(Arrays.asList(events)); + } + + /** + * Setter for events builder. + * + *

events: Optional. The input conversation events for the example. + */ + @CanIgnoreReturnValue + public Builder events( + MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent.Builder... + eventsBuilders) { + return events( + Arrays.asList(eventsBuilders).stream() + .map( + MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent + .Builder + ::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder events( + Optional> + events); + + /** Clears the value of events field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvents() { + return events(Optional.empty()); + } + + public abstract MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSource build(); + } + + /** + * Deserializes a JSON string to a + * MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSource object. + */ + @ExcludeFromGeneratedCoverageReport + public static MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSource fromJson( + String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSource.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent.java new file mode 100644 index 000000000000..6baf175418a4 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent.java @@ -0,0 +1,101 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import java.util.Optional; + +/** The conversation source event for generating memories. */ +@AutoValue +@JsonDeserialize( + builder = + MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent.Builder.class) +public abstract class MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent + extends JsonSerializable { + /** Required. The content of the event. */ + @JsonProperty("content") + public abstract Optional content(); + + /** + * Instantiates a builder for + * MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent. + */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent + .Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use + * `MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent + .Builder(); + } + + /** + * Setter for content. + * + *

content: Required. The content of the event. + */ + @JsonProperty("content") + public abstract Builder content(Content content); + + @ExcludeFromGeneratedCoverageReport + abstract Builder content(Optional content); + + /** Clears the value of content field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContent() { + return content(Optional.empty()); + } + + public abstract MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent + build(); + } + + /** + * Deserializes a JSON string to a + * MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent object. + */ + @ExcludeFromGeneratedCoverageReport + public static MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent + fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, + MemoryBankCustomizationConfigGenerateMemoriesExampleConversationSourceEvent.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory.java new file mode 100644 index 000000000000..77a5a3e98eb4 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory.java @@ -0,0 +1,155 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** A memory generated by the operation. */ +@AutoValue +@JsonDeserialize( + builder = MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory.Builder.class) +public abstract class MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory + extends JsonSerializable { + /** Required. The fact to generate a memory from. */ + @JsonProperty("fact") + public abstract Optional fact(); + + /** + * Optional. The list of topics that the memory should be associated with. For example, use + * `custom_memory_topic_label = "jargon"` if the extracted memory is an example of memory + * extraction for the custom topic `jargon`. + */ + @JsonProperty("topics") + public abstract Optional> topics(); + + /** + * Instantiates a builder for MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory. + */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory + .Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use + * `MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory + .Builder(); + } + + /** + * Setter for fact. + * + *

fact: Required. The fact to generate a memory from. + */ + @JsonProperty("fact") + public abstract Builder fact(String fact); + + @ExcludeFromGeneratedCoverageReport + abstract Builder fact(Optional fact); + + /** Clears the value of fact field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFact() { + return fact(Optional.empty()); + } + + /** + * Setter for topics. + * + *

topics: Optional. The list of topics that the memory should be associated with. For + * example, use `custom_memory_topic_label = "jargon"` if the extracted memory is an example of + * memory extraction for the custom topic `jargon`. + */ + @JsonProperty("topics") + public abstract Builder topics(List topics); + + /** + * Setter for topics. + * + *

topics: Optional. The list of topics that the memory should be associated with. For + * example, use `custom_memory_topic_label = "jargon"` if the extracted memory is an example of + * memory extraction for the custom topic `jargon`. + */ + @CanIgnoreReturnValue + public Builder topics(MemoryTopicId... topics) { + return topics(Arrays.asList(topics)); + } + + /** + * Setter for topics builder. + * + *

topics: Optional. The list of topics that the memory should be associated with. For + * example, use `custom_memory_topic_label = "jargon"` if the extracted memory is an example of + * memory extraction for the custom topic `jargon`. + */ + @CanIgnoreReturnValue + public Builder topics(MemoryTopicId.Builder... topicsBuilders) { + return topics( + Arrays.asList(topicsBuilders).stream() + .map(MemoryTopicId.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder topics(Optional> topics); + + /** Clears the value of topics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTopics() { + return topics(Optional.empty()); + } + + public abstract MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory build(); + } + + /** + * Deserializes a JSON string to a + * MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory object. + */ + @ExcludeFromGeneratedCoverageReport + public static MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory fromJson( + String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, MemoryBankCustomizationConfigGenerateMemoriesExampleGeneratedMemory.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigMemoryTopic.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigMemoryTopic.java new file mode 100644 index 000000000000..9543a2c0eff0 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigMemoryTopic.java @@ -0,0 +1,137 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** A topic of information that should be extracted from conversations and stored as memories. */ +@AutoValue +@JsonDeserialize(builder = MemoryBankCustomizationConfigMemoryTopic.Builder.class) +public abstract class MemoryBankCustomizationConfigMemoryTopic extends JsonSerializable { + /** A custom memory topic defined by the developer. */ + @JsonProperty("customMemoryTopic") + public abstract Optional + customMemoryTopic(); + + /** A managed memory topic defined by Memory Bank. */ + @JsonProperty("managedMemoryTopic") + public abstract Optional + managedMemoryTopic(); + + /** Instantiates a builder for MemoryBankCustomizationConfigMemoryTopic. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MemoryBankCustomizationConfigMemoryTopic.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MemoryBankCustomizationConfigMemoryTopic. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `MemoryBankCustomizationConfigMemoryTopic.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_MemoryBankCustomizationConfigMemoryTopic.Builder(); + } + + /** + * Setter for customMemoryTopic. + * + *

customMemoryTopic: A custom memory topic defined by the developer. + */ + @JsonProperty("customMemoryTopic") + public abstract Builder customMemoryTopic( + MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic customMemoryTopic); + + /** + * Setter for customMemoryTopic builder. + * + *

customMemoryTopic: A custom memory topic defined by the developer. + */ + @CanIgnoreReturnValue + public Builder customMemoryTopic( + MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic.Builder + customMemoryTopicBuilder) { + return customMemoryTopic(customMemoryTopicBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder customMemoryTopic( + Optional customMemoryTopic); + + /** Clears the value of customMemoryTopic field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCustomMemoryTopic() { + return customMemoryTopic(Optional.empty()); + } + + /** + * Setter for managedMemoryTopic. + * + *

managedMemoryTopic: A managed memory topic defined by Memory Bank. + */ + @JsonProperty("managedMemoryTopic") + public abstract Builder managedMemoryTopic( + MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic managedMemoryTopic); + + /** + * Setter for managedMemoryTopic builder. + * + *

managedMemoryTopic: A managed memory topic defined by Memory Bank. + */ + @CanIgnoreReturnValue + public Builder managedMemoryTopic( + MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic.Builder + managedMemoryTopicBuilder) { + return managedMemoryTopic(managedMemoryTopicBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder managedMemoryTopic( + Optional managedMemoryTopic); + + /** Clears the value of managedMemoryTopic field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearManagedMemoryTopic() { + return managedMemoryTopic(Optional.empty()); + } + + public abstract MemoryBankCustomizationConfigMemoryTopic build(); + } + + /** Deserializes a JSON string to a MemoryBankCustomizationConfigMemoryTopic object. */ + @ExcludeFromGeneratedCoverageReport + public static MemoryBankCustomizationConfigMemoryTopic fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, MemoryBankCustomizationConfigMemoryTopic.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic.java new file mode 100644 index 000000000000..3aabc27aafab --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic.java @@ -0,0 +1,116 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** A custom memory topic defined by the developer. */ +@AutoValue +@JsonDeserialize(builder = MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic.Builder.class) +public abstract class MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic + extends JsonSerializable { + /** Required. The label of the topic. */ + @JsonProperty("label") + public abstract Optional label(); + + /** + * Required. Description of the memory topic. This should explain what information should be + * extracted for this topic. + */ + @JsonProperty("description") + public abstract Optional description(); + + /** Instantiates a builder for MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use + * `MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic.Builder(); + } + + /** + * Setter for label. + * + *

label: Required. The label of the topic. + */ + @JsonProperty("label") + public abstract Builder label(String label); + + @ExcludeFromGeneratedCoverageReport + abstract Builder label(Optional label); + + /** Clears the value of label field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLabel() { + return label(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: Required. Description of the memory topic. This should explain what + * information should be extracted for this topic. + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + public abstract MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic build(); + } + + /** + * Deserializes a JSON string to a MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic + * object. + */ + @ExcludeFromGeneratedCoverageReport + public static MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic fromJson( + String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, MemoryBankCustomizationConfigMemoryTopicCustomMemoryTopic.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic.java new file mode 100644 index 000000000000..cc55512c7205 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic.java @@ -0,0 +1,110 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** A managed memory topic defined by the system. */ +@AutoValue +@JsonDeserialize(builder = MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic.Builder.class) +public abstract class MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic + extends JsonSerializable { + /** Required. The managed topic. */ + @JsonProperty("managedTopicEnum") + public abstract Optional managedTopicEnum(); + + /** Instantiates a builder for MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use + * `MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic.Builder(); + } + + /** + * Setter for managedTopicEnum. + * + *

managedTopicEnum: Required. The managed topic. + */ + @JsonProperty("managedTopicEnum") + public abstract Builder managedTopicEnum(ManagedTopicEnum managedTopicEnum); + + @ExcludeFromGeneratedCoverageReport + abstract Builder managedTopicEnum(Optional managedTopicEnum); + + /** Clears the value of managedTopicEnum field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearManagedTopicEnum() { + return managedTopicEnum(Optional.empty()); + } + + /** + * Setter for managedTopicEnum given a known enum. + * + *

managedTopicEnum: Required. The managed topic. + */ + @CanIgnoreReturnValue + public Builder managedTopicEnum(ManagedTopicEnum.Known knownType) { + return managedTopicEnum(new ManagedTopicEnum(knownType)); + } + + /** + * Setter for managedTopicEnum given a string. + * + *

managedTopicEnum: Required. The managed topic. + */ + @CanIgnoreReturnValue + public Builder managedTopicEnum(String managedTopicEnum) { + return managedTopicEnum(new ManagedTopicEnum(managedTopicEnum)); + } + + public abstract MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic build(); + } + + /** + * Deserializes a JSON string to a MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic + * object. + */ + @ExcludeFromGeneratedCoverageReport + public static MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic fromJson( + String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, MemoryBankCustomizationConfigMemoryTopicManagedMemoryTopic.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryRevision.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryRevision.java new file mode 100644 index 000000000000..8f37f4d0467b --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryRevision.java @@ -0,0 +1,244 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.time.Instant; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** A memory revision. */ +@AutoValue +@JsonDeserialize(builder = MemoryRevision.Builder.class) +public abstract class MemoryRevision extends JsonSerializable { + /** + * Identifier. The resource name of the Memory Revision. Format: + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}/revisions/{memory_revision}` + */ + @JsonProperty("name") + public abstract Optional name(); + + /** Output only. Timestamp when this Memory Revision was created. */ + @JsonProperty("createTime") + public abstract Optional createTime(); + + /** Output only. Timestamp of when this resource is considered expired. */ + @JsonProperty("expireTime") + public abstract Optional expireTime(); + + /** + * Output only. The fact of the Memory Revision. This corresponds to the `fact` field of the + * parent Memory at the time of revision creation. + */ + @JsonProperty("fact") + public abstract Optional fact(); + + /** + * Output only. The labels of the Memory Revision. These labels are applied to the MemoryRevision + * when it is created based on `GenerateMemoriesRequest.revision_labels`. + */ + @JsonProperty("labels") + public abstract Optional> labels(); + + /** + * Output only. The extracted memories from the source content before consolidation when the + * memory was updated via GenerateMemories. This information was used to modify an existing Memory + * via Consolidation. + */ + @JsonProperty("extractedMemories") + public abstract Optional> extractedMemories(); + + /** Instantiates a builder for MemoryRevision. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MemoryRevision.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MemoryRevision. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `MemoryRevision.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_MemoryRevision.Builder(); + } + + /** + * Setter for name. + * + *

name: Identifier. The resource name of the Memory Revision. Format: + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/memories/{memory}/revisions/{memory_revision}` + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for createTime. + * + *

createTime: Output only. Timestamp when this Memory Revision was created. + */ + @JsonProperty("createTime") + public abstract Builder createTime(Instant createTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder createTime(Optional createTime); + + /** Clears the value of createTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCreateTime() { + return createTime(Optional.empty()); + } + + /** + * Setter for expireTime. + * + *

expireTime: Output only. Timestamp of when this resource is considered expired. + */ + @JsonProperty("expireTime") + public abstract Builder expireTime(Instant expireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder expireTime(Optional expireTime); + + /** Clears the value of expireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExpireTime() { + return expireTime(Optional.empty()); + } + + /** + * Setter for fact. + * + *

fact: Output only. The fact of the Memory Revision. This corresponds to the `fact` field + * of the parent Memory at the time of revision creation. + */ + @JsonProperty("fact") + public abstract Builder fact(String fact); + + @ExcludeFromGeneratedCoverageReport + abstract Builder fact(Optional fact); + + /** Clears the value of fact field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFact() { + return fact(Optional.empty()); + } + + /** + * Setter for labels. + * + *

labels: Output only. The labels of the Memory Revision. These labels are applied to the + * MemoryRevision when it is created based on `GenerateMemoriesRequest.revision_labels`. + */ + @JsonProperty("labels") + public abstract Builder labels(Map labels); + + @ExcludeFromGeneratedCoverageReport + abstract Builder labels(Optional> labels); + + /** Clears the value of labels field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLabels() { + return labels(Optional.empty()); + } + + /** + * Setter for extractedMemories. + * + *

extractedMemories: Output only. The extracted memories from the source content before + * consolidation when the memory was updated via GenerateMemories. This information was used to + * modify an existing Memory via Consolidation. + */ + @JsonProperty("extractedMemories") + public abstract Builder extractedMemories(List extractedMemories); + + /** + * Setter for extractedMemories. + * + *

extractedMemories: Output only. The extracted memories from the source content before + * consolidation when the memory was updated via GenerateMemories. This information was used to + * modify an existing Memory via Consolidation. + */ + @CanIgnoreReturnValue + public Builder extractedMemories(IntermediateExtractedMemory... extractedMemories) { + return extractedMemories(Arrays.asList(extractedMemories)); + } + + /** + * Setter for extractedMemories builder. + * + *

extractedMemories: Output only. The extracted memories from the source content before + * consolidation when the memory was updated via GenerateMemories. This information was used to + * modify an existing Memory via Consolidation. + */ + @CanIgnoreReturnValue + public Builder extractedMemories( + IntermediateExtractedMemory.Builder... extractedMemoriesBuilders) { + return extractedMemories( + Arrays.asList(extractedMemoriesBuilders).stream() + .map(IntermediateExtractedMemory.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder extractedMemories( + Optional> extractedMemories); + + /** Clears the value of extractedMemories field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExtractedMemories() { + return extractedMemories(Optional.empty()); + } + + public abstract MemoryRevision build(); + } + + /** Deserializes a JSON string to a MemoryRevision object. */ + @ExcludeFromGeneratedCoverageReport + public static MemoryRevision fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, MemoryRevision.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryTopicId.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryTopicId.java new file mode 100644 index 000000000000..5f732ba45735 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MemoryTopicId.java @@ -0,0 +1,123 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** The topic ID for a memory. */ +@AutoValue +@JsonDeserialize(builder = MemoryTopicId.Builder.class) +public abstract class MemoryTopicId extends JsonSerializable { + /** Optional. The custom memory topic label. */ + @JsonProperty("customMemoryTopicLabel") + public abstract Optional customMemoryTopicLabel(); + + /** Optional. The managed memory topic. */ + @JsonProperty("managedMemoryTopic") + public abstract Optional managedMemoryTopic(); + + /** Instantiates a builder for MemoryTopicId. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MemoryTopicId.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MemoryTopicId. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `MemoryTopicId.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_MemoryTopicId.Builder(); + } + + /** + * Setter for customMemoryTopicLabel. + * + *

customMemoryTopicLabel: Optional. The custom memory topic label. + */ + @JsonProperty("customMemoryTopicLabel") + public abstract Builder customMemoryTopicLabel(String customMemoryTopicLabel); + + @ExcludeFromGeneratedCoverageReport + abstract Builder customMemoryTopicLabel(Optional customMemoryTopicLabel); + + /** Clears the value of customMemoryTopicLabel field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCustomMemoryTopicLabel() { + return customMemoryTopicLabel(Optional.empty()); + } + + /** + * Setter for managedMemoryTopic. + * + *

managedMemoryTopic: Optional. The managed memory topic. + */ + @JsonProperty("managedMemoryTopic") + public abstract Builder managedMemoryTopic(ManagedTopicEnum managedMemoryTopic); + + @ExcludeFromGeneratedCoverageReport + abstract Builder managedMemoryTopic(Optional managedMemoryTopic); + + /** Clears the value of managedMemoryTopic field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearManagedMemoryTopic() { + return managedMemoryTopic(Optional.empty()); + } + + /** + * Setter for managedMemoryTopic given a known enum. + * + *

managedMemoryTopic: Optional. The managed memory topic. + */ + @CanIgnoreReturnValue + public Builder managedMemoryTopic(ManagedTopicEnum.Known knownType) { + return managedMemoryTopic(new ManagedTopicEnum(knownType)); + } + + /** + * Setter for managedMemoryTopic given a string. + * + *

managedMemoryTopic: Optional. The managed memory topic. + */ + @CanIgnoreReturnValue + public Builder managedMemoryTopic(String managedMemoryTopic) { + return managedMemoryTopic(new ManagedTopicEnum(managedMemoryTopic)); + } + + public abstract MemoryTopicId build(); + } + + /** Deserializes a JSON string to a MemoryTopicId object. */ + @ExcludeFromGeneratedCoverageReport + public static MemoryTopicId fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, MemoryTopicId.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Message.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Message.java new file mode 100644 index 000000000000..b055d9210808 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Message.java @@ -0,0 +1,149 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import java.time.Instant; +import java.util.Optional; + +/** Represents a single message turn in a conversation. */ +@AutoValue +@JsonDeserialize(builder = Message.Builder.class) +public abstract class Message extends JsonSerializable { + /** Unique identifier for the message turn. */ + @JsonProperty("turnId") + public abstract Optional turnId(); + + /** Content of the message, including function call. */ + @JsonProperty("content") + public abstract Optional content(); + + /** Timestamp indicating when the message was created. */ + @JsonProperty("creationTimestamp") + public abstract Optional creationTimestamp(); + + /** Name of the entity that produced the message. */ + @JsonProperty("author") + public abstract Optional author(); + + /** Instantiates a builder for Message. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_Message.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for Message. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `Message.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_Message.Builder(); + } + + /** + * Setter for turnId. + * + *

turnId: Unique identifier for the message turn. + */ + @JsonProperty("turnId") + public abstract Builder turnId(String turnId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder turnId(Optional turnId); + + /** Clears the value of turnId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTurnId() { + return turnId(Optional.empty()); + } + + /** + * Setter for content. + * + *

content: Content of the message, including function call. + */ + @JsonProperty("content") + public abstract Builder content(Content content); + + @ExcludeFromGeneratedCoverageReport + abstract Builder content(Optional content); + + /** Clears the value of content field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContent() { + return content(Optional.empty()); + } + + /** + * Setter for creationTimestamp. + * + *

creationTimestamp: Timestamp indicating when the message was created. + */ + @JsonProperty("creationTimestamp") + public abstract Builder creationTimestamp(Instant creationTimestamp); + + @ExcludeFromGeneratedCoverageReport + abstract Builder creationTimestamp(Optional creationTimestamp); + + /** Clears the value of creationTimestamp field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCreationTimestamp() { + return creationTimestamp(Optional.empty()); + } + + /** + * Setter for author. + * + *

author: Name of the entity that produced the message. + */ + @JsonProperty("author") + public abstract Builder author(String author); + + @ExcludeFromGeneratedCoverageReport + abstract Builder author(Optional author); + + /** Clears the value of author field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAuthor() { + return author(Optional.empty()); + } + + public abstract Message build(); + } + + /** Deserializes a JSON string to a Message object. */ + @ExcludeFromGeneratedCoverageReport + public static Message fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, Message.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Metadata.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Metadata.java new file mode 100644 index 000000000000..193bb8f23276 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Metadata.java @@ -0,0 +1,87 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Metadata for a chunk. */ +@AutoValue +@JsonDeserialize(builder = Metadata.Builder.class) +public abstract class Metadata extends JsonSerializable { + /** + * Optional. Attributes attached to the data. The keys have semantic conventions and the consumers + * of the attributes should know how to deserialize the value bytes based on the keys. + */ + @JsonProperty("attributes") + public abstract Optional> attributes(); + + /** Instantiates a builder for Metadata. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_Metadata.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for Metadata. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `Metadata.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_Metadata.Builder(); + } + + /** + * Setter for attributes. + * + *

attributes: Optional. Attributes attached to the data. The keys have semantic conventions + * and the consumers of the attributes should know how to deserialize the value bytes based on + * the keys. + */ + @JsonProperty("attributes") + public abstract Builder attributes(Map attributes); + + @ExcludeFromGeneratedCoverageReport + abstract Builder attributes(Optional> attributes); + + /** Clears the value of attributes field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAttributes() { + return attributes(Optional.empty()); + } + + public abstract Metadata build(); + } + + /** Deserializes a JSON string to a Metadata object. */ + @ExcludeFromGeneratedCoverageReport + public static Metadata fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, Metadata.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Metric.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Metric.java new file mode 100644 index 000000000000..fd5265696fe8 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Metric.java @@ -0,0 +1,262 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.GenerationConfig; +import java.util.Map; +import java.util.Optional; + +/** The metric used for evaluation. */ +@AutoValue +@JsonDeserialize(builder = Metric.Builder.class) +public abstract class Metric extends JsonSerializable { + /** The name of the metric. */ + @JsonProperty("name") + public abstract Optional name(); + + /** The prompt template for the metric. */ + @JsonProperty("promptTemplate") + public abstract Optional promptTemplate(); + + /** The judge model for the metric. */ + @JsonProperty("judgeModel") + public abstract Optional judgeModel(); + + /** The generation config for the judge LLM (temperature, top_k, top_p, etc). */ + @JsonProperty("judgeModelGenerationConfig") + public abstract Optional judgeModelGenerationConfig(); + + /** The sampling count for the judge model. */ + @JsonProperty("judgeModelSamplingCount") + public abstract Optional judgeModelSamplingCount(); + + /** The system instruction for the judge model. */ + @JsonProperty("judgeModelSystemInstruction") + public abstract Optional judgeModelSystemInstruction(); + + /** Whether to return the raw output from the judge model. */ + @JsonProperty("returnRawOutput") + public abstract Optional returnRawOutput(); + + /** The rubric group name for the rubric-based metric. */ + @JsonProperty("rubricGroupName") + public abstract Optional rubricGroupName(); + + /** Optional steering instruction parameters for the automated predefined metric. */ + @JsonProperty("metricSpecParameters") + public abstract Optional> metricSpecParameters(); + + /** Instantiates a builder for Metric. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_Metric.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for Metric. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `Metric.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_Metric.Builder(); + } + + /** + * Setter for name. + * + *

name: The name of the metric. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for promptTemplate. + * + *

promptTemplate: The prompt template for the metric. + */ + @JsonProperty("promptTemplate") + public abstract Builder promptTemplate(String promptTemplate); + + @ExcludeFromGeneratedCoverageReport + abstract Builder promptTemplate(Optional promptTemplate); + + /** Clears the value of promptTemplate field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPromptTemplate() { + return promptTemplate(Optional.empty()); + } + + /** + * Setter for judgeModel. + * + *

judgeModel: The judge model for the metric. + */ + @JsonProperty("judgeModel") + public abstract Builder judgeModel(String judgeModel); + + @ExcludeFromGeneratedCoverageReport + abstract Builder judgeModel(Optional judgeModel); + + /** Clears the value of judgeModel field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearJudgeModel() { + return judgeModel(Optional.empty()); + } + + /** + * Setter for judgeModelGenerationConfig. + * + *

judgeModelGenerationConfig: The generation config for the judge LLM (temperature, top_k, + * top_p, etc). + */ + @JsonProperty("judgeModelGenerationConfig") + public abstract Builder judgeModelGenerationConfig(GenerationConfig judgeModelGenerationConfig); + + @ExcludeFromGeneratedCoverageReport + abstract Builder judgeModelGenerationConfig( + Optional judgeModelGenerationConfig); + + /** Clears the value of judgeModelGenerationConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearJudgeModelGenerationConfig() { + return judgeModelGenerationConfig(Optional.empty()); + } + + /** + * Setter for judgeModelSamplingCount. + * + *

judgeModelSamplingCount: The sampling count for the judge model. + */ + @JsonProperty("judgeModelSamplingCount") + public abstract Builder judgeModelSamplingCount(Integer judgeModelSamplingCount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder judgeModelSamplingCount(Optional judgeModelSamplingCount); + + /** Clears the value of judgeModelSamplingCount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearJudgeModelSamplingCount() { + return judgeModelSamplingCount(Optional.empty()); + } + + /** + * Setter for judgeModelSystemInstruction. + * + *

judgeModelSystemInstruction: The system instruction for the judge model. + */ + @JsonProperty("judgeModelSystemInstruction") + public abstract Builder judgeModelSystemInstruction(String judgeModelSystemInstruction); + + @ExcludeFromGeneratedCoverageReport + abstract Builder judgeModelSystemInstruction(Optional judgeModelSystemInstruction); + + /** Clears the value of judgeModelSystemInstruction field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearJudgeModelSystemInstruction() { + return judgeModelSystemInstruction(Optional.empty()); + } + + /** + * Setter for returnRawOutput. + * + *

returnRawOutput: Whether to return the raw output from the judge model. + */ + @JsonProperty("returnRawOutput") + public abstract Builder returnRawOutput(boolean returnRawOutput); + + @ExcludeFromGeneratedCoverageReport + abstract Builder returnRawOutput(Optional returnRawOutput); + + /** Clears the value of returnRawOutput field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReturnRawOutput() { + return returnRawOutput(Optional.empty()); + } + + /** + * Setter for rubricGroupName. + * + *

rubricGroupName: The rubric group name for the rubric-based metric. + */ + @JsonProperty("rubricGroupName") + public abstract Builder rubricGroupName(String rubricGroupName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubricGroupName(Optional rubricGroupName); + + /** Clears the value of rubricGroupName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubricGroupName() { + return rubricGroupName(Optional.empty()); + } + + /** + * Setter for metricSpecParameters. + * + *

metricSpecParameters: Optional steering instruction parameters for the automated + * predefined metric. + */ + @JsonProperty("metricSpecParameters") + public abstract Builder metricSpecParameters(Map metricSpecParameters); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metricSpecParameters(Optional> metricSpecParameters); + + /** Clears the value of metricSpecParameters field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetricSpecParameters() { + return metricSpecParameters(Optional.empty()); + } + + public abstract Metric build(); + } + + /** Deserializes a JSON string to a Metric object. */ + @ExcludeFromGeneratedCoverageReport + public static Metric fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, Metric.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MetricResult.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MetricResult.java new file mode 100644 index 000000000000..34786bdd7779 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MetricResult.java @@ -0,0 +1,179 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.GoogleRpcStatus; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Result for a single metric on a single instance. */ +@AutoValue +@JsonDeserialize(builder = MetricResult.Builder.class) +public abstract class MetricResult extends JsonSerializable { + /** + * The score for the metric. Please refer to each metric's documentation for the meaning of the + * score. + */ + @JsonProperty("score") + public abstract Optional score(); + + /** For rubric-based metrics, the verdicts for each rubric. */ + @JsonProperty("rubricVerdicts") + public abstract Optional> rubricVerdicts(); + + /** The explanation for the metric result. */ + @JsonProperty("explanation") + public abstract Optional explanation(); + + /** The error status for the metric result. */ + @JsonProperty("error") + public abstract Optional error(); + + /** Instantiates a builder for MetricResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MetricResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MetricResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `MetricResult.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_MetricResult.Builder(); + } + + /** + * Setter for score. + * + *

score: The score for the metric. Please refer to each metric's documentation for the + * meaning of the score. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + @ExcludeFromGeneratedCoverageReport + abstract Builder score(Optional score); + + /** Clears the value of score field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScore() { + return score(Optional.empty()); + } + + /** + * Setter for rubricVerdicts. + * + *

rubricVerdicts: For rubric-based metrics, the verdicts for each rubric. + */ + @JsonProperty("rubricVerdicts") + public abstract Builder rubricVerdicts(List rubricVerdicts); + + /** + * Setter for rubricVerdicts. + * + *

rubricVerdicts: For rubric-based metrics, the verdicts for each rubric. + */ + @CanIgnoreReturnValue + public Builder rubricVerdicts(RubricVerdict... rubricVerdicts) { + return rubricVerdicts(Arrays.asList(rubricVerdicts)); + } + + /** + * Setter for rubricVerdicts builder. + * + *

rubricVerdicts: For rubric-based metrics, the verdicts for each rubric. + */ + @CanIgnoreReturnValue + public Builder rubricVerdicts(RubricVerdict.Builder... rubricVerdictsBuilders) { + return rubricVerdicts( + Arrays.asList(rubricVerdictsBuilders).stream() + .map(RubricVerdict.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubricVerdicts(Optional> rubricVerdicts); + + /** Clears the value of rubricVerdicts field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubricVerdicts() { + return rubricVerdicts(Optional.empty()); + } + + /** + * Setter for explanation. + * + *

explanation: The explanation for the metric result. + */ + @JsonProperty("explanation") + public abstract Builder explanation(String explanation); + + @ExcludeFromGeneratedCoverageReport + abstract Builder explanation(Optional explanation); + + /** Clears the value of explanation field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExplanation() { + return explanation(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error status for the metric result. + */ + @JsonProperty("error") + public abstract Builder error(GoogleRpcStatus error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + public abstract MetricResult build(); + } + + /** Deserializes a JSON string to a MetricResult object. */ + @ExcludeFromGeneratedCoverageReport + public static MetricResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, MetricResult.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MetricxResult.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MetricxResult.java new file mode 100644 index 000000000000..40c1cad0feef --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MetricxResult.java @@ -0,0 +1,84 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** + * Spec for MetricX result - calculates the MetricX score for the given instance using the version + * specified in the spec. + */ +@AutoValue +@JsonDeserialize(builder = MetricxResult.Builder.class) +public abstract class MetricxResult extends JsonSerializable { + /** Output only. MetricX score. Range depends on version. */ + @JsonProperty("score") + public abstract Optional score(); + + /** Instantiates a builder for MetricxResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MetricxResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MetricxResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `MetricxResult.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_MetricxResult.Builder(); + } + + /** + * Setter for score. + * + *

score: Output only. MetricX score. Range depends on version. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + @ExcludeFromGeneratedCoverageReport + abstract Builder score(Optional score); + + /** Clears the value of score field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScore() { + return score(Optional.empty()); + } + + public abstract MetricxResult build(); + } + + /** Deserializes a JSON string to a MetricxResult object. */ + @ExcludeFromGeneratedCoverageReport + public static MetricxResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, MetricxResult.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MultimodalDataset.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MultimodalDataset.java new file mode 100644 index 000000000000..4839ad1e8ab2 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MultimodalDataset.java @@ -0,0 +1,157 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents a multimodal dataset. */ +@AutoValue +@JsonDeserialize(builder = MultimodalDataset.Builder.class) +public abstract class MultimodalDataset extends JsonSerializable { + /** The ID of the multimodal dataset. */ + @JsonProperty("name") + public abstract Optional name(); + + /** The display name of the multimodal dataset. */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** The metadata of the multimodal dataset. */ + @JsonProperty("metadata") + public abstract Optional metadata(); + + /** The description of the multimodal dataset. */ + @JsonProperty("description") + public abstract Optional description(); + + /** Instantiates a builder for MultimodalDataset. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MultimodalDataset.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MultimodalDataset. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `MultimodalDataset.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_MultimodalDataset.Builder(); + } + + /** + * Setter for name. + * + *

name: The ID of the multimodal dataset. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: The display name of the multimodal dataset. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: The metadata of the multimodal dataset. + */ + @JsonProperty("metadata") + public abstract Builder metadata(SchemaTablesDatasetMetadata metadata); + + /** + * Setter for metadata builder. + * + *

metadata: The metadata of the multimodal dataset. + */ + @CanIgnoreReturnValue + public Builder metadata(SchemaTablesDatasetMetadata.Builder metadataBuilder) { + return metadata(metadataBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: The description of the multimodal dataset. + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + public abstract MultimodalDataset build(); + } + + /** Deserializes a JSON string to a MultimodalDataset object. */ + @ExcludeFromGeneratedCoverageReport + public static MultimodalDataset fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, MultimodalDataset.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MultimodalDatasetOperation.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MultimodalDatasetOperation.java new file mode 100644 index 000000000000..2a2cf3d05b64 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/MultimodalDatasetOperation.java @@ -0,0 +1,188 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Represents the create dataset operation. */ +@AutoValue +@JsonDeserialize(builder = MultimodalDatasetOperation.Builder.class) +public abstract class MultimodalDatasetOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** The result of the dataset operation. */ + @JsonProperty("response") + public abstract Optional> response(); + + /** Instantiates a builder for MultimodalDatasetOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_MultimodalDatasetOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for MultimodalDatasetOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `MultimodalDatasetOperation.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_MultimodalDatasetOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + /** + * Setter for response. + * + *

response: The result of the dataset operation. + */ + @JsonProperty("response") + public abstract Builder response(Map response); + + @ExcludeFromGeneratedCoverageReport + abstract Builder response(Optional> response); + + /** Clears the value of response field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResponse() { + return response(Optional.empty()); + } + + public abstract MultimodalDatasetOperation build(); + } + + /** Deserializes a JSON string to a MultimodalDatasetOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static MultimodalDatasetOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, MultimodalDatasetOperation.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/NfsMount.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/NfsMount.java new file mode 100644 index 000000000000..698f80cb971f --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/NfsMount.java @@ -0,0 +1,130 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents a mount configuration for Network File System (NFS) to mount. */ +@AutoValue +@JsonDeserialize(builder = NfsMount.Builder.class) +public abstract class NfsMount extends JsonSerializable { + /** Required. Destination mount path. The NFS will be mounted for the user under /mnt/nfs/ */ + @JsonProperty("mountPoint") + public abstract Optional mountPoint(); + + /** + * Required. Source path exported from NFS server. Has to start with '/', and combined with the ip + * address, it indicates the source mount path in the form of `server:path` + */ + @JsonProperty("path") + public abstract Optional path(); + + /** Required. IP address of the NFS server. */ + @JsonProperty("server") + public abstract Optional server(); + + /** Instantiates a builder for NfsMount. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_NfsMount.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for NfsMount. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `NfsMount.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_NfsMount.Builder(); + } + + /** + * Setter for mountPoint. + * + *

mountPoint: Required. Destination mount path. The NFS will be mounted for the user under + * /mnt/nfs/ + */ + @JsonProperty("mountPoint") + public abstract Builder mountPoint(String mountPoint); + + @ExcludeFromGeneratedCoverageReport + abstract Builder mountPoint(Optional mountPoint); + + /** Clears the value of mountPoint field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMountPoint() { + return mountPoint(Optional.empty()); + } + + /** + * Setter for path. + * + *

path: Required. Source path exported from NFS server. Has to start with '/', and combined + * with the ip address, it indicates the source mount path in the form of `server:path` + */ + @JsonProperty("path") + public abstract Builder path(String path); + + @ExcludeFromGeneratedCoverageReport + abstract Builder path(Optional path); + + /** Clears the value of path field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPath() { + return path(Optional.empty()); + } + + /** + * Setter for server. + * + *

server: Required. IP address of the NFS server. + */ + @JsonProperty("server") + public abstract Builder server(String server); + + @ExcludeFromGeneratedCoverageReport + abstract Builder server(Optional server); + + /** Clears the value of server field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearServer() { + return server(Optional.empty()); + } + + public abstract NfsMount build(); + } + + /** Deserializes a JSON string to a NfsMount object. */ + @ExcludeFromGeneratedCoverageReport + public static NfsMount fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, NfsMount.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ObservabilityEvalCase.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ObservabilityEvalCase.java new file mode 100644 index 000000000000..4454de0ea139 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ObservabilityEvalCase.java @@ -0,0 +1,148 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** A single evaluation case instance for data stored in GCP Observability. */ +@AutoValue +@JsonDeserialize(builder = ObservabilityEvalCase.Builder.class) +public abstract class ObservabilityEvalCase extends JsonSerializable { + /** String containing the GCS reference to the GenAI input content. */ + @JsonProperty("inputSrc") + public abstract Optional inputSrc(); + + /** String containing the GCS reference to the GenAI response content. */ + @JsonProperty("outputSrc") + public abstract Optional outputSrc(); + + /** An optional string containing the GCS reference to the GenAI system instruction. */ + @JsonProperty("systemInstructionSrc") + public abstract Optional systemInstructionSrc(); + + /** The underlying API client. */ + @JsonProperty("apiClient") + public abstract Optional apiClient(); + + /** Instantiates a builder for ObservabilityEvalCase. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ObservabilityEvalCase.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ObservabilityEvalCase. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ObservabilityEvalCase.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ObservabilityEvalCase.Builder(); + } + + /** + * Setter for inputSrc. + * + *

inputSrc: String containing the GCS reference to the GenAI input content. + */ + @JsonProperty("inputSrc") + public abstract Builder inputSrc(String inputSrc); + + @ExcludeFromGeneratedCoverageReport + abstract Builder inputSrc(Optional inputSrc); + + /** Clears the value of inputSrc field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInputSrc() { + return inputSrc(Optional.empty()); + } + + /** + * Setter for outputSrc. + * + *

outputSrc: String containing the GCS reference to the GenAI response content. + */ + @JsonProperty("outputSrc") + public abstract Builder outputSrc(String outputSrc); + + @ExcludeFromGeneratedCoverageReport + abstract Builder outputSrc(Optional outputSrc); + + /** Clears the value of outputSrc field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOutputSrc() { + return outputSrc(Optional.empty()); + } + + /** + * Setter for systemInstructionSrc. + * + *

systemInstructionSrc: An optional string containing the GCS reference to the GenAI system + * instruction. + */ + @JsonProperty("systemInstructionSrc") + public abstract Builder systemInstructionSrc(String systemInstructionSrc); + + @ExcludeFromGeneratedCoverageReport + abstract Builder systemInstructionSrc(Optional systemInstructionSrc); + + /** Clears the value of systemInstructionSrc field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSystemInstructionSrc() { + return systemInstructionSrc(Optional.empty()); + } + + /** + * Setter for apiClient. + * + *

apiClient: The underlying API client. + */ + @JsonProperty("apiClient") + public abstract Builder apiClient(Object apiClient); + + @ExcludeFromGeneratedCoverageReport + abstract Builder apiClient(Optional apiClient); + + /** Clears the value of apiClient field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearApiClient() { + return apiClient(Optional.empty()); + } + + public abstract ObservabilityEvalCase build(); + } + + /** Deserializes a JSON string to a ObservabilityEvalCase object. */ + @ExcludeFromGeneratedCoverageReport + public static ObservabilityEvalCase fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ObservabilityEvalCase.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeConfig.java new file mode 100644 index 000000000000..feec304b27ed --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeConfig.java @@ -0,0 +1,124 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for Prompt Optimizer. */ +@AutoValue +@JsonDeserialize(builder = OptimizeConfig.Builder.class) +public abstract class OptimizeConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** */ + @JsonProperty("optimizationTarget") + public abstract Optional optimizationTarget(); + + /** Instantiates a builder for OptimizeConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_OptimizeConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for OptimizeConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `OptimizeConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_OptimizeConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for optimizationTarget. + * + *

optimizationTarget: + */ + @JsonProperty("optimizationTarget") + public abstract Builder optimizationTarget(OptimizeTarget optimizationTarget); + + @ExcludeFromGeneratedCoverageReport + abstract Builder optimizationTarget(Optional optimizationTarget); + + /** Clears the value of optimizationTarget field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOptimizationTarget() { + return optimizationTarget(Optional.empty()); + } + + /** + * Setter for optimizationTarget given a known enum. + * + *

optimizationTarget: + */ + @CanIgnoreReturnValue + public Builder optimizationTarget(OptimizeTarget.Known knownType) { + return optimizationTarget(new OptimizeTarget(knownType)); + } + + /** + * Setter for optimizationTarget given a string. + * + *

optimizationTarget: + */ + @CanIgnoreReturnValue + public Builder optimizationTarget(String optimizationTarget) { + return optimizationTarget(new OptimizeTarget(optimizationTarget)); + } + + public abstract OptimizeConfig build(); + } + + /** Deserializes a JSON string to a OptimizeConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static OptimizeConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, OptimizeConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeRequestParameters.java new file mode 100644 index 000000000000..eebf3500cf18 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeRequestParameters.java @@ -0,0 +1,116 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import java.util.Optional; + +/** Request for the optimize_prompt method. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = OptimizeRequestParameters.Builder.class) +public abstract class OptimizeRequestParameters extends JsonSerializable { + /** */ + @JsonProperty("content") + public abstract Optional content(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for OptimizeRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_OptimizeRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for OptimizeRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `OptimizeRequestParameters.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_OptimizeRequestParameters.Builder(); + } + + /** + * Setter for content. + * + *

content: + */ + @JsonProperty("content") + public abstract Builder content(Content content); + + @ExcludeFromGeneratedCoverageReport + abstract Builder content(Optional content); + + /** Clears the value of content field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContent() { + return content(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(OptimizeConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(OptimizeConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract OptimizeRequestParameters build(); + } + + /** Deserializes a JSON string to a OptimizeRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static OptimizeRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, OptimizeRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeResponse.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeResponse.java new file mode 100644 index 000000000000..de9c0a22c7bd --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeResponse.java @@ -0,0 +1,113 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Response for the optimize_prompt method. */ +@AutoValue +@JsonDeserialize(builder = OptimizeResponse.Builder.class) +public abstract class OptimizeResponse extends JsonSerializable { + /** */ + @JsonProperty("rawTextResponse") + public abstract Optional rawTextResponse(); + + /** */ + @JsonProperty("parsedResponse") + public abstract Optional parsedResponse(); + + /** Instantiates a builder for OptimizeResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_OptimizeResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for OptimizeResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `OptimizeResponse.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_OptimizeResponse.Builder(); + } + + /** + * Setter for rawTextResponse. + * + *

rawTextResponse: + */ + @JsonProperty("rawTextResponse") + public abstract Builder rawTextResponse(String rawTextResponse); + + @ExcludeFromGeneratedCoverageReport + abstract Builder rawTextResponse(Optional rawTextResponse); + + /** Clears the value of rawTextResponse field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRawTextResponse() { + return rawTextResponse(Optional.empty()); + } + + /** + * Setter for parsedResponse. + * + *

parsedResponse: + */ + @JsonProperty("parsedResponse") + public abstract Builder parsedResponse(ParsedResponse parsedResponse); + + /** + * Setter for parsedResponse builder. + * + *

parsedResponse: + */ + @CanIgnoreReturnValue + public Builder parsedResponse(ParsedResponse.Builder parsedResponseBuilder) { + return parsedResponse(parsedResponseBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder parsedResponse(Optional parsedResponse); + + /** Clears the value of parsedResponse field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearParsedResponse() { + return parsedResponse(Optional.empty()); + } + + public abstract OptimizeResponse build(); + } + + /** Deserializes a JSON string to a OptimizeResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static OptimizeResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, OptimizeResponse.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeResponseEndpoint.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeResponseEndpoint.java new file mode 100644 index 000000000000..6423558eed7e --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeResponseEndpoint.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import java.util.Optional; + +/** Response for the optimize_prompt method. */ +@AutoValue +@JsonDeserialize(builder = OptimizeResponseEndpoint.Builder.class) +public abstract class OptimizeResponseEndpoint extends JsonSerializable { + /** */ + @JsonProperty("content") + public abstract Optional content(); + + /** Instantiates a builder for OptimizeResponseEndpoint. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_OptimizeResponseEndpoint.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for OptimizeResponseEndpoint. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `OptimizeResponseEndpoint.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_OptimizeResponseEndpoint.Builder(); + } + + /** + * Setter for content. + * + *

content: + */ + @JsonProperty("content") + public abstract Builder content(Content content); + + @ExcludeFromGeneratedCoverageReport + abstract Builder content(Optional content); + + /** Clears the value of content field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContent() { + return content(Optional.empty()); + } + + public abstract OptimizeResponseEndpoint build(); + } + + /** Deserializes a JSON string to a OptimizeResponseEndpoint object. */ + @ExcludeFromGeneratedCoverageReport + public static OptimizeResponseEndpoint fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, OptimizeResponseEndpoint.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeTarget.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeTarget.java new file mode 100644 index 000000000000..ec345c09b619 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/OptimizeTarget.java @@ -0,0 +1,107 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** None */ +public class OptimizeTarget { + + /** Enum representing the known values for OptimizeTarget. */ + public enum Known { + /** The data driven prompt optimizer designer for prompts from Android core API. */ + OPTIMIZATION_TARGET_GEMINI_NANO, + + OPTIMIZE_TARGET_UNSPECIFIED + } + + private Known optimizeTargetEnum; + private final String value; + + @JsonCreator + public OptimizeTarget(String value) { + this.value = value; + for (Known optimizeTargetEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(optimizeTargetEnum.toString(), value)) { + this.optimizeTargetEnum = optimizeTargetEnum; + break; + } + } + if (this.optimizeTargetEnum == null) { + this.optimizeTargetEnum = Known.OPTIMIZE_TARGET_UNSPECIFIED; + } + } + + public OptimizeTarget(Known knownValue) { + this.optimizeTargetEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof OptimizeTarget)) { + return false; + } + + OptimizeTarget other = (OptimizeTarget) o; + + if (this.optimizeTargetEnum != Known.OPTIMIZE_TARGET_UNSPECIFIED + && other.optimizeTargetEnum != Known.OPTIMIZE_TARGET_UNSPECIFIED) { + return this.optimizeTargetEnum == other.optimizeTargetEnum; + } else if (this.optimizeTargetEnum == Known.OPTIMIZE_TARGET_UNSPECIFIED + && other.optimizeTargetEnum == Known.OPTIMIZE_TARGET_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.optimizeTargetEnum != Known.OPTIMIZE_TARGET_UNSPECIFIED) { + return this.optimizeTargetEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.optimizeTargetEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PairwiseChoice.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PairwiseChoice.java new file mode 100644 index 000000000000..6935862bdb38 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PairwiseChoice.java @@ -0,0 +1,114 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** Output only. Pairwise metric choice. */ +public class PairwiseChoice { + + /** Enum representing the known values for PairwiseChoice. */ + public enum Known { + /** Unspecified prediction choice. */ + PAIRWISE_CHOICE_UNSPECIFIED, + + /** Baseline prediction wins */ + BASELINE, + + /** Candidate prediction wins */ + CANDIDATE, + + /** Winner cannot be determined */ + TIE + } + + private Known pairwiseChoiceEnum; + private final String value; + + @JsonCreator + public PairwiseChoice(String value) { + this.value = value; + for (Known pairwiseChoiceEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(pairwiseChoiceEnum.toString(), value)) { + this.pairwiseChoiceEnum = pairwiseChoiceEnum; + break; + } + } + if (this.pairwiseChoiceEnum == null) { + this.pairwiseChoiceEnum = Known.PAIRWISE_CHOICE_UNSPECIFIED; + } + } + + public PairwiseChoice(Known knownValue) { + this.pairwiseChoiceEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof PairwiseChoice)) { + return false; + } + + PairwiseChoice other = (PairwiseChoice) o; + + if (this.pairwiseChoiceEnum != Known.PAIRWISE_CHOICE_UNSPECIFIED + && other.pairwiseChoiceEnum != Known.PAIRWISE_CHOICE_UNSPECIFIED) { + return this.pairwiseChoiceEnum == other.pairwiseChoiceEnum; + } else if (this.pairwiseChoiceEnum == Known.PAIRWISE_CHOICE_UNSPECIFIED + && other.pairwiseChoiceEnum == Known.PAIRWISE_CHOICE_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.pairwiseChoiceEnum != Known.PAIRWISE_CHOICE_UNSPECIFIED) { + return this.pairwiseChoiceEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.pairwiseChoiceEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PairwiseMetricInput.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PairwiseMetricInput.java new file mode 100644 index 000000000000..3cae31230035 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PairwiseMetricInput.java @@ -0,0 +1,91 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Pairwise metric instance. */ +@AutoValue +@JsonDeserialize(builder = PairwiseMetricInput.Builder.class) +public abstract class PairwiseMetricInput extends JsonSerializable { + /** Required. Pairwise metric instance. */ + @JsonProperty("instance") + public abstract Optional instance(); + + /** Instantiates a builder for PairwiseMetricInput. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_PairwiseMetricInput.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PairwiseMetricInput. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `PairwiseMetricInput.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_PairwiseMetricInput.Builder(); + } + + /** + * Setter for instance. + * + *

instance: Required. Pairwise metric instance. + */ + @JsonProperty("instance") + public abstract Builder instance(PairwiseMetricInstance instance); + + /** + * Setter for instance builder. + * + *

instance: Required. Pairwise metric instance. + */ + @CanIgnoreReturnValue + public Builder instance(PairwiseMetricInstance.Builder instanceBuilder) { + return instance(instanceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder instance(Optional instance); + + /** Clears the value of instance field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInstance() { + return instance(Optional.empty()); + } + + public abstract PairwiseMetricInput build(); + } + + /** Deserializes a JSON string to a PairwiseMetricInput object. */ + @ExcludeFromGeneratedCoverageReport + public static PairwiseMetricInput fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PairwiseMetricInput.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PairwiseMetricInstance.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PairwiseMetricInstance.java new file mode 100644 index 000000000000..6e4bc6e2dfdf --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PairwiseMetricInstance.java @@ -0,0 +1,85 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Pairwise metric instance. */ +@AutoValue +@JsonDeserialize(builder = PairwiseMetricInstance.Builder.class) +public abstract class PairwiseMetricInstance extends JsonSerializable { + /** + * Instance specified as a json string. String key-value pairs are expected in the json_instance + * to render PairwiseMetricSpec.instance_prompt_template. + */ + @JsonProperty("jsonInstance") + public abstract Optional jsonInstance(); + + /** Instantiates a builder for PairwiseMetricInstance. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_PairwiseMetricInstance.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PairwiseMetricInstance. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `PairwiseMetricInstance.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_PairwiseMetricInstance.Builder(); + } + + /** + * Setter for jsonInstance. + * + *

jsonInstance: Instance specified as a json string. String key-value pairs are expected in + * the json_instance to render PairwiseMetricSpec.instance_prompt_template. + */ + @JsonProperty("jsonInstance") + public abstract Builder jsonInstance(String jsonInstance); + + @ExcludeFromGeneratedCoverageReport + abstract Builder jsonInstance(Optional jsonInstance); + + /** Clears the value of jsonInstance field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearJsonInstance() { + return jsonInstance(Optional.empty()); + } + + public abstract PairwiseMetricInstance build(); + } + + /** Deserializes a JSON string to a PairwiseMetricInstance object. */ + @ExcludeFromGeneratedCoverageReport + public static PairwiseMetricInstance fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PairwiseMetricInstance.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PairwiseMetricResult.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PairwiseMetricResult.java new file mode 100644 index 000000000000..c3823d7fe77c --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PairwiseMetricResult.java @@ -0,0 +1,155 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Spec for pairwise metric result. */ +@AutoValue +@JsonDeserialize(builder = PairwiseMetricResult.Builder.class) +public abstract class PairwiseMetricResult extends JsonSerializable { + /** Output only. Spec for custom output. */ + @JsonProperty("customOutput") + public abstract Optional customOutput(); + + /** Output only. Explanation for pairwise metric score. */ + @JsonProperty("explanation") + public abstract Optional explanation(); + + /** Output only. Pairwise metric choice. */ + @JsonProperty("pairwiseChoice") + public abstract Optional pairwiseChoice(); + + /** Instantiates a builder for PairwiseMetricResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_PairwiseMetricResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PairwiseMetricResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `PairwiseMetricResult.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_PairwiseMetricResult.Builder(); + } + + /** + * Setter for customOutput. + * + *

customOutput: Output only. Spec for custom output. + */ + @JsonProperty("customOutput") + public abstract Builder customOutput(CustomOutput customOutput); + + /** + * Setter for customOutput builder. + * + *

customOutput: Output only. Spec for custom output. + */ + @CanIgnoreReturnValue + public Builder customOutput(CustomOutput.Builder customOutputBuilder) { + return customOutput(customOutputBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder customOutput(Optional customOutput); + + /** Clears the value of customOutput field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCustomOutput() { + return customOutput(Optional.empty()); + } + + /** + * Setter for explanation. + * + *

explanation: Output only. Explanation for pairwise metric score. + */ + @JsonProperty("explanation") + public abstract Builder explanation(String explanation); + + @ExcludeFromGeneratedCoverageReport + abstract Builder explanation(Optional explanation); + + /** Clears the value of explanation field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExplanation() { + return explanation(Optional.empty()); + } + + /** + * Setter for pairwiseChoice. + * + *

pairwiseChoice: Output only. Pairwise metric choice. + */ + @JsonProperty("pairwiseChoice") + public abstract Builder pairwiseChoice(PairwiseChoice pairwiseChoice); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pairwiseChoice(Optional pairwiseChoice); + + /** Clears the value of pairwiseChoice field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPairwiseChoice() { + return pairwiseChoice(Optional.empty()); + } + + /** + * Setter for pairwiseChoice given a known enum. + * + *

pairwiseChoice: Output only. Pairwise metric choice. + */ + @CanIgnoreReturnValue + public Builder pairwiseChoice(PairwiseChoice.Known knownType) { + return pairwiseChoice(new PairwiseChoice(knownType)); + } + + /** + * Setter for pairwiseChoice given a string. + * + *

pairwiseChoice: Output only. Pairwise metric choice. + */ + @CanIgnoreReturnValue + public Builder pairwiseChoice(String pairwiseChoice) { + return pairwiseChoice(new PairwiseChoice(pairwiseChoice)); + } + + public abstract PairwiseMetricResult build(); + } + + /** Deserializes a JSON string to a PairwiseMetricResult object. */ + @ExcludeFromGeneratedCoverageReport + public static PairwiseMetricResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PairwiseMetricResult.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ParsedResponse.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ParsedResponse.java new file mode 100644 index 000000000000..b5c0a51fcf81 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ParsedResponse.java @@ -0,0 +1,175 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Response for the optimize_prompt method. */ +@AutoValue +@JsonDeserialize(builder = ParsedResponse.Builder.class) +public abstract class ParsedResponse extends JsonSerializable { + /** */ + @JsonProperty("optimizationType") + public abstract Optional optimizationType(); + + /** */ + @JsonProperty("applicableGuidelines") + public abstract Optional> applicableGuidelines(); + + /** */ + @JsonProperty("originalPrompt") + public abstract Optional originalPrompt(); + + /** */ + @JsonProperty("suggestedPrompt") + public abstract Optional suggestedPrompt(); + + /** Instantiates a builder for ParsedResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ParsedResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ParsedResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ParsedResponse.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ParsedResponse.Builder(); + } + + /** + * Setter for optimizationType. + * + *

optimizationType: + */ + @JsonProperty("optimizationType") + public abstract Builder optimizationType(String optimizationType); + + @ExcludeFromGeneratedCoverageReport + abstract Builder optimizationType(Optional optimizationType); + + /** Clears the value of optimizationType field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOptimizationType() { + return optimizationType(Optional.empty()); + } + + /** + * Setter for applicableGuidelines. + * + *

applicableGuidelines: + */ + @JsonProperty("applicableGuidelines") + public abstract Builder applicableGuidelines(List applicableGuidelines); + + /** + * Setter for applicableGuidelines. + * + *

applicableGuidelines: + */ + @CanIgnoreReturnValue + public Builder applicableGuidelines(ApplicableGuideline... applicableGuidelines) { + return applicableGuidelines(Arrays.asList(applicableGuidelines)); + } + + /** + * Setter for applicableGuidelines builder. + * + *

applicableGuidelines: + */ + @CanIgnoreReturnValue + public Builder applicableGuidelines( + ApplicableGuideline.Builder... applicableGuidelinesBuilders) { + return applicableGuidelines( + Arrays.asList(applicableGuidelinesBuilders).stream() + .map(ApplicableGuideline.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder applicableGuidelines(Optional> applicableGuidelines); + + /** Clears the value of applicableGuidelines field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearApplicableGuidelines() { + return applicableGuidelines(Optional.empty()); + } + + /** + * Setter for originalPrompt. + * + *

originalPrompt: + */ + @JsonProperty("originalPrompt") + public abstract Builder originalPrompt(String originalPrompt); + + @ExcludeFromGeneratedCoverageReport + abstract Builder originalPrompt(Optional originalPrompt); + + /** Clears the value of originalPrompt field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOriginalPrompt() { + return originalPrompt(Optional.empty()); + } + + /** + * Setter for suggestedPrompt. + * + *

suggestedPrompt: + */ + @JsonProperty("suggestedPrompt") + public abstract Builder suggestedPrompt(String suggestedPrompt); + + @ExcludeFromGeneratedCoverageReport + abstract Builder suggestedPrompt(Optional suggestedPrompt); + + /** Clears the value of suggestedPrompt field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSuggestedPrompt() { + return suggestedPrompt(Optional.empty()); + } + + public abstract ParsedResponse build(); + } + + /** Deserializes a JSON string to a ParsedResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static ParsedResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ParsedResponse.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PointwiseMetricInput.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PointwiseMetricInput.java new file mode 100644 index 000000000000..76d716f1c851 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PointwiseMetricInput.java @@ -0,0 +1,91 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Pointwise metric input. */ +@AutoValue +@JsonDeserialize(builder = PointwiseMetricInput.Builder.class) +public abstract class PointwiseMetricInput extends JsonSerializable { + /** Required. Pointwise metric instance. */ + @JsonProperty("instance") + public abstract Optional instance(); + + /** Instantiates a builder for PointwiseMetricInput. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_PointwiseMetricInput.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PointwiseMetricInput. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `PointwiseMetricInput.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_PointwiseMetricInput.Builder(); + } + + /** + * Setter for instance. + * + *

instance: Required. Pointwise metric instance. + */ + @JsonProperty("instance") + public abstract Builder instance(PointwiseMetricInstance instance); + + /** + * Setter for instance builder. + * + *

instance: Required. Pointwise metric instance. + */ + @CanIgnoreReturnValue + public Builder instance(PointwiseMetricInstance.Builder instanceBuilder) { + return instance(instanceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder instance(Optional instance); + + /** Clears the value of instance field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInstance() { + return instance(Optional.empty()); + } + + public abstract PointwiseMetricInput build(); + } + + /** Deserializes a JSON string to a PointwiseMetricInput object. */ + @ExcludeFromGeneratedCoverageReport + public static PointwiseMetricInput fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PointwiseMetricInput.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PointwiseMetricInstance.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PointwiseMetricInstance.java new file mode 100644 index 000000000000..2a07296bd9dd --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PointwiseMetricInstance.java @@ -0,0 +1,85 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Pointwise metric instance. */ +@AutoValue +@JsonDeserialize(builder = PointwiseMetricInstance.Builder.class) +public abstract class PointwiseMetricInstance extends JsonSerializable { + /** + * Instance specified as a json string. String key-value pairs are expected in the json_instance + * to render PointwiseMetricSpec.instance_prompt_template. + */ + @JsonProperty("jsonInstance") + public abstract Optional jsonInstance(); + + /** Instantiates a builder for PointwiseMetricInstance. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_PointwiseMetricInstance.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PointwiseMetricInstance. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `PointwiseMetricInstance.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_PointwiseMetricInstance.Builder(); + } + + /** + * Setter for jsonInstance. + * + *

jsonInstance: Instance specified as a json string. String key-value pairs are expected in + * the json_instance to render PointwiseMetricSpec.instance_prompt_template. + */ + @JsonProperty("jsonInstance") + public abstract Builder jsonInstance(String jsonInstance); + + @ExcludeFromGeneratedCoverageReport + abstract Builder jsonInstance(Optional jsonInstance); + + /** Clears the value of jsonInstance field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearJsonInstance() { + return jsonInstance(Optional.empty()); + } + + public abstract PointwiseMetricInstance build(); + } + + /** Deserializes a JSON string to a PointwiseMetricInstance object. */ + @ExcludeFromGeneratedCoverageReport + public static PointwiseMetricInstance fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PointwiseMetricInstance.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PointwiseMetricResult.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PointwiseMetricResult.java new file mode 100644 index 000000000000..603a127b2ca4 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PointwiseMetricResult.java @@ -0,0 +1,135 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Spec for pointwise metric result. */ +@AutoValue +@JsonDeserialize(builder = PointwiseMetricResult.Builder.class) +public abstract class PointwiseMetricResult extends JsonSerializable { + /** Output only. Spec for custom output. */ + @JsonProperty("customOutput") + public abstract Optional customOutput(); + + /** Output only. Explanation for pointwise metric score. */ + @JsonProperty("explanation") + public abstract Optional explanation(); + + /** Output only. Pointwise metric score. */ + @JsonProperty("score") + public abstract Optional score(); + + /** Instantiates a builder for PointwiseMetricResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_PointwiseMetricResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PointwiseMetricResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `PointwiseMetricResult.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_PointwiseMetricResult.Builder(); + } + + /** + * Setter for customOutput. + * + *

customOutput: Output only. Spec for custom output. + */ + @JsonProperty("customOutput") + public abstract Builder customOutput(CustomOutput customOutput); + + /** + * Setter for customOutput builder. + * + *

customOutput: Output only. Spec for custom output. + */ + @CanIgnoreReturnValue + public Builder customOutput(CustomOutput.Builder customOutputBuilder) { + return customOutput(customOutputBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder customOutput(Optional customOutput); + + /** Clears the value of customOutput field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCustomOutput() { + return customOutput(Optional.empty()); + } + + /** + * Setter for explanation. + * + *

explanation: Output only. Explanation for pointwise metric score. + */ + @JsonProperty("explanation") + public abstract Builder explanation(String explanation); + + @ExcludeFromGeneratedCoverageReport + abstract Builder explanation(Optional explanation); + + /** Clears the value of explanation field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExplanation() { + return explanation(Optional.empty()); + } + + /** + * Setter for score. + * + *

score: Output only. Pointwise metric score. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + @ExcludeFromGeneratedCoverageReport + abstract Builder score(Optional score); + + /** Clears the value of score field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScore() { + return score(Optional.empty()); + } + + public abstract PointwiseMetricResult build(); + } + + /** Deserializes a JSON string to a PointwiseMetricResult object. */ + @ExcludeFromGeneratedCoverageReport + public static PointwiseMetricResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PointwiseMetricResult.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PredefinedMetricSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PredefinedMetricSpec.java new file mode 100644 index 000000000000..10787df4f690 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PredefinedMetricSpec.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Spec for predefined metric. */ +@AutoValue +@JsonDeserialize(builder = PredefinedMetricSpec.Builder.class) +public abstract class PredefinedMetricSpec extends JsonSerializable { + /** The name of a pre-defined metric, such as "instruction_following_v1" or "text_quality_v1". */ + @JsonProperty("metricSpecName") + public abstract Optional metricSpecName(); + + /** Instantiates a builder for PredefinedMetricSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_PredefinedMetricSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PredefinedMetricSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `PredefinedMetricSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_PredefinedMetricSpec.Builder(); + } + + /** + * Setter for metricSpecName. + * + *

metricSpecName: The name of a pre-defined metric, such as "instruction_following_v1" or + * "text_quality_v1". + */ + @JsonProperty("metricSpecName") + public abstract Builder metricSpecName(String metricSpecName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metricSpecName(Optional metricSpecName); + + /** Clears the value of metricSpecName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetricSpecName() { + return metricSpecName(Optional.empty()); + } + + public abstract PredefinedMetricSpec build(); + } + + /** Deserializes a JSON string to a PredefinedMetricSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static PredefinedMetricSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PredefinedMetricSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptOptimizerConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptOptimizerConfig.java new file mode 100644 index 000000000000..d4dcba0402dc --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptOptimizerConfig.java @@ -0,0 +1,183 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** VAPO Prompt Optimizer Config. */ +@AutoValue +@JsonDeserialize(builder = PromptOptimizerConfig.Builder.class) +public abstract class PromptOptimizerConfig extends JsonSerializable { + /** The gcs path to the config file, e.g. gs://bucket/config.json. */ + @JsonProperty("configPath") + public abstract Optional configPath(); + + /** + * The service account to use for the custom job. Cannot be provided at the same time as + * service_account_project_number. + */ + @JsonProperty("serviceAccount") + public abstract Optional serviceAccount(); + + /** + * The project number used to construct the default service + * account:{service_account_project_number}-compute@developer.gserviceaccount.comCannot be + * provided at the same time as "service_account". + */ + @JsonProperty("serviceAccountProjectNumber") + public abstract Optional serviceAccountProjectNumber(); + + /** Whether to wait for the job tocomplete. Ignored for async jobs. */ + @JsonProperty("waitForCompletion") + public abstract Optional waitForCompletion(); + + /** + * The display name of the optimization job. If not provided, a display name in the format of + * "vapo-optimizer-{timestamp}" will be used. + */ + @JsonProperty("optimizerJobDisplayName") + public abstract Optional optimizerJobDisplayName(); + + /** Instantiates a builder for PromptOptimizerConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_PromptOptimizerConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PromptOptimizerConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `PromptOptimizerConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_PromptOptimizerConfig.Builder(); + } + + /** + * Setter for configPath. + * + *

configPath: The gcs path to the config file, e.g. gs://bucket/config.json. + */ + @JsonProperty("configPath") + public abstract Builder configPath(String configPath); + + @ExcludeFromGeneratedCoverageReport + abstract Builder configPath(Optional configPath); + + /** Clears the value of configPath field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfigPath() { + return configPath(Optional.empty()); + } + + /** + * Setter for serviceAccount. + * + *

serviceAccount: The service account to use for the custom job. Cannot be provided at the + * same time as service_account_project_number. + */ + @JsonProperty("serviceAccount") + public abstract Builder serviceAccount(String serviceAccount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder serviceAccount(Optional serviceAccount); + + /** Clears the value of serviceAccount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearServiceAccount() { + return serviceAccount(Optional.empty()); + } + + /** + * Setter for serviceAccountProjectNumber. + * + *

serviceAccountProjectNumber: The project number used to construct the default service + * account:{service_account_project_number}-compute@developer.gserviceaccount.comCannot be + * provided at the same time as "service_account". + */ + @JsonProperty("serviceAccountProjectNumber") + public abstract Builder serviceAccountProjectNumber(int serviceAccountProjectNumber); + + @ExcludeFromGeneratedCoverageReport + abstract Builder serviceAccountProjectNumber(Optional serviceAccountProjectNumber); + + /** Clears the value of serviceAccountProjectNumber field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearServiceAccountProjectNumber() { + return serviceAccountProjectNumber(Optional.empty()); + } + + /** + * Setter for waitForCompletion. + * + *

waitForCompletion: Whether to wait for the job tocomplete. Ignored for async jobs. + */ + @JsonProperty("waitForCompletion") + public abstract Builder waitForCompletion(boolean waitForCompletion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder waitForCompletion(Optional waitForCompletion); + + /** Clears the value of waitForCompletion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWaitForCompletion() { + return waitForCompletion(Optional.empty()); + } + + /** + * Setter for optimizerJobDisplayName. + * + *

optimizerJobDisplayName: The display name of the optimization job. If not provided, a + * display name in the format of "vapo-optimizer-{timestamp}" will be used. + */ + @JsonProperty("optimizerJobDisplayName") + public abstract Builder optimizerJobDisplayName(String optimizerJobDisplayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder optimizerJobDisplayName(Optional optimizerJobDisplayName); + + /** Clears the value of optimizerJobDisplayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOptimizerJobDisplayName() { + return optimizerJobDisplayName(Optional.empty()); + } + + public abstract PromptOptimizerConfig build(); + } + + /** Deserializes a JSON string to a PromptOptimizerConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static PromptOptimizerConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PromptOptimizerConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptOptimizerMethod.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptOptimizerMethod.java new file mode 100644 index 000000000000..a35d57539a2d --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptOptimizerMethod.java @@ -0,0 +1,110 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** The method for data driven prompt optimization. */ +public class PromptOptimizerMethod { + + /** Enum representing the known values for PromptOptimizerMethod. */ + public enum Known { + /** The default data driven Vertex AI Prompt Optimizer. */ + VAPO, + + /** The data driven prompt optimizer designer for prompts from Android core API. */ + OPTIMIZATION_TARGET_GEMINI_NANO, + + PROMPT_OPTIMIZER_METHOD_UNSPECIFIED + } + + private Known promptOptimizerMethodEnum; + private final String value; + + @JsonCreator + public PromptOptimizerMethod(String value) { + this.value = value; + for (Known promptOptimizerMethodEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(promptOptimizerMethodEnum.toString(), value)) { + this.promptOptimizerMethodEnum = promptOptimizerMethodEnum; + break; + } + } + if (this.promptOptimizerMethodEnum == null) { + this.promptOptimizerMethodEnum = Known.PROMPT_OPTIMIZER_METHOD_UNSPECIFIED; + } + } + + public PromptOptimizerMethod(Known knownValue) { + this.promptOptimizerMethodEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof PromptOptimizerMethod)) { + return false; + } + + PromptOptimizerMethod other = (PromptOptimizerMethod) o; + + if (this.promptOptimizerMethodEnum != Known.PROMPT_OPTIMIZER_METHOD_UNSPECIFIED + && other.promptOptimizerMethodEnum != Known.PROMPT_OPTIMIZER_METHOD_UNSPECIFIED) { + return this.promptOptimizerMethodEnum == other.promptOptimizerMethodEnum; + } else if (this.promptOptimizerMethodEnum == Known.PROMPT_OPTIMIZER_METHOD_UNSPECIFIED + && other.promptOptimizerMethodEnum == Known.PROMPT_OPTIMIZER_METHOD_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.promptOptimizerMethodEnum != Known.PROMPT_OPTIMIZER_METHOD_UNSPECIFIED) { + return this.promptOptimizerMethodEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.promptOptimizerMethodEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptRef.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptRef.java new file mode 100644 index 000000000000..c090f58b578e --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptRef.java @@ -0,0 +1,103 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Reference to a prompt. */ +@AutoValue +@JsonDeserialize(builder = PromptRef.Builder.class) +public abstract class PromptRef extends JsonSerializable { + /** */ + @JsonProperty("promptId") + public abstract Optional promptId(); + + /** */ + @JsonProperty("model") + public abstract Optional model(); + + /** Instantiates a builder for PromptRef. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_PromptRef.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PromptRef. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `PromptRef.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_PromptRef.Builder(); + } + + /** + * Setter for promptId. + * + *

promptId: + */ + @JsonProperty("promptId") + public abstract Builder promptId(String promptId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder promptId(Optional promptId); + + /** Clears the value of promptId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPromptId() { + return promptId(Optional.empty()); + } + + /** + * Setter for model. + * + *

model: + */ + @JsonProperty("model") + public abstract Builder model(String model); + + @ExcludeFromGeneratedCoverageReport + abstract Builder model(Optional model); + + /** Clears the value of model field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearModel() { + return model(Optional.empty()); + } + + public abstract PromptRef build(); + } + + /** Deserializes a JSON string to a PromptRef object. */ + @ExcludeFromGeneratedCoverageReport + public static PromptRef fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PromptRef.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptTemplate.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptTemplate.java new file mode 100644 index 000000000000..d0a4e506c666 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptTemplate.java @@ -0,0 +1,81 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** A prompt template for creating prompts with variables. */ +@AutoValue +@JsonDeserialize(builder = PromptTemplate.Builder.class) +public abstract class PromptTemplate extends JsonSerializable { + /** The prompt template text. */ + @JsonProperty("text") + public abstract Optional text(); + + /** Instantiates a builder for PromptTemplate. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_PromptTemplate.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PromptTemplate. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `PromptTemplate.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_PromptTemplate.Builder(); + } + + /** + * Setter for text. + * + *

text: The prompt template text. + */ + @JsonProperty("text") + public abstract Builder text(String text); + + @ExcludeFromGeneratedCoverageReport + abstract Builder text(Optional text); + + /** Clears the value of text field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearText() { + return text(Optional.empty()); + } + + public abstract PromptTemplate build(); + } + + /** Deserializes a JSON string to a PromptTemplate object. */ + @ExcludeFromGeneratedCoverageReport + public static PromptTemplate fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PromptTemplate.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptTemplateData.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptTemplateData.java new file mode 100644 index 000000000000..6cdcb551089c --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptTemplateData.java @@ -0,0 +1,83 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import java.util.Map; +import java.util.Optional; + +/** Message to hold a prompt template and the values to populate the template. */ +@AutoValue +@JsonDeserialize(builder = PromptTemplateData.Builder.class) +public abstract class PromptTemplateData extends JsonSerializable { + /** The values for fields in the prompt template. */ + @JsonProperty("values") + public abstract Optional> values(); + + /** Instantiates a builder for PromptTemplateData. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_PromptTemplateData.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PromptTemplateData. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `PromptTemplateData.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_PromptTemplateData.Builder(); + } + + /** + * Setter for values. + * + *

values: The values for fields in the prompt template. + */ + @JsonProperty("values") + public abstract Builder values(Map values); + + @ExcludeFromGeneratedCoverageReport + abstract Builder values(Optional> values); + + /** Clears the value of values field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearValues() { + return values(Optional.empty()); + } + + public abstract PromptTemplateData build(); + } + + /** Deserializes a JSON string to a PromptTemplateData object. */ + @ExcludeFromGeneratedCoverageReport + public static PromptTemplateData fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PromptTemplateData.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptVersionRef.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptVersionRef.java new file mode 100644 index 000000000000..cc3cc1df2142 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PromptVersionRef.java @@ -0,0 +1,125 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Reference to a prompt version. */ +@AutoValue +@JsonDeserialize(builder = PromptVersionRef.Builder.class) +public abstract class PromptVersionRef extends JsonSerializable { + /** */ + @JsonProperty("promptId") + public abstract Optional promptId(); + + /** */ + @JsonProperty("versionId") + public abstract Optional versionId(); + + /** */ + @JsonProperty("model") + public abstract Optional model(); + + /** Instantiates a builder for PromptVersionRef. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_PromptVersionRef.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PromptVersionRef. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `PromptVersionRef.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_PromptVersionRef.Builder(); + } + + /** + * Setter for promptId. + * + *

promptId: + */ + @JsonProperty("promptId") + public abstract Builder promptId(String promptId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder promptId(Optional promptId); + + /** Clears the value of promptId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPromptId() { + return promptId(Optional.empty()); + } + + /** + * Setter for versionId. + * + *

versionId: + */ + @JsonProperty("versionId") + public abstract Builder versionId(String versionId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder versionId(Optional versionId); + + /** Clears the value of versionId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearVersionId() { + return versionId(Optional.empty()); + } + + /** + * Setter for model. + * + *

model: + */ + @JsonProperty("model") + public abstract Builder model(String model); + + @ExcludeFromGeneratedCoverageReport + abstract Builder model(Optional model); + + /** Clears the value of model field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearModel() { + return model(Optional.empty()); + } + + public abstract PromptVersionRef build(); + } + + /** Deserializes a JSON string to a PromptVersionRef object. */ + @ExcludeFromGeneratedCoverageReport + public static PromptVersionRef fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PromptVersionRef.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PscInterfaceConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PscInterfaceConfig.java new file mode 100644 index 000000000000..ccd04dba985f --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PscInterfaceConfig.java @@ -0,0 +1,156 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The PSC interface config. */ +@AutoValue +@JsonDeserialize(builder = PscInterfaceConfig.Builder.class) +public abstract class PscInterfaceConfig extends JsonSerializable { + /** + * Optional. DNS peering configurations. When specified, Vertex AI will attempt to configure DNS + * peering zones in the tenant project VPC to resolve the specified domains using the target + * network's Cloud DNS. The user must grant the dns.peer role to the Vertex AI Service Agent on + * the target project. + */ + @JsonProperty("dnsPeeringConfigs") + public abstract Optional> dnsPeeringConfigs(); + + /** + * Optional. The name of the Compute Engine [network + * attachment](https://cloud.google.com/vpc/docs/about-network-attachments) to attach to the + * resource within the region and user project. To specify this field, you must have already + * [created a network attachment] + * (https://cloud.google.com/vpc/docs/create-manage-network-attachments#create-network-attachments). + * This field is only used for resources using PSC-I. + */ + @JsonProperty("networkAttachment") + public abstract Optional networkAttachment(); + + /** Instantiates a builder for PscInterfaceConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_PscInterfaceConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PscInterfaceConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `PscInterfaceConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_PscInterfaceConfig.Builder(); + } + + /** + * Setter for dnsPeeringConfigs. + * + *

dnsPeeringConfigs: Optional. DNS peering configurations. When specified, Vertex AI will + * attempt to configure DNS peering zones in the tenant project VPC to resolve the specified + * domains using the target network's Cloud DNS. The user must grant the dns.peer role to the + * Vertex AI Service Agent on the target project. + */ + @JsonProperty("dnsPeeringConfigs") + public abstract Builder dnsPeeringConfigs(List dnsPeeringConfigs); + + /** + * Setter for dnsPeeringConfigs. + * + *

dnsPeeringConfigs: Optional. DNS peering configurations. When specified, Vertex AI will + * attempt to configure DNS peering zones in the tenant project VPC to resolve the specified + * domains using the target network's Cloud DNS. The user must grant the dns.peer role to the + * Vertex AI Service Agent on the target project. + */ + @CanIgnoreReturnValue + public Builder dnsPeeringConfigs(DnsPeeringConfig... dnsPeeringConfigs) { + return dnsPeeringConfigs(Arrays.asList(dnsPeeringConfigs)); + } + + /** + * Setter for dnsPeeringConfigs builder. + * + *

dnsPeeringConfigs: Optional. DNS peering configurations. When specified, Vertex AI will + * attempt to configure DNS peering zones in the tenant project VPC to resolve the specified + * domains using the target network's Cloud DNS. The user must grant the dns.peer role to the + * Vertex AI Service Agent on the target project. + */ + @CanIgnoreReturnValue + public Builder dnsPeeringConfigs(DnsPeeringConfig.Builder... dnsPeeringConfigsBuilders) { + return dnsPeeringConfigs( + Arrays.asList(dnsPeeringConfigsBuilders).stream() + .map(DnsPeeringConfig.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder dnsPeeringConfigs(Optional> dnsPeeringConfigs); + + /** Clears the value of dnsPeeringConfigs field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDnsPeeringConfigs() { + return dnsPeeringConfigs(Optional.empty()); + } + + /** + * Setter for networkAttachment. + * + *

networkAttachment: Optional. The name of the Compute Engine [network + * attachment](https://cloud.google.com/vpc/docs/about-network-attachments) to attach to the + * resource within the region and user project. To specify this field, you must have already + * [created a network attachment] + * (https://cloud.google.com/vpc/docs/create-manage-network-attachments#create-network-attachments). + * This field is only used for resources using PSC-I. + */ + @JsonProperty("networkAttachment") + public abstract Builder networkAttachment(String networkAttachment); + + @ExcludeFromGeneratedCoverageReport + abstract Builder networkAttachment(Optional networkAttachment); + + /** Clears the value of networkAttachment field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNetworkAttachment() { + return networkAttachment(Optional.empty()); + } + + public abstract PscInterfaceConfig build(); + } + + /** Deserializes a JSON string to a PscInterfaceConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static PscInterfaceConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PscInterfaceConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PythonPackageSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PythonPackageSpec.java new file mode 100644 index 000000000000..6823580a003a --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PythonPackageSpec.java @@ -0,0 +1,234 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The spec of a Python packaged code. */ +@AutoValue +@JsonDeserialize(builder = PythonPackageSpec.Builder.class) +public abstract class PythonPackageSpec extends JsonSerializable { + /** Command line arguments to be passed to the Python task. */ + @JsonProperty("args") + public abstract Optional> args(); + + /** Environment variables to be passed to the python module. Maximum limit is 100. */ + @JsonProperty("env") + public abstract Optional> env(); + + /** + * Required. The URI of a container image in Artifact Registry that will run the provided Python + * package. Vertex AI provides a wide range of executor images with pre-installed packages to meet + * users' various use cases. See the list of [pre-built containers for + * training](https://cloud.google.com/vertex-ai/docs/training/pre-built-containers). You must use + * an image from this list. + */ + @JsonProperty("executorImageUri") + public abstract Optional executorImageUri(); + + /** + * Required. The Google Cloud Storage location of the Python package files which are the training + * program and its dependent packages. The maximum number of package URIs is 100. + */ + @JsonProperty("packageUris") + public abstract Optional> packageUris(); + + /** Required. The Python module name to run after installing the packages. */ + @JsonProperty("pythonModule") + public abstract Optional pythonModule(); + + /** Instantiates a builder for PythonPackageSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_PythonPackageSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for PythonPackageSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `PythonPackageSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_PythonPackageSpec.Builder(); + } + + /** + * Setter for args. + * + *

args: Command line arguments to be passed to the Python task. + */ + @JsonProperty("args") + public abstract Builder args(List args); + + /** + * Setter for args. + * + *

args: Command line arguments to be passed to the Python task. + */ + @CanIgnoreReturnValue + public Builder args(String... args) { + return args(Arrays.asList(args)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder args(Optional> args); + + /** Clears the value of args field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearArgs() { + return args(Optional.empty()); + } + + /** + * Setter for env. + * + *

env: Environment variables to be passed to the python module. Maximum limit is 100. + */ + @JsonProperty("env") + public abstract Builder env(List env); + + /** + * Setter for env. + * + *

env: Environment variables to be passed to the python module. Maximum limit is 100. + */ + @CanIgnoreReturnValue + public Builder env(EnvVar... env) { + return env(Arrays.asList(env)); + } + + /** + * Setter for env builder. + * + *

env: Environment variables to be passed to the python module. Maximum limit is 100. + */ + @CanIgnoreReturnValue + public Builder env(EnvVar.Builder... envBuilders) { + return env( + Arrays.asList(envBuilders).stream() + .map(EnvVar.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder env(Optional> env); + + /** Clears the value of env field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEnv() { + return env(Optional.empty()); + } + + /** + * Setter for executorImageUri. + * + *

executorImageUri: Required. The URI of a container image in Artifact Registry that will + * run the provided Python package. Vertex AI provides a wide range of executor images with + * pre-installed packages to meet users' various use cases. See the list of [pre-built + * containers for + * training](https://cloud.google.com/vertex-ai/docs/training/pre-built-containers). You must + * use an image from this list. + */ + @JsonProperty("executorImageUri") + public abstract Builder executorImageUri(String executorImageUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder executorImageUri(Optional executorImageUri); + + /** Clears the value of executorImageUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExecutorImageUri() { + return executorImageUri(Optional.empty()); + } + + /** + * Setter for packageUris. + * + *

packageUris: Required. The Google Cloud Storage location of the Python package files which + * are the training program and its dependent packages. The maximum number of package URIs is + * 100. + */ + @JsonProperty("packageUris") + public abstract Builder packageUris(List packageUris); + + /** + * Setter for packageUris. + * + *

packageUris: Required. The Google Cloud Storage location of the Python package files which + * are the training program and its dependent packages. The maximum number of package URIs is + * 100. + */ + @CanIgnoreReturnValue + public Builder packageUris(String... packageUris) { + return packageUris(Arrays.asList(packageUris)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder packageUris(Optional> packageUris); + + /** Clears the value of packageUris field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPackageUris() { + return packageUris(Optional.empty()); + } + + /** + * Setter for pythonModule. + * + *

pythonModule: Required. The Python module name to run after installing the packages. + */ + @JsonProperty("pythonModule") + public abstract Builder pythonModule(String pythonModule); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pythonModule(Optional pythonModule); + + /** Clears the value of pythonModule field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPythonModule() { + return pythonModule(Optional.empty()); + } + + public abstract PythonPackageSpec build(); + } + + /** Deserializes a JSON string to a PythonPackageSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static PythonPackageSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, PythonPackageSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PythonVersion.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PythonVersion.java new file mode 100644 index 000000000000..4ae453573b9c --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/PythonVersion.java @@ -0,0 +1,134 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** + * The Python version to be used for the Agent Engine. If not specified, it will use the current + * Python version of the environment. Supported versions: "3.9", "3.10", "3.11", "3.12", "3.13". + */ +public class PythonVersion { + + /** Enum representing the known values for PythonVersion. */ + public enum Known { + VALUE_3_9("3.9"), + + VALUE_3_10("3.10"), + + VALUE_3_11("3.11"), + + VALUE_3_12("3.12"), + + VALUE_3_13("3.13"), + + PYTHON_VERSION_UNSPECIFIED; + private final String value; + + Known() { + this.value = this.name(); + } + + Known(String value) { + this.value = value; + } + + public String value() { + return value; + } + + public String toString() { + return value; + } + } + + private Known pythonVersionEnum; + private final String value; + + @JsonCreator + public PythonVersion(String value) { + this.value = value; + for (Known pythonVersionEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(pythonVersionEnum.toString(), value)) { + this.pythonVersionEnum = pythonVersionEnum; + break; + } + } + if (this.pythonVersionEnum == null) { + this.pythonVersionEnum = Known.PYTHON_VERSION_UNSPECIFIED; + } + } + + public PythonVersion(Known knownValue) { + this.pythonVersionEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof PythonVersion)) { + return false; + } + + PythonVersion other = (PythonVersion) o; + + if (this.pythonVersionEnum != Known.PYTHON_VERSION_UNSPECIFIED + && other.pythonVersionEnum != Known.PYTHON_VERSION_UNSPECIFIED) { + return this.pythonVersionEnum == other.pythonVersionEnum; + } else if (this.pythonVersionEnum == Known.PYTHON_VERSION_UNSPECIFIED + && other.pythonVersionEnum == Known.PYTHON_VERSION_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.pythonVersionEnum != Known.PYTHON_VERSION_UNSPECIFIED) { + return this.pythonVersionEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.pythonVersionEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/QueryAgentEngineConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/QueryAgentEngineConfig.java new file mode 100644 index 000000000000..81c02785ee7a --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/QueryAgentEngineConfig.java @@ -0,0 +1,149 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Map; +import java.util.Optional; + +/** Config for querying agent engines. */ +@AutoValue +@JsonDeserialize(builder = QueryAgentEngineConfig.Builder.class) +public abstract class QueryAgentEngineConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** The class method to call. */ + @JsonProperty("classMethod") + public abstract Optional classMethod(); + + /** The input to the class method. */ + @JsonProperty("input") + public abstract Optional> input(); + + /** */ + @JsonProperty("includeAllFields") + public abstract Optional includeAllFields(); + + /** Instantiates a builder for QueryAgentEngineConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_QueryAgentEngineConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for QueryAgentEngineConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `QueryAgentEngineConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_QueryAgentEngineConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for classMethod. + * + *

classMethod: The class method to call. + */ + @JsonProperty("classMethod") + public abstract Builder classMethod(String classMethod); + + @ExcludeFromGeneratedCoverageReport + abstract Builder classMethod(Optional classMethod); + + /** Clears the value of classMethod field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearClassMethod() { + return classMethod(Optional.empty()); + } + + /** + * Setter for input. + * + *

input: The input to the class method. + */ + @JsonProperty("input") + public abstract Builder input(Map input); + + @ExcludeFromGeneratedCoverageReport + abstract Builder input(Optional> input); + + /** Clears the value of input field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInput() { + return input(Optional.empty()); + } + + /** + * Setter for includeAllFields. + * + *

includeAllFields: + */ + @JsonProperty("includeAllFields") + public abstract Builder includeAllFields(boolean includeAllFields); + + @ExcludeFromGeneratedCoverageReport + abstract Builder includeAllFields(Optional includeAllFields); + + /** Clears the value of includeAllFields field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearIncludeAllFields() { + return includeAllFields(Optional.empty()); + } + + public abstract QueryAgentEngineConfig build(); + } + + /** Deserializes a JSON string to a QueryAgentEngineConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static QueryAgentEngineConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, QueryAgentEngineConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/QueryAgentEngineRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/QueryAgentEngineRequestParameters.java new file mode 100644 index 000000000000..b40c101df0f3 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/QueryAgentEngineRequestParameters.java @@ -0,0 +1,118 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for querying agent engines. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = QueryAgentEngineRequestParameters.Builder.class) +public abstract class QueryAgentEngineRequestParameters extends JsonSerializable { + /** Name of the agent engine. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for QueryAgentEngineRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_QueryAgentEngineRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for QueryAgentEngineRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `QueryAgentEngineRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_QueryAgentEngineRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(QueryAgentEngineConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(QueryAgentEngineConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract QueryAgentEngineRequestParameters build(); + } + + /** Deserializes a JSON string to a QueryAgentEngineRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static QueryAgentEngineRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, QueryAgentEngineRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/QueryReasoningEngineResponse.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/QueryReasoningEngineResponse.java new file mode 100644 index 000000000000..f553cf185cee --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/QueryReasoningEngineResponse.java @@ -0,0 +1,83 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** The response for querying an agent engine. */ +@AutoValue +@JsonDeserialize(builder = QueryReasoningEngineResponse.Builder.class) +public abstract class QueryReasoningEngineResponse extends JsonSerializable { + /** Response provided by users in JSON object format. */ + @JsonProperty("output") + public abstract Optional output(); + + /** Instantiates a builder for QueryReasoningEngineResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_QueryReasoningEngineResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for QueryReasoningEngineResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `QueryReasoningEngineResponse.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_QueryReasoningEngineResponse.Builder(); + } + + /** + * Setter for output. + * + *

output: Response provided by users in JSON object format. + */ + @JsonProperty("output") + public abstract Builder output(Object output); + + @ExcludeFromGeneratedCoverageReport + abstract Builder output(Optional output); + + /** Clears the value of output field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOutput() { + return output(Optional.empty()); + } + + public abstract QueryReasoningEngineResponse build(); + } + + /** Deserializes a JSON string to a QueryReasoningEngineResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static QueryReasoningEngineResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, QueryReasoningEngineResponse.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RawOutput.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RawOutput.java new file mode 100644 index 000000000000..8c29c4c3b4fe --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RawOutput.java @@ -0,0 +1,93 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Raw output. */ +@AutoValue +@JsonDeserialize(builder = RawOutput.Builder.class) +public abstract class RawOutput extends JsonSerializable { + /** Output only. Raw output string. */ + @JsonProperty("rawOutput") + public abstract Optional> rawOutput(); + + /** Instantiates a builder for RawOutput. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RawOutput.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RawOutput. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RawOutput.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RawOutput.Builder(); + } + + /** + * Setter for rawOutput. + * + *

rawOutput: Output only. Raw output string. + */ + @JsonProperty("rawOutput") + public abstract Builder rawOutput(List rawOutput); + + /** + * Setter for rawOutput. + * + *

rawOutput: Output only. Raw output string. + */ + @CanIgnoreReturnValue + public Builder rawOutput(String... rawOutput) { + return rawOutput(Arrays.asList(rawOutput)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rawOutput(Optional> rawOutput); + + /** Clears the value of rawOutput field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRawOutput() { + return rawOutput(Optional.empty()); + } + + public abstract RawOutput build(); + } + + /** Deserializes a JSON string to a RawOutput object. */ + @ExcludeFromGeneratedCoverageReport + public static RawOutput fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RawOutput.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngine.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngine.java new file mode 100644 index 000000000000..68ce917b3fc7 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngine.java @@ -0,0 +1,316 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.EncryptionSpec; +import java.time.Instant; +import java.util.Map; +import java.util.Optional; + +/** An agent engine. */ +@AutoValue +@JsonDeserialize(builder = ReasoningEngine.Builder.class) +public abstract class ReasoningEngine extends JsonSerializable { + /** + * Customer-managed encryption key spec for a ReasoningEngine. If set, this ReasoningEngine and + * all sub-resources of this ReasoningEngine will be secured by this key. + */ + @JsonProperty("encryptionSpec") + public abstract Optional encryptionSpec(); + + /** Optional. Configuration for how Agent Engine sub-resources should manage context. */ + @JsonProperty("contextSpec") + public abstract Optional contextSpec(); + + /** Output only. Timestamp when this ReasoningEngine was created. */ + @JsonProperty("createTime") + public abstract Optional createTime(); + + /** Optional. The description of the ReasoningEngine. */ + @JsonProperty("description") + public abstract Optional description(); + + /** Required. The display name of the ReasoningEngine. */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** + * Optional. Used to perform consistent read-modify-write updates. If not set, a blind "overwrite" + * update happens. + */ + @JsonProperty("etag") + public abstract Optional etag(); + + /** Labels for the ReasoningEngine. */ + @JsonProperty("labels") + public abstract Optional> labels(); + + /** + * Identifier. The resource name of the ReasoningEngine. Format: + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}` + */ + @JsonProperty("name") + public abstract Optional name(); + + /** Optional. Configurations of the ReasoningEngine */ + @JsonProperty("spec") + public abstract Optional spec(); + + /** Output only. Timestamp when this ReasoningEngine was most recently updated. */ + @JsonProperty("updateTime") + public abstract Optional updateTime(); + + /** Instantiates a builder for ReasoningEngine. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ReasoningEngine.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ReasoningEngine. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ReasoningEngine.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ReasoningEngine.Builder(); + } + + /** + * Setter for encryptionSpec. + * + *

encryptionSpec: Customer-managed encryption key spec for a ReasoningEngine. If set, this + * ReasoningEngine and all sub-resources of this ReasoningEngine will be secured by this key. + */ + @JsonProperty("encryptionSpec") + public abstract Builder encryptionSpec(EncryptionSpec encryptionSpec); + + @ExcludeFromGeneratedCoverageReport + abstract Builder encryptionSpec(Optional encryptionSpec); + + /** Clears the value of encryptionSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEncryptionSpec() { + return encryptionSpec(Optional.empty()); + } + + /** + * Setter for contextSpec. + * + *

contextSpec: Optional. Configuration for how Agent Engine sub-resources should manage + * context. + */ + @JsonProperty("contextSpec") + public abstract Builder contextSpec(ReasoningEngineContextSpec contextSpec); + + /** + * Setter for contextSpec builder. + * + *

contextSpec: Optional. Configuration for how Agent Engine sub-resources should manage + * context. + */ + @CanIgnoreReturnValue + public Builder contextSpec(ReasoningEngineContextSpec.Builder contextSpecBuilder) { + return contextSpec(contextSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder contextSpec(Optional contextSpec); + + /** Clears the value of contextSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContextSpec() { + return contextSpec(Optional.empty()); + } + + /** + * Setter for createTime. + * + *

createTime: Output only. Timestamp when this ReasoningEngine was created. + */ + @JsonProperty("createTime") + public abstract Builder createTime(Instant createTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder createTime(Optional createTime); + + /** Clears the value of createTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCreateTime() { + return createTime(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: Optional. The description of the ReasoningEngine. + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: Required. The display name of the ReasoningEngine. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for etag. + * + *

etag: Optional. Used to perform consistent read-modify-write updates. If not set, a blind + * "overwrite" update happens. + */ + @JsonProperty("etag") + public abstract Builder etag(String etag); + + @ExcludeFromGeneratedCoverageReport + abstract Builder etag(Optional etag); + + /** Clears the value of etag field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEtag() { + return etag(Optional.empty()); + } + + /** + * Setter for labels. + * + *

labels: Labels for the ReasoningEngine. + */ + @JsonProperty("labels") + public abstract Builder labels(Map labels); + + @ExcludeFromGeneratedCoverageReport + abstract Builder labels(Optional> labels); + + /** Clears the value of labels field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLabels() { + return labels(Optional.empty()); + } + + /** + * Setter for name. + * + *

name: Identifier. The resource name of the ReasoningEngine. Format: + * `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}` + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for spec. + * + *

spec: Optional. Configurations of the ReasoningEngine + */ + @JsonProperty("spec") + public abstract Builder spec(ReasoningEngineSpec spec); + + /** + * Setter for spec builder. + * + *

spec: Optional. Configurations of the ReasoningEngine + */ + @CanIgnoreReturnValue + public Builder spec(ReasoningEngineSpec.Builder specBuilder) { + return spec(specBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder spec(Optional spec); + + /** Clears the value of spec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSpec() { + return spec(Optional.empty()); + } + + /** + * Setter for updateTime. + * + *

updateTime: Output only. Timestamp when this ReasoningEngine was most recently updated. + */ + @JsonProperty("updateTime") + public abstract Builder updateTime(Instant updateTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder updateTime(Optional updateTime); + + /** Clears the value of updateTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUpdateTime() { + return updateTime(Optional.empty()); + } + + public abstract ReasoningEngine build(); + } + + /** Deserializes a JSON string to a ReasoningEngine object. */ + @ExcludeFromGeneratedCoverageReport + public static ReasoningEngine fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ReasoningEngine.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpec.java new file mode 100644 index 000000000000..e3af105579d3 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpec.java @@ -0,0 +1,96 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** The configuration for agent engine sub-resources to manage context. */ +@AutoValue +@JsonDeserialize(builder = ReasoningEngineContextSpec.Builder.class) +public abstract class ReasoningEngineContextSpec extends JsonSerializable { + /** Optional. Specification for a Memory Bank, which manages memories for the Agent Engine. */ + @JsonProperty("memoryBankConfig") + public abstract Optional memoryBankConfig(); + + /** Instantiates a builder for ReasoningEngineContextSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ReasoningEngineContextSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ReasoningEngineContextSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ReasoningEngineContextSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ReasoningEngineContextSpec.Builder(); + } + + /** + * Setter for memoryBankConfig. + * + *

memoryBankConfig: Optional. Specification for a Memory Bank, which manages memories for + * the Agent Engine. + */ + @JsonProperty("memoryBankConfig") + public abstract Builder memoryBankConfig( + ReasoningEngineContextSpecMemoryBankConfig memoryBankConfig); + + /** + * Setter for memoryBankConfig builder. + * + *

memoryBankConfig: Optional. Specification for a Memory Bank, which manages memories for + * the Agent Engine. + */ + @CanIgnoreReturnValue + public Builder memoryBankConfig( + ReasoningEngineContextSpecMemoryBankConfig.Builder memoryBankConfigBuilder) { + return memoryBankConfig(memoryBankConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder memoryBankConfig( + Optional memoryBankConfig); + + /** Clears the value of memoryBankConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMemoryBankConfig() { + return memoryBankConfig(Optional.empty()); + } + + public abstract ReasoningEngineContextSpec build(); + } + + /** Deserializes a JSON string to a ReasoningEngineContextSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static ReasoningEngineContextSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ReasoningEngineContextSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfig.java new file mode 100644 index 000000000000..7cf3e4ade8f2 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfig.java @@ -0,0 +1,268 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Specification for a Memory Bank. */ +@AutoValue +@JsonDeserialize(builder = ReasoningEngineContextSpecMemoryBankConfig.Builder.class) +public abstract class ReasoningEngineContextSpecMemoryBankConfig extends JsonSerializable { + /** Optional. Configuration for how to customize Memory Bank behavior for a particular scope. */ + @JsonProperty("customizationConfigs") + public abstract Optional> customizationConfigs(); + + /** Optional. Configuration for how to generate memories for the Memory Bank. */ + @JsonProperty("generationConfig") + public abstract Optional + generationConfig(); + + /** + * Optional. Configuration for how to perform similarity search on memories. If not set, the + * Memory Bank will use the default embedding model `text-embedding-005`. + */ + @JsonProperty("similaritySearchConfig") + public abstract Optional + similaritySearchConfig(); + + /** + * Optional. Configuration for automatic TTL ("time-to-live") of the memories in the Memory Bank. + * If not set, TTL will not be applied automatically. The TTL can be explicitly set by modifying + * the `expire_time` of each Memory resource. + */ + @JsonProperty("ttlConfig") + public abstract Optional ttlConfig(); + + /** If true, no memory revisions will be created for any requests to the Memory Bank. */ + @JsonProperty("disableMemoryRevisions") + public abstract Optional disableMemoryRevisions(); + + /** Instantiates a builder for ReasoningEngineContextSpecMemoryBankConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ReasoningEngineContextSpecMemoryBankConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ReasoningEngineContextSpecMemoryBankConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ReasoningEngineContextSpecMemoryBankConfig.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ReasoningEngineContextSpecMemoryBankConfig.Builder(); + } + + /** + * Setter for customizationConfigs. + * + *

customizationConfigs: Optional. Configuration for how to customize Memory Bank behavior + * for a particular scope. + */ + @JsonProperty("customizationConfigs") + public abstract Builder customizationConfigs( + List customizationConfigs); + + /** + * Setter for customizationConfigs. + * + *

customizationConfigs: Optional. Configuration for how to customize Memory Bank behavior + * for a particular scope. + */ + @CanIgnoreReturnValue + public Builder customizationConfigs(MemoryBankCustomizationConfig... customizationConfigs) { + return customizationConfigs(Arrays.asList(customizationConfigs)); + } + + /** + * Setter for customizationConfigs builder. + * + *

customizationConfigs: Optional. Configuration for how to customize Memory Bank behavior + * for a particular scope. + */ + @CanIgnoreReturnValue + public Builder customizationConfigs( + MemoryBankCustomizationConfig.Builder... customizationConfigsBuilders) { + return customizationConfigs( + Arrays.asList(customizationConfigsBuilders).stream() + .map(MemoryBankCustomizationConfig.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder customizationConfigs( + Optional> customizationConfigs); + + /** Clears the value of customizationConfigs field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCustomizationConfigs() { + return customizationConfigs(Optional.empty()); + } + + /** + * Setter for generationConfig. + * + *

generationConfig: Optional. Configuration for how to generate memories for the Memory + * Bank. + */ + @JsonProperty("generationConfig") + public abstract Builder generationConfig( + ReasoningEngineContextSpecMemoryBankConfigGenerationConfig generationConfig); + + /** + * Setter for generationConfig builder. + * + *

generationConfig: Optional. Configuration for how to generate memories for the Memory + * Bank. + */ + @CanIgnoreReturnValue + public Builder generationConfig( + ReasoningEngineContextSpecMemoryBankConfigGenerationConfig.Builder + generationConfigBuilder) { + return generationConfig(generationConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder generationConfig( + Optional generationConfig); + + /** Clears the value of generationConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGenerationConfig() { + return generationConfig(Optional.empty()); + } + + /** + * Setter for similaritySearchConfig. + * + *

similaritySearchConfig: Optional. Configuration for how to perform similarity search on + * memories. If not set, the Memory Bank will use the default embedding model + * `text-embedding-005`. + */ + @JsonProperty("similaritySearchConfig") + public abstract Builder similaritySearchConfig( + ReasoningEngineContextSpecMemoryBankConfigSimilaritySearchConfig similaritySearchConfig); + + /** + * Setter for similaritySearchConfig builder. + * + *

similaritySearchConfig: Optional. Configuration for how to perform similarity search on + * memories. If not set, the Memory Bank will use the default embedding model + * `text-embedding-005`. + */ + @CanIgnoreReturnValue + public Builder similaritySearchConfig( + ReasoningEngineContextSpecMemoryBankConfigSimilaritySearchConfig.Builder + similaritySearchConfigBuilder) { + return similaritySearchConfig(similaritySearchConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder similaritySearchConfig( + Optional + similaritySearchConfig); + + /** Clears the value of similaritySearchConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSimilaritySearchConfig() { + return similaritySearchConfig(Optional.empty()); + } + + /** + * Setter for ttlConfig. + * + *

ttlConfig: Optional. Configuration for automatic TTL ("time-to-live") of the memories in + * the Memory Bank. If not set, TTL will not be applied automatically. The TTL can be explicitly + * set by modifying the `expire_time` of each Memory resource. + */ + @JsonProperty("ttlConfig") + public abstract Builder ttlConfig( + ReasoningEngineContextSpecMemoryBankConfigTtlConfig ttlConfig); + + /** + * Setter for ttlConfig builder. + * + *

ttlConfig: Optional. Configuration for automatic TTL ("time-to-live") of the memories in + * the Memory Bank. If not set, TTL will not be applied automatically. The TTL can be explicitly + * set by modifying the `expire_time` of each Memory resource. + */ + @CanIgnoreReturnValue + public Builder ttlConfig( + ReasoningEngineContextSpecMemoryBankConfigTtlConfig.Builder ttlConfigBuilder) { + return ttlConfig(ttlConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder ttlConfig( + Optional ttlConfig); + + /** Clears the value of ttlConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTtlConfig() { + return ttlConfig(Optional.empty()); + } + + /** + * Setter for disableMemoryRevisions. + * + *

disableMemoryRevisions: If true, no memory revisions will be created for any requests to + * the Memory Bank. + */ + @JsonProperty("disableMemoryRevisions") + public abstract Builder disableMemoryRevisions(boolean disableMemoryRevisions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder disableMemoryRevisions(Optional disableMemoryRevisions); + + /** Clears the value of disableMemoryRevisions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisableMemoryRevisions() { + return disableMemoryRevisions(Optional.empty()); + } + + public abstract ReasoningEngineContextSpecMemoryBankConfig build(); + } + + /** Deserializes a JSON string to a ReasoningEngineContextSpecMemoryBankConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static ReasoningEngineContextSpecMemoryBankConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, ReasoningEngineContextSpecMemoryBankConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfigGenerationConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfigGenerationConfig.java new file mode 100644 index 000000000000..cf996ec10f2c --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfigGenerationConfig.java @@ -0,0 +1,94 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Configuration for how to generate memories. */ +@AutoValue +@JsonDeserialize(builder = ReasoningEngineContextSpecMemoryBankConfigGenerationConfig.Builder.class) +public abstract class ReasoningEngineContextSpecMemoryBankConfigGenerationConfig + extends JsonSerializable { + /** + * Required. The model used to generate memories. Format: + * `projects/{project}/locations/{location}/publishers/google/models/{model}`. + */ + @JsonProperty("model") + public abstract Optional model(); + + /** Instantiates a builder for ReasoningEngineContextSpecMemoryBankConfigGenerationConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ReasoningEngineContextSpecMemoryBankConfigGenerationConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ReasoningEngineContextSpecMemoryBankConfigGenerationConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use + * `ReasoningEngineContextSpecMemoryBankConfigGenerationConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ReasoningEngineContextSpecMemoryBankConfigGenerationConfig.Builder(); + } + + /** + * Setter for model. + * + *

model: Required. The model used to generate memories. Format: + * `projects/{project}/locations/{location}/publishers/google/models/{model}`. + */ + @JsonProperty("model") + public abstract Builder model(String model); + + @ExcludeFromGeneratedCoverageReport + abstract Builder model(Optional model); + + /** Clears the value of model field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearModel() { + return model(Optional.empty()); + } + + public abstract ReasoningEngineContextSpecMemoryBankConfigGenerationConfig build(); + } + + /** + * Deserializes a JSON string to a ReasoningEngineContextSpecMemoryBankConfigGenerationConfig + * object. + */ + @ExcludeFromGeneratedCoverageReport + public static ReasoningEngineContextSpecMemoryBankConfigGenerationConfig fromJson( + String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, ReasoningEngineContextSpecMemoryBankConfigGenerationConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfigSimilaritySearchConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfigSimilaritySearchConfig.java new file mode 100644 index 000000000000..ab817dbd7819 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfigSimilaritySearchConfig.java @@ -0,0 +1,99 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Configuration for how to perform similarity search on memories. */ +@AutoValue +@JsonDeserialize( + builder = ReasoningEngineContextSpecMemoryBankConfigSimilaritySearchConfig.Builder.class) +public abstract class ReasoningEngineContextSpecMemoryBankConfigSimilaritySearchConfig + extends JsonSerializable { + /** + * Required. The model used to generate embeddings to lookup similar memories. Format: + * `projects/{project}/locations/{location}/publishers/google/models/{model}`. + */ + @JsonProperty("embeddingModel") + public abstract Optional embeddingModel(); + + /** + * Instantiates a builder for ReasoningEngineContextSpecMemoryBankConfigSimilaritySearchConfig. + */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ReasoningEngineContextSpecMemoryBankConfigSimilaritySearchConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ReasoningEngineContextSpecMemoryBankConfigSimilaritySearchConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use + * `ReasoningEngineContextSpecMemoryBankConfigSimilaritySearchConfig.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ReasoningEngineContextSpecMemoryBankConfigSimilaritySearchConfig + .Builder(); + } + + /** + * Setter for embeddingModel. + * + *

embeddingModel: Required. The model used to generate embeddings to lookup similar + * memories. Format: `projects/{project}/locations/{location}/publishers/google/models/{model}`. + */ + @JsonProperty("embeddingModel") + public abstract Builder embeddingModel(String embeddingModel); + + @ExcludeFromGeneratedCoverageReport + abstract Builder embeddingModel(Optional embeddingModel); + + /** Clears the value of embeddingModel field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEmbeddingModel() { + return embeddingModel(Optional.empty()); + } + + public abstract ReasoningEngineContextSpecMemoryBankConfigSimilaritySearchConfig build(); + } + + /** + * Deserializes a JSON string to a + * ReasoningEngineContextSpecMemoryBankConfigSimilaritySearchConfig object. + */ + @ExcludeFromGeneratedCoverageReport + public static ReasoningEngineContextSpecMemoryBankConfigSimilaritySearchConfig fromJson( + String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, ReasoningEngineContextSpecMemoryBankConfigSimilaritySearchConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfigTtlConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfigTtlConfig.java new file mode 100644 index 000000000000..a30cf032d6ee --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfigTtlConfig.java @@ -0,0 +1,161 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.time.Duration; +import java.util.Optional; + +/** + * Configuration for automatically setting the TTL ("time-to-live") of the memories in the Memory + * Bank. + */ +@AutoValue +@JsonDeserialize(builder = ReasoningEngineContextSpecMemoryBankConfigTtlConfig.Builder.class) +public abstract class ReasoningEngineContextSpecMemoryBankConfigTtlConfig extends JsonSerializable { + /** + * Optional. The default TTL duration of the memories in the Memory Bank. This applies to all + * operations that create or update a memory. + */ + @JsonProperty("defaultTtl") + public abstract Optional defaultTtl(); + + /** Optional. The granular TTL configuration of the memories in the Memory Bank. */ + @JsonProperty("granularTtlConfig") + public abstract Optional + granularTtlConfig(); + + /** + * Optional. The default TTL duration of the memory revisions in the Memory Bank. This applies to + * all operations that create a memory revision. If not set, a default TTL of 365 days will be + * used. + */ + @JsonProperty("memoryRevisionDefaultTtl") + public abstract Optional memoryRevisionDefaultTtl(); + + /** Instantiates a builder for ReasoningEngineContextSpecMemoryBankConfigTtlConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ReasoningEngineContextSpecMemoryBankConfigTtlConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ReasoningEngineContextSpecMemoryBankConfigTtlConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use + * `ReasoningEngineContextSpecMemoryBankConfigTtlConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ReasoningEngineContextSpecMemoryBankConfigTtlConfig.Builder(); + } + + /** + * Setter for defaultTtl. + * + *

defaultTtl: Optional. The default TTL duration of the memories in the Memory Bank. This + * applies to all operations that create or update a memory. + */ + @JsonProperty("defaultTtl") + public abstract Builder defaultTtl(Duration defaultTtl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder defaultTtl(Optional defaultTtl); + + /** Clears the value of defaultTtl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDefaultTtl() { + return defaultTtl(Optional.empty()); + } + + /** + * Setter for granularTtlConfig. + * + *

granularTtlConfig: Optional. The granular TTL configuration of the memories in the Memory + * Bank. + */ + @JsonProperty("granularTtlConfig") + public abstract Builder granularTtlConfig( + ReasoningEngineContextSpecMemoryBankConfigTtlConfigGranularTtlConfig granularTtlConfig); + + /** + * Setter for granularTtlConfig builder. + * + *

granularTtlConfig: Optional. The granular TTL configuration of the memories in the Memory + * Bank. + */ + @CanIgnoreReturnValue + public Builder granularTtlConfig( + ReasoningEngineContextSpecMemoryBankConfigTtlConfigGranularTtlConfig.Builder + granularTtlConfigBuilder) { + return granularTtlConfig(granularTtlConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder granularTtlConfig( + Optional + granularTtlConfig); + + /** Clears the value of granularTtlConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGranularTtlConfig() { + return granularTtlConfig(Optional.empty()); + } + + /** + * Setter for memoryRevisionDefaultTtl. + * + *

memoryRevisionDefaultTtl: Optional. The default TTL duration of the memory revisions in + * the Memory Bank. This applies to all operations that create a memory revision. If not set, a + * default TTL of 365 days will be used. + */ + @JsonProperty("memoryRevisionDefaultTtl") + public abstract Builder memoryRevisionDefaultTtl(Duration memoryRevisionDefaultTtl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder memoryRevisionDefaultTtl(Optional memoryRevisionDefaultTtl); + + /** Clears the value of memoryRevisionDefaultTtl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMemoryRevisionDefaultTtl() { + return memoryRevisionDefaultTtl(Optional.empty()); + } + + public abstract ReasoningEngineContextSpecMemoryBankConfigTtlConfig build(); + } + + /** Deserializes a JSON string to a ReasoningEngineContextSpecMemoryBankConfigTtlConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static ReasoningEngineContextSpecMemoryBankConfigTtlConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, ReasoningEngineContextSpecMemoryBankConfigTtlConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfigTtlConfigGranularTtlConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfigTtlConfigGranularTtlConfig.java new file mode 100644 index 000000000000..36a5c3efabf5 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineContextSpecMemoryBankConfigTtlConfigGranularTtlConfig.java @@ -0,0 +1,155 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.time.Duration; +import java.util.Optional; + +/** + * Configuration for TTL of the memories in the Memory Bank based on the action that created or + * updated the memory. + */ +@AutoValue +@JsonDeserialize( + builder = ReasoningEngineContextSpecMemoryBankConfigTtlConfigGranularTtlConfig.Builder.class) +public abstract class ReasoningEngineContextSpecMemoryBankConfigTtlConfigGranularTtlConfig + extends JsonSerializable { + /** Optional. The TTL duration for memories uploaded via CreateMemory. */ + @JsonProperty("createTtl") + public abstract Optional createTtl(); + + /** + * Optional. The TTL duration for memories newly generated via GenerateMemories + * (GenerateMemoriesResponse.GeneratedMemory.Action.CREATED). + */ + @JsonProperty("generateCreatedTtl") + public abstract Optional generateCreatedTtl(); + + /** + * Optional. The TTL duration for memories updated via GenerateMemories + * (GenerateMemoriesResponse.GeneratedMemory.Action.UPDATED). In the case of an UPDATE action, the + * `expire_time` of the existing memory will be updated to the new value (now + TTL). + */ + @JsonProperty("generateUpdatedTtl") + public abstract Optional generateUpdatedTtl(); + + /** + * Instantiates a builder for + * ReasoningEngineContextSpecMemoryBankConfigTtlConfigGranularTtlConfig. + */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ReasoningEngineContextSpecMemoryBankConfigTtlConfigGranularTtlConfig + .Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ReasoningEngineContextSpecMemoryBankConfigTtlConfigGranularTtlConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use + * `ReasoningEngineContextSpecMemoryBankConfigTtlConfigGranularTtlConfig.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ReasoningEngineContextSpecMemoryBankConfigTtlConfigGranularTtlConfig + .Builder(); + } + + /** + * Setter for createTtl. + * + *

createTtl: Optional. The TTL duration for memories uploaded via CreateMemory. + */ + @JsonProperty("createTtl") + public abstract Builder createTtl(Duration createTtl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder createTtl(Optional createTtl); + + /** Clears the value of createTtl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCreateTtl() { + return createTtl(Optional.empty()); + } + + /** + * Setter for generateCreatedTtl. + * + *

generateCreatedTtl: Optional. The TTL duration for memories newly generated via + * GenerateMemories (GenerateMemoriesResponse.GeneratedMemory.Action.CREATED). + */ + @JsonProperty("generateCreatedTtl") + public abstract Builder generateCreatedTtl(Duration generateCreatedTtl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder generateCreatedTtl(Optional generateCreatedTtl); + + /** Clears the value of generateCreatedTtl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGenerateCreatedTtl() { + return generateCreatedTtl(Optional.empty()); + } + + /** + * Setter for generateUpdatedTtl. + * + *

generateUpdatedTtl: Optional. The TTL duration for memories updated via GenerateMemories + * (GenerateMemoriesResponse.GeneratedMemory.Action.UPDATED). In the case of an UPDATE action, + * the `expire_time` of the existing memory will be updated to the new value (now + TTL). + */ + @JsonProperty("generateUpdatedTtl") + public abstract Builder generateUpdatedTtl(Duration generateUpdatedTtl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder generateUpdatedTtl(Optional generateUpdatedTtl); + + /** Clears the value of generateUpdatedTtl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGenerateUpdatedTtl() { + return generateUpdatedTtl(Optional.empty()); + } + + public abstract ReasoningEngineContextSpecMemoryBankConfigTtlConfigGranularTtlConfig build(); + } + + /** + * Deserializes a JSON string to a + * ReasoningEngineContextSpecMemoryBankConfigTtlConfigGranularTtlConfig object. + */ + @ExcludeFromGeneratedCoverageReport + public static ReasoningEngineContextSpecMemoryBankConfigTtlConfigGranularTtlConfig fromJson( + String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, ReasoningEngineContextSpecMemoryBankConfigTtlConfigGranularTtlConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpec.java new file mode 100644 index 000000000000..289594bcf132 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpec.java @@ -0,0 +1,346 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** The specification of an agent engine. */ +@AutoValue +@JsonDeserialize(builder = ReasoningEngineSpec.Builder.class) +public abstract class ReasoningEngineSpec extends JsonSerializable { + /** + * Optional. The OSS agent framework used to develop the agent. Currently supported values: + * "google-adk", "langchain", "langgraph", "ag2", "llama-index", "custom". + */ + @JsonProperty("agentFramework") + public abstract Optional agentFramework(); + + /** Optional. Declarations for object class methods in OpenAPI specification format. */ + @JsonProperty("classMethods") + public abstract Optional>> classMethods(); + + /** Optional. The specification of a Reasoning Engine deployment. */ + @JsonProperty("deploymentSpec") + public abstract Optional deploymentSpec(); + + /** + * Output only. The identity to use for the Reasoning Engine. It can contain one of the following + * values: * service-{project}@gcp-sa-aiplatform-re.googleapis.com (for SERVICE_AGENT identity + * type) * {name}@{project}.gserviceaccount.com (for SERVICE_ACCOUNT identity type) * + * agents.global.{org}.system.id.goog/resources/aiplatform/projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine} + * (for AGENT_IDENTITY identity type) + */ + @JsonProperty("effectiveIdentity") + public abstract Optional effectiveIdentity(); + + /** + * Optional. The identity type to use for the Reasoning Engine. If not specified, the + * `service_account` field will be used if set, otherwise the default Vertex AI Reasoning Engine + * Service Agent in the project will be used. + */ + @JsonProperty("identityType") + public abstract Optional identityType(); + + /** + * Optional. User provided package spec of the ReasoningEngine. Ignored when users directly + * specify a deployment image through `deployment_spec.first_party_image_override`, but keeping + * the field_behavior to avoid introducing breaking changes. The `deployment_source` field should + * not be set if `package_spec` is specified. + */ + @JsonProperty("packageSpec") + public abstract Optional packageSpec(); + + /** + * Optional. The service account that the Reasoning Engine artifact runs as. It should have + * "roles/storage.objectViewer" for reading the user project's Cloud Storage and + * "roles/aiplatform.user" for using Vertex extensions. If not specified, the Vertex AI Reasoning + * Engine Service Agent in the project will be used. + */ + @JsonProperty("serviceAccount") + public abstract Optional serviceAccount(); + + /** Deploy from source code files with a defined entrypoint. */ + @JsonProperty("sourceCodeSpec") + public abstract Optional sourceCodeSpec(); + + /** Instantiates a builder for ReasoningEngineSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ReasoningEngineSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ReasoningEngineSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ReasoningEngineSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ReasoningEngineSpec.Builder(); + } + + /** + * Setter for agentFramework. + * + *

agentFramework: Optional. The OSS agent framework used to develop the agent. Currently + * supported values: "google-adk", "langchain", "langgraph", "ag2", "llama-index", "custom". + */ + @JsonProperty("agentFramework") + public abstract Builder agentFramework(String agentFramework); + + @ExcludeFromGeneratedCoverageReport + abstract Builder agentFramework(Optional agentFramework); + + /** Clears the value of agentFramework field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAgentFramework() { + return agentFramework(Optional.empty()); + } + + /** + * Setter for classMethods. + * + *

classMethods: Optional. Declarations for object class methods in OpenAPI specification + * format. + */ + @JsonProperty("classMethods") + public abstract Builder classMethods(List> classMethods); + + /** + * Setter for classMethods. + * + *

classMethods: Optional. Declarations for object class methods in OpenAPI specification + * format. + */ + @CanIgnoreReturnValue + public Builder classMethods(Map... classMethods) { + return classMethods(Arrays.asList(classMethods)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder classMethods(Optional>> classMethods); + + /** Clears the value of classMethods field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearClassMethods() { + return classMethods(Optional.empty()); + } + + /** + * Setter for deploymentSpec. + * + *

deploymentSpec: Optional. The specification of a Reasoning Engine deployment. + */ + @JsonProperty("deploymentSpec") + public abstract Builder deploymentSpec(ReasoningEngineSpecDeploymentSpec deploymentSpec); + + /** + * Setter for deploymentSpec builder. + * + *

deploymentSpec: Optional. The specification of a Reasoning Engine deployment. + */ + @CanIgnoreReturnValue + public Builder deploymentSpec(ReasoningEngineSpecDeploymentSpec.Builder deploymentSpecBuilder) { + return deploymentSpec(deploymentSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder deploymentSpec(Optional deploymentSpec); + + /** Clears the value of deploymentSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDeploymentSpec() { + return deploymentSpec(Optional.empty()); + } + + /** + * Setter for effectiveIdentity. + * + *

effectiveIdentity: Output only. The identity to use for the Reasoning Engine. It can + * contain one of the following values: * service-{project}@gcp-sa-aiplatform-re.googleapis.com + * (for SERVICE_AGENT identity type) * {name}@{project}.gserviceaccount.com (for SERVICE_ACCOUNT + * identity type) * + * agents.global.{org}.system.id.goog/resources/aiplatform/projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine} + * (for AGENT_IDENTITY identity type) + */ + @JsonProperty("effectiveIdentity") + public abstract Builder effectiveIdentity(String effectiveIdentity); + + @ExcludeFromGeneratedCoverageReport + abstract Builder effectiveIdentity(Optional effectiveIdentity); + + /** Clears the value of effectiveIdentity field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEffectiveIdentity() { + return effectiveIdentity(Optional.empty()); + } + + /** + * Setter for identityType. + * + *

identityType: Optional. The identity type to use for the Reasoning Engine. If not + * specified, the `service_account` field will be used if set, otherwise the default Vertex AI + * Reasoning Engine Service Agent in the project will be used. + */ + @JsonProperty("identityType") + public abstract Builder identityType(IdentityType identityType); + + @ExcludeFromGeneratedCoverageReport + abstract Builder identityType(Optional identityType); + + /** Clears the value of identityType field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearIdentityType() { + return identityType(Optional.empty()); + } + + /** + * Setter for identityType given a known enum. + * + *

identityType: Optional. The identity type to use for the Reasoning Engine. If not + * specified, the `service_account` field will be used if set, otherwise the default Vertex AI + * Reasoning Engine Service Agent in the project will be used. + */ + @CanIgnoreReturnValue + public Builder identityType(IdentityType.Known knownType) { + return identityType(new IdentityType(knownType)); + } + + /** + * Setter for identityType given a string. + * + *

identityType: Optional. The identity type to use for the Reasoning Engine. If not + * specified, the `service_account` field will be used if set, otherwise the default Vertex AI + * Reasoning Engine Service Agent in the project will be used. + */ + @CanIgnoreReturnValue + public Builder identityType(String identityType) { + return identityType(new IdentityType(identityType)); + } + + /** + * Setter for packageSpec. + * + *

packageSpec: Optional. User provided package spec of the ReasoningEngine. Ignored when + * users directly specify a deployment image through + * `deployment_spec.first_party_image_override`, but keeping the field_behavior to avoid + * introducing breaking changes. The `deployment_source` field should not be set if + * `package_spec` is specified. + */ + @JsonProperty("packageSpec") + public abstract Builder packageSpec(ReasoningEngineSpecPackageSpec packageSpec); + + /** + * Setter for packageSpec builder. + * + *

packageSpec: Optional. User provided package spec of the ReasoningEngine. Ignored when + * users directly specify a deployment image through + * `deployment_spec.first_party_image_override`, but keeping the field_behavior to avoid + * introducing breaking changes. The `deployment_source` field should not be set if + * `package_spec` is specified. + */ + @CanIgnoreReturnValue + public Builder packageSpec(ReasoningEngineSpecPackageSpec.Builder packageSpecBuilder) { + return packageSpec(packageSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder packageSpec(Optional packageSpec); + + /** Clears the value of packageSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPackageSpec() { + return packageSpec(Optional.empty()); + } + + /** + * Setter for serviceAccount. + * + *

serviceAccount: Optional. The service account that the Reasoning Engine artifact runs as. + * It should have "roles/storage.objectViewer" for reading the user project's Cloud Storage and + * "roles/aiplatform.user" for using Vertex extensions. If not specified, the Vertex AI + * Reasoning Engine Service Agent in the project will be used. + */ + @JsonProperty("serviceAccount") + public abstract Builder serviceAccount(String serviceAccount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder serviceAccount(Optional serviceAccount); + + /** Clears the value of serviceAccount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearServiceAccount() { + return serviceAccount(Optional.empty()); + } + + /** + * Setter for sourceCodeSpec. + * + *

sourceCodeSpec: Deploy from source code files with a defined entrypoint. + */ + @JsonProperty("sourceCodeSpec") + public abstract Builder sourceCodeSpec(ReasoningEngineSpecSourceCodeSpec sourceCodeSpec); + + /** + * Setter for sourceCodeSpec builder. + * + *

sourceCodeSpec: Deploy from source code files with a defined entrypoint. + */ + @CanIgnoreReturnValue + public Builder sourceCodeSpec(ReasoningEngineSpecSourceCodeSpec.Builder sourceCodeSpecBuilder) { + return sourceCodeSpec(sourceCodeSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder sourceCodeSpec(Optional sourceCodeSpec); + + /** Clears the value of sourceCodeSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSourceCodeSpec() { + return sourceCodeSpec(Optional.empty()); + } + + public abstract ReasoningEngineSpec build(); + } + + /** Deserializes a JSON string to a ReasoningEngineSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static ReasoningEngineSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ReasoningEngineSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecDeploymentSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecDeploymentSpec.java new file mode 100644 index 000000000000..24cad8432893 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecDeploymentSpec.java @@ -0,0 +1,359 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** The specification of a Reasoning Engine deployment. */ +@AutoValue +@JsonDeserialize(builder = ReasoningEngineSpecDeploymentSpec.Builder.class) +public abstract class ReasoningEngineSpecDeploymentSpec extends JsonSerializable { + /** The agent server mode. */ + @JsonProperty("agentServerMode") + public abstract Optional agentServerMode(); + + /** + * Optional. The maximum number of concurrent requests that can be handled by the application. + * Defaults to 8. + */ + @JsonProperty("containerConcurrency") + public abstract Optional containerConcurrency(); + + /** + * Optional. Environment variables to be set with the Reasoning Engine deployment. The environment + * variables can be updated through the UpdateReasoningEngine API. + */ + @JsonProperty("env") + public abstract Optional> env(); + + /** + * Optional. The maximum number of application instances that can be launched to handle increased + * traffic. Defaults to 100. Range: [1, 1000]. If VPC-SC or PSC-I is enabled, the acceptable range + * is [1, 100]. + */ + @JsonProperty("maxInstances") + public abstract Optional maxInstances(); + + /** + * Optional. The minimum number of application instances that will be kept running at all times. + * Defaults to 1. + */ + @JsonProperty("minInstances") + public abstract Optional minInstances(); + + /** Optional. Configuration for PSC-I. */ + @JsonProperty("pscInterfaceConfig") + public abstract Optional pscInterfaceConfig(); + + /** + * Optional. Resource limits for each container. Only 'cpu' and 'memory' keys are supported. + * Defaults to {"cpu": "4", "memory": "4Gi"}. * The only supported values for CPU are '1', '2', + * '4', and '8'. For more information, go to https://cloud.google.com/run/docs/configuring/cpu. * + * For supported 'memory' values and syntax, go to + * https://cloud.google.com/run/docs/configuring/memory-limits + */ + @JsonProperty("resourceLimits") + public abstract Optional> resourceLimits(); + + /** + * Optional. Environment variables where the value is a secret in Cloud Secret Manager. To use + * this feature, add 'Secret Manager Secret Accessor' role (roles/secretmanager.secretAccessor) to + * AI Platform Reasoning Engine Service Agent. + */ + @JsonProperty("secretEnv") + public abstract Optional> secretEnv(); + + /** Instantiates a builder for ReasoningEngineSpecDeploymentSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ReasoningEngineSpecDeploymentSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ReasoningEngineSpecDeploymentSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ReasoningEngineSpecDeploymentSpec.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ReasoningEngineSpecDeploymentSpec.Builder(); + } + + /** + * Setter for agentServerMode. + * + *

agentServerMode: The agent server mode. + */ + @JsonProperty("agentServerMode") + public abstract Builder agentServerMode(AgentServerMode agentServerMode); + + @ExcludeFromGeneratedCoverageReport + abstract Builder agentServerMode(Optional agentServerMode); + + /** Clears the value of agentServerMode field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAgentServerMode() { + return agentServerMode(Optional.empty()); + } + + /** + * Setter for agentServerMode given a known enum. + * + *

agentServerMode: The agent server mode. + */ + @CanIgnoreReturnValue + public Builder agentServerMode(AgentServerMode.Known knownType) { + return agentServerMode(new AgentServerMode(knownType)); + } + + /** + * Setter for agentServerMode given a string. + * + *

agentServerMode: The agent server mode. + */ + @CanIgnoreReturnValue + public Builder agentServerMode(String agentServerMode) { + return agentServerMode(new AgentServerMode(agentServerMode)); + } + + /** + * Setter for containerConcurrency. + * + *

containerConcurrency: Optional. The maximum number of concurrent requests that can be + * handled by the application. Defaults to 8. + */ + @JsonProperty("containerConcurrency") + public abstract Builder containerConcurrency(Integer containerConcurrency); + + @ExcludeFromGeneratedCoverageReport + abstract Builder containerConcurrency(Optional containerConcurrency); + + /** Clears the value of containerConcurrency field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContainerConcurrency() { + return containerConcurrency(Optional.empty()); + } + + /** + * Setter for env. + * + *

env: Optional. Environment variables to be set with the Reasoning Engine deployment. The + * environment variables can be updated through the UpdateReasoningEngine API. + */ + @JsonProperty("env") + public abstract Builder env(List env); + + /** + * Setter for env. + * + *

env: Optional. Environment variables to be set with the Reasoning Engine deployment. The + * environment variables can be updated through the UpdateReasoningEngine API. + */ + @CanIgnoreReturnValue + public Builder env(EnvVar... env) { + return env(Arrays.asList(env)); + } + + /** + * Setter for env builder. + * + *

env: Optional. Environment variables to be set with the Reasoning Engine deployment. The + * environment variables can be updated through the UpdateReasoningEngine API. + */ + @CanIgnoreReturnValue + public Builder env(EnvVar.Builder... envBuilders) { + return env( + Arrays.asList(envBuilders).stream() + .map(EnvVar.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder env(Optional> env); + + /** Clears the value of env field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEnv() { + return env(Optional.empty()); + } + + /** + * Setter for maxInstances. + * + *

maxInstances: Optional. The maximum number of application instances that can be launched + * to handle increased traffic. Defaults to 100. Range: [1, 1000]. If VPC-SC or PSC-I is + * enabled, the acceptable range is [1, 100]. + */ + @JsonProperty("maxInstances") + public abstract Builder maxInstances(Integer maxInstances); + + @ExcludeFromGeneratedCoverageReport + abstract Builder maxInstances(Optional maxInstances); + + /** Clears the value of maxInstances field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMaxInstances() { + return maxInstances(Optional.empty()); + } + + /** + * Setter for minInstances. + * + *

minInstances: Optional. The minimum number of application instances that will be kept + * running at all times. Defaults to 1. + */ + @JsonProperty("minInstances") + public abstract Builder minInstances(Integer minInstances); + + @ExcludeFromGeneratedCoverageReport + abstract Builder minInstances(Optional minInstances); + + /** Clears the value of minInstances field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMinInstances() { + return minInstances(Optional.empty()); + } + + /** + * Setter for pscInterfaceConfig. + * + *

pscInterfaceConfig: Optional. Configuration for PSC-I. + */ + @JsonProperty("pscInterfaceConfig") + public abstract Builder pscInterfaceConfig(PscInterfaceConfig pscInterfaceConfig); + + /** + * Setter for pscInterfaceConfig builder. + * + *

pscInterfaceConfig: Optional. Configuration for PSC-I. + */ + @CanIgnoreReturnValue + public Builder pscInterfaceConfig(PscInterfaceConfig.Builder pscInterfaceConfigBuilder) { + return pscInterfaceConfig(pscInterfaceConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder pscInterfaceConfig(Optional pscInterfaceConfig); + + /** Clears the value of pscInterfaceConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPscInterfaceConfig() { + return pscInterfaceConfig(Optional.empty()); + } + + /** + * Setter for resourceLimits. + * + *

resourceLimits: Optional. Resource limits for each container. Only 'cpu' and 'memory' keys + * are supported. Defaults to {"cpu": "4", "memory": "4Gi"}. * The only supported values for CPU + * are '1', '2', '4', and '8'. For more information, go to + * https://cloud.google.com/run/docs/configuring/cpu. * For supported 'memory' values and + * syntax, go to https://cloud.google.com/run/docs/configuring/memory-limits + */ + @JsonProperty("resourceLimits") + public abstract Builder resourceLimits(Map resourceLimits); + + @ExcludeFromGeneratedCoverageReport + abstract Builder resourceLimits(Optional> resourceLimits); + + /** Clears the value of resourceLimits field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResourceLimits() { + return resourceLimits(Optional.empty()); + } + + /** + * Setter for secretEnv. + * + *

secretEnv: Optional. Environment variables where the value is a secret in Cloud Secret + * Manager. To use this feature, add 'Secret Manager Secret Accessor' role + * (roles/secretmanager.secretAccessor) to AI Platform Reasoning Engine Service Agent. + */ + @JsonProperty("secretEnv") + public abstract Builder secretEnv(List secretEnv); + + /** + * Setter for secretEnv. + * + *

secretEnv: Optional. Environment variables where the value is a secret in Cloud Secret + * Manager. To use this feature, add 'Secret Manager Secret Accessor' role + * (roles/secretmanager.secretAccessor) to AI Platform Reasoning Engine Service Agent. + */ + @CanIgnoreReturnValue + public Builder secretEnv(SecretEnvVar... secretEnv) { + return secretEnv(Arrays.asList(secretEnv)); + } + + /** + * Setter for secretEnv builder. + * + *

secretEnv: Optional. Environment variables where the value is a secret in Cloud Secret + * Manager. To use this feature, add 'Secret Manager Secret Accessor' role + * (roles/secretmanager.secretAccessor) to AI Platform Reasoning Engine Service Agent. + */ + @CanIgnoreReturnValue + public Builder secretEnv(SecretEnvVar.Builder... secretEnvBuilders) { + return secretEnv( + Arrays.asList(secretEnvBuilders).stream() + .map(SecretEnvVar.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder secretEnv(Optional> secretEnv); + + /** Clears the value of secretEnv field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSecretEnv() { + return secretEnv(Optional.empty()); + } + + public abstract ReasoningEngineSpecDeploymentSpec build(); + } + + /** Deserializes a JSON string to a ReasoningEngineSpecDeploymentSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static ReasoningEngineSpecDeploymentSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ReasoningEngineSpecDeploymentSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecPackageSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecPackageSpec.java new file mode 100644 index 000000000000..fd2a236e50d8 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecPackageSpec.java @@ -0,0 +1,154 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** User-provided package specification, containing pickled object and package requirements. */ +@AutoValue +@JsonDeserialize(builder = ReasoningEngineSpecPackageSpec.Builder.class) +public abstract class ReasoningEngineSpecPackageSpec extends JsonSerializable { + /** Optional. The Cloud Storage URI of the dependency files in tar.gz format. */ + @JsonProperty("dependencyFilesGcsUri") + public abstract Optional dependencyFilesGcsUri(); + + /** Optional. The Cloud Storage URI of the pickled python object. */ + @JsonProperty("pickleObjectGcsUri") + public abstract Optional pickleObjectGcsUri(); + + /** + * Optional. The Python version. Currently support 3.8, 3.9, 3.10, 3.11. If not specified, default + * value is 3.10. + */ + @JsonProperty("pythonVersion") + public abstract Optional pythonVersion(); + + /** Optional. The Cloud Storage URI of the `requirements.txt` file */ + @JsonProperty("requirementsGcsUri") + public abstract Optional requirementsGcsUri(); + + /** Instantiates a builder for ReasoningEngineSpecPackageSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ReasoningEngineSpecPackageSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ReasoningEngineSpecPackageSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ReasoningEngineSpecPackageSpec.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ReasoningEngineSpecPackageSpec.Builder(); + } + + /** + * Setter for dependencyFilesGcsUri. + * + *

dependencyFilesGcsUri: Optional. The Cloud Storage URI of the dependency files in tar.gz + * format. + */ + @JsonProperty("dependencyFilesGcsUri") + public abstract Builder dependencyFilesGcsUri(String dependencyFilesGcsUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder dependencyFilesGcsUri(Optional dependencyFilesGcsUri); + + /** Clears the value of dependencyFilesGcsUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDependencyFilesGcsUri() { + return dependencyFilesGcsUri(Optional.empty()); + } + + /** + * Setter for pickleObjectGcsUri. + * + *

pickleObjectGcsUri: Optional. The Cloud Storage URI of the pickled python object. + */ + @JsonProperty("pickleObjectGcsUri") + public abstract Builder pickleObjectGcsUri(String pickleObjectGcsUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pickleObjectGcsUri(Optional pickleObjectGcsUri); + + /** Clears the value of pickleObjectGcsUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPickleObjectGcsUri() { + return pickleObjectGcsUri(Optional.empty()); + } + + /** + * Setter for pythonVersion. + * + *

pythonVersion: Optional. The Python version. Currently support 3.8, 3.9, 3.10, 3.11. If + * not specified, default value is 3.10. + */ + @JsonProperty("pythonVersion") + public abstract Builder pythonVersion(String pythonVersion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pythonVersion(Optional pythonVersion); + + /** Clears the value of pythonVersion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPythonVersion() { + return pythonVersion(Optional.empty()); + } + + /** + * Setter for requirementsGcsUri. + * + *

requirementsGcsUri: Optional. The Cloud Storage URI of the `requirements.txt` file + */ + @JsonProperty("requirementsGcsUri") + public abstract Builder requirementsGcsUri(String requirementsGcsUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder requirementsGcsUri(Optional requirementsGcsUri); + + /** Clears the value of requirementsGcsUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRequirementsGcsUri() { + return requirementsGcsUri(Optional.empty()); + } + + public abstract ReasoningEngineSpecPackageSpec build(); + } + + /** Deserializes a JSON string to a ReasoningEngineSpecPackageSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static ReasoningEngineSpecPackageSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ReasoningEngineSpecPackageSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecSourceCodeSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecSourceCodeSpec.java new file mode 100644 index 000000000000..4910e7470c40 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecSourceCodeSpec.java @@ -0,0 +1,130 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Specification for deploying from source code. */ +@AutoValue +@JsonDeserialize(builder = ReasoningEngineSpecSourceCodeSpec.Builder.class) +public abstract class ReasoningEngineSpecSourceCodeSpec extends JsonSerializable { + /** Source code is provided directly in the request. */ + @JsonProperty("inlineSource") + public abstract Optional inlineSource(); + + /** Configuration for a Python application. */ + @JsonProperty("pythonSpec") + public abstract Optional pythonSpec(); + + /** Instantiates a builder for ReasoningEngineSpecSourceCodeSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ReasoningEngineSpecSourceCodeSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ReasoningEngineSpecSourceCodeSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ReasoningEngineSpecSourceCodeSpec.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ReasoningEngineSpecSourceCodeSpec.Builder(); + } + + /** + * Setter for inlineSource. + * + *

inlineSource: Source code is provided directly in the request. + */ + @JsonProperty("inlineSource") + public abstract Builder inlineSource( + ReasoningEngineSpecSourceCodeSpecInlineSource inlineSource); + + /** + * Setter for inlineSource builder. + * + *

inlineSource: Source code is provided directly in the request. + */ + @CanIgnoreReturnValue + public Builder inlineSource( + ReasoningEngineSpecSourceCodeSpecInlineSource.Builder inlineSourceBuilder) { + return inlineSource(inlineSourceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder inlineSource( + Optional inlineSource); + + /** Clears the value of inlineSource field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInlineSource() { + return inlineSource(Optional.empty()); + } + + /** + * Setter for pythonSpec. + * + *

pythonSpec: Configuration for a Python application. + */ + @JsonProperty("pythonSpec") + public abstract Builder pythonSpec(ReasoningEngineSpecSourceCodeSpecPythonSpec pythonSpec); + + /** + * Setter for pythonSpec builder. + * + *

pythonSpec: Configuration for a Python application. + */ + @CanIgnoreReturnValue + public Builder pythonSpec( + ReasoningEngineSpecSourceCodeSpecPythonSpec.Builder pythonSpecBuilder) { + return pythonSpec(pythonSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder pythonSpec(Optional pythonSpec); + + /** Clears the value of pythonSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPythonSpec() { + return pythonSpec(Optional.empty()); + } + + public abstract ReasoningEngineSpecSourceCodeSpec build(); + } + + /** Deserializes a JSON string to a ReasoningEngineSpecSourceCodeSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static ReasoningEngineSpecSourceCodeSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ReasoningEngineSpecSourceCodeSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecSourceCodeSpecInlineSource.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecSourceCodeSpecInlineSource.java new file mode 100644 index 000000000000..b6f19f9ab494 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecSourceCodeSpecInlineSource.java @@ -0,0 +1,89 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Specifies source code provided as a byte stream. */ +@AutoValue +@JsonDeserialize(builder = ReasoningEngineSpecSourceCodeSpecInlineSource.Builder.class) +public abstract class ReasoningEngineSpecSourceCodeSpecInlineSource extends JsonSerializable { + /** + * Required. Input only. The application source code archive, provided as a compressed tarball + * (.tar.gz) file. + */ + @JsonProperty("sourceArchive") + public abstract Optional sourceArchive(); + + /** Instantiates a builder for ReasoningEngineSpecSourceCodeSpecInlineSource. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ReasoningEngineSpecSourceCodeSpecInlineSource.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ReasoningEngineSpecSourceCodeSpecInlineSource. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ReasoningEngineSpecSourceCodeSpecInlineSource.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ReasoningEngineSpecSourceCodeSpecInlineSource.Builder(); + } + + /** + * Setter for sourceArchive. + * + *

sourceArchive: Required. Input only. The application source code archive, provided as a + * compressed tarball (.tar.gz) file. + */ + @JsonProperty("sourceArchive") + public abstract Builder sourceArchive(byte[] sourceArchive); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sourceArchive(Optional sourceArchive); + + /** Clears the value of sourceArchive field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSourceArchive() { + return sourceArchive(Optional.empty()); + } + + public abstract ReasoningEngineSpecSourceCodeSpecInlineSource build(); + } + + /** Deserializes a JSON string to a ReasoningEngineSpecSourceCodeSpecInlineSource object. */ + @ExcludeFromGeneratedCoverageReport + public static ReasoningEngineSpecSourceCodeSpecInlineSource fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, ReasoningEngineSpecSourceCodeSpecInlineSource.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecSourceCodeSpecPythonSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecSourceCodeSpecPythonSpec.java new file mode 100644 index 000000000000..151d973757fe --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReasoningEngineSpecSourceCodeSpecPythonSpec.java @@ -0,0 +1,170 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Specification for running a Python application from source. */ +@AutoValue +@JsonDeserialize(builder = ReasoningEngineSpecSourceCodeSpecPythonSpec.Builder.class) +public abstract class ReasoningEngineSpecSourceCodeSpecPythonSpec extends JsonSerializable { + /** + * Optional. The Python module to load as the entrypoint, specified as a fully qualified module + * name. For example: path.to.agent. If not specified, defaults to "agent". The project root will + * be added to Python sys.path, allowing imports to be specified relative to the root. + */ + @JsonProperty("entrypointModule") + public abstract Optional entrypointModule(); + + /** + * Optional. The name of the callable object within the `entrypoint_module` to use as the + * application If not specified, defaults to "root_agent". + */ + @JsonProperty("entrypointObject") + public abstract Optional entrypointObject(); + + /** + * Optional. The path to the requirements file, relative to the source root. If not specified, + * defaults to "requirements.txt". + */ + @JsonProperty("requirementsFile") + public abstract Optional requirementsFile(); + + /** + * Optional. The version of Python to use. Support version includes 3.9, 3.10, 3.11, 3.12, 3.13. + * If not specified, default value is 3.10. + */ + @JsonProperty("version") + public abstract Optional version(); + + /** Instantiates a builder for ReasoningEngineSpecSourceCodeSpecPythonSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ReasoningEngineSpecSourceCodeSpecPythonSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ReasoningEngineSpecSourceCodeSpecPythonSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ReasoningEngineSpecSourceCodeSpecPythonSpec.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ReasoningEngineSpecSourceCodeSpecPythonSpec.Builder(); + } + + /** + * Setter for entrypointModule. + * + *

entrypointModule: Optional. The Python module to load as the entrypoint, specified as a + * fully qualified module name. For example: path.to.agent. If not specified, defaults to + * "agent". The project root will be added to Python sys.path, allowing imports to be specified + * relative to the root. + */ + @JsonProperty("entrypointModule") + public abstract Builder entrypointModule(String entrypointModule); + + @ExcludeFromGeneratedCoverageReport + abstract Builder entrypointModule(Optional entrypointModule); + + /** Clears the value of entrypointModule field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEntrypointModule() { + return entrypointModule(Optional.empty()); + } + + /** + * Setter for entrypointObject. + * + *

entrypointObject: Optional. The name of the callable object within the `entrypoint_module` + * to use as the application If not specified, defaults to "root_agent". + */ + @JsonProperty("entrypointObject") + public abstract Builder entrypointObject(String entrypointObject); + + @ExcludeFromGeneratedCoverageReport + abstract Builder entrypointObject(Optional entrypointObject); + + /** Clears the value of entrypointObject field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEntrypointObject() { + return entrypointObject(Optional.empty()); + } + + /** + * Setter for requirementsFile. + * + *

requirementsFile: Optional. The path to the requirements file, relative to the source + * root. If not specified, defaults to "requirements.txt". + */ + @JsonProperty("requirementsFile") + public abstract Builder requirementsFile(String requirementsFile); + + @ExcludeFromGeneratedCoverageReport + abstract Builder requirementsFile(Optional requirementsFile); + + /** Clears the value of requirementsFile field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRequirementsFile() { + return requirementsFile(Optional.empty()); + } + + /** + * Setter for version. + * + *

version: Optional. The version of Python to use. Support version includes 3.9, 3.10, 3.11, + * 3.12, 3.13. If not specified, default value is 3.10. + */ + @JsonProperty("version") + public abstract Builder version(String version); + + @ExcludeFromGeneratedCoverageReport + abstract Builder version(Optional version); + + /** Clears the value of version field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearVersion() { + return version(Optional.empty()); + } + + public abstract ReasoningEngineSpecSourceCodeSpecPythonSpec build(); + } + + /** Deserializes a JSON string to a ReasoningEngineSpecSourceCodeSpecPythonSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static ReasoningEngineSpecSourceCodeSpecPythonSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, ReasoningEngineSpecSourceCodeSpecPythonSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReservationAffinity.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReservationAffinity.java new file mode 100644 index 000000000000..e563b108224e --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ReservationAffinity.java @@ -0,0 +1,172 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** + * A ReservationAffinity can be used to configure a Vertex AI resource (e.g., a DeployedModel) to + * draw its Compute Engine resources from a Shared Reservation, or exclusively from on-demand + * capacity. + */ +@AutoValue +@JsonDeserialize(builder = ReservationAffinity.Builder.class) +public abstract class ReservationAffinity extends JsonSerializable { + /** + * Optional. Corresponds to the label key of a reservation resource. To target a + * SPECIFIC_RESERVATION by name, use `compute.googleapis.com/reservation-name` as the key and + * specify the name of your reservation as its value. + */ + @JsonProperty("key") + public abstract Optional key(); + + /** Required. Specifies the reservation affinity type. */ + @JsonProperty("reservationAffinityType") + public abstract Optional reservationAffinityType(); + + /** + * Optional. Corresponds to the label values of a reservation resource. This must be the full + * resource name of the reservation or reservation block. + */ + @JsonProperty("values") + public abstract Optional> values(); + + /** Instantiates a builder for ReservationAffinity. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ReservationAffinity.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ReservationAffinity. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ReservationAffinity.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ReservationAffinity.Builder(); + } + + /** + * Setter for key. + * + *

key: Optional. Corresponds to the label key of a reservation resource. To target a + * SPECIFIC_RESERVATION by name, use `compute.googleapis.com/reservation-name` as the key and + * specify the name of your reservation as its value. + */ + @JsonProperty("key") + public abstract Builder key(String key); + + @ExcludeFromGeneratedCoverageReport + abstract Builder key(Optional key); + + /** Clears the value of key field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearKey() { + return key(Optional.empty()); + } + + /** + * Setter for reservationAffinityType. + * + *

reservationAffinityType: Required. Specifies the reservation affinity type. + */ + @JsonProperty("reservationAffinityType") + public abstract Builder reservationAffinityType(Type reservationAffinityType); + + @ExcludeFromGeneratedCoverageReport + abstract Builder reservationAffinityType(Optional reservationAffinityType); + + /** Clears the value of reservationAffinityType field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReservationAffinityType() { + return reservationAffinityType(Optional.empty()); + } + + /** + * Setter for reservationAffinityType given a known enum. + * + *

reservationAffinityType: Required. Specifies the reservation affinity type. + */ + @CanIgnoreReturnValue + public Builder reservationAffinityType(Type.Known knownType) { + return reservationAffinityType(new Type(knownType)); + } + + /** + * Setter for reservationAffinityType given a string. + * + *

reservationAffinityType: Required. Specifies the reservation affinity type. + */ + @CanIgnoreReturnValue + public Builder reservationAffinityType(String reservationAffinityType) { + return reservationAffinityType(new Type(reservationAffinityType)); + } + + /** + * Setter for values. + * + *

values: Optional. Corresponds to the label values of a reservation resource. This must be + * the full resource name of the reservation or reservation block. + */ + @JsonProperty("values") + public abstract Builder values(List values); + + /** + * Setter for values. + * + *

values: Optional. Corresponds to the label values of a reservation resource. This must be + * the full resource name of the reservation or reservation block. + */ + @CanIgnoreReturnValue + public Builder values(String... values) { + return values(Arrays.asList(values)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder values(Optional> values); + + /** Clears the value of values field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearValues() { + return values(Optional.empty()); + } + + public abstract ReservationAffinity build(); + } + + /** Deserializes a JSON string to a ReservationAffinity object. */ + @ExcludeFromGeneratedCoverageReport + public static ReservationAffinity fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ReservationAffinity.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ResponseCandidate.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ResponseCandidate.java new file mode 100644 index 000000000000..33b19525a225 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ResponseCandidate.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import java.util.Optional; + +/** A model-generated content to the prompt. */ +@AutoValue +@JsonDeserialize(builder = ResponseCandidate.Builder.class) +public abstract class ResponseCandidate extends JsonSerializable { + /** The final model-generated response to the `prompt`. */ + @JsonProperty("response") + public abstract Optional response(); + + /** Instantiates a builder for ResponseCandidate. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ResponseCandidate.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ResponseCandidate. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ResponseCandidate.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ResponseCandidate.Builder(); + } + + /** + * Setter for response. + * + *

response: The final model-generated response to the `prompt`. + */ + @JsonProperty("response") + public abstract Builder response(Content response); + + @ExcludeFromGeneratedCoverageReport + abstract Builder response(Optional response); + + /** Clears the value of response field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResponse() { + return response(Optional.empty()); + } + + public abstract ResponseCandidate build(); + } + + /** Deserializes a JSON string to a ResponseCandidate object. */ + @ExcludeFromGeneratedCoverageReport + public static ResponseCandidate fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ResponseCandidate.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ResponseCandidateResult.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ResponseCandidateResult.java new file mode 100644 index 000000000000..7bd447ca0ece --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ResponseCandidateResult.java @@ -0,0 +1,105 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Aggregated metric results for a single response candidate of an EvalCase. */ +@AutoValue +@JsonDeserialize(builder = ResponseCandidateResult.Builder.class) +public abstract class ResponseCandidateResult extends JsonSerializable { + /** Index of the response candidate this result pertains to. */ + @JsonProperty("responseIndex") + public abstract Optional responseIndex(); + + /** A dictionary of metric results for this response candidate, keyed by metric name. */ + @JsonProperty("metricResults") + public abstract Optional> metricResults(); + + /** Instantiates a builder for ResponseCandidateResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ResponseCandidateResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ResponseCandidateResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ResponseCandidateResult.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ResponseCandidateResult.Builder(); + } + + /** + * Setter for responseIndex. + * + *

responseIndex: Index of the response candidate this result pertains to. + */ + @JsonProperty("responseIndex") + public abstract Builder responseIndex(Integer responseIndex); + + @ExcludeFromGeneratedCoverageReport + abstract Builder responseIndex(Optional responseIndex); + + /** Clears the value of responseIndex field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResponseIndex() { + return responseIndex(Optional.empty()); + } + + /** + * Setter for metricResults. + * + *

metricResults: A dictionary of metric results for this response candidate, keyed by metric + * name. + */ + @JsonProperty("metricResults") + public abstract Builder metricResults(Map metricResults); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metricResults(Optional> metricResults); + + /** Clears the value of metricResults field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetricResults() { + return metricResults(Optional.empty()); + } + + public abstract ResponseCandidateResult build(); + } + + /** Deserializes a JSON string to a ResponseCandidateResult object. */ + @ExcludeFromGeneratedCoverageReport + public static ResponseCandidateResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ResponseCandidateResult.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RestoreVersionConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RestoreVersionConfig.java new file mode 100644 index 000000000000..6122b919cd37 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RestoreVersionConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for restoring a prompt version. */ +@AutoValue +@JsonDeserialize(builder = RestoreVersionConfig.Builder.class) +public abstract class RestoreVersionConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for RestoreVersionConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RestoreVersionConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RestoreVersionConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RestoreVersionConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RestoreVersionConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract RestoreVersionConfig build(); + } + + /** Deserializes a JSON string to a RestoreVersionConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static RestoreVersionConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RestoreVersionConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RestoreVersionOperation.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RestoreVersionOperation.java new file mode 100644 index 000000000000..bfc9de52c8a6 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RestoreVersionOperation.java @@ -0,0 +1,166 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Represents the restore version operation. */ +@AutoValue +@JsonDeserialize(builder = RestoreVersionOperation.Builder.class) +public abstract class RestoreVersionOperation extends JsonSerializable { + /** + * The server-assigned name, which is only unique within the same service that originally returns + * it. If you use the default HTTP mapping, the `name` should be a resource name ending with + * `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Service-specific metadata associated with the operation. It typically contains progress + * information and common metadata such as create time. Some services might not provide such + * metadata. Any method that returns a long-running operation should document the metadata type, + * if any. + */ + @JsonProperty("metadata") + public abstract Optional> metadata(); + + /** + * If the value is `false`, it means the operation is still in progress. If `true`, the operation + * is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Optional done(); + + /** The error result of the operation in case of failure or cancellation. */ + @JsonProperty("error") + public abstract Optional> error(); + + /** Instantiates a builder for RestoreVersionOperation. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RestoreVersionOperation.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RestoreVersionOperation. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RestoreVersionOperation.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RestoreVersionOperation.Builder(); + } + + /** + * Setter for name. + * + *

name: The server-assigned name, which is only unique within the same service that + * originally returns it. If you use the default HTTP mapping, the `name` should be a resource + * name ending with `operations/{unique_id}`. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Service-specific metadata associated with the operation. It typically contains + * progress information and common metadata such as create time. Some services might not provide + * such metadata. Any method that returns a long-running operation should document the metadata + * type, if any. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Map metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional> metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for done. + * + *

done: If the value is `false`, it means the operation is still in progress. If `true`, the + * operation is completed, and either `error` or `response` is available. + */ + @JsonProperty("done") + public abstract Builder done(boolean done); + + @ExcludeFromGeneratedCoverageReport + abstract Builder done(Optional done); + + /** Clears the value of done field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDone() { + return done(Optional.empty()); + } + + /** + * Setter for error. + * + *

error: The error result of the operation in case of failure or cancellation. + */ + @JsonProperty("error") + public abstract Builder error(Map error); + + @ExcludeFromGeneratedCoverageReport + abstract Builder error(Optional> error); + + /** Clears the value of error field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearError() { + return error(Optional.empty()); + } + + public abstract RestoreVersionOperation build(); + } + + /** Deserializes a JSON string to a RestoreVersionOperation object. */ + @ExcludeFromGeneratedCoverageReport + public static RestoreVersionOperation fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RestoreVersionOperation.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RestoreVersionRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RestoreVersionRequestParameters.java new file mode 100644 index 000000000000..8c0f7773a231 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RestoreVersionRequestParameters.java @@ -0,0 +1,139 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for restoring a prompt version. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = RestoreVersionRequestParameters.Builder.class) +public abstract class RestoreVersionRequestParameters extends JsonSerializable { + /** ID of the prompt dataset to be restored. */ + @JsonProperty("datasetId") + public abstract Optional datasetId(); + + /** ID of the prompt dataset version to be restored. */ + @JsonProperty("versionId") + public abstract Optional versionId(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for RestoreVersionRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RestoreVersionRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RestoreVersionRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `RestoreVersionRequestParameters.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_RestoreVersionRequestParameters.Builder(); + } + + /** + * Setter for datasetId. + * + *

datasetId: ID of the prompt dataset to be restored. + */ + @JsonProperty("datasetId") + public abstract Builder datasetId(String datasetId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder datasetId(Optional datasetId); + + /** Clears the value of datasetId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDatasetId() { + return datasetId(Optional.empty()); + } + + /** + * Setter for versionId. + * + *

versionId: ID of the prompt dataset version to be restored. + */ + @JsonProperty("versionId") + public abstract Builder versionId(String versionId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder versionId(Optional versionId); + + /** Clears the value of versionId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearVersionId() { + return versionId(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(RestoreVersionConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(RestoreVersionConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract RestoreVersionRequestParameters build(); + } + + /** Deserializes a JSON string to a RestoreVersionRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static RestoreVersionRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RestoreVersionRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveAgentEngineMemoriesConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveAgentEngineMemoriesConfig.java new file mode 100644 index 000000000000..2fc26f2b3137 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveAgentEngineMemoriesConfig.java @@ -0,0 +1,115 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for retrieving memories. */ +@AutoValue +@JsonDeserialize(builder = RetrieveAgentEngineMemoriesConfig.Builder.class) +public abstract class RetrieveAgentEngineMemoriesConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** + * The standard list filter that will be applied to the retrieved memories. More detail in + * [AIP-160](https://google.aip.dev/160). + * + *

Supported fields: `fact` `create_time` `update_time` + */ + @JsonProperty("filter") + public abstract Optional filter(); + + /** Instantiates a builder for RetrieveAgentEngineMemoriesConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RetrieveAgentEngineMemoriesConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RetrieveAgentEngineMemoriesConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `RetrieveAgentEngineMemoriesConfig.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_RetrieveAgentEngineMemoriesConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for filter. + * + *

filter: The standard list filter that will be applied to the retrieved memories. More + * detail in [AIP-160](https://google.aip.dev/160). + * + *

Supported fields: `fact` `create_time` `update_time` + */ + @JsonProperty("filter") + public abstract Builder filter(String filter); + + @ExcludeFromGeneratedCoverageReport + abstract Builder filter(Optional filter); + + /** Clears the value of filter field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFilter() { + return filter(Optional.empty()); + } + + public abstract RetrieveAgentEngineMemoriesConfig build(); + } + + /** Deserializes a JSON string to a RetrieveAgentEngineMemoriesConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static RetrieveAgentEngineMemoriesConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RetrieveAgentEngineMemoriesConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveAgentEngineMemoriesRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveAgentEngineMemoriesRequestParameters.java new file mode 100644 index 000000000000..d6626d0f4070 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveAgentEngineMemoriesRequestParameters.java @@ -0,0 +1,220 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Parameters for retrieving agent engine memories. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = RetrieveAgentEngineMemoriesRequestParameters.Builder.class) +public abstract class RetrieveAgentEngineMemoriesRequestParameters extends JsonSerializable { + /** Name of the agent engine to retrieve memories from. */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * The scope of the memories to retrieve. + * + *

A memory must have exactly the same scope as the scope provided here to be retrieved (i.e. + * same keys and values). Order does not matter, but it is case-sensitive. + */ + @JsonProperty("scope") + public abstract Optional> scope(); + + /** Parameters for semantic similarity search based retrieval. */ + @JsonProperty("similaritySearchParams") + public abstract Optional similaritySearchParams(); + + /** Parameters for simple (non-similarity search) retrieval. */ + @JsonProperty("simpleRetrievalParams") + public abstract Optional simpleRetrievalParams(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for RetrieveAgentEngineMemoriesRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RetrieveAgentEngineMemoriesRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RetrieveAgentEngineMemoriesRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `RetrieveAgentEngineMemoriesRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_RetrieveAgentEngineMemoriesRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine to retrieve memories from. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for scope. + * + *

scope: The scope of the memories to retrieve. + * + *

A memory must have exactly the same scope as the scope provided here to be retrieved (i.e. + * same keys and values). Order does not matter, but it is case-sensitive. + */ + @JsonProperty("scope") + public abstract Builder scope(Map scope); + + @ExcludeFromGeneratedCoverageReport + abstract Builder scope(Optional> scope); + + /** Clears the value of scope field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScope() { + return scope(Optional.empty()); + } + + /** + * Setter for similaritySearchParams. + * + *

similaritySearchParams: Parameters for semantic similarity search based retrieval. + */ + @JsonProperty("similaritySearchParams") + public abstract Builder similaritySearchParams( + RetrieveMemoriesRequestSimilaritySearchParams similaritySearchParams); + + /** + * Setter for similaritySearchParams builder. + * + *

similaritySearchParams: Parameters for semantic similarity search based retrieval. + */ + @CanIgnoreReturnValue + public Builder similaritySearchParams( + RetrieveMemoriesRequestSimilaritySearchParams.Builder similaritySearchParamsBuilder) { + return similaritySearchParams(similaritySearchParamsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder similaritySearchParams( + Optional similaritySearchParams); + + /** Clears the value of similaritySearchParams field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSimilaritySearchParams() { + return similaritySearchParams(Optional.empty()); + } + + /** + * Setter for simpleRetrievalParams. + * + *

simpleRetrievalParams: Parameters for simple (non-similarity search) retrieval. + */ + @JsonProperty("simpleRetrievalParams") + public abstract Builder simpleRetrievalParams( + RetrieveMemoriesRequestSimpleRetrievalParams simpleRetrievalParams); + + /** + * Setter for simpleRetrievalParams builder. + * + *

simpleRetrievalParams: Parameters for simple (non-similarity search) retrieval. + */ + @CanIgnoreReturnValue + public Builder simpleRetrievalParams( + RetrieveMemoriesRequestSimpleRetrievalParams.Builder simpleRetrievalParamsBuilder) { + return simpleRetrievalParams(simpleRetrievalParamsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder simpleRetrievalParams( + Optional simpleRetrievalParams); + + /** Clears the value of simpleRetrievalParams field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSimpleRetrievalParams() { + return simpleRetrievalParams(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(RetrieveAgentEngineMemoriesConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(RetrieveAgentEngineMemoriesConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract RetrieveAgentEngineMemoriesRequestParameters build(); + } + + /** Deserializes a JSON string to a RetrieveAgentEngineMemoriesRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static RetrieveAgentEngineMemoriesRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, RetrieveAgentEngineMemoriesRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesRequestSimilaritySearchParams.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesRequestSimilaritySearchParams.java new file mode 100644 index 000000000000..81c9dd3cd3f1 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesRequestSimilaritySearchParams.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** The parameters for semantic similarity search based retrieval. */ +@AutoValue +@JsonDeserialize(builder = RetrieveMemoriesRequestSimilaritySearchParams.Builder.class) +public abstract class RetrieveMemoriesRequestSimilaritySearchParams extends JsonSerializable { + /** + * Required. Query to use for similarity search retrieval. If provided, then the parent + * ReasoningEngine must have ReasoningEngineContextSpec.MemoryBankConfig.SimilaritySearchConfig + * set. + */ + @JsonProperty("searchQuery") + public abstract Optional searchQuery(); + + /** + * Optional. The maximum number of memories to return. The service may return fewer than this + * value. If unspecified, at most 3 memories will be returned. The maximum value is 100; values + * above 100 will be coerced to 100. + */ + @JsonProperty("topK") + public abstract Optional topK(); + + /** Instantiates a builder for RetrieveMemoriesRequestSimilaritySearchParams. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RetrieveMemoriesRequestSimilaritySearchParams.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RetrieveMemoriesRequestSimilaritySearchParams. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `RetrieveMemoriesRequestSimilaritySearchParams.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_RetrieveMemoriesRequestSimilaritySearchParams.Builder(); + } + + /** + * Setter for searchQuery. + * + *

searchQuery: Required. Query to use for similarity search retrieval. If provided, then the + * parent ReasoningEngine must have + * ReasoningEngineContextSpec.MemoryBankConfig.SimilaritySearchConfig set. + */ + @JsonProperty("searchQuery") + public abstract Builder searchQuery(String searchQuery); + + @ExcludeFromGeneratedCoverageReport + abstract Builder searchQuery(Optional searchQuery); + + /** Clears the value of searchQuery field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSearchQuery() { + return searchQuery(Optional.empty()); + } + + /** + * Setter for topK. + * + *

topK: Optional. The maximum number of memories to return. The service may return fewer + * than this value. If unspecified, at most 3 memories will be returned. The maximum value is + * 100; values above 100 will be coerced to 100. + */ + @JsonProperty("topK") + public abstract Builder topK(Integer topK); + + @ExcludeFromGeneratedCoverageReport + abstract Builder topK(Optional topK); + + /** Clears the value of topK field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTopK() { + return topK(Optional.empty()); + } + + public abstract RetrieveMemoriesRequestSimilaritySearchParams build(); + } + + /** Deserializes a JSON string to a RetrieveMemoriesRequestSimilaritySearchParams object. */ + @ExcludeFromGeneratedCoverageReport + public static RetrieveMemoriesRequestSimilaritySearchParams fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, RetrieveMemoriesRequestSimilaritySearchParams.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesRequestSimpleRetrievalParams.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesRequestSimpleRetrievalParams.java new file mode 100644 index 000000000000..7f5b6569000f --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesRequestSimpleRetrievalParams.java @@ -0,0 +1,117 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** The parameters for simple (non-similarity search) retrieval. */ +@AutoValue +@JsonDeserialize(builder = RetrieveMemoriesRequestSimpleRetrievalParams.Builder.class) +public abstract class RetrieveMemoriesRequestSimpleRetrievalParams extends JsonSerializable { + /** + * Optional. The maximum number of memories to return. The service may return fewer than this + * value. If unspecified, at most 3 memories will be returned. The maximum value is 100; values + * above 100 will be coerced to 100. + */ + @JsonProperty("pageSize") + public abstract Optional pageSize(); + + /** + * Optional. A page token, received from a previous `RetrieveMemories` call. Provide this to + * retrieve the subsequent page. + */ + @JsonProperty("pageToken") + public abstract Optional pageToken(); + + /** Instantiates a builder for RetrieveMemoriesRequestSimpleRetrievalParams. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RetrieveMemoriesRequestSimpleRetrievalParams.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RetrieveMemoriesRequestSimpleRetrievalParams. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `RetrieveMemoriesRequestSimpleRetrievalParams.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_RetrieveMemoriesRequestSimpleRetrievalParams.Builder(); + } + + /** + * Setter for pageSize. + * + *

pageSize: Optional. The maximum number of memories to return. The service may return fewer + * than this value. If unspecified, at most 3 memories will be returned. The maximum value is + * 100; values above 100 will be coerced to 100. + */ + @JsonProperty("pageSize") + public abstract Builder pageSize(Integer pageSize); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageSize(Optional pageSize); + + /** Clears the value of pageSize field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageSize() { + return pageSize(Optional.empty()); + } + + /** + * Setter for pageToken. + * + *

pageToken: Optional. A page token, received from a previous `RetrieveMemories` call. + * Provide this to retrieve the subsequent page. + */ + @JsonProperty("pageToken") + public abstract Builder pageToken(String pageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pageToken(Optional pageToken); + + /** Clears the value of pageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPageToken() { + return pageToken(Optional.empty()); + } + + public abstract RetrieveMemoriesRequestSimpleRetrievalParams build(); + } + + /** Deserializes a JSON string to a RetrieveMemoriesRequestSimpleRetrievalParams object. */ + @ExcludeFromGeneratedCoverageReport + public static RetrieveMemoriesRequestSimpleRetrievalParams fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, RetrieveMemoriesRequestSimpleRetrievalParams.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesResponse.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesResponse.java new file mode 100644 index 000000000000..ef06251f7e99 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesResponse.java @@ -0,0 +1,139 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The response for retrieving memories. */ +@AutoValue +@JsonDeserialize(builder = RetrieveMemoriesResponse.Builder.class) +public abstract class RetrieveMemoriesResponse extends JsonSerializable { + /** + * A token that can be sent as `page_token` to retrieve the next page. If this field is omitted, + * there are no subsequent pages. This token is not set if similarity search was used for + * retrieval. + */ + @JsonProperty("nextPageToken") + public abstract Optional nextPageToken(); + + /** The retrieved memories. */ + @JsonProperty("retrievedMemories") + public abstract Optional> retrievedMemories(); + + /** Instantiates a builder for RetrieveMemoriesResponse. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RetrieveMemoriesResponse.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RetrieveMemoriesResponse. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RetrieveMemoriesResponse.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RetrieveMemoriesResponse.Builder(); + } + + /** + * Setter for nextPageToken. + * + *

nextPageToken: A token that can be sent as `page_token` to retrieve the next page. If this + * field is omitted, there are no subsequent pages. This token is not set if similarity search + * was used for retrieval. + */ + @JsonProperty("nextPageToken") + public abstract Builder nextPageToken(String nextPageToken); + + @ExcludeFromGeneratedCoverageReport + abstract Builder nextPageToken(Optional nextPageToken); + + /** Clears the value of nextPageToken field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNextPageToken() { + return nextPageToken(Optional.empty()); + } + + /** + * Setter for retrievedMemories. + * + *

retrievedMemories: The retrieved memories. + */ + @JsonProperty("retrievedMemories") + public abstract Builder retrievedMemories( + List retrievedMemories); + + /** + * Setter for retrievedMemories. + * + *

retrievedMemories: The retrieved memories. + */ + @CanIgnoreReturnValue + public Builder retrievedMemories(RetrieveMemoriesResponseRetrievedMemory... retrievedMemories) { + return retrievedMemories(Arrays.asList(retrievedMemories)); + } + + /** + * Setter for retrievedMemories builder. + * + *

retrievedMemories: The retrieved memories. + */ + @CanIgnoreReturnValue + public Builder retrievedMemories( + RetrieveMemoriesResponseRetrievedMemory.Builder... retrievedMemoriesBuilders) { + return retrievedMemories( + Arrays.asList(retrievedMemoriesBuilders).stream() + .map(RetrieveMemoriesResponseRetrievedMemory.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder retrievedMemories( + Optional> retrievedMemories); + + /** Clears the value of retrievedMemories field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRetrievedMemories() { + return retrievedMemories(Optional.empty()); + } + + public abstract RetrieveMemoriesResponse build(); + } + + /** Deserializes a JSON string to a RetrieveMemoriesResponse object. */ + @ExcludeFromGeneratedCoverageReport + public static RetrieveMemoriesResponse fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RetrieveMemoriesResponse.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesResponseRetrievedMemory.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesResponseRetrievedMemory.java new file mode 100644 index 000000000000..f5a02b9e2e6b --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RetrieveMemoriesResponseRetrievedMemory.java @@ -0,0 +1,121 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** A retrieved memory. */ +@AutoValue +@JsonDeserialize(builder = RetrieveMemoriesResponseRetrievedMemory.Builder.class) +public abstract class RetrieveMemoriesResponseRetrievedMemory extends JsonSerializable { + /** + * The distance between the query and the retrieved Memory. Smaller values indicate more similar + * memories. This is only set if similarity search was used for retrieval. + */ + @JsonProperty("distance") + public abstract Optional distance(); + + /** The retrieved Memory. */ + @JsonProperty("memory") + public abstract Optional memory(); + + /** Instantiates a builder for RetrieveMemoriesResponseRetrievedMemory. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RetrieveMemoriesResponseRetrievedMemory.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RetrieveMemoriesResponseRetrievedMemory. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `RetrieveMemoriesResponseRetrievedMemory.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_RetrieveMemoriesResponseRetrievedMemory.Builder(); + } + + /** + * Setter for distance. + * + *

distance: The distance between the query and the retrieved Memory. Smaller values indicate + * more similar memories. This is only set if similarity search was used for retrieval. + */ + @JsonProperty("distance") + public abstract Builder distance(Double distance); + + @ExcludeFromGeneratedCoverageReport + abstract Builder distance(Optional distance); + + /** Clears the value of distance field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDistance() { + return distance(Optional.empty()); + } + + /** + * Setter for memory. + * + *

memory: The retrieved Memory. + */ + @JsonProperty("memory") + public abstract Builder memory(Memory memory); + + /** + * Setter for memory builder. + * + *

memory: The retrieved Memory. + */ + @CanIgnoreReturnValue + public Builder memory(Memory.Builder memoryBuilder) { + return memory(memoryBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder memory(Optional memory); + + /** Clears the value of memory field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMemory() { + return memory(Optional.empty()); + } + + public abstract RetrieveMemoriesResponseRetrievedMemory build(); + } + + /** Deserializes a JSON string to a RetrieveMemoriesResponseRetrievedMemory object. */ + @ExcludeFromGeneratedCoverageReport + public static RetrieveMemoriesResponseRetrievedMemory fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, RetrieveMemoriesResponseRetrievedMemory.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RollbackAgentEngineMemoryConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RollbackAgentEngineMemoryConfig.java new file mode 100644 index 000000000000..312b0fdd2c26 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RollbackAgentEngineMemoryConfig.java @@ -0,0 +1,106 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for rolling back a memory. */ +@AutoValue +@JsonDeserialize(builder = RollbackAgentEngineMemoryConfig.Builder.class) +public abstract class RollbackAgentEngineMemoryConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Waits for the operation to complete before returning. */ + @JsonProperty("waitForCompletion") + public abstract Optional waitForCompletion(); + + /** Instantiates a builder for RollbackAgentEngineMemoryConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RollbackAgentEngineMemoryConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RollbackAgentEngineMemoryConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `RollbackAgentEngineMemoryConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_RollbackAgentEngineMemoryConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for waitForCompletion. + * + *

waitForCompletion: Waits for the operation to complete before returning. + */ + @JsonProperty("waitForCompletion") + public abstract Builder waitForCompletion(boolean waitForCompletion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder waitForCompletion(Optional waitForCompletion); + + /** Clears the value of waitForCompletion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWaitForCompletion() { + return waitForCompletion(Optional.empty()); + } + + public abstract RollbackAgentEngineMemoryConfig build(); + } + + /** Deserializes a JSON string to a RollbackAgentEngineMemoryConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static RollbackAgentEngineMemoryConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RollbackAgentEngineMemoryConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RollbackAgentEngineMemoryRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RollbackAgentEngineMemoryRequestParameters.java new file mode 100644 index 000000000000..e9fb281fb102 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RollbackAgentEngineMemoryRequestParameters.java @@ -0,0 +1,141 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for generating agent engine memories. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = RollbackAgentEngineMemoryRequestParameters.Builder.class) +public abstract class RollbackAgentEngineMemoryRequestParameters extends JsonSerializable { + /** Name of the agent engine memory to rollback. */ + @JsonProperty("name") + public abstract Optional name(); + + /** The ID of the revision to rollback to. */ + @JsonProperty("targetRevisionId") + public abstract Optional targetRevisionId(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for RollbackAgentEngineMemoryRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RollbackAgentEngineMemoryRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RollbackAgentEngineMemoryRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `RollbackAgentEngineMemoryRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_RollbackAgentEngineMemoryRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine memory to rollback. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for targetRevisionId. + * + *

targetRevisionId: The ID of the revision to rollback to. + */ + @JsonProperty("targetRevisionId") + public abstract Builder targetRevisionId(String targetRevisionId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder targetRevisionId(Optional targetRevisionId); + + /** Clears the value of targetRevisionId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTargetRevisionId() { + return targetRevisionId(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(RollbackAgentEngineMemoryConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(RollbackAgentEngineMemoryConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract RollbackAgentEngineMemoryRequestParameters build(); + } + + /** Deserializes a JSON string to a RollbackAgentEngineMemoryRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static RollbackAgentEngineMemoryRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, RollbackAgentEngineMemoryRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RougeInput.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RougeInput.java new file mode 100644 index 000000000000..cd953361f1c9 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RougeInput.java @@ -0,0 +1,108 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Rouge input. */ +@AutoValue +@JsonDeserialize(builder = RougeInput.Builder.class) +public abstract class RougeInput extends JsonSerializable { + /** Required. Repeated rouge instances. */ + @JsonProperty("instances") + public abstract Optional> instances(); + + /** Instantiates a builder for RougeInput. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RougeInput.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RougeInput. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RougeInput.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RougeInput.Builder(); + } + + /** + * Setter for instances. + * + *

instances: Required. Repeated rouge instances. + */ + @JsonProperty("instances") + public abstract Builder instances(List instances); + + /** + * Setter for instances. + * + *

instances: Required. Repeated rouge instances. + */ + @CanIgnoreReturnValue + public Builder instances(RougeInstance... instances) { + return instances(Arrays.asList(instances)); + } + + /** + * Setter for instances builder. + * + *

instances: Required. Repeated rouge instances. + */ + @CanIgnoreReturnValue + public Builder instances(RougeInstance.Builder... instancesBuilders) { + return instances( + Arrays.asList(instancesBuilders).stream() + .map(RougeInstance.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder instances(Optional> instances); + + /** Clears the value of instances field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInstances() { + return instances(Optional.empty()); + } + + public abstract RougeInput build(); + } + + /** Deserializes a JSON string to a RougeInput object. */ + @ExcludeFromGeneratedCoverageReport + public static RougeInput fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RougeInput.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RougeInstance.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RougeInstance.java new file mode 100644 index 000000000000..e7278cd4dda0 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RougeInstance.java @@ -0,0 +1,103 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Rouge instance. */ +@AutoValue +@JsonDeserialize(builder = RougeInstance.Builder.class) +public abstract class RougeInstance extends JsonSerializable { + /** Required. Output of the evaluated model. */ + @JsonProperty("prediction") + public abstract Optional prediction(); + + /** Required. Ground truth used to compare against the prediction. */ + @JsonProperty("reference") + public abstract Optional reference(); + + /** Instantiates a builder for RougeInstance. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RougeInstance.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RougeInstance. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RougeInstance.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RougeInstance.Builder(); + } + + /** + * Setter for prediction. + * + *

prediction: Required. Output of the evaluated model. + */ + @JsonProperty("prediction") + public abstract Builder prediction(String prediction); + + @ExcludeFromGeneratedCoverageReport + abstract Builder prediction(Optional prediction); + + /** Clears the value of prediction field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPrediction() { + return prediction(Optional.empty()); + } + + /** + * Setter for reference. + * + *

reference: Required. Ground truth used to compare against the prediction. + */ + @JsonProperty("reference") + public abstract Builder reference(String reference); + + @ExcludeFromGeneratedCoverageReport + abstract Builder reference(Optional reference); + + /** Clears the value of reference field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReference() { + return reference(Optional.empty()); + } + + public abstract RougeInstance build(); + } + + /** Deserializes a JSON string to a RougeInstance object. */ + @ExcludeFromGeneratedCoverageReport + public static RougeInstance fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RougeInstance.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RougeMetricValue.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RougeMetricValue.java new file mode 100644 index 000000000000..172826d5664c --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RougeMetricValue.java @@ -0,0 +1,81 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Rouge metric value for an instance. */ +@AutoValue +@JsonDeserialize(builder = RougeMetricValue.Builder.class) +public abstract class RougeMetricValue extends JsonSerializable { + /** Output only. Rouge score. */ + @JsonProperty("score") + public abstract Optional score(); + + /** Instantiates a builder for RougeMetricValue. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RougeMetricValue.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RougeMetricValue. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RougeMetricValue.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RougeMetricValue.Builder(); + } + + /** + * Setter for score. + * + *

score: Output only. Rouge score. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + @ExcludeFromGeneratedCoverageReport + abstract Builder score(Optional score); + + /** Clears the value of score field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScore() { + return score(Optional.empty()); + } + + public abstract RougeMetricValue build(); + } + + /** Deserializes a JSON string to a RougeMetricValue object. */ + @ExcludeFromGeneratedCoverageReport + public static RougeMetricValue fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RougeMetricValue.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RougeResults.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RougeResults.java new file mode 100644 index 000000000000..0faef3317c2c --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RougeResults.java @@ -0,0 +1,108 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Results for rouge metric. */ +@AutoValue +@JsonDeserialize(builder = RougeResults.Builder.class) +public abstract class RougeResults extends JsonSerializable { + /** Output only. Rouge metric values. */ + @JsonProperty("rougeMetricValues") + public abstract Optional> rougeMetricValues(); + + /** Instantiates a builder for RougeResults. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RougeResults.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RougeResults. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RougeResults.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RougeResults.Builder(); + } + + /** + * Setter for rougeMetricValues. + * + *

rougeMetricValues: Output only. Rouge metric values. + */ + @JsonProperty("rougeMetricValues") + public abstract Builder rougeMetricValues(List rougeMetricValues); + + /** + * Setter for rougeMetricValues. + * + *

rougeMetricValues: Output only. Rouge metric values. + */ + @CanIgnoreReturnValue + public Builder rougeMetricValues(RougeMetricValue... rougeMetricValues) { + return rougeMetricValues(Arrays.asList(rougeMetricValues)); + } + + /** + * Setter for rougeMetricValues builder. + * + *

rougeMetricValues: Output only. Rouge metric values. + */ + @CanIgnoreReturnValue + public Builder rougeMetricValues(RougeMetricValue.Builder... rougeMetricValuesBuilders) { + return rougeMetricValues( + Arrays.asList(rougeMetricValuesBuilders).stream() + .map(RougeMetricValue.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rougeMetricValues(Optional> rougeMetricValues); + + /** Clears the value of rougeMetricValues field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRougeMetricValues() { + return rougeMetricValues(Optional.empty()); + } + + public abstract RougeResults build(); + } + + /** Deserializes a JSON string to a RougeResults object. */ + @ExcludeFromGeneratedCoverageReport + public static RougeResults fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RougeResults.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Rubric.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Rubric.java new file mode 100644 index 000000000000..00f58745c09f --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Rubric.java @@ -0,0 +1,192 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** + * Message representing a single testable criterion for evaluation. + * + *

One input prompt could have multiple rubrics. + */ +@AutoValue +@JsonDeserialize(builder = Rubric.Builder.class) +public abstract class Rubric extends JsonSerializable { + /** + * Required. Unique identifier for the rubric. This ID is used to refer to this rubric, e.g., in + * RubricVerdict. + */ + @JsonProperty("rubricId") + public abstract Optional rubricId(); + + /** Required. The actual testable criteria for the rubric. */ + @JsonProperty("content") + public abstract Optional content(); + + /** + * Optional. A type designator for the rubric, which can inform how it's evaluated or interpreted + * by systems or users. It's recommended to use consistent, well-defined, upper snake_case + * strings. Examples: "SUMMARIZATION_QUALITY", "SAFETY_HARMFUL_CONTENT", "INSTRUCTION_ADHERENCE". + */ + @JsonProperty("type") + public abstract Optional type(); + + /** Optional. The relative importance of this rubric. */ + @JsonProperty("importance") + public abstract Optional importance(); + + /** Instantiates a builder for Rubric. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_Rubric.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for Rubric. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `Rubric.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_Rubric.Builder(); + } + + /** + * Setter for rubricId. + * + *

rubricId: Required. Unique identifier for the rubric. This ID is used to refer to this + * rubric, e.g., in RubricVerdict. + */ + @JsonProperty("rubricId") + public abstract Builder rubricId(String rubricId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubricId(Optional rubricId); + + /** Clears the value of rubricId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubricId() { + return rubricId(Optional.empty()); + } + + /** + * Setter for content. + * + *

content: Required. The actual testable criteria for the rubric. + */ + @JsonProperty("content") + public abstract Builder content(RubricContent content); + + /** + * Setter for content builder. + * + *

content: Required. The actual testable criteria for the rubric. + */ + @CanIgnoreReturnValue + public Builder content(RubricContent.Builder contentBuilder) { + return content(contentBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder content(Optional content); + + /** Clears the value of content field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContent() { + return content(Optional.empty()); + } + + /** + * Setter for type. + * + *

type: Optional. A type designator for the rubric, which can inform how it's evaluated or + * interpreted by systems or users. It's recommended to use consistent, well-defined, upper + * snake_case strings. Examples: "SUMMARIZATION_QUALITY", "SAFETY_HARMFUL_CONTENT", + * "INSTRUCTION_ADHERENCE". + */ + @JsonProperty("type") + public abstract Builder type(String type); + + @ExcludeFromGeneratedCoverageReport + abstract Builder type(Optional type); + + /** Clears the value of type field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearType() { + return type(Optional.empty()); + } + + /** + * Setter for importance. + * + *

importance: Optional. The relative importance of this rubric. + */ + @JsonProperty("importance") + public abstract Builder importance(Importance importance); + + @ExcludeFromGeneratedCoverageReport + abstract Builder importance(Optional importance); + + /** Clears the value of importance field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearImportance() { + return importance(Optional.empty()); + } + + /** + * Setter for importance given a known enum. + * + *

importance: Optional. The relative importance of this rubric. + */ + @CanIgnoreReturnValue + public Builder importance(Importance.Known knownType) { + return importance(new Importance(knownType)); + } + + /** + * Setter for importance given a string. + * + *

importance: Optional. The relative importance of this rubric. + */ + @CanIgnoreReturnValue + public Builder importance(String importance) { + return importance(new Importance(importance)); + } + + public abstract Rubric build(); + } + + /** Deserializes a JSON string to a Rubric object. */ + @ExcludeFromGeneratedCoverageReport + public static Rubric fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, Rubric.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricBasedMetricInput.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricBasedMetricInput.java new file mode 100644 index 000000000000..889e13ba717b --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricBasedMetricInput.java @@ -0,0 +1,123 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Input for a rubric-based metrics. */ +@AutoValue +@JsonDeserialize(builder = RubricBasedMetricInput.Builder.class) +public abstract class RubricBasedMetricInput extends JsonSerializable { + /** Specification for the rubric-based metric. */ + @JsonProperty("metricSpec") + public abstract Optional metricSpec(); + + /** The instance to be evaluated. */ + @JsonProperty("instance") + public abstract Optional instance(); + + /** Instantiates a builder for RubricBasedMetricInput. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RubricBasedMetricInput.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RubricBasedMetricInput. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RubricBasedMetricInput.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RubricBasedMetricInput.Builder(); + } + + /** + * Setter for metricSpec. + * + *

metricSpec: Specification for the rubric-based metric. + */ + @JsonProperty("metricSpec") + public abstract Builder metricSpec(RubricBasedMetricSpec metricSpec); + + /** + * Setter for metricSpec builder. + * + *

metricSpec: Specification for the rubric-based metric. + */ + @CanIgnoreReturnValue + public Builder metricSpec(RubricBasedMetricSpec.Builder metricSpecBuilder) { + return metricSpec(metricSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metricSpec(Optional metricSpec); + + /** Clears the value of metricSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetricSpec() { + return metricSpec(Optional.empty()); + } + + /** + * Setter for instance. + * + *

instance: The instance to be evaluated. + */ + @JsonProperty("instance") + public abstract Builder instance(RubricBasedMetricInstance instance); + + /** + * Setter for instance builder. + * + *

instance: The instance to be evaluated. + */ + @CanIgnoreReturnValue + public Builder instance(RubricBasedMetricInstance.Builder instanceBuilder) { + return instance(instanceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder instance(Optional instance); + + /** Clears the value of instance field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInstance() { + return instance(Optional.empty()); + } + + public abstract RubricBasedMetricInput build(); + } + + /** Deserializes a JSON string to a RubricBasedMetricInput object. */ + @ExcludeFromGeneratedCoverageReport + public static RubricBasedMetricInput fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RubricBasedMetricInput.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricBasedMetricInstance.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricBasedMetricInstance.java new file mode 100644 index 000000000000..45d7e4315a67 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricBasedMetricInstance.java @@ -0,0 +1,117 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Defines an instance for Rubric-based metrics, allowing various input formats. */ +@AutoValue +@JsonDeserialize(builder = RubricBasedMetricInstance.Builder.class) +public abstract class RubricBasedMetricInstance extends JsonSerializable { + /** Specify evaluation fields and their string values in JSON format. */ + @JsonProperty("jsonInstance") + public abstract Optional jsonInstance(); + + /** Provide input as Gemini Content along with one or more associated rubric groups. */ + @JsonProperty("rubricEnhancedContents") + public abstract Optional rubricEnhancedContents(); + + /** Instantiates a builder for RubricBasedMetricInstance. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RubricBasedMetricInstance.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RubricBasedMetricInstance. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RubricBasedMetricInstance.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RubricBasedMetricInstance.Builder(); + } + + /** + * Setter for jsonInstance. + * + *

jsonInstance: Specify evaluation fields and their string values in JSON format. + */ + @JsonProperty("jsonInstance") + public abstract Builder jsonInstance(String jsonInstance); + + @ExcludeFromGeneratedCoverageReport + abstract Builder jsonInstance(Optional jsonInstance); + + /** Clears the value of jsonInstance field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearJsonInstance() { + return jsonInstance(Optional.empty()); + } + + /** + * Setter for rubricEnhancedContents. + * + *

rubricEnhancedContents: Provide input as Gemini Content along with one or more associated + * rubric groups. + */ + @JsonProperty("rubricEnhancedContents") + public abstract Builder rubricEnhancedContents(RubricEnhancedContents rubricEnhancedContents); + + /** + * Setter for rubricEnhancedContents builder. + * + *

rubricEnhancedContents: Provide input as Gemini Content along with one or more associated + * rubric groups. + */ + @CanIgnoreReturnValue + public Builder rubricEnhancedContents( + RubricEnhancedContents.Builder rubricEnhancedContentsBuilder) { + return rubricEnhancedContents(rubricEnhancedContentsBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubricEnhancedContents( + Optional rubricEnhancedContents); + + /** Clears the value of rubricEnhancedContents field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubricEnhancedContents() { + return rubricEnhancedContents(Optional.empty()); + } + + public abstract RubricBasedMetricInstance build(); + } + + /** Deserializes a JSON string to a RubricBasedMetricInstance object. */ + @ExcludeFromGeneratedCoverageReport + public static RubricBasedMetricInstance fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RubricBasedMetricInstance.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricBasedMetricResult.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricBasedMetricResult.java new file mode 100644 index 000000000000..6515a4e87cea --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricBasedMetricResult.java @@ -0,0 +1,130 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Result for a rubric-based metric. */ +@AutoValue +@JsonDeserialize(builder = RubricBasedMetricResult.Builder.class) +public abstract class RubricBasedMetricResult extends JsonSerializable { + /** Passing rate of all the rubrics. */ + @JsonProperty("score") + public abstract Optional score(); + + /** The details of all the rubrics and their verdicts. */ + @JsonProperty("rubricVerdicts") + public abstract Optional> rubricVerdicts(); + + /** Instantiates a builder for RubricBasedMetricResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RubricBasedMetricResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RubricBasedMetricResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RubricBasedMetricResult.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RubricBasedMetricResult.Builder(); + } + + /** + * Setter for score. + * + *

score: Passing rate of all the rubrics. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + @ExcludeFromGeneratedCoverageReport + abstract Builder score(Optional score); + + /** Clears the value of score field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScore() { + return score(Optional.empty()); + } + + /** + * Setter for rubricVerdicts. + * + *

rubricVerdicts: The details of all the rubrics and their verdicts. + */ + @JsonProperty("rubricVerdicts") + public abstract Builder rubricVerdicts(List rubricVerdicts); + + /** + * Setter for rubricVerdicts. + * + *

rubricVerdicts: The details of all the rubrics and their verdicts. + */ + @CanIgnoreReturnValue + public Builder rubricVerdicts(RubricVerdict... rubricVerdicts) { + return rubricVerdicts(Arrays.asList(rubricVerdicts)); + } + + /** + * Setter for rubricVerdicts builder. + * + *

rubricVerdicts: The details of all the rubrics and their verdicts. + */ + @CanIgnoreReturnValue + public Builder rubricVerdicts(RubricVerdict.Builder... rubricVerdictsBuilders) { + return rubricVerdicts( + Arrays.asList(rubricVerdictsBuilders).stream() + .map(RubricVerdict.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubricVerdicts(Optional> rubricVerdicts); + + /** Clears the value of rubricVerdicts field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubricVerdicts() { + return rubricVerdicts(Optional.empty()); + } + + public abstract RubricBasedMetricResult build(); + } + + /** Deserializes a JSON string to a RubricBasedMetricResult object. */ + @ExcludeFromGeneratedCoverageReport + public static RubricBasedMetricResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RubricBasedMetricResult.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricBasedMetricSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricBasedMetricSpec.java new file mode 100644 index 000000000000..1f4b1b472202 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricBasedMetricSpec.java @@ -0,0 +1,214 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.AutoraterConfig; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Specification for a metric that is based on rubrics. */ +@AutoValue +@JsonDeserialize(builder = RubricBasedMetricSpec.Builder.class) +public abstract class RubricBasedMetricSpec extends JsonSerializable { + /** Template for the prompt used by the judge model to evaluate against rubrics. */ + @JsonProperty("metricPromptTemplate") + public abstract Optional metricPromptTemplate(); + + /** Optional configuration for the judge LLM (Autorater). */ + @JsonProperty("judgeAutoraterConfig") + public abstract Optional judgeAutoraterConfig(); + + /** Use rubrics provided directly in the spec. */ + @JsonProperty("inlineRubrics") + public abstract Optional> inlineRubrics(); + + /** + * Use a pre-defined group of rubrics associated with the input content. This refers to a key in + * the `rubric_groups` map of `RubricEnhancedContents`. + */ + @JsonProperty("rubricGroupKey") + public abstract Optional rubricGroupKey(); + + /** Dynamically generate rubrics for evaluation using this specification. */ + @JsonProperty("rubricGenerationSpec") + public abstract Optional rubricGenerationSpec(); + + /** Instantiates a builder for RubricBasedMetricSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RubricBasedMetricSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RubricBasedMetricSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RubricBasedMetricSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RubricBasedMetricSpec.Builder(); + } + + /** + * Setter for metricPromptTemplate. + * + *

metricPromptTemplate: Template for the prompt used by the judge model to evaluate against + * rubrics. + */ + @JsonProperty("metricPromptTemplate") + public abstract Builder metricPromptTemplate(String metricPromptTemplate); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metricPromptTemplate(Optional metricPromptTemplate); + + /** Clears the value of metricPromptTemplate field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetricPromptTemplate() { + return metricPromptTemplate(Optional.empty()); + } + + /** + * Setter for judgeAutoraterConfig. + * + *

judgeAutoraterConfig: Optional configuration for the judge LLM (Autorater). + */ + @JsonProperty("judgeAutoraterConfig") + public abstract Builder judgeAutoraterConfig(AutoraterConfig judgeAutoraterConfig); + + @ExcludeFromGeneratedCoverageReport + abstract Builder judgeAutoraterConfig(Optional judgeAutoraterConfig); + + /** Clears the value of judgeAutoraterConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearJudgeAutoraterConfig() { + return judgeAutoraterConfig(Optional.empty()); + } + + /** + * Setter for inlineRubrics. + * + *

inlineRubrics: Use rubrics provided directly in the spec. + */ + @JsonProperty("inlineRubrics") + public abstract Builder inlineRubrics(List inlineRubrics); + + /** + * Setter for inlineRubrics. + * + *

inlineRubrics: Use rubrics provided directly in the spec. + */ + @CanIgnoreReturnValue + public Builder inlineRubrics(Rubric... inlineRubrics) { + return inlineRubrics(Arrays.asList(inlineRubrics)); + } + + /** + * Setter for inlineRubrics builder. + * + *

inlineRubrics: Use rubrics provided directly in the spec. + */ + @CanIgnoreReturnValue + public Builder inlineRubrics(Rubric.Builder... inlineRubricsBuilders) { + return inlineRubrics( + Arrays.asList(inlineRubricsBuilders).stream() + .map(Rubric.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder inlineRubrics(Optional> inlineRubrics); + + /** Clears the value of inlineRubrics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInlineRubrics() { + return inlineRubrics(Optional.empty()); + } + + /** + * Setter for rubricGroupKey. + * + *

rubricGroupKey: Use a pre-defined group of rubrics associated with the input content. This + * refers to a key in the `rubric_groups` map of `RubricEnhancedContents`. + */ + @JsonProperty("rubricGroupKey") + public abstract Builder rubricGroupKey(String rubricGroupKey); + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubricGroupKey(Optional rubricGroupKey); + + /** Clears the value of rubricGroupKey field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubricGroupKey() { + return rubricGroupKey(Optional.empty()); + } + + /** + * Setter for rubricGenerationSpec. + * + *

rubricGenerationSpec: Dynamically generate rubrics for evaluation using this + * specification. + */ + @JsonProperty("rubricGenerationSpec") + public abstract Builder rubricGenerationSpec(RubricGenerationSpec rubricGenerationSpec); + + /** + * Setter for rubricGenerationSpec builder. + * + *

rubricGenerationSpec: Dynamically generate rubrics for evaluation using this + * specification. + */ + @CanIgnoreReturnValue + public Builder rubricGenerationSpec(RubricGenerationSpec.Builder rubricGenerationSpecBuilder) { + return rubricGenerationSpec(rubricGenerationSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubricGenerationSpec(Optional rubricGenerationSpec); + + /** Clears the value of rubricGenerationSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubricGenerationSpec() { + return rubricGenerationSpec(Optional.empty()); + } + + public abstract RubricBasedMetricSpec build(); + } + + /** Deserializes a JSON string to a RubricBasedMetricSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static RubricBasedMetricSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RubricBasedMetricSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricContent.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricContent.java new file mode 100644 index 000000000000..c28e5652f5f5 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricContent.java @@ -0,0 +1,91 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Content of the rubric, defining the testable criteria. */ +@AutoValue +@JsonDeserialize(builder = RubricContent.Builder.class) +public abstract class RubricContent extends JsonSerializable { + /** Evaluation criteria based on a specific property. */ + @JsonProperty("property") + public abstract Optional property(); + + /** Instantiates a builder for RubricContent. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RubricContent.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RubricContent. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RubricContent.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RubricContent.Builder(); + } + + /** + * Setter for property. + * + *

property: Evaluation criteria based on a specific property. + */ + @JsonProperty("property") + public abstract Builder property(RubricContentProperty property); + + /** + * Setter for property builder. + * + *

property: Evaluation criteria based on a specific property. + */ + @CanIgnoreReturnValue + public Builder property(RubricContentProperty.Builder propertyBuilder) { + return property(propertyBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder property(Optional property); + + /** Clears the value of property field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearProperty() { + return property(Optional.empty()); + } + + public abstract RubricContent build(); + } + + /** Deserializes a JSON string to a RubricContent object. */ + @ExcludeFromGeneratedCoverageReport + public static RubricContent fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RubricContent.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricContentProperty.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricContentProperty.java new file mode 100644 index 000000000000..b7f1a47f3052 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricContentProperty.java @@ -0,0 +1,85 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Defines criteria based on a specific property. */ +@AutoValue +@JsonDeserialize(builder = RubricContentProperty.Builder.class) +public abstract class RubricContentProperty extends JsonSerializable { + /** + * Description of the property being evaluated. Example: "The model's response is grammatically + * correct." + */ + @JsonProperty("description") + public abstract Optional description(); + + /** Instantiates a builder for RubricContentProperty. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RubricContentProperty.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RubricContentProperty. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RubricContentProperty.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RubricContentProperty.Builder(); + } + + /** + * Setter for description. + * + *

description: Description of the property being evaluated. Example: "The model's response + * is grammatically correct." + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + public abstract RubricContentProperty build(); + } + + /** Deserializes a JSON string to a RubricContentProperty object. */ + @ExcludeFromGeneratedCoverageReport + public static RubricContentProperty fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RubricContentProperty.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricContentType.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricContentType.java new file mode 100644 index 000000000000..d7ddb85b47a6 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricContentType.java @@ -0,0 +1,113 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** Specifies the type of rubric content to generate. */ +public class RubricContentType { + + /** Enum representing the known values for RubricContentType. */ + public enum Known { + /** Generate rubrics based on properties. */ + PROPERTY, + + /** Generate rubrics in an NL question answer format. */ + NL_QUESTION_ANSWER, + + /** Generate rubrics in a unit test format. */ + PYTHON_CODE_ASSERTION, + + RUBRIC_CONTENT_TYPE_UNSPECIFIED + } + + private Known rubricContentTypeEnum; + private final String value; + + @JsonCreator + public RubricContentType(String value) { + this.value = value; + for (Known rubricContentTypeEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(rubricContentTypeEnum.toString(), value)) { + this.rubricContentTypeEnum = rubricContentTypeEnum; + break; + } + } + if (this.rubricContentTypeEnum == null) { + this.rubricContentTypeEnum = Known.RUBRIC_CONTENT_TYPE_UNSPECIFIED; + } + } + + public RubricContentType(Known knownValue) { + this.rubricContentTypeEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof RubricContentType)) { + return false; + } + + RubricContentType other = (RubricContentType) o; + + if (this.rubricContentTypeEnum != Known.RUBRIC_CONTENT_TYPE_UNSPECIFIED + && other.rubricContentTypeEnum != Known.RUBRIC_CONTENT_TYPE_UNSPECIFIED) { + return this.rubricContentTypeEnum == other.rubricContentTypeEnum; + } else if (this.rubricContentTypeEnum == Known.RUBRIC_CONTENT_TYPE_UNSPECIFIED + && other.rubricContentTypeEnum == Known.RUBRIC_CONTENT_TYPE_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.rubricContentTypeEnum != Known.RUBRIC_CONTENT_TYPE_UNSPECIFIED) { + return this.rubricContentTypeEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.rubricContentTypeEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricEnhancedContents.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricEnhancedContents.java new file mode 100644 index 000000000000..ba7cf7ced112 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricEnhancedContents.java @@ -0,0 +1,126 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Rubric-enhanced contents for evaluation. */ +@AutoValue +@JsonDeserialize(builder = RubricEnhancedContents.Builder.class) +public abstract class RubricEnhancedContents extends JsonSerializable { + /** User prompt, using the standard Content type from the Gen AI SDK. */ + @JsonProperty("prompt") + public abstract Optional> prompt(); + + /** Response, using the standard Content type from the Gen AI SDK. */ + @JsonProperty("response") + public abstract Optional> response(); + + /** Instantiates a builder for RubricEnhancedContents. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RubricEnhancedContents.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RubricEnhancedContents. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RubricEnhancedContents.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RubricEnhancedContents.Builder(); + } + + /** + * Setter for prompt. + * + *

prompt: User prompt, using the standard Content type from the Gen AI SDK. + */ + @JsonProperty("prompt") + public abstract Builder prompt(List prompt); + + /** + * Setter for prompt. + * + *

prompt: User prompt, using the standard Content type from the Gen AI SDK. + */ + @CanIgnoreReturnValue + public Builder prompt(Content... prompt) { + return prompt(Arrays.asList(prompt)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder prompt(Optional> prompt); + + /** Clears the value of prompt field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPrompt() { + return prompt(Optional.empty()); + } + + /** + * Setter for response. + * + *

response: Response, using the standard Content type from the Gen AI SDK. + */ + @JsonProperty("response") + public abstract Builder response(List response); + + /** + * Setter for response. + * + *

response: Response, using the standard Content type from the Gen AI SDK. + */ + @CanIgnoreReturnValue + public Builder response(Content... response) { + return response(Arrays.asList(response)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder response(Optional> response); + + /** Clears the value of response field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResponse() { + return response(Optional.empty()); + } + + public abstract RubricEnhancedContents build(); + } + + /** Deserializes a JSON string to a RubricEnhancedContents object. */ + @ExcludeFromGeneratedCoverageReport + public static RubricEnhancedContents fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RubricEnhancedContents.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricGenerationConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricGenerationConfig.java new file mode 100644 index 000000000000..929ea2b26d77 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricGenerationConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for generating rubrics. */ +@AutoValue +@JsonDeserialize(builder = RubricGenerationConfig.Builder.class) +public abstract class RubricGenerationConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for RubricGenerationConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RubricGenerationConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RubricGenerationConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RubricGenerationConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RubricGenerationConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract RubricGenerationConfig build(); + } + + /** Deserializes a JSON string to a RubricGenerationConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static RubricGenerationConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RubricGenerationConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricGenerationSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricGenerationSpec.java new file mode 100644 index 000000000000..be924395193d --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricGenerationSpec.java @@ -0,0 +1,197 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.AutoraterConfig; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Spec for generating rubrics. */ +@AutoValue +@JsonDeserialize(builder = RubricGenerationSpec.Builder.class) +public abstract class RubricGenerationSpec extends JsonSerializable { + /** + * Template for the prompt used to generate rubrics. The details should be updated based on the + * most-recent recipe requirements. + */ + @JsonProperty("promptTemplate") + public abstract Optional promptTemplate(); + + /** + * Configuration for the model used in rubric generation. Configs including sampling count and + * base model can be specified here. Flipping is not supported for rubric generation. + */ + @JsonProperty("generatorModelConfig") + public abstract Optional generatorModelConfig(); + + /** The type of rubric content to be generated. */ + @JsonProperty("rubricContentType") + public abstract Optional rubricContentType(); + + /** + * An optional, pre-defined list of allowed types for generated rubrics. If this field is + * provided, it implies `include_rubric_type` should be true, and the generated rubric types + * should be chosen from this ontology. + */ + @JsonProperty("rubricTypeOntology") + public abstract Optional> rubricTypeOntology(); + + /** Instantiates a builder for RubricGenerationSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RubricGenerationSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RubricGenerationSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RubricGenerationSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RubricGenerationSpec.Builder(); + } + + /** + * Setter for promptTemplate. + * + *

promptTemplate: Template for the prompt used to generate rubrics. The details should be + * updated based on the most-recent recipe requirements. + */ + @JsonProperty("promptTemplate") + public abstract Builder promptTemplate(String promptTemplate); + + @ExcludeFromGeneratedCoverageReport + abstract Builder promptTemplate(Optional promptTemplate); + + /** Clears the value of promptTemplate field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPromptTemplate() { + return promptTemplate(Optional.empty()); + } + + /** + * Setter for generatorModelConfig. + * + *

generatorModelConfig: Configuration for the model used in rubric generation. Configs + * including sampling count and base model can be specified here. Flipping is not supported for + * rubric generation. + */ + @JsonProperty("generatorModelConfig") + public abstract Builder generatorModelConfig(AutoraterConfig generatorModelConfig); + + @ExcludeFromGeneratedCoverageReport + abstract Builder generatorModelConfig(Optional generatorModelConfig); + + /** Clears the value of generatorModelConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGeneratorModelConfig() { + return generatorModelConfig(Optional.empty()); + } + + /** + * Setter for rubricContentType. + * + *

rubricContentType: The type of rubric content to be generated. + */ + @JsonProperty("rubricContentType") + public abstract Builder rubricContentType(RubricContentType rubricContentType); + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubricContentType(Optional rubricContentType); + + /** Clears the value of rubricContentType field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubricContentType() { + return rubricContentType(Optional.empty()); + } + + /** + * Setter for rubricContentType given a known enum. + * + *

rubricContentType: The type of rubric content to be generated. + */ + @CanIgnoreReturnValue + public Builder rubricContentType(RubricContentType.Known knownType) { + return rubricContentType(new RubricContentType(knownType)); + } + + /** + * Setter for rubricContentType given a string. + * + *

rubricContentType: The type of rubric content to be generated. + */ + @CanIgnoreReturnValue + public Builder rubricContentType(String rubricContentType) { + return rubricContentType(new RubricContentType(rubricContentType)); + } + + /** + * Setter for rubricTypeOntology. + * + *

rubricTypeOntology: An optional, pre-defined list of allowed types for generated rubrics. + * If this field is provided, it implies `include_rubric_type` should be true, and the generated + * rubric types should be chosen from this ontology. + */ + @JsonProperty("rubricTypeOntology") + public abstract Builder rubricTypeOntology(List rubricTypeOntology); + + /** + * Setter for rubricTypeOntology. + * + *

rubricTypeOntology: An optional, pre-defined list of allowed types for generated rubrics. + * If this field is provided, it implies `include_rubric_type` should be true, and the generated + * rubric types should be chosen from this ontology. + */ + @CanIgnoreReturnValue + public Builder rubricTypeOntology(String... rubricTypeOntology) { + return rubricTypeOntology(Arrays.asList(rubricTypeOntology)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubricTypeOntology(Optional> rubricTypeOntology); + + /** Clears the value of rubricTypeOntology field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubricTypeOntology() { + return rubricTypeOntology(Optional.empty()); + } + + public abstract RubricGenerationSpec build(); + } + + /** Deserializes a JSON string to a RubricGenerationSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static RubricGenerationSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RubricGenerationSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricGroup.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricGroup.java new file mode 100644 index 000000000000..b34a27b06c73 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricGroup.java @@ -0,0 +1,158 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** A group of rubrics, used for grouping rubrics based on a metric or a version. */ +@AutoValue +@JsonDeserialize(builder = RubricGroup.Builder.class) +public abstract class RubricGroup extends JsonSerializable { + /** Unique identifier for the group. */ + @JsonProperty("groupId") + public abstract Optional groupId(); + + /** + * Human-readable name for the group. This should be unique within a given context if used for + * display or selection. Example: "Instruction Following V1", "Content Quality - Summarization + * Task". + */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** Rubrics that are part of this group. */ + @JsonProperty("rubrics") + public abstract Optional> rubrics(); + + /** Instantiates a builder for RubricGroup. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RubricGroup.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RubricGroup. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RubricGroup.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RubricGroup.Builder(); + } + + /** + * Setter for groupId. + * + *

groupId: Unique identifier for the group. + */ + @JsonProperty("groupId") + public abstract Builder groupId(String groupId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder groupId(Optional groupId); + + /** Clears the value of groupId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGroupId() { + return groupId(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: Human-readable name for the group. This should be unique within a given + * context if used for display or selection. Example: "Instruction Following V1", "Content + * Quality - Summarization Task". + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for rubrics. + * + *

rubrics: Rubrics that are part of this group. + */ + @JsonProperty("rubrics") + public abstract Builder rubrics(List rubrics); + + /** + * Setter for rubrics. + * + *

rubrics: Rubrics that are part of this group. + */ + @CanIgnoreReturnValue + public Builder rubrics(Rubric... rubrics) { + return rubrics(Arrays.asList(rubrics)); + } + + /** + * Setter for rubrics builder. + * + *

rubrics: Rubrics that are part of this group. + */ + @CanIgnoreReturnValue + public Builder rubrics(Rubric.Builder... rubricsBuilders) { + return rubrics( + Arrays.asList(rubricsBuilders).stream() + .map(Rubric.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder rubrics(Optional> rubrics); + + /** Clears the value of rubrics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRubrics() { + return rubrics(Optional.empty()); + } + + public abstract RubricGroup build(); + } + + /** Deserializes a JSON string to a RubricGroup object. */ + @ExcludeFromGeneratedCoverageReport + public static RubricGroup fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RubricGroup.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricVerdict.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricVerdict.java new file mode 100644 index 000000000000..a56c282c4d09 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/RubricVerdict.java @@ -0,0 +1,152 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents the verdict of an evaluation against a single rubric. */ +@AutoValue +@JsonDeserialize(builder = RubricVerdict.Builder.class) +public abstract class RubricVerdict extends JsonSerializable { + /** + * Required. The full rubric definition that was evaluated. Storing this ensures the verdict is + * self-contained and understandable, especially if the original rubric definition changes or was + * dynamically generated. + */ + @JsonProperty("evaluatedRubric") + public abstract Optional evaluatedRubric(); + + /** + * Required. Outcome of the evaluation against the rubric, represented as a boolean. `true` + * indicates a "Pass", `false` indicates a "Fail". + */ + @JsonProperty("verdict") + public abstract Optional verdict(); + + /** + * Optional. Human-readable reasoning or explanation for the verdict. This can include specific + * examples or details from the evaluated content that justify the given verdict. + */ + @JsonProperty("reasoning") + public abstract Optional reasoning(); + + /** Instantiates a builder for RubricVerdict. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_RubricVerdict.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for RubricVerdict. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `RubricVerdict.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_RubricVerdict.Builder(); + } + + /** + * Setter for evaluatedRubric. + * + *

evaluatedRubric: Required. The full rubric definition that was evaluated. Storing this + * ensures the verdict is self-contained and understandable, especially if the original rubric + * definition changes or was dynamically generated. + */ + @JsonProperty("evaluatedRubric") + public abstract Builder evaluatedRubric(Rubric evaluatedRubric); + + /** + * Setter for evaluatedRubric builder. + * + *

evaluatedRubric: Required. The full rubric definition that was evaluated. Storing this + * ensures the verdict is self-contained and understandable, especially if the original rubric + * definition changes or was dynamically generated. + */ + @CanIgnoreReturnValue + public Builder evaluatedRubric(Rubric.Builder evaluatedRubricBuilder) { + return evaluatedRubric(evaluatedRubricBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder evaluatedRubric(Optional evaluatedRubric); + + /** Clears the value of evaluatedRubric field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEvaluatedRubric() { + return evaluatedRubric(Optional.empty()); + } + + /** + * Setter for verdict. + * + *

verdict: Required. Outcome of the evaluation against the rubric, represented as a boolean. + * `true` indicates a "Pass", `false` indicates a "Fail". + */ + @JsonProperty("verdict") + public abstract Builder verdict(boolean verdict); + + @ExcludeFromGeneratedCoverageReport + abstract Builder verdict(Optional verdict); + + /** Clears the value of verdict field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearVerdict() { + return verdict(Optional.empty()); + } + + /** + * Setter for reasoning. + * + *

reasoning: Optional. Human-readable reasoning or explanation for the verdict. This can + * include specific examples or details from the evaluated content that justify the given + * verdict. + */ + @JsonProperty("reasoning") + public abstract Builder reasoning(String reasoning); + + @ExcludeFromGeneratedCoverageReport + abstract Builder reasoning(Optional reasoning); + + /** Clears the value of reasoning field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReasoning() { + return reasoning(Optional.empty()); + } + + public abstract RubricVerdict build(); + } + + /** Deserializes a JSON string to a RubricVerdict object. */ + @ExcludeFromGeneratedCoverageReport + public static RubricVerdict fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, RubricVerdict.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SamplingConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SamplingConfig.java new file mode 100644 index 000000000000..c29d014699f0 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SamplingConfig.java @@ -0,0 +1,145 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Sampling config for a BigQuery request set. */ +@AutoValue +@JsonDeserialize(builder = SamplingConfig.Builder.class) +public abstract class SamplingConfig extends JsonSerializable { + /** */ + @JsonProperty("samplingCount") + public abstract Optional samplingCount(); + + /** */ + @JsonProperty("samplingMethod") + public abstract Optional samplingMethod(); + + /** */ + @JsonProperty("samplingDuration") + public abstract Optional samplingDuration(); + + /** Instantiates a builder for SamplingConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SamplingConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SamplingConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `SamplingConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_SamplingConfig.Builder(); + } + + /** + * Setter for samplingCount. + * + *

samplingCount: + */ + @JsonProperty("samplingCount") + public abstract Builder samplingCount(Integer samplingCount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder samplingCount(Optional samplingCount); + + /** Clears the value of samplingCount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSamplingCount() { + return samplingCount(Optional.empty()); + } + + /** + * Setter for samplingMethod. + * + *

samplingMethod: + */ + @JsonProperty("samplingMethod") + public abstract Builder samplingMethod(SamplingMethod samplingMethod); + + @ExcludeFromGeneratedCoverageReport + abstract Builder samplingMethod(Optional samplingMethod); + + /** Clears the value of samplingMethod field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSamplingMethod() { + return samplingMethod(Optional.empty()); + } + + /** + * Setter for samplingMethod given a known enum. + * + *

samplingMethod: + */ + @CanIgnoreReturnValue + public Builder samplingMethod(SamplingMethod.Known knownType) { + return samplingMethod(new SamplingMethod(knownType)); + } + + /** + * Setter for samplingMethod given a string. + * + *

samplingMethod: + */ + @CanIgnoreReturnValue + public Builder samplingMethod(String samplingMethod) { + return samplingMethod(new SamplingMethod(samplingMethod)); + } + + /** + * Setter for samplingDuration. + * + *

samplingDuration: + */ + @JsonProperty("samplingDuration") + public abstract Builder samplingDuration(String samplingDuration); + + @ExcludeFromGeneratedCoverageReport + abstract Builder samplingDuration(Optional samplingDuration); + + /** Clears the value of samplingDuration field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSamplingDuration() { + return samplingDuration(Optional.empty()); + } + + public abstract SamplingConfig build(); + } + + /** Deserializes a JSON string to a SamplingConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static SamplingConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SamplingConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SamplingMethod.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SamplingMethod.java new file mode 100644 index 000000000000..ea98fde2c59e --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SamplingMethod.java @@ -0,0 +1,110 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** Represents the sampling method for a BigQuery request set. */ +public class SamplingMethod { + + /** Enum representing the known values for SamplingMethod. */ + public enum Known { + /** Sampling method is unspecified. */ + UNSPECIFIED, + + /** Sampling method is random. */ + RANDOM, + + SAMPLING_METHOD_UNSPECIFIED + } + + private Known samplingMethodEnum; + private final String value; + + @JsonCreator + public SamplingMethod(String value) { + this.value = value; + for (Known samplingMethodEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(samplingMethodEnum.toString(), value)) { + this.samplingMethodEnum = samplingMethodEnum; + break; + } + } + if (this.samplingMethodEnum == null) { + this.samplingMethodEnum = Known.SAMPLING_METHOD_UNSPECIFIED; + } + } + + public SamplingMethod(Known knownValue) { + this.samplingMethodEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof SamplingMethod)) { + return false; + } + + SamplingMethod other = (SamplingMethod) o; + + if (this.samplingMethodEnum != Known.SAMPLING_METHOD_UNSPECIFIED + && other.samplingMethodEnum != Known.SAMPLING_METHOD_UNSPECIFIED) { + return this.samplingMethodEnum == other.samplingMethodEnum; + } else if (this.samplingMethodEnum == Known.SAMPLING_METHOD_UNSPECIFIED + && other.samplingMethodEnum == Known.SAMPLING_METHOD_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.samplingMethodEnum != Known.SAMPLING_METHOD_UNSPECIFIED) { + return this.samplingMethodEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.samplingMethodEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironment.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironment.java new file mode 100644 index 000000000000..20ca69128d30 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironment.java @@ -0,0 +1,304 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.time.Duration; +import java.time.Instant; +import java.util.Optional; + +/** A sandbox environment. */ +@AutoValue +@JsonDeserialize(builder = SandboxEnvironment.Builder.class) +public abstract class SandboxEnvironment extends JsonSerializable { + /** Expiration time of the sandbox environment. */ + @JsonProperty("expireTime") + public abstract Optional expireTime(); + + /** Output only. The connection information of the SandboxEnvironment. */ + @JsonProperty("connectionInfo") + public abstract Optional connectionInfo(); + + /** Output only. The timestamp when this SandboxEnvironment was created. */ + @JsonProperty("createTime") + public abstract Optional createTime(); + + /** Required. The display name of the SandboxEnvironment. */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** Identifier. The name of the SandboxEnvironment. */ + @JsonProperty("name") + public abstract Optional name(); + + /** Optional. The configuration of the SandboxEnvironment. */ + @JsonProperty("spec") + public abstract Optional spec(); + + /** Output only. The runtime state of the SandboxEnvironment. */ + @JsonProperty("state") + public abstract Optional state(); + + /** + * Optional. Input only. The TTL for the sandbox environment. The expiration time is computed: now + * + TTL. + */ + @JsonProperty("ttl") + public abstract Optional ttl(); + + /** Output only. The timestamp when this SandboxEnvironment was most recently updated. */ + @JsonProperty("updateTime") + public abstract Optional updateTime(); + + /** Instantiates a builder for SandboxEnvironment. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SandboxEnvironment.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SandboxEnvironment. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `SandboxEnvironment.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_SandboxEnvironment.Builder(); + } + + /** + * Setter for expireTime. + * + *

expireTime: Expiration time of the sandbox environment. + */ + @JsonProperty("expireTime") + public abstract Builder expireTime(Instant expireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder expireTime(Optional expireTime); + + /** Clears the value of expireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExpireTime() { + return expireTime(Optional.empty()); + } + + /** + * Setter for connectionInfo. + * + *

connectionInfo: Output only. The connection information of the SandboxEnvironment. + */ + @JsonProperty("connectionInfo") + public abstract Builder connectionInfo(SandboxEnvironmentConnectionInfo connectionInfo); + + /** + * Setter for connectionInfo builder. + * + *

connectionInfo: Output only. The connection information of the SandboxEnvironment. + */ + @CanIgnoreReturnValue + public Builder connectionInfo(SandboxEnvironmentConnectionInfo.Builder connectionInfoBuilder) { + return connectionInfo(connectionInfoBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder connectionInfo(Optional connectionInfo); + + /** Clears the value of connectionInfo field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConnectionInfo() { + return connectionInfo(Optional.empty()); + } + + /** + * Setter for createTime. + * + *

createTime: Output only. The timestamp when this SandboxEnvironment was created. + */ + @JsonProperty("createTime") + public abstract Builder createTime(Instant createTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder createTime(Optional createTime); + + /** Clears the value of createTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCreateTime() { + return createTime(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: Required. The display name of the SandboxEnvironment. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for name. + * + *

name: Identifier. The name of the SandboxEnvironment. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for spec. + * + *

spec: Optional. The configuration of the SandboxEnvironment. + */ + @JsonProperty("spec") + public abstract Builder spec(SandboxEnvironmentSpec spec); + + /** + * Setter for spec builder. + * + *

spec: Optional. The configuration of the SandboxEnvironment. + */ + @CanIgnoreReturnValue + public Builder spec(SandboxEnvironmentSpec.Builder specBuilder) { + return spec(specBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder spec(Optional spec); + + /** Clears the value of spec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSpec() { + return spec(Optional.empty()); + } + + /** + * Setter for state. + * + *

state: Output only. The runtime state of the SandboxEnvironment. + */ + @JsonProperty("state") + public abstract Builder state(State state); + + @ExcludeFromGeneratedCoverageReport + abstract Builder state(Optional state); + + /** Clears the value of state field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearState() { + return state(Optional.empty()); + } + + /** + * Setter for state given a known enum. + * + *

state: Output only. The runtime state of the SandboxEnvironment. + */ + @CanIgnoreReturnValue + public Builder state(State.Known knownType) { + return state(new State(knownType)); + } + + /** + * Setter for state given a string. + * + *

state: Output only. The runtime state of the SandboxEnvironment. + */ + @CanIgnoreReturnValue + public Builder state(String state) { + return state(new State(state)); + } + + /** + * Setter for ttl. + * + *

ttl: Optional. Input only. The TTL for the sandbox environment. The expiration time is + * computed: now + TTL. + */ + @JsonProperty("ttl") + public abstract Builder ttl(Duration ttl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder ttl(Optional ttl); + + /** Clears the value of ttl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTtl() { + return ttl(Optional.empty()); + } + + /** + * Setter for updateTime. + * + *

updateTime: Output only. The timestamp when this SandboxEnvironment was most recently + * updated. + */ + @JsonProperty("updateTime") + public abstract Builder updateTime(Instant updateTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder updateTime(Optional updateTime); + + /** Clears the value of updateTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUpdateTime() { + return updateTime(Optional.empty()); + } + + public abstract SandboxEnvironment build(); + } + + /** Deserializes a JSON string to a SandboxEnvironment object. */ + @ExcludeFromGeneratedCoverageReport + public static SandboxEnvironment fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SandboxEnvironment.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentConnectionInfo.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentConnectionInfo.java new file mode 100644 index 000000000000..406fe68bca9d --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentConnectionInfo.java @@ -0,0 +1,128 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** The connection information of the SandboxEnvironment. */ +@AutoValue +@JsonDeserialize(builder = SandboxEnvironmentConnectionInfo.Builder.class) +public abstract class SandboxEnvironmentConnectionInfo extends JsonSerializable { + /** Output only. The hostname of the load balancer. */ + @JsonProperty("loadBalancerHostname") + public abstract Optional loadBalancerHostname(); + + /** Output only. The IP address of the load balancer. */ + @JsonProperty("loadBalancerIp") + public abstract Optional loadBalancerIp(); + + /** Output only. The internal IP address of the SandboxEnvironment. */ + @JsonProperty("sandboxInternalIp") + public abstract Optional sandboxInternalIp(); + + /** Instantiates a builder for SandboxEnvironmentConnectionInfo. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SandboxEnvironmentConnectionInfo.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SandboxEnvironmentConnectionInfo. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SandboxEnvironmentConnectionInfo.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SandboxEnvironmentConnectionInfo.Builder(); + } + + /** + * Setter for loadBalancerHostname. + * + *

loadBalancerHostname: Output only. The hostname of the load balancer. + */ + @JsonProperty("loadBalancerHostname") + public abstract Builder loadBalancerHostname(String loadBalancerHostname); + + @ExcludeFromGeneratedCoverageReport + abstract Builder loadBalancerHostname(Optional loadBalancerHostname); + + /** Clears the value of loadBalancerHostname field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLoadBalancerHostname() { + return loadBalancerHostname(Optional.empty()); + } + + /** + * Setter for loadBalancerIp. + * + *

loadBalancerIp: Output only. The IP address of the load balancer. + */ + @JsonProperty("loadBalancerIp") + public abstract Builder loadBalancerIp(String loadBalancerIp); + + @ExcludeFromGeneratedCoverageReport + abstract Builder loadBalancerIp(Optional loadBalancerIp); + + /** Clears the value of loadBalancerIp field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLoadBalancerIp() { + return loadBalancerIp(Optional.empty()); + } + + /** + * Setter for sandboxInternalIp. + * + *

sandboxInternalIp: Output only. The internal IP address of the SandboxEnvironment. + */ + @JsonProperty("sandboxInternalIp") + public abstract Builder sandboxInternalIp(String sandboxInternalIp); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sandboxInternalIp(Optional sandboxInternalIp); + + /** Clears the value of sandboxInternalIp field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSandboxInternalIp() { + return sandboxInternalIp(Optional.empty()); + } + + public abstract SandboxEnvironmentConnectionInfo build(); + } + + /** Deserializes a JSON string to a SandboxEnvironmentConnectionInfo object. */ + @ExcludeFromGeneratedCoverageReport + public static SandboxEnvironmentConnectionInfo fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SandboxEnvironmentConnectionInfo.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpec.java new file mode 100644 index 000000000000..f98a7b9d83d1 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpec.java @@ -0,0 +1,130 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** The specification of a sandbox environment. */ +@AutoValue +@JsonDeserialize(builder = SandboxEnvironmentSpec.Builder.class) +public abstract class SandboxEnvironmentSpec extends JsonSerializable { + /** Optional. The code execution environment. */ + @JsonProperty("codeExecutionEnvironment") + public abstract Optional + codeExecutionEnvironment(); + + /** Optional. The computer use environment. */ + @JsonProperty("computerUseEnvironment") + public abstract Optional computerUseEnvironment(); + + /** Instantiates a builder for SandboxEnvironmentSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SandboxEnvironmentSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SandboxEnvironmentSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `SandboxEnvironmentSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_SandboxEnvironmentSpec.Builder(); + } + + /** + * Setter for codeExecutionEnvironment. + * + *

codeExecutionEnvironment: Optional. The code execution environment. + */ + @JsonProperty("codeExecutionEnvironment") + public abstract Builder codeExecutionEnvironment( + SandboxEnvironmentSpecCodeExecutionEnvironment codeExecutionEnvironment); + + /** + * Setter for codeExecutionEnvironment builder. + * + *

codeExecutionEnvironment: Optional. The code execution environment. + */ + @CanIgnoreReturnValue + public Builder codeExecutionEnvironment( + SandboxEnvironmentSpecCodeExecutionEnvironment.Builder codeExecutionEnvironmentBuilder) { + return codeExecutionEnvironment(codeExecutionEnvironmentBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder codeExecutionEnvironment( + Optional codeExecutionEnvironment); + + /** Clears the value of codeExecutionEnvironment field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCodeExecutionEnvironment() { + return codeExecutionEnvironment(Optional.empty()); + } + + /** + * Setter for computerUseEnvironment. + * + *

computerUseEnvironment: Optional. The computer use environment. + */ + @JsonProperty("computerUseEnvironment") + public abstract Builder computerUseEnvironment( + SandboxEnvironmentSpecComputerUseEnvironment computerUseEnvironment); + + /** + * Setter for computerUseEnvironment builder. + * + *

computerUseEnvironment: Optional. The computer use environment. + */ + @CanIgnoreReturnValue + public Builder computerUseEnvironment( + SandboxEnvironmentSpecComputerUseEnvironment.Builder computerUseEnvironmentBuilder) { + return computerUseEnvironment(computerUseEnvironmentBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder computerUseEnvironment( + Optional computerUseEnvironment); + + /** Clears the value of computerUseEnvironment field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearComputerUseEnvironment() { + return computerUseEnvironment(Optional.empty()); + } + + public abstract SandboxEnvironmentSpec build(); + } + + /** Deserializes a JSON string to a SandboxEnvironmentSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static SandboxEnvironmentSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SandboxEnvironmentSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpecCodeExecutionEnvironment.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpecCodeExecutionEnvironment.java new file mode 100644 index 000000000000..6e9733c97598 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpecCodeExecutionEnvironment.java @@ -0,0 +1,147 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** The code execution environment with customized settings. */ +@AutoValue +@JsonDeserialize(builder = SandboxEnvironmentSpecCodeExecutionEnvironment.Builder.class) +public abstract class SandboxEnvironmentSpecCodeExecutionEnvironment extends JsonSerializable { + /** The coding language supported in this environment. */ + @JsonProperty("codeLanguage") + public abstract Optional codeLanguage(); + + /** The machine config of the code execution environment. */ + @JsonProperty("machineConfig") + public abstract Optional machineConfig(); + + /** Instantiates a builder for SandboxEnvironmentSpecCodeExecutionEnvironment. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SandboxEnvironmentSpecCodeExecutionEnvironment.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SandboxEnvironmentSpecCodeExecutionEnvironment. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SandboxEnvironmentSpecCodeExecutionEnvironment.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SandboxEnvironmentSpecCodeExecutionEnvironment.Builder(); + } + + /** + * Setter for codeLanguage. + * + *

codeLanguage: The coding language supported in this environment. + */ + @JsonProperty("codeLanguage") + public abstract Builder codeLanguage(Language codeLanguage); + + @ExcludeFromGeneratedCoverageReport + abstract Builder codeLanguage(Optional codeLanguage); + + /** Clears the value of codeLanguage field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCodeLanguage() { + return codeLanguage(Optional.empty()); + } + + /** + * Setter for codeLanguage given a known enum. + * + *

codeLanguage: The coding language supported in this environment. + */ + @CanIgnoreReturnValue + public Builder codeLanguage(Language.Known knownType) { + return codeLanguage(new Language(knownType)); + } + + /** + * Setter for codeLanguage given a string. + * + *

codeLanguage: The coding language supported in this environment. + */ + @CanIgnoreReturnValue + public Builder codeLanguage(String codeLanguage) { + return codeLanguage(new Language(codeLanguage)); + } + + /** + * Setter for machineConfig. + * + *

machineConfig: The machine config of the code execution environment. + */ + @JsonProperty("machineConfig") + public abstract Builder machineConfig(MachineConfig machineConfig); + + @ExcludeFromGeneratedCoverageReport + abstract Builder machineConfig(Optional machineConfig); + + /** Clears the value of machineConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMachineConfig() { + return machineConfig(Optional.empty()); + } + + /** + * Setter for machineConfig given a known enum. + * + *

machineConfig: The machine config of the code execution environment. + */ + @CanIgnoreReturnValue + public Builder machineConfig(MachineConfig.Known knownType) { + return machineConfig(new MachineConfig(knownType)); + } + + /** + * Setter for machineConfig given a string. + * + *

machineConfig: The machine config of the code execution environment. + */ + @CanIgnoreReturnValue + public Builder machineConfig(String machineConfig) { + return machineConfig(new MachineConfig(machineConfig)); + } + + public abstract SandboxEnvironmentSpecCodeExecutionEnvironment build(); + } + + /** Deserializes a JSON string to a SandboxEnvironmentSpecCodeExecutionEnvironment object. */ + @ExcludeFromGeneratedCoverageReport + public static SandboxEnvironmentSpecCodeExecutionEnvironment fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, SandboxEnvironmentSpecCodeExecutionEnvironment.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpecComputerUseEnvironment.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpecComputerUseEnvironment.java new file mode 100644 index 000000000000..f6857fe5ed93 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SandboxEnvironmentSpecComputerUseEnvironment.java @@ -0,0 +1,60 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.genai.JsonSerializable; + +/** The computer use environment with customized settings. */ +@AutoValue +@JsonDeserialize(builder = SandboxEnvironmentSpecComputerUseEnvironment.Builder.class) +public abstract class SandboxEnvironmentSpecComputerUseEnvironment extends JsonSerializable { + /** Instantiates a builder for SandboxEnvironmentSpecComputerUseEnvironment. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SandboxEnvironmentSpecComputerUseEnvironment.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SandboxEnvironmentSpecComputerUseEnvironment. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SandboxEnvironmentSpecComputerUseEnvironment.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SandboxEnvironmentSpecComputerUseEnvironment.Builder(); + } + + public abstract SandboxEnvironmentSpecComputerUseEnvironment build(); + } + + /** Deserializes a JSON string to a SandboxEnvironmentSpecComputerUseEnvironment object. */ + @ExcludeFromGeneratedCoverageReport + public static SandboxEnvironmentSpecComputerUseEnvironment fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, SandboxEnvironmentSpecComputerUseEnvironment.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SavedQuery.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SavedQuery.java new file mode 100644 index 000000000000..2163c73998bc --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SavedQuery.java @@ -0,0 +1,303 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.time.Instant; +import java.util.Optional; + +/** + * A SavedQuery is a view of the dataset. It references a subset of annotations by problem type and + * filters. + */ +@AutoValue +@JsonDeserialize(builder = SavedQuery.Builder.class) +public abstract class SavedQuery extends JsonSerializable { + /** Output only. Filters on the Annotations in the dataset. */ + @JsonProperty("annotationFilter") + public abstract Optional annotationFilter(); + + /** Output only. Number of AnnotationSpecs in the context of the SavedQuery. */ + @JsonProperty("annotationSpecCount") + public abstract Optional annotationSpecCount(); + + /** Output only. Timestamp when this SavedQuery was created. */ + @JsonProperty("createTime") + public abstract Optional createTime(); + + /** + * Required. The user-defined name of the SavedQuery. The name can be up to 128 characters long + * and can consist of any UTF-8 characters. + */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** + * Used to perform a consistent read-modify-write update. If not set, a blind "overwrite" update + * happens. + */ + @JsonProperty("etag") + public abstract Optional etag(); + + /** Some additional information about the SavedQuery. */ + @JsonProperty("metadata") + public abstract Optional metadata(); + + /** Output only. Resource name of the SavedQuery. */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Required. Problem type of the SavedQuery. Allowed values: * IMAGE_CLASSIFICATION_SINGLE_LABEL * + * IMAGE_CLASSIFICATION_MULTI_LABEL * IMAGE_BOUNDING_POLY * IMAGE_BOUNDING_BOX * + * TEXT_CLASSIFICATION_SINGLE_LABEL * TEXT_CLASSIFICATION_MULTI_LABEL * TEXT_EXTRACTION * + * TEXT_SENTIMENT * VIDEO_CLASSIFICATION * VIDEO_OBJECT_TRACKING + */ + @JsonProperty("problemType") + public abstract Optional problemType(); + + /** + * Output only. If the Annotations belonging to the SavedQuery can be used for AutoML training. + */ + @JsonProperty("supportAutomlTraining") + public abstract Optional supportAutomlTraining(); + + /** Output only. Timestamp when SavedQuery was last updated. */ + @JsonProperty("updateTime") + public abstract Optional updateTime(); + + /** Instantiates a builder for SavedQuery. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SavedQuery.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SavedQuery. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `SavedQuery.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_SavedQuery.Builder(); + } + + /** + * Setter for annotationFilter. + * + *

annotationFilter: Output only. Filters on the Annotations in the dataset. + */ + @JsonProperty("annotationFilter") + public abstract Builder annotationFilter(String annotationFilter); + + @ExcludeFromGeneratedCoverageReport + abstract Builder annotationFilter(Optional annotationFilter); + + /** Clears the value of annotationFilter field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAnnotationFilter() { + return annotationFilter(Optional.empty()); + } + + /** + * Setter for annotationSpecCount. + * + *

annotationSpecCount: Output only. Number of AnnotationSpecs in the context of the + * SavedQuery. + */ + @JsonProperty("annotationSpecCount") + public abstract Builder annotationSpecCount(Integer annotationSpecCount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder annotationSpecCount(Optional annotationSpecCount); + + /** Clears the value of annotationSpecCount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAnnotationSpecCount() { + return annotationSpecCount(Optional.empty()); + } + + /** + * Setter for createTime. + * + *

createTime: Output only. Timestamp when this SavedQuery was created. + */ + @JsonProperty("createTime") + public abstract Builder createTime(Instant createTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder createTime(Optional createTime); + + /** Clears the value of createTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCreateTime() { + return createTime(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: Required. The user-defined name of the SavedQuery. The name can be up to 128 + * characters long and can consist of any UTF-8 characters. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for etag. + * + *

etag: Used to perform a consistent read-modify-write update. If not set, a blind + * "overwrite" update happens. + */ + @JsonProperty("etag") + public abstract Builder etag(String etag); + + @ExcludeFromGeneratedCoverageReport + abstract Builder etag(Optional etag); + + /** Clears the value of etag field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEtag() { + return etag(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: Some additional information about the SavedQuery. + */ + @JsonProperty("metadata") + public abstract Builder metadata(Object metadata); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for name. + * + *

name: Output only. Resource name of the SavedQuery. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for problemType. + * + *

problemType: Required. Problem type of the SavedQuery. Allowed values: * + * IMAGE_CLASSIFICATION_SINGLE_LABEL * IMAGE_CLASSIFICATION_MULTI_LABEL * IMAGE_BOUNDING_POLY * + * IMAGE_BOUNDING_BOX * TEXT_CLASSIFICATION_SINGLE_LABEL * TEXT_CLASSIFICATION_MULTI_LABEL * + * TEXT_EXTRACTION * TEXT_SENTIMENT * VIDEO_CLASSIFICATION * VIDEO_OBJECT_TRACKING + */ + @JsonProperty("problemType") + public abstract Builder problemType(String problemType); + + @ExcludeFromGeneratedCoverageReport + abstract Builder problemType(Optional problemType); + + /** Clears the value of problemType field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearProblemType() { + return problemType(Optional.empty()); + } + + /** + * Setter for supportAutomlTraining. + * + *

supportAutomlTraining: Output only. If the Annotations belonging to the SavedQuery can be + * used for AutoML training. + */ + @JsonProperty("supportAutomlTraining") + public abstract Builder supportAutomlTraining(boolean supportAutomlTraining); + + @ExcludeFromGeneratedCoverageReport + abstract Builder supportAutomlTraining(Optional supportAutomlTraining); + + /** Clears the value of supportAutomlTraining field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSupportAutomlTraining() { + return supportAutomlTraining(Optional.empty()); + } + + /** + * Setter for updateTime. + * + *

updateTime: Output only. Timestamp when SavedQuery was last updated. + */ + @JsonProperty("updateTime") + public abstract Builder updateTime(Instant updateTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder updateTime(Optional updateTime); + + /** Clears the value of updateTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUpdateTime() { + return updateTime(Optional.empty()); + } + + public abstract SavedQuery build(); + } + + /** Deserializes a JSON string to a SavedQuery object. */ + @ExcludeFromGeneratedCoverageReport + public static SavedQuery fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SavedQuery.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Scheduling.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Scheduling.java new file mode 100644 index 000000000000..7754d9724488 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Scheduling.java @@ -0,0 +1,206 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.time.Duration; +import java.util.Optional; + +/** All parameters related to queuing and scheduling of custom jobs. */ +@AutoValue +@JsonDeserialize(builder = Scheduling.Builder.class) +public abstract class Scheduling extends JsonSerializable { + /** + * Optional. Indicates if the job should retry for internal errors after the job starts running. + * If true, overrides `Scheduling.restart_job_on_worker_restart` to false. + */ + @JsonProperty("disableRetries") + public abstract Optional disableRetries(); + + /** + * Optional. This is the maximum duration that a job will wait for the requested resources to be + * provisioned if the scheduling strategy is set to [Strategy.DWS_FLEX_START]. If set to 0, the + * job will wait indefinitely. The default is 24 hours. + */ + @JsonProperty("maxWaitDuration") + public abstract Optional maxWaitDuration(); + + /** + * Optional. Restarts the entire CustomJob if a worker gets restarted. This feature can be used by + * distributed training jobs that are not resilient to workers leaving and joining a job. + */ + @JsonProperty("restartJobOnWorkerRestart") + public abstract Optional restartJobOnWorkerRestart(); + + /** Optional. This determines which type of scheduling strategy to use. */ + @JsonProperty("strategy") + public abstract Optional strategy(); + + /** Optional. The maximum job running time. The default is 7 days. */ + @JsonProperty("timeout") + public abstract Optional timeout(); + + /** Instantiates a builder for Scheduling. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_Scheduling.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for Scheduling. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `Scheduling.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_Scheduling.Builder(); + } + + /** + * Setter for disableRetries. + * + *

disableRetries: Optional. Indicates if the job should retry for internal errors after the + * job starts running. If true, overrides `Scheduling.restart_job_on_worker_restart` to false. + */ + @JsonProperty("disableRetries") + public abstract Builder disableRetries(boolean disableRetries); + + @ExcludeFromGeneratedCoverageReport + abstract Builder disableRetries(Optional disableRetries); + + /** Clears the value of disableRetries field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisableRetries() { + return disableRetries(Optional.empty()); + } + + /** + * Setter for maxWaitDuration. + * + *

maxWaitDuration: Optional. This is the maximum duration that a job will wait for the + * requested resources to be provisioned if the scheduling strategy is set to + * [Strategy.DWS_FLEX_START]. If set to 0, the job will wait indefinitely. The default is 24 + * hours. + */ + @JsonProperty("maxWaitDuration") + public abstract Builder maxWaitDuration(Duration maxWaitDuration); + + @ExcludeFromGeneratedCoverageReport + abstract Builder maxWaitDuration(Optional maxWaitDuration); + + /** Clears the value of maxWaitDuration field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMaxWaitDuration() { + return maxWaitDuration(Optional.empty()); + } + + /** + * Setter for restartJobOnWorkerRestart. + * + *

restartJobOnWorkerRestart: Optional. Restarts the entire CustomJob if a worker gets + * restarted. This feature can be used by distributed training jobs that are not resilient to + * workers leaving and joining a job. + */ + @JsonProperty("restartJobOnWorkerRestart") + public abstract Builder restartJobOnWorkerRestart(boolean restartJobOnWorkerRestart); + + @ExcludeFromGeneratedCoverageReport + abstract Builder restartJobOnWorkerRestart(Optional restartJobOnWorkerRestart); + + /** Clears the value of restartJobOnWorkerRestart field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRestartJobOnWorkerRestart() { + return restartJobOnWorkerRestart(Optional.empty()); + } + + /** + * Setter for strategy. + * + *

strategy: Optional. This determines which type of scheduling strategy to use. + */ + @JsonProperty("strategy") + public abstract Builder strategy(Strategy strategy); + + @ExcludeFromGeneratedCoverageReport + abstract Builder strategy(Optional strategy); + + /** Clears the value of strategy field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearStrategy() { + return strategy(Optional.empty()); + } + + /** + * Setter for strategy given a known enum. + * + *

strategy: Optional. This determines which type of scheduling strategy to use. + */ + @CanIgnoreReturnValue + public Builder strategy(Strategy.Known knownType) { + return strategy(new Strategy(knownType)); + } + + /** + * Setter for strategy given a string. + * + *

strategy: Optional. This determines which type of scheduling strategy to use. + */ + @CanIgnoreReturnValue + public Builder strategy(String strategy) { + return strategy(new Strategy(strategy)); + } + + /** + * Setter for timeout. + * + *

timeout: Optional. The maximum job running time. The default is 7 days. + */ + @JsonProperty("timeout") + public abstract Builder timeout(Duration timeout); + + @ExcludeFromGeneratedCoverageReport + abstract Builder timeout(Optional timeout); + + /** Clears the value of timeout field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTimeout() { + return timeout(Optional.empty()); + } + + public abstract Scheduling build(); + } + + /** Deserializes a JSON string to a Scheduling object. */ + @ExcludeFromGeneratedCoverageReport + public static Scheduling fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, Scheduling.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPredictParamsGroundingConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPredictParamsGroundingConfig.java new file mode 100644 index 000000000000..1739bec3a0bf --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPredictParamsGroundingConfig.java @@ -0,0 +1,135 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The configuration for grounding checking. */ +@AutoValue +@JsonDeserialize(builder = SchemaPredictParamsGroundingConfig.Builder.class) +public abstract class SchemaPredictParamsGroundingConfig extends JsonSerializable { + /** If set, skip finding claim attributions (i.e not generate grounding citation). */ + @JsonProperty("disableAttribution") + public abstract Optional disableAttribution(); + + /** The sources for the grounding checking. */ + @JsonProperty("sources") + public abstract Optional> sources(); + + /** Instantiates a builder for SchemaPredictParamsGroundingConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaPredictParamsGroundingConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaPredictParamsGroundingConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SchemaPredictParamsGroundingConfig.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaPredictParamsGroundingConfig.Builder(); + } + + /** + * Setter for disableAttribution. + * + *

disableAttribution: If set, skip finding claim attributions (i.e not generate grounding + * citation). + */ + @JsonProperty("disableAttribution") + public abstract Builder disableAttribution(boolean disableAttribution); + + @ExcludeFromGeneratedCoverageReport + abstract Builder disableAttribution(Optional disableAttribution); + + /** Clears the value of disableAttribution field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisableAttribution() { + return disableAttribution(Optional.empty()); + } + + /** + * Setter for sources. + * + *

sources: The sources for the grounding checking. + */ + @JsonProperty("sources") + public abstract Builder sources(List sources); + + /** + * Setter for sources. + * + *

sources: The sources for the grounding checking. + */ + @CanIgnoreReturnValue + public Builder sources(SchemaPredictParamsGroundingConfigSourceEntry... sources) { + return sources(Arrays.asList(sources)); + } + + /** + * Setter for sources builder. + * + *

sources: The sources for the grounding checking. + */ + @CanIgnoreReturnValue + public Builder sources( + SchemaPredictParamsGroundingConfigSourceEntry.Builder... sourcesBuilders) { + return sources( + Arrays.asList(sourcesBuilders).stream() + .map(SchemaPredictParamsGroundingConfigSourceEntry.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder sources(Optional> sources); + + /** Clears the value of sources field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSources() { + return sources(Optional.empty()); + } + + public abstract SchemaPredictParamsGroundingConfig build(); + } + + /** Deserializes a JSON string to a SchemaPredictParamsGroundingConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaPredictParamsGroundingConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SchemaPredictParamsGroundingConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPredictParamsGroundingConfigSourceEntry.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPredictParamsGroundingConfigSourceEntry.java new file mode 100644 index 000000000000..6a3923d3262e --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPredictParamsGroundingConfigSourceEntry.java @@ -0,0 +1,178 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Single source entry for the grounding checking. */ +@AutoValue +@JsonDeserialize(builder = SchemaPredictParamsGroundingConfigSourceEntry.Builder.class) +public abstract class SchemaPredictParamsGroundingConfigSourceEntry extends JsonSerializable { + /** + * The uri of the Vertex AI Search data source. Deprecated. Use vertex_ai_search_datastore + * instead. + */ + @JsonProperty("enterpriseDatastore") + public abstract Optional enterpriseDatastore(); + + /** + * The grounding text passed inline with the Predict API. It can support up to 1 million bytes. + */ + @JsonProperty("inlineContext") + public abstract Optional inlineContext(); + + /** The type of the grounding checking source. */ + @JsonProperty("type") + public abstract Optional type(); + + /** The uri of the Vertex AI Search data source. */ + @JsonProperty("vertexAiSearchDatastore") + public abstract Optional vertexAiSearchDatastore(); + + /** Instantiates a builder for SchemaPredictParamsGroundingConfigSourceEntry. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaPredictParamsGroundingConfigSourceEntry.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaPredictParamsGroundingConfigSourceEntry. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SchemaPredictParamsGroundingConfigSourceEntry.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaPredictParamsGroundingConfigSourceEntry.Builder(); + } + + /** + * Setter for enterpriseDatastore. + * + *

enterpriseDatastore: The uri of the Vertex AI Search data source. Deprecated. Use + * vertex_ai_search_datastore instead. + */ + @JsonProperty("enterpriseDatastore") + public abstract Builder enterpriseDatastore(String enterpriseDatastore); + + @ExcludeFromGeneratedCoverageReport + abstract Builder enterpriseDatastore(Optional enterpriseDatastore); + + /** Clears the value of enterpriseDatastore field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEnterpriseDatastore() { + return enterpriseDatastore(Optional.empty()); + } + + /** + * Setter for inlineContext. + * + *

inlineContext: The grounding text passed inline with the Predict API. It can support up to + * 1 million bytes. + */ + @JsonProperty("inlineContext") + public abstract Builder inlineContext(String inlineContext); + + @ExcludeFromGeneratedCoverageReport + abstract Builder inlineContext(Optional inlineContext); + + /** Clears the value of inlineContext field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInlineContext() { + return inlineContext(Optional.empty()); + } + + /** + * Setter for type. + * + *

type: The type of the grounding checking source. + */ + @JsonProperty("type") + public abstract Builder type(Type type); + + @ExcludeFromGeneratedCoverageReport + abstract Builder type(Optional type); + + /** Clears the value of type field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearType() { + return type(Optional.empty()); + } + + /** + * Setter for type given a known enum. + * + *

type: The type of the grounding checking source. + */ + @CanIgnoreReturnValue + public Builder type(Type.Known knownType) { + return type(new Type(knownType)); + } + + /** + * Setter for type given a string. + * + *

type: The type of the grounding checking source. + */ + @CanIgnoreReturnValue + public Builder type(String type) { + return type(new Type(type)); + } + + /** + * Setter for vertexAiSearchDatastore. + * + *

vertexAiSearchDatastore: The uri of the Vertex AI Search data source. + */ + @JsonProperty("vertexAiSearchDatastore") + public abstract Builder vertexAiSearchDatastore(String vertexAiSearchDatastore); + + @ExcludeFromGeneratedCoverageReport + abstract Builder vertexAiSearchDatastore(Optional vertexAiSearchDatastore); + + /** Clears the value of vertexAiSearchDatastore field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearVertexAiSearchDatastore() { + return vertexAiSearchDatastore(Optional.empty()); + } + + public abstract SchemaPredictParamsGroundingConfigSourceEntry build(); + } + + /** Deserializes a JSON string to a SchemaPredictParamsGroundingConfigSourceEntry object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaPredictParamsGroundingConfigSourceEntry fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, SchemaPredictParamsGroundingConfigSourceEntry.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptApiSchema.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptApiSchema.java new file mode 100644 index 000000000000..fd28c0e90672 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptApiSchema.java @@ -0,0 +1,230 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The A2 schema of a prompt. */ +@AutoValue +@JsonDeserialize(builder = SchemaPromptApiSchema.Builder.class) +public abstract class SchemaPromptApiSchema extends JsonSerializable { + /** The Schema version that represents changes to the API behavior. */ + @JsonProperty("apiSchemaVersion") + public abstract Optional apiSchemaVersion(); + + /** A list of execution instances for constructing a ready-to-use prompt. */ + @JsonProperty("executions") + public abstract Optional> executions(); + + /** Multimodal prompt which embeds preambles to prompt string. */ + @JsonProperty("multimodalPrompt") + public abstract Optional multimodalPrompt(); + + /** The prompt variation that stores preambles in separate fields. */ + @JsonProperty("structuredPrompt") + public abstract Optional structuredPrompt(); + + /** The prompt variation for Translation use case. */ + @JsonProperty("translationPrompt") + public abstract Optional translationPrompt(); + + /** Instantiates a builder for SchemaPromptApiSchema. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaPromptApiSchema.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaPromptApiSchema. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `SchemaPromptApiSchema.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaPromptApiSchema.Builder(); + } + + /** + * Setter for apiSchemaVersion. + * + *

apiSchemaVersion: The Schema version that represents changes to the API behavior. + */ + @JsonProperty("apiSchemaVersion") + public abstract Builder apiSchemaVersion(String apiSchemaVersion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder apiSchemaVersion(Optional apiSchemaVersion); + + /** Clears the value of apiSchemaVersion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearApiSchemaVersion() { + return apiSchemaVersion(Optional.empty()); + } + + /** + * Setter for executions. + * + *

executions: A list of execution instances for constructing a ready-to-use prompt. + */ + @JsonProperty("executions") + public abstract Builder executions(List executions); + + /** + * Setter for executions. + * + *

executions: A list of execution instances for constructing a ready-to-use prompt. + */ + @CanIgnoreReturnValue + public Builder executions(SchemaPromptInstancePromptExecution... executions) { + return executions(Arrays.asList(executions)); + } + + /** + * Setter for executions builder. + * + *

executions: A list of execution instances for constructing a ready-to-use prompt. + */ + @CanIgnoreReturnValue + public Builder executions(SchemaPromptInstancePromptExecution.Builder... executionsBuilders) { + return executions( + Arrays.asList(executionsBuilders).stream() + .map(SchemaPromptInstancePromptExecution.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder executions(Optional> executions); + + /** Clears the value of executions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExecutions() { + return executions(Optional.empty()); + } + + /** + * Setter for multimodalPrompt. + * + *

multimodalPrompt: Multimodal prompt which embeds preambles to prompt string. + */ + @JsonProperty("multimodalPrompt") + public abstract Builder multimodalPrompt(SchemaPromptSpecMultimodalPrompt multimodalPrompt); + + /** + * Setter for multimodalPrompt builder. + * + *

multimodalPrompt: Multimodal prompt which embeds preambles to prompt string. + */ + @CanIgnoreReturnValue + public Builder multimodalPrompt( + SchemaPromptSpecMultimodalPrompt.Builder multimodalPromptBuilder) { + return multimodalPrompt(multimodalPromptBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder multimodalPrompt(Optional multimodalPrompt); + + /** Clears the value of multimodalPrompt field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMultimodalPrompt() { + return multimodalPrompt(Optional.empty()); + } + + /** + * Setter for structuredPrompt. + * + *

structuredPrompt: The prompt variation that stores preambles in separate fields. + */ + @JsonProperty("structuredPrompt") + public abstract Builder structuredPrompt(SchemaPromptSpecStructuredPrompt structuredPrompt); + + /** + * Setter for structuredPrompt builder. + * + *

structuredPrompt: The prompt variation that stores preambles in separate fields. + */ + @CanIgnoreReturnValue + public Builder structuredPrompt( + SchemaPromptSpecStructuredPrompt.Builder structuredPromptBuilder) { + return structuredPrompt(structuredPromptBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder structuredPrompt(Optional structuredPrompt); + + /** Clears the value of structuredPrompt field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearStructuredPrompt() { + return structuredPrompt(Optional.empty()); + } + + /** + * Setter for translationPrompt. + * + *

translationPrompt: The prompt variation for Translation use case. + */ + @JsonProperty("translationPrompt") + public abstract Builder translationPrompt(SchemaPromptSpecTranslationPrompt translationPrompt); + + /** + * Setter for translationPrompt builder. + * + *

translationPrompt: The prompt variation for Translation use case. + */ + @CanIgnoreReturnValue + public Builder translationPrompt( + SchemaPromptSpecTranslationPrompt.Builder translationPromptBuilder) { + return translationPrompt(translationPromptBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder translationPrompt( + Optional translationPrompt); + + /** Clears the value of translationPrompt field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTranslationPrompt() { + return translationPrompt(Optional.empty()); + } + + public abstract SchemaPromptApiSchema build(); + } + + /** Deserializes a JSON string to a SchemaPromptApiSchema object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaPromptApiSchema fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SchemaPromptApiSchema.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptInstancePromptExecution.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptInstancePromptExecution.java new file mode 100644 index 000000000000..857933554aa1 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptInstancePromptExecution.java @@ -0,0 +1,85 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** A prompt instance's parameters set that contains a set of variable values. */ +@AutoValue +@JsonDeserialize(builder = SchemaPromptInstancePromptExecution.Builder.class) +public abstract class SchemaPromptInstancePromptExecution extends JsonSerializable { + /** Maps variable names to their value. */ + @JsonProperty("arguments") + public abstract Optional> arguments(); + + /** Instantiates a builder for SchemaPromptInstancePromptExecution. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaPromptInstancePromptExecution.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaPromptInstancePromptExecution. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SchemaPromptInstancePromptExecution.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaPromptInstancePromptExecution.Builder(); + } + + /** + * Setter for arguments. + * + *

arguments: Maps variable names to their value. + */ + @JsonProperty("arguments") + public abstract Builder arguments(Map arguments); + + @ExcludeFromGeneratedCoverageReport + abstract Builder arguments(Optional> arguments); + + /** Clears the value of arguments field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearArguments() { + return arguments(Optional.empty()); + } + + public abstract SchemaPromptInstancePromptExecution build(); + } + + /** Deserializes a JSON string to a SchemaPromptInstancePromptExecution object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaPromptInstancePromptExecution fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SchemaPromptInstancePromptExecution.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptInstanceVariableValue.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptInstanceVariableValue.java new file mode 100644 index 000000000000..c19e548f4431 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptInstanceVariableValue.java @@ -0,0 +1,94 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents a prompt instance variable. */ +@AutoValue +@JsonDeserialize(builder = SchemaPromptInstanceVariableValue.Builder.class) +public abstract class SchemaPromptInstanceVariableValue extends JsonSerializable { + /** The parts of the variable value. */ + @JsonProperty("partList") + public abstract Optional partList(); + + /** Instantiates a builder for SchemaPromptInstanceVariableValue. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaPromptInstanceVariableValue.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaPromptInstanceVariableValue. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SchemaPromptInstanceVariableValue.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaPromptInstanceVariableValue.Builder(); + } + + /** + * Setter for partList. + * + *

partList: The parts of the variable value. + */ + @JsonProperty("partList") + public abstract Builder partList(SchemaPromptSpecPartList partList); + + /** + * Setter for partList builder. + * + *

partList: The parts of the variable value. + */ + @CanIgnoreReturnValue + public Builder partList(SchemaPromptSpecPartList.Builder partListBuilder) { + return partList(partListBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder partList(Optional partList); + + /** Clears the value of partList field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPartList() { + return partList(Optional.empty()); + } + + public abstract SchemaPromptInstanceVariableValue build(); + } + + /** Deserializes a JSON string to a SchemaPromptInstanceVariableValue object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaPromptInstanceVariableValue fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SchemaPromptInstanceVariableValue.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecMultimodalPrompt.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecMultimodalPrompt.java new file mode 100644 index 000000000000..8beddfcee74f --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecMultimodalPrompt.java @@ -0,0 +1,94 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Prompt variation that embeds preambles to prompt string. */ +@AutoValue +@JsonDeserialize(builder = SchemaPromptSpecMultimodalPrompt.Builder.class) +public abstract class SchemaPromptSpecMultimodalPrompt extends JsonSerializable { + /** The prompt message. */ + @JsonProperty("promptMessage") + public abstract Optional promptMessage(); + + /** Instantiates a builder for SchemaPromptSpecMultimodalPrompt. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaPromptSpecMultimodalPrompt.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaPromptSpecMultimodalPrompt. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SchemaPromptSpecMultimodalPrompt.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaPromptSpecMultimodalPrompt.Builder(); + } + + /** + * Setter for promptMessage. + * + *

promptMessage: The prompt message. + */ + @JsonProperty("promptMessage") + public abstract Builder promptMessage(SchemaPromptSpecPromptMessage promptMessage); + + /** + * Setter for promptMessage builder. + * + *

promptMessage: The prompt message. + */ + @CanIgnoreReturnValue + public Builder promptMessage(SchemaPromptSpecPromptMessage.Builder promptMessageBuilder) { + return promptMessage(promptMessageBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder promptMessage(Optional promptMessage); + + /** Clears the value of promptMessage field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPromptMessage() { + return promptMessage(Optional.empty()); + } + + public abstract SchemaPromptSpecMultimodalPrompt build(); + } + + /** Deserializes a JSON string to a SchemaPromptSpecMultimodalPrompt object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaPromptSpecMultimodalPrompt fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SchemaPromptSpecMultimodalPrompt.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecPartList.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecPartList.java new file mode 100644 index 000000000000..435f39882f54 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecPartList.java @@ -0,0 +1,94 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Part; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Represents a prompt spec part list. */ +@AutoValue +@JsonDeserialize(builder = SchemaPromptSpecPartList.Builder.class) +public abstract class SchemaPromptSpecPartList extends JsonSerializable { + /** A list of elements that can be part of a prompt. */ + @JsonProperty("parts") + public abstract Optional> parts(); + + /** Instantiates a builder for SchemaPromptSpecPartList. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaPromptSpecPartList.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaPromptSpecPartList. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `SchemaPromptSpecPartList.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaPromptSpecPartList.Builder(); + } + + /** + * Setter for parts. + * + *

parts: A list of elements that can be part of a prompt. + */ + @JsonProperty("parts") + public abstract Builder parts(List parts); + + /** + * Setter for parts. + * + *

parts: A list of elements that can be part of a prompt. + */ + @CanIgnoreReturnValue + public Builder parts(Part... parts) { + return parts(Arrays.asList(parts)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder parts(Optional> parts); + + /** Clears the value of parts field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearParts() { + return parts(Optional.empty()); + } + + public abstract SchemaPromptSpecPartList build(); + } + + /** Deserializes a JSON string to a SchemaPromptSpecPartList object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaPromptSpecPartList fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SchemaPromptSpecPartList.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecPromptMessage.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecPromptMessage.java new file mode 100644 index 000000000000..02a2ac5094f6 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecPromptMessage.java @@ -0,0 +1,311 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import com.google.genai.types.FunctionCallingConfig; +import com.google.genai.types.GenerationConfig; +import com.google.genai.types.Part; +import com.google.genai.types.SafetySetting; +import com.google.genai.types.Tool; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** Represents a prompt message. */ +@AutoValue +@JsonDeserialize(builder = SchemaPromptSpecPromptMessage.Builder.class) +public abstract class SchemaPromptSpecPromptMessage extends JsonSerializable { + /** Generation config. */ + @JsonProperty("generationConfig") + public abstract Optional generationConfig(); + + /** Tool config. This config is shared for all tools provided in the request. */ + @JsonProperty("toolConfig") + public abstract Optional toolConfig(); + + /** + * A list of `Tools` the model may use to generate the next response. A `Tool` is a piece of code + * that enables the system to interact with external systems to perform an action, or set of + * actions, outside of knowledge and scope of the model. + */ + @JsonProperty("tools") + public abstract Optional> tools(); + + /** + * Per request settings for blocking unsafe content. Enforced on + * GenerateContentResponse.candidates. + */ + @JsonProperty("safetySettings") + public abstract Optional> safetySettings(); + + /** + * The content of the current conversation with the model. For single-turn queries, this is a + * single instance. For multi-turn queries, this is a repeated field that contains conversation + * history + latest request. + */ + @JsonProperty("contents") + public abstract Optional> contents(); + + /** + * The user provided system instructions for the model. Note: only text should be used in parts + * and content in each part will be in a separate paragraph. + */ + @JsonProperty("systemInstruction") + public abstract Optional systemInstruction(); + + /** */ + @JsonProperty("variables") + public abstract Optional>> variables(); + + /** The model name. */ + @JsonProperty("model") + public abstract Optional model(); + + /** Instantiates a builder for SchemaPromptSpecPromptMessage. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaPromptSpecPromptMessage.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaPromptSpecPromptMessage. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SchemaPromptSpecPromptMessage.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaPromptSpecPromptMessage.Builder(); + } + + /** + * Setter for generationConfig. + * + *

generationConfig: Generation config. + */ + @JsonProperty("generationConfig") + public abstract Builder generationConfig(GenerationConfig generationConfig); + + @ExcludeFromGeneratedCoverageReport + abstract Builder generationConfig(Optional generationConfig); + + /** Clears the value of generationConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGenerationConfig() { + return generationConfig(Optional.empty()); + } + + /** + * Setter for toolConfig. + * + *

toolConfig: Tool config. This config is shared for all tools provided in the request. + */ + @JsonProperty("toolConfig") + public abstract Builder toolConfig(FunctionCallingConfig toolConfig); + + @ExcludeFromGeneratedCoverageReport + abstract Builder toolConfig(Optional toolConfig); + + /** Clears the value of toolConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearToolConfig() { + return toolConfig(Optional.empty()); + } + + /** + * Setter for tools. + * + *

tools: A list of `Tools` the model may use to generate the next response. A `Tool` is a + * piece of code that enables the system to interact with external systems to perform an action, + * or set of actions, outside of knowledge and scope of the model. + */ + @JsonProperty("tools") + public abstract Builder tools(List tools); + + /** + * Setter for tools. + * + *

tools: A list of `Tools` the model may use to generate the next response. A `Tool` is a + * piece of code that enables the system to interact with external systems to perform an action, + * or set of actions, outside of knowledge and scope of the model. + */ + @CanIgnoreReturnValue + public Builder tools(Tool... tools) { + return tools(Arrays.asList(tools)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder tools(Optional> tools); + + /** Clears the value of tools field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTools() { + return tools(Optional.empty()); + } + + /** + * Setter for safetySettings. + * + *

safetySettings: Per request settings for blocking unsafe content. Enforced on + * GenerateContentResponse.candidates. + */ + @JsonProperty("safetySettings") + public abstract Builder safetySettings(List safetySettings); + + /** + * Setter for safetySettings. + * + *

safetySettings: Per request settings for blocking unsafe content. Enforced on + * GenerateContentResponse.candidates. + */ + @CanIgnoreReturnValue + public Builder safetySettings(SafetySetting... safetySettings) { + return safetySettings(Arrays.asList(safetySettings)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder safetySettings(Optional> safetySettings); + + /** Clears the value of safetySettings field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSafetySettings() { + return safetySettings(Optional.empty()); + } + + /** + * Setter for contents. + * + *

contents: The content of the current conversation with the model. For single-turn queries, + * this is a single instance. For multi-turn queries, this is a repeated field that contains + * conversation history + latest request. + */ + @JsonProperty("contents") + public abstract Builder contents(List contents); + + /** + * Setter for contents. + * + *

contents: The content of the current conversation with the model. For single-turn queries, + * this is a single instance. For multi-turn queries, this is a repeated field that contains + * conversation history + latest request. + */ + @CanIgnoreReturnValue + public Builder contents(Content... contents) { + return contents(Arrays.asList(contents)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder contents(Optional> contents); + + /** Clears the value of contents field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContents() { + return contents(Optional.empty()); + } + + /** + * Setter for systemInstruction. + * + *

systemInstruction: The user provided system instructions for the model. Note: only text + * should be used in parts and content in each part will be in a separate paragraph. + */ + @JsonProperty("systemInstruction") + public abstract Builder systemInstruction(Content systemInstruction); + + @ExcludeFromGeneratedCoverageReport + abstract Builder systemInstruction(Optional systemInstruction); + + /** Clears the value of systemInstruction field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSystemInstruction() { + return systemInstruction(Optional.empty()); + } + + /** + * Setter for variables. + * + *

variables: + */ + @JsonProperty("variables") + public abstract Builder variables(List> variables); + + /** + * Setter for variables. + * + *

variables: + */ + @CanIgnoreReturnValue + public Builder variables(Map... variables) { + return variables(Arrays.asList(variables)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder variables(Optional>> variables); + + /** Clears the value of variables field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearVariables() { + return variables(Optional.empty()); + } + + /** + * Setter for model. + * + *

model: The model name. + */ + @JsonProperty("model") + public abstract Builder model(String model); + + @ExcludeFromGeneratedCoverageReport + abstract Builder model(Optional model); + + /** Clears the value of model field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearModel() { + return model(Optional.empty()); + } + + public abstract SchemaPromptSpecPromptMessage build(); + } + + /** Deserializes a JSON string to a SchemaPromptSpecPromptMessage object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaPromptSpecPromptMessage fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SchemaPromptSpecPromptMessage.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecReferenceSentencePair.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecReferenceSentencePair.java new file mode 100644 index 000000000000..34e6e2af1769 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecReferenceSentencePair.java @@ -0,0 +1,106 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** A pair of sentences used as reference in source and target languages. */ +@AutoValue +@JsonDeserialize(builder = SchemaPromptSpecReferenceSentencePair.Builder.class) +public abstract class SchemaPromptSpecReferenceSentencePair extends JsonSerializable { + /** Source sentence in the sentence pair. */ + @JsonProperty("sourceSentence") + public abstract Optional sourceSentence(); + + /** Target sentence in the sentence pair. */ + @JsonProperty("targetSentence") + public abstract Optional targetSentence(); + + /** Instantiates a builder for SchemaPromptSpecReferenceSentencePair. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaPromptSpecReferenceSentencePair.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaPromptSpecReferenceSentencePair. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SchemaPromptSpecReferenceSentencePair.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaPromptSpecReferenceSentencePair.Builder(); + } + + /** + * Setter for sourceSentence. + * + *

sourceSentence: Source sentence in the sentence pair. + */ + @JsonProperty("sourceSentence") + public abstract Builder sourceSentence(String sourceSentence); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sourceSentence(Optional sourceSentence); + + /** Clears the value of sourceSentence field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSourceSentence() { + return sourceSentence(Optional.empty()); + } + + /** + * Setter for targetSentence. + * + *

targetSentence: Target sentence in the sentence pair. + */ + @JsonProperty("targetSentence") + public abstract Builder targetSentence(String targetSentence); + + @ExcludeFromGeneratedCoverageReport + abstract Builder targetSentence(Optional targetSentence); + + /** Clears the value of targetSentence field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTargetSentence() { + return targetSentence(Optional.empty()); + } + + public abstract SchemaPromptSpecReferenceSentencePair build(); + } + + /** Deserializes a JSON string to a SchemaPromptSpecReferenceSentencePair object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaPromptSpecReferenceSentencePair fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SchemaPromptSpecReferenceSentencePair.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecReferenceSentencePairList.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecReferenceSentencePairList.java new file mode 100644 index 000000000000..8e63edf57a7a --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecReferenceSentencePairList.java @@ -0,0 +1,116 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** A list of reference sentence pairs. */ +@AutoValue +@JsonDeserialize(builder = SchemaPromptSpecReferenceSentencePairList.Builder.class) +public abstract class SchemaPromptSpecReferenceSentencePairList extends JsonSerializable { + /** Reference sentence pairs. */ + @JsonProperty("referenceSentencePairs") + public abstract Optional> referenceSentencePairs(); + + /** Instantiates a builder for SchemaPromptSpecReferenceSentencePairList. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaPromptSpecReferenceSentencePairList.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaPromptSpecReferenceSentencePairList. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SchemaPromptSpecReferenceSentencePairList.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaPromptSpecReferenceSentencePairList.Builder(); + } + + /** + * Setter for referenceSentencePairs. + * + *

referenceSentencePairs: Reference sentence pairs. + */ + @JsonProperty("referenceSentencePairs") + public abstract Builder referenceSentencePairs( + List referenceSentencePairs); + + /** + * Setter for referenceSentencePairs. + * + *

referenceSentencePairs: Reference sentence pairs. + */ + @CanIgnoreReturnValue + public Builder referenceSentencePairs( + SchemaPromptSpecReferenceSentencePair... referenceSentencePairs) { + return referenceSentencePairs(Arrays.asList(referenceSentencePairs)); + } + + /** + * Setter for referenceSentencePairs builder. + * + *

referenceSentencePairs: Reference sentence pairs. + */ + @CanIgnoreReturnValue + public Builder referenceSentencePairs( + SchemaPromptSpecReferenceSentencePair.Builder... referenceSentencePairsBuilders) { + return referenceSentencePairs( + Arrays.asList(referenceSentencePairsBuilders).stream() + .map(SchemaPromptSpecReferenceSentencePair.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder referenceSentencePairs( + Optional> referenceSentencePairs); + + /** Clears the value of referenceSentencePairs field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReferenceSentencePairs() { + return referenceSentencePairs(Optional.empty()); + } + + public abstract SchemaPromptSpecReferenceSentencePairList build(); + } + + /** Deserializes a JSON string to a SchemaPromptSpecReferenceSentencePairList object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaPromptSpecReferenceSentencePairList fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, SchemaPromptSpecReferenceSentencePairList.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecStructuredPrompt.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecStructuredPrompt.java new file mode 100644 index 000000000000..c7fc2beb9542 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecStructuredPrompt.java @@ -0,0 +1,325 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Content; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Represents a structured prompt. */ +@AutoValue +@JsonDeserialize(builder = SchemaPromptSpecStructuredPrompt.Builder.class) +public abstract class SchemaPromptSpecStructuredPrompt extends JsonSerializable { + /** Preamble: The context of the prompt. */ + @JsonProperty("context") + public abstract Optional context(); + + /** Preamble: A set of examples for expected model response. */ + @JsonProperty("examples") + public abstract Optional> examples(); + + /** Preamble: For infill prompt, the prefix before expected model response. */ + @JsonProperty("infillPrefix") + public abstract Optional infillPrefix(); + + /** Preamble: For infill prompt, the suffix after expected model response. */ + @JsonProperty("infillSuffix") + public abstract Optional infillSuffix(); + + /** Preamble: The input prefixes before each example input. */ + @JsonProperty("inputPrefixes") + public abstract Optional> inputPrefixes(); + + /** Preamble: The output prefixes before each example output. */ + @JsonProperty("outputPrefixes") + public abstract Optional> outputPrefixes(); + + /** + * Preamble: The input test data for prediction. Each PartList in this field represents one + * text-only input set for a single model request. + */ + @JsonProperty("predictionInputs") + public abstract Optional> predictionInputs(); + + /** The prompt message. */ + @JsonProperty("promptMessage") + public abstract Optional promptMessage(); + + /** Instantiates a builder for SchemaPromptSpecStructuredPrompt. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaPromptSpecStructuredPrompt.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaPromptSpecStructuredPrompt. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SchemaPromptSpecStructuredPrompt.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaPromptSpecStructuredPrompt.Builder(); + } + + /** + * Setter for context. + * + *

context: Preamble: The context of the prompt. + */ + @JsonProperty("context") + public abstract Builder context(Content context); + + @ExcludeFromGeneratedCoverageReport + abstract Builder context(Optional context); + + /** Clears the value of context field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContext() { + return context(Optional.empty()); + } + + /** + * Setter for examples. + * + *

examples: Preamble: A set of examples for expected model response. + */ + @JsonProperty("examples") + public abstract Builder examples(List examples); + + /** + * Setter for examples. + * + *

examples: Preamble: A set of examples for expected model response. + */ + @CanIgnoreReturnValue + public Builder examples(SchemaPromptSpecPartList... examples) { + return examples(Arrays.asList(examples)); + } + + /** + * Setter for examples builder. + * + *

examples: Preamble: A set of examples for expected model response. + */ + @CanIgnoreReturnValue + public Builder examples(SchemaPromptSpecPartList.Builder... examplesBuilders) { + return examples( + Arrays.asList(examplesBuilders).stream() + .map(SchemaPromptSpecPartList.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder examples(Optional> examples); + + /** Clears the value of examples field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExamples() { + return examples(Optional.empty()); + } + + /** + * Setter for infillPrefix. + * + *

infillPrefix: Preamble: For infill prompt, the prefix before expected model response. + */ + @JsonProperty("infillPrefix") + public abstract Builder infillPrefix(String infillPrefix); + + @ExcludeFromGeneratedCoverageReport + abstract Builder infillPrefix(Optional infillPrefix); + + /** Clears the value of infillPrefix field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInfillPrefix() { + return infillPrefix(Optional.empty()); + } + + /** + * Setter for infillSuffix. + * + *

infillSuffix: Preamble: For infill prompt, the suffix after expected model response. + */ + @JsonProperty("infillSuffix") + public abstract Builder infillSuffix(String infillSuffix); + + @ExcludeFromGeneratedCoverageReport + abstract Builder infillSuffix(Optional infillSuffix); + + /** Clears the value of infillSuffix field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInfillSuffix() { + return infillSuffix(Optional.empty()); + } + + /** + * Setter for inputPrefixes. + * + *

inputPrefixes: Preamble: The input prefixes before each example input. + */ + @JsonProperty("inputPrefixes") + public abstract Builder inputPrefixes(List inputPrefixes); + + /** + * Setter for inputPrefixes. + * + *

inputPrefixes: Preamble: The input prefixes before each example input. + */ + @CanIgnoreReturnValue + public Builder inputPrefixes(String... inputPrefixes) { + return inputPrefixes(Arrays.asList(inputPrefixes)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder inputPrefixes(Optional> inputPrefixes); + + /** Clears the value of inputPrefixes field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInputPrefixes() { + return inputPrefixes(Optional.empty()); + } + + /** + * Setter for outputPrefixes. + * + *

outputPrefixes: Preamble: The output prefixes before each example output. + */ + @JsonProperty("outputPrefixes") + public abstract Builder outputPrefixes(List outputPrefixes); + + /** + * Setter for outputPrefixes. + * + *

outputPrefixes: Preamble: The output prefixes before each example output. + */ + @CanIgnoreReturnValue + public Builder outputPrefixes(String... outputPrefixes) { + return outputPrefixes(Arrays.asList(outputPrefixes)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder outputPrefixes(Optional> outputPrefixes); + + /** Clears the value of outputPrefixes field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOutputPrefixes() { + return outputPrefixes(Optional.empty()); + } + + /** + * Setter for predictionInputs. + * + *

predictionInputs: Preamble: The input test data for prediction. Each PartList in this + * field represents one text-only input set for a single model request. + */ + @JsonProperty("predictionInputs") + public abstract Builder predictionInputs(List predictionInputs); + + /** + * Setter for predictionInputs. + * + *

predictionInputs: Preamble: The input test data for prediction. Each PartList in this + * field represents one text-only input set for a single model request. + */ + @CanIgnoreReturnValue + public Builder predictionInputs(SchemaPromptSpecPartList... predictionInputs) { + return predictionInputs(Arrays.asList(predictionInputs)); + } + + /** + * Setter for predictionInputs builder. + * + *

predictionInputs: Preamble: The input test data for prediction. Each PartList in this + * field represents one text-only input set for a single model request. + */ + @CanIgnoreReturnValue + public Builder predictionInputs(SchemaPromptSpecPartList.Builder... predictionInputsBuilders) { + return predictionInputs( + Arrays.asList(predictionInputsBuilders).stream() + .map(SchemaPromptSpecPartList.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder predictionInputs(Optional> predictionInputs); + + /** Clears the value of predictionInputs field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPredictionInputs() { + return predictionInputs(Optional.empty()); + } + + /** + * Setter for promptMessage. + * + *

promptMessage: The prompt message. + */ + @JsonProperty("promptMessage") + public abstract Builder promptMessage(SchemaPromptSpecPromptMessage promptMessage); + + /** + * Setter for promptMessage builder. + * + *

promptMessage: The prompt message. + */ + @CanIgnoreReturnValue + public Builder promptMessage(SchemaPromptSpecPromptMessage.Builder promptMessageBuilder) { + return promptMessage(promptMessageBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder promptMessage(Optional promptMessage); + + /** Clears the value of promptMessage field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPromptMessage() { + return promptMessage(Optional.empty()); + } + + public abstract SchemaPromptSpecStructuredPrompt build(); + } + + /** Deserializes a JSON string to a SchemaPromptSpecStructuredPrompt object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaPromptSpecStructuredPrompt fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SchemaPromptSpecStructuredPrompt.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationExample.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationExample.java new file mode 100644 index 000000000000..16956d352c0e --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationExample.java @@ -0,0 +1,167 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The translation example that contains reference sentences from various sources. */ +@AutoValue +@JsonDeserialize(builder = SchemaPromptSpecTranslationExample.Builder.class) +public abstract class SchemaPromptSpecTranslationExample extends JsonSerializable { + /** The reference sentences from inline text. */ + @JsonProperty("referenceSentencePairLists") + public abstract Optional> + referenceSentencePairLists(); + + /** The reference sentences from file. */ + @JsonProperty("referenceSentencesFileInputs") + public abstract Optional> + referenceSentencesFileInputs(); + + /** Instantiates a builder for SchemaPromptSpecTranslationExample. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaPromptSpecTranslationExample.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaPromptSpecTranslationExample. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SchemaPromptSpecTranslationExample.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaPromptSpecTranslationExample.Builder(); + } + + /** + * Setter for referenceSentencePairLists. + * + *

referenceSentencePairLists: The reference sentences from inline text. + */ + @JsonProperty("referenceSentencePairLists") + public abstract Builder referenceSentencePairLists( + List referenceSentencePairLists); + + /** + * Setter for referenceSentencePairLists. + * + *

referenceSentencePairLists: The reference sentences from inline text. + */ + @CanIgnoreReturnValue + public Builder referenceSentencePairLists( + SchemaPromptSpecReferenceSentencePairList... referenceSentencePairLists) { + return referenceSentencePairLists(Arrays.asList(referenceSentencePairLists)); + } + + /** + * Setter for referenceSentencePairLists builder. + * + *

referenceSentencePairLists: The reference sentences from inline text. + */ + @CanIgnoreReturnValue + public Builder referenceSentencePairLists( + SchemaPromptSpecReferenceSentencePairList.Builder... referenceSentencePairListsBuilders) { + return referenceSentencePairLists( + Arrays.asList(referenceSentencePairListsBuilders).stream() + .map(SchemaPromptSpecReferenceSentencePairList.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder referenceSentencePairLists( + Optional> referenceSentencePairLists); + + /** Clears the value of referenceSentencePairLists field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReferenceSentencePairLists() { + return referenceSentencePairLists(Optional.empty()); + } + + /** + * Setter for referenceSentencesFileInputs. + * + *

referenceSentencesFileInputs: The reference sentences from file. + */ + @JsonProperty("referenceSentencesFileInputs") + public abstract Builder referenceSentencesFileInputs( + List referenceSentencesFileInputs); + + /** + * Setter for referenceSentencesFileInputs. + * + *

referenceSentencesFileInputs: The reference sentences from file. + */ + @CanIgnoreReturnValue + public Builder referenceSentencesFileInputs( + SchemaPromptSpecTranslationSentenceFileInput... referenceSentencesFileInputs) { + return referenceSentencesFileInputs(Arrays.asList(referenceSentencesFileInputs)); + } + + /** + * Setter for referenceSentencesFileInputs builder. + * + *

referenceSentencesFileInputs: The reference sentences from file. + */ + @CanIgnoreReturnValue + public Builder referenceSentencesFileInputs( + SchemaPromptSpecTranslationSentenceFileInput.Builder... + referenceSentencesFileInputsBuilders) { + return referenceSentencesFileInputs( + Arrays.asList(referenceSentencesFileInputsBuilders).stream() + .map(SchemaPromptSpecTranslationSentenceFileInput.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder referenceSentencesFileInputs( + Optional> referenceSentencesFileInputs); + + /** Clears the value of referenceSentencesFileInputs field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReferenceSentencesFileInputs() { + return referenceSentencesFileInputs(Optional.empty()); + } + + public abstract SchemaPromptSpecTranslationExample build(); + } + + /** Deserializes a JSON string to a SchemaPromptSpecTranslationExample object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaPromptSpecTranslationExample fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SchemaPromptSpecTranslationExample.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationFileInputSource.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationFileInputSource.java new file mode 100644 index 000000000000..5f054fe495bb --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationFileInputSource.java @@ -0,0 +1,129 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** */ +@AutoValue +@JsonDeserialize(builder = SchemaPromptSpecTranslationFileInputSource.Builder.class) +public abstract class SchemaPromptSpecTranslationFileInputSource extends JsonSerializable { + /** The file's contents. */ + @JsonProperty("content") + public abstract Optional content(); + + /** The file's display name. */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** The file's mime type. */ + @JsonProperty("mimeType") + public abstract Optional mimeType(); + + /** Instantiates a builder for SchemaPromptSpecTranslationFileInputSource. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaPromptSpecTranslationFileInputSource.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaPromptSpecTranslationFileInputSource. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SchemaPromptSpecTranslationFileInputSource.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaPromptSpecTranslationFileInputSource.Builder(); + } + + /** + * Setter for content. + * + *

content: The file's contents. + */ + @JsonProperty("content") + public abstract Builder content(String content); + + @ExcludeFromGeneratedCoverageReport + abstract Builder content(Optional content); + + /** Clears the value of content field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContent() { + return content(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: The file's display name. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for mimeType. + * + *

mimeType: The file's mime type. + */ + @JsonProperty("mimeType") + public abstract Builder mimeType(String mimeType); + + @ExcludeFromGeneratedCoverageReport + abstract Builder mimeType(Optional mimeType); + + /** Clears the value of mimeType field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMimeType() { + return mimeType(Optional.empty()); + } + + public abstract SchemaPromptSpecTranslationFileInputSource build(); + } + + /** Deserializes a JSON string to a SchemaPromptSpecTranslationFileInputSource object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaPromptSpecTranslationFileInputSource fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, SchemaPromptSpecTranslationFileInputSource.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationGcsInputSource.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationGcsInputSource.java new file mode 100644 index 000000000000..3da9d9f5fac3 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationGcsInputSource.java @@ -0,0 +1,85 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** */ +@AutoValue +@JsonDeserialize(builder = SchemaPromptSpecTranslationGcsInputSource.Builder.class) +public abstract class SchemaPromptSpecTranslationGcsInputSource extends JsonSerializable { + /** Source data URI. For example, `gs://my_bucket/my_object`. */ + @JsonProperty("inputUri") + public abstract Optional inputUri(); + + /** Instantiates a builder for SchemaPromptSpecTranslationGcsInputSource. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaPromptSpecTranslationGcsInputSource.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaPromptSpecTranslationGcsInputSource. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SchemaPromptSpecTranslationGcsInputSource.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaPromptSpecTranslationGcsInputSource.Builder(); + } + + /** + * Setter for inputUri. + * + *

inputUri: Source data URI. For example, `gs://my_bucket/my_object`. + */ + @JsonProperty("inputUri") + public abstract Builder inputUri(String inputUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder inputUri(Optional inputUri); + + /** Clears the value of inputUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInputUri() { + return inputUri(Optional.empty()); + } + + public abstract SchemaPromptSpecTranslationGcsInputSource build(); + } + + /** Deserializes a JSON string to a SchemaPromptSpecTranslationGcsInputSource object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaPromptSpecTranslationGcsInputSource fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, SchemaPromptSpecTranslationGcsInputSource.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationOption.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationOption.java new file mode 100644 index 000000000000..d0b1cd0d3e77 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationOption.java @@ -0,0 +1,84 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Optional settings for translation prompt. */ +@AutoValue +@JsonDeserialize(builder = SchemaPromptSpecTranslationOption.Builder.class) +public abstract class SchemaPromptSpecTranslationOption extends JsonSerializable { + /** How many shots to use. */ + @JsonProperty("numberOfShots") + public abstract Optional numberOfShots(); + + /** Instantiates a builder for SchemaPromptSpecTranslationOption. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaPromptSpecTranslationOption.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaPromptSpecTranslationOption. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SchemaPromptSpecTranslationOption.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaPromptSpecTranslationOption.Builder(); + } + + /** + * Setter for numberOfShots. + * + *

numberOfShots: How many shots to use. + */ + @JsonProperty("numberOfShots") + public abstract Builder numberOfShots(Integer numberOfShots); + + @ExcludeFromGeneratedCoverageReport + abstract Builder numberOfShots(Optional numberOfShots); + + /** Clears the value of numberOfShots field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNumberOfShots() { + return numberOfShots(Optional.empty()); + } + + public abstract SchemaPromptSpecTranslationOption build(); + } + + /** Deserializes a JSON string to a SchemaPromptSpecTranslationOption object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaPromptSpecTranslationOption fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SchemaPromptSpecTranslationOption.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationPrompt.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationPrompt.java new file mode 100644 index 000000000000..a0df3f69ff2e --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationPrompt.java @@ -0,0 +1,202 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Prompt variation for Translation use case. */ +@AutoValue +@JsonDeserialize(builder = SchemaPromptSpecTranslationPrompt.Builder.class) +public abstract class SchemaPromptSpecTranslationPrompt extends JsonSerializable { + /** The translation example. */ + @JsonProperty("example") + public abstract Optional example(); + + /** The translation option. */ + @JsonProperty("option") + public abstract Optional option(); + + /** The prompt message. */ + @JsonProperty("promptMessage") + public abstract Optional promptMessage(); + + /** The source language code. */ + @JsonProperty("sourceLanguageCode") + public abstract Optional sourceLanguageCode(); + + /** The target language code. */ + @JsonProperty("targetLanguageCode") + public abstract Optional targetLanguageCode(); + + /** Instantiates a builder for SchemaPromptSpecTranslationPrompt. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaPromptSpecTranslationPrompt.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaPromptSpecTranslationPrompt. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SchemaPromptSpecTranslationPrompt.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaPromptSpecTranslationPrompt.Builder(); + } + + /** + * Setter for example. + * + *

example: The translation example. + */ + @JsonProperty("example") + public abstract Builder example(SchemaPromptSpecTranslationExample example); + + /** + * Setter for example builder. + * + *

example: The translation example. + */ + @CanIgnoreReturnValue + public Builder example(SchemaPromptSpecTranslationExample.Builder exampleBuilder) { + return example(exampleBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder example(Optional example); + + /** Clears the value of example field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExample() { + return example(Optional.empty()); + } + + /** + * Setter for option. + * + *

option: The translation option. + */ + @JsonProperty("option") + public abstract Builder option(SchemaPromptSpecTranslationOption option); + + /** + * Setter for option builder. + * + *

option: The translation option. + */ + @CanIgnoreReturnValue + public Builder option(SchemaPromptSpecTranslationOption.Builder optionBuilder) { + return option(optionBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder option(Optional option); + + /** Clears the value of option field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearOption() { + return option(Optional.empty()); + } + + /** + * Setter for promptMessage. + * + *

promptMessage: The prompt message. + */ + @JsonProperty("promptMessage") + public abstract Builder promptMessage(SchemaPromptSpecPromptMessage promptMessage); + + /** + * Setter for promptMessage builder. + * + *

promptMessage: The prompt message. + */ + @CanIgnoreReturnValue + public Builder promptMessage(SchemaPromptSpecPromptMessage.Builder promptMessageBuilder) { + return promptMessage(promptMessageBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder promptMessage(Optional promptMessage); + + /** Clears the value of promptMessage field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPromptMessage() { + return promptMessage(Optional.empty()); + } + + /** + * Setter for sourceLanguageCode. + * + *

sourceLanguageCode: The source language code. + */ + @JsonProperty("sourceLanguageCode") + public abstract Builder sourceLanguageCode(String sourceLanguageCode); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sourceLanguageCode(Optional sourceLanguageCode); + + /** Clears the value of sourceLanguageCode field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSourceLanguageCode() { + return sourceLanguageCode(Optional.empty()); + } + + /** + * Setter for targetLanguageCode. + * + *

targetLanguageCode: The target language code. + */ + @JsonProperty("targetLanguageCode") + public abstract Builder targetLanguageCode(String targetLanguageCode); + + @ExcludeFromGeneratedCoverageReport + abstract Builder targetLanguageCode(Optional targetLanguageCode); + + /** Clears the value of targetLanguageCode field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTargetLanguageCode() { + return targetLanguageCode(Optional.empty()); + } + + public abstract SchemaPromptSpecTranslationPrompt build(); + } + + /** Deserializes a JSON string to a SchemaPromptSpecTranslationPrompt object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaPromptSpecTranslationPrompt fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SchemaPromptSpecTranslationPrompt.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationSentenceFileInput.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationSentenceFileInput.java new file mode 100644 index 000000000000..e0ee46a6d95c --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaPromptSpecTranslationSentenceFileInput.java @@ -0,0 +1,133 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** */ +@AutoValue +@JsonDeserialize(builder = SchemaPromptSpecTranslationSentenceFileInput.Builder.class) +public abstract class SchemaPromptSpecTranslationSentenceFileInput extends JsonSerializable { + /** Inlined file source. */ + @JsonProperty("fileInputSource") + public abstract Optional fileInputSource(); + + /** Cloud Storage file source. */ + @JsonProperty("gcsInputSource") + public abstract Optional gcsInputSource(); + + /** Instantiates a builder for SchemaPromptSpecTranslationSentenceFileInput. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaPromptSpecTranslationSentenceFileInput.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaPromptSpecTranslationSentenceFileInput. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SchemaPromptSpecTranslationSentenceFileInput.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaPromptSpecTranslationSentenceFileInput.Builder(); + } + + /** + * Setter for fileInputSource. + * + *

fileInputSource: Inlined file source. + */ + @JsonProperty("fileInputSource") + public abstract Builder fileInputSource( + SchemaPromptSpecTranslationFileInputSource fileInputSource); + + /** + * Setter for fileInputSource builder. + * + *

fileInputSource: Inlined file source. + */ + @CanIgnoreReturnValue + public Builder fileInputSource( + SchemaPromptSpecTranslationFileInputSource.Builder fileInputSourceBuilder) { + return fileInputSource(fileInputSourceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder fileInputSource( + Optional fileInputSource); + + /** Clears the value of fileInputSource field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFileInputSource() { + return fileInputSource(Optional.empty()); + } + + /** + * Setter for gcsInputSource. + * + *

gcsInputSource: Cloud Storage file source. + */ + @JsonProperty("gcsInputSource") + public abstract Builder gcsInputSource( + SchemaPromptSpecTranslationGcsInputSource gcsInputSource); + + /** + * Setter for gcsInputSource builder. + * + *

gcsInputSource: Cloud Storage file source. + */ + @CanIgnoreReturnValue + public Builder gcsInputSource( + SchemaPromptSpecTranslationGcsInputSource.Builder gcsInputSourceBuilder) { + return gcsInputSource(gcsInputSourceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder gcsInputSource( + Optional gcsInputSource); + + /** Clears the value of gcsInputSource field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGcsInputSource() { + return gcsInputSource(Optional.empty()); + } + + public abstract SchemaPromptSpecTranslationSentenceFileInput build(); + } + + /** Deserializes a JSON string to a SchemaPromptSpecTranslationSentenceFileInput object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaPromptSpecTranslationSentenceFileInput fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, SchemaPromptSpecTranslationSentenceFileInput.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaTablesDatasetMetadata.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaTablesDatasetMetadata.java new file mode 100644 index 000000000000..5162359f2dab --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaTablesDatasetMetadata.java @@ -0,0 +1,91 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents the metadata schema for multimodal dataset metadata. */ +@AutoValue +@JsonDeserialize(builder = SchemaTablesDatasetMetadata.Builder.class) +public abstract class SchemaTablesDatasetMetadata extends JsonSerializable { + /** The input config for multimodal dataset metadata. */ + @JsonProperty("inputConfig") + public abstract Optional inputConfig(); + + /** Instantiates a builder for SchemaTablesDatasetMetadata. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaTablesDatasetMetadata.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaTablesDatasetMetadata. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `SchemaTablesDatasetMetadata.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaTablesDatasetMetadata.Builder(); + } + + /** + * Setter for inputConfig. + * + *

inputConfig: The input config for multimodal dataset metadata. + */ + @JsonProperty("inputConfig") + public abstract Builder inputConfig(SchemaTablesDatasetMetadataInputConfig inputConfig); + + /** + * Setter for inputConfig builder. + * + *

inputConfig: The input config for multimodal dataset metadata. + */ + @CanIgnoreReturnValue + public Builder inputConfig(SchemaTablesDatasetMetadataInputConfig.Builder inputConfigBuilder) { + return inputConfig(inputConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder inputConfig(Optional inputConfig); + + /** Clears the value of inputConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInputConfig() { + return inputConfig(Optional.empty()); + } + + public abstract SchemaTablesDatasetMetadata build(); + } + + /** Deserializes a JSON string to a SchemaTablesDatasetMetadata object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaTablesDatasetMetadata fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SchemaTablesDatasetMetadata.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaTablesDatasetMetadataBigQuerySource.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaTablesDatasetMetadataBigQuerySource.java new file mode 100644 index 000000000000..a0a39f3e49ed --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaTablesDatasetMetadataBigQuerySource.java @@ -0,0 +1,88 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents the BigQuery source for multimodal dataset metadata. */ +@AutoValue +@JsonDeserialize(builder = SchemaTablesDatasetMetadataBigQuerySource.Builder.class) +public abstract class SchemaTablesDatasetMetadataBigQuerySource extends JsonSerializable { + /** + * The URI of the BigQuery table. This accepts the table name with or without the bq:// prefix. + */ + @JsonProperty("uri") + public abstract Optional uri(); + + /** Instantiates a builder for SchemaTablesDatasetMetadataBigQuerySource. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaTablesDatasetMetadataBigQuerySource.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaTablesDatasetMetadataBigQuerySource. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SchemaTablesDatasetMetadataBigQuerySource.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaTablesDatasetMetadataBigQuerySource.Builder(); + } + + /** + * Setter for uri. + * + *

uri: The URI of the BigQuery table. This accepts the table name with or without the bq:// + * prefix. + */ + @JsonProperty("uri") + public abstract Builder uri(String uri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder uri(Optional uri); + + /** Clears the value of uri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUri() { + return uri(Optional.empty()); + } + + public abstract SchemaTablesDatasetMetadataBigQuerySource build(); + } + + /** Deserializes a JSON string to a SchemaTablesDatasetMetadataBigQuerySource object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaTablesDatasetMetadataBigQuerySource fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, SchemaTablesDatasetMetadataBigQuerySource.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaTablesDatasetMetadataInputConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaTablesDatasetMetadataInputConfig.java new file mode 100644 index 000000000000..e463345df182 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaTablesDatasetMetadataInputConfig.java @@ -0,0 +1,98 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents the input config for multimodal dataset metadata. */ +@AutoValue +@JsonDeserialize(builder = SchemaTablesDatasetMetadataInputConfig.Builder.class) +public abstract class SchemaTablesDatasetMetadataInputConfig extends JsonSerializable { + /** The BigQuery source for multimodal dataset metadata. */ + @JsonProperty("bigquerySource") + public abstract Optional bigquerySource(); + + /** Instantiates a builder for SchemaTablesDatasetMetadataInputConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaTablesDatasetMetadataInputConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaTablesDatasetMetadataInputConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SchemaTablesDatasetMetadataInputConfig.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaTablesDatasetMetadataInputConfig.Builder(); + } + + /** + * Setter for bigquerySource. + * + *

bigquerySource: The BigQuery source for multimodal dataset metadata. + */ + @JsonProperty("bigquerySource") + public abstract Builder bigquerySource( + SchemaTablesDatasetMetadataBigQuerySource bigquerySource); + + /** + * Setter for bigquerySource builder. + * + *

bigquerySource: The BigQuery source for multimodal dataset metadata. + */ + @CanIgnoreReturnValue + public Builder bigquerySource( + SchemaTablesDatasetMetadataBigQuerySource.Builder bigquerySourceBuilder) { + return bigquerySource(bigquerySourceBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder bigquerySource( + Optional bigquerySource); + + /** Clears the value of bigquerySource field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBigquerySource() { + return bigquerySource(Optional.empty()); + } + + public abstract SchemaTablesDatasetMetadataInputConfig build(); + } + + /** Deserializes a JSON string to a SchemaTablesDatasetMetadataInputConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaTablesDatasetMetadataInputConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, SchemaTablesDatasetMetadataInputConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaTextPromptDatasetMetadata.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaTextPromptDatasetMetadata.java new file mode 100644 index 000000000000..a8e69a756262 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SchemaTextPromptDatasetMetadata.java @@ -0,0 +1,508 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Represents the text prompt dataset metadata. */ +@AutoValue +@JsonDeserialize(builder = SchemaTextPromptDatasetMetadata.Builder.class) +public abstract class SchemaTextPromptDatasetMetadata extends JsonSerializable { + /** Number of candidates. */ + @JsonProperty("candidateCount") + public abstract Optional candidateCount(); + + /** The Google Cloud Storage URI that stores the prompt data. */ + @JsonProperty("gcsUri") + public abstract Optional gcsUri(); + + /** Grounding checking configuration. */ + @JsonProperty("groundingConfig") + public abstract Optional groundingConfig(); + + /** Whether the prompt dataset has prompt variable. */ + @JsonProperty("hasPromptVariable") + public abstract Optional hasPromptVariable(); + + /** Whether or not the user has enabled logit probabilities in the model parameters. */ + @JsonProperty("logprobs") + public abstract Optional logprobs(); + + /** Value of the maximum number of tokens generated set when the dataset was saved. */ + @JsonProperty("maxOutputTokens") + public abstract Optional maxOutputTokens(); + + /** User-created prompt note. Note size limit is 2KB. */ + @JsonProperty("note") + public abstract Optional note(); + + /** The API schema of the prompt to support both UI and SDK usages. */ + @JsonProperty("promptApiSchema") + public abstract Optional promptApiSchema(); + + /** Type of the prompt dataset. */ + @JsonProperty("promptType") + public abstract Optional promptType(); + + /** + * Seeding enables model to return a deterministic response on a best effort basis. Determinism + * isn't guaranteed. This field determines whether or not seeding is enabled. + */ + @JsonProperty("seedEnabled") + public abstract Optional seedEnabled(); + + /** The actual value of the seed. */ + @JsonProperty("seedValue") + public abstract Optional seedValue(); + + /** Customized stop sequences. */ + @JsonProperty("stopSequences") + public abstract Optional> stopSequences(); + + /** The content of the prompt dataset system instruction. */ + @JsonProperty("systemInstruction") + public abstract Optional systemInstruction(); + + /** The Google Cloud Storage URI that stores the system instruction, starting with gs://. */ + @JsonProperty("systemInstructionGcsUri") + public abstract Optional systemInstructionGcsUri(); + + /** + * Temperature value used for sampling set when the dataset was saved. This value is used to tune + * the degree of randomness. + */ + @JsonProperty("temperature") + public abstract Optional temperature(); + + /** The content of the prompt dataset. */ + @JsonProperty("text") + public abstract Optional text(); + + /** + * Top K value set when the dataset was saved. This value determines how many candidates with + * highest probability from the vocab would be selected for each decoding step. + */ + @JsonProperty("topK") + public abstract Optional topK(); + + /** + * Top P value set when the dataset was saved. Given topK tokens for decoding, top candidates will + * be selected until the sum of their probabilities is topP. + */ + @JsonProperty("topP") + public abstract Optional topP(); + + /** Instantiates a builder for SchemaTextPromptDatasetMetadata. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SchemaTextPromptDatasetMetadata.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SchemaTextPromptDatasetMetadata. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `SchemaTextPromptDatasetMetadata.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_SchemaTextPromptDatasetMetadata.Builder(); + } + + /** + * Setter for candidateCount. + * + *

candidateCount: Number of candidates. + */ + @JsonProperty("candidateCount") + public abstract Builder candidateCount(Long candidateCount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder candidateCount(Optional candidateCount); + + /** Clears the value of candidateCount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCandidateCount() { + return candidateCount(Optional.empty()); + } + + /** + * Setter for gcsUri. + * + *

gcsUri: The Google Cloud Storage URI that stores the prompt data. + */ + @JsonProperty("gcsUri") + public abstract Builder gcsUri(String gcsUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder gcsUri(Optional gcsUri); + + /** Clears the value of gcsUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGcsUri() { + return gcsUri(Optional.empty()); + } + + /** + * Setter for groundingConfig. + * + *

groundingConfig: Grounding checking configuration. + */ + @JsonProperty("groundingConfig") + public abstract Builder groundingConfig(SchemaPredictParamsGroundingConfig groundingConfig); + + /** + * Setter for groundingConfig builder. + * + *

groundingConfig: Grounding checking configuration. + */ + @CanIgnoreReturnValue + public Builder groundingConfig( + SchemaPredictParamsGroundingConfig.Builder groundingConfigBuilder) { + return groundingConfig(groundingConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder groundingConfig(Optional groundingConfig); + + /** Clears the value of groundingConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearGroundingConfig() { + return groundingConfig(Optional.empty()); + } + + /** + * Setter for hasPromptVariable. + * + *

hasPromptVariable: Whether the prompt dataset has prompt variable. + */ + @JsonProperty("hasPromptVariable") + public abstract Builder hasPromptVariable(boolean hasPromptVariable); + + @ExcludeFromGeneratedCoverageReport + abstract Builder hasPromptVariable(Optional hasPromptVariable); + + /** Clears the value of hasPromptVariable field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHasPromptVariable() { + return hasPromptVariable(Optional.empty()); + } + + /** + * Setter for logprobs. + * + *

logprobs: Whether or not the user has enabled logit probabilities in the model parameters. + */ + @JsonProperty("logprobs") + public abstract Builder logprobs(boolean logprobs); + + @ExcludeFromGeneratedCoverageReport + abstract Builder logprobs(Optional logprobs); + + /** Clears the value of logprobs field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLogprobs() { + return logprobs(Optional.empty()); + } + + /** + * Setter for maxOutputTokens. + * + *

maxOutputTokens: Value of the maximum number of tokens generated set when the dataset was + * saved. + */ + @JsonProperty("maxOutputTokens") + public abstract Builder maxOutputTokens(Long maxOutputTokens); + + @ExcludeFromGeneratedCoverageReport + abstract Builder maxOutputTokens(Optional maxOutputTokens); + + /** Clears the value of maxOutputTokens field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMaxOutputTokens() { + return maxOutputTokens(Optional.empty()); + } + + /** + * Setter for note. + * + *

note: User-created prompt note. Note size limit is 2KB. + */ + @JsonProperty("note") + public abstract Builder note(String note); + + @ExcludeFromGeneratedCoverageReport + abstract Builder note(Optional note); + + /** Clears the value of note field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNote() { + return note(Optional.empty()); + } + + /** + * Setter for promptApiSchema. + * + *

promptApiSchema: The API schema of the prompt to support both UI and SDK usages. + */ + @JsonProperty("promptApiSchema") + public abstract Builder promptApiSchema(SchemaPromptApiSchema promptApiSchema); + + /** + * Setter for promptApiSchema builder. + * + *

promptApiSchema: The API schema of the prompt to support both UI and SDK usages. + */ + @CanIgnoreReturnValue + public Builder promptApiSchema(SchemaPromptApiSchema.Builder promptApiSchemaBuilder) { + return promptApiSchema(promptApiSchemaBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder promptApiSchema(Optional promptApiSchema); + + /** Clears the value of promptApiSchema field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPromptApiSchema() { + return promptApiSchema(Optional.empty()); + } + + /** + * Setter for promptType. + * + *

promptType: Type of the prompt dataset. + */ + @JsonProperty("promptType") + public abstract Builder promptType(String promptType); + + @ExcludeFromGeneratedCoverageReport + abstract Builder promptType(Optional promptType); + + /** Clears the value of promptType field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPromptType() { + return promptType(Optional.empty()); + } + + /** + * Setter for seedEnabled. + * + *

seedEnabled: Seeding enables model to return a deterministic response on a best effort + * basis. Determinism isn't guaranteed. This field determines whether or not seeding is enabled. + */ + @JsonProperty("seedEnabled") + public abstract Builder seedEnabled(boolean seedEnabled); + + @ExcludeFromGeneratedCoverageReport + abstract Builder seedEnabled(Optional seedEnabled); + + /** Clears the value of seedEnabled field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSeedEnabled() { + return seedEnabled(Optional.empty()); + } + + /** + * Setter for seedValue. + * + *

seedValue: The actual value of the seed. + */ + @JsonProperty("seedValue") + public abstract Builder seedValue(Long seedValue); + + @ExcludeFromGeneratedCoverageReport + abstract Builder seedValue(Optional seedValue); + + /** Clears the value of seedValue field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSeedValue() { + return seedValue(Optional.empty()); + } + + /** + * Setter for stopSequences. + * + *

stopSequences: Customized stop sequences. + */ + @JsonProperty("stopSequences") + public abstract Builder stopSequences(List stopSequences); + + /** + * Setter for stopSequences. + * + *

stopSequences: Customized stop sequences. + */ + @CanIgnoreReturnValue + public Builder stopSequences(String... stopSequences) { + return stopSequences(Arrays.asList(stopSequences)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder stopSequences(Optional> stopSequences); + + /** Clears the value of stopSequences field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearStopSequences() { + return stopSequences(Optional.empty()); + } + + /** + * Setter for systemInstruction. + * + *

systemInstruction: The content of the prompt dataset system instruction. + */ + @JsonProperty("systemInstruction") + public abstract Builder systemInstruction(String systemInstruction); + + @ExcludeFromGeneratedCoverageReport + abstract Builder systemInstruction(Optional systemInstruction); + + /** Clears the value of systemInstruction field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSystemInstruction() { + return systemInstruction(Optional.empty()); + } + + /** + * Setter for systemInstructionGcsUri. + * + *

systemInstructionGcsUri: The Google Cloud Storage URI that stores the system instruction, + * starting with gs://. + */ + @JsonProperty("systemInstructionGcsUri") + public abstract Builder systemInstructionGcsUri(String systemInstructionGcsUri); + + @ExcludeFromGeneratedCoverageReport + abstract Builder systemInstructionGcsUri(Optional systemInstructionGcsUri); + + /** Clears the value of systemInstructionGcsUri field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSystemInstructionGcsUri() { + return systemInstructionGcsUri(Optional.empty()); + } + + /** + * Setter for temperature. + * + *

temperature: Temperature value used for sampling set when the dataset was saved. This + * value is used to tune the degree of randomness. + */ + @JsonProperty("temperature") + public abstract Builder temperature(Float temperature); + + @ExcludeFromGeneratedCoverageReport + abstract Builder temperature(Optional temperature); + + /** Clears the value of temperature field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTemperature() { + return temperature(Optional.empty()); + } + + /** + * Setter for text. + * + *

text: The content of the prompt dataset. + */ + @JsonProperty("text") + public abstract Builder text(String text); + + @ExcludeFromGeneratedCoverageReport + abstract Builder text(Optional text); + + /** Clears the value of text field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearText() { + return text(Optional.empty()); + } + + /** + * Setter for topK. + * + *

topK: Top K value set when the dataset was saved. This value determines how many + * candidates with highest probability from the vocab would be selected for each decoding step. + */ + @JsonProperty("topK") + public abstract Builder topK(Long topK); + + @ExcludeFromGeneratedCoverageReport + abstract Builder topK(Optional topK); + + /** Clears the value of topK field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTopK() { + return topK(Optional.empty()); + } + + /** + * Setter for topP. + * + *

topP: Top P value set when the dataset was saved. Given topK tokens for decoding, top + * candidates will be selected until the sum of their probabilities is topP. + */ + @JsonProperty("topP") + public abstract Builder topP(Float topP); + + @ExcludeFromGeneratedCoverageReport + abstract Builder topP(Optional topP); + + /** Clears the value of topP field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTopP() { + return topP(Optional.empty()); + } + + public abstract SchemaTextPromptDatasetMetadata build(); + } + + /** Deserializes a JSON string to a SchemaTextPromptDatasetMetadata object. */ + @ExcludeFromGeneratedCoverageReport + public static SchemaTextPromptDatasetMetadata fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SchemaTextPromptDatasetMetadata.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SecretEnvVar.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SecretEnvVar.java new file mode 100644 index 000000000000..e00c67869ba5 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SecretEnvVar.java @@ -0,0 +1,118 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Represents an environment variable where the value is a secret in Cloud Secret Manager. */ +@AutoValue +@JsonDeserialize(builder = SecretEnvVar.Builder.class) +public abstract class SecretEnvVar extends JsonSerializable { + /** Required. Name of the secret environment variable. */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * Required. Reference to a secret stored in the Cloud Secret Manager that will provide the value + * for this environment variable. + */ + @JsonProperty("secretRef") + public abstract Optional secretRef(); + + /** Instantiates a builder for SecretEnvVar. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SecretEnvVar.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SecretEnvVar. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `SecretEnvVar.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_SecretEnvVar.Builder(); + } + + /** + * Setter for name. + * + *

name: Required. Name of the secret environment variable. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for secretRef. + * + *

secretRef: Required. Reference to a secret stored in the Cloud Secret Manager that will + * provide the value for this environment variable. + */ + @JsonProperty("secretRef") + public abstract Builder secretRef(SecretRef secretRef); + + /** + * Setter for secretRef builder. + * + *

secretRef: Required. Reference to a secret stored in the Cloud Secret Manager that will + * provide the value for this environment variable. + */ + @CanIgnoreReturnValue + public Builder secretRef(SecretRef.Builder secretRefBuilder) { + return secretRef(secretRefBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder secretRef(Optional secretRef); + + /** Clears the value of secretRef field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSecretRef() { + return secretRef(Optional.empty()); + } + + public abstract SecretEnvVar build(); + } + + /** Deserializes a JSON string to a SecretEnvVar object. */ + @ExcludeFromGeneratedCoverageReport + public static SecretEnvVar fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SecretEnvVar.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SecretRef.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SecretRef.java new file mode 100644 index 000000000000..1b4a10acb999 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SecretRef.java @@ -0,0 +1,110 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** + * Reference to a secret stored in the Cloud Secret Manager that will provide the value for this + * environment variable. + */ +@AutoValue +@JsonDeserialize(builder = SecretRef.Builder.class) +public abstract class SecretRef extends JsonSerializable { + /** Required. The name of the secret in Cloud Secret Manager. Format: {secret_name}. */ + @JsonProperty("secret") + public abstract Optional secret(); + + /** + * The Cloud Secret Manager secret version. Can be 'latest' for the latest version, an integer for + * a specific version, or a version alias. + */ + @JsonProperty("version") + public abstract Optional version(); + + /** Instantiates a builder for SecretRef. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SecretRef.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SecretRef. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `SecretRef.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_SecretRef.Builder(); + } + + /** + * Setter for secret. + * + *

secret: Required. The name of the secret in Cloud Secret Manager. Format: {secret_name}. + */ + @JsonProperty("secret") + public abstract Builder secret(String secret); + + @ExcludeFromGeneratedCoverageReport + abstract Builder secret(Optional secret); + + /** Clears the value of secret field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSecret() { + return secret(Optional.empty()); + } + + /** + * Setter for version. + * + *

version: The Cloud Secret Manager secret version. Can be 'latest' for the latest version, + * an integer for a specific version, or a version alias. + */ + @JsonProperty("version") + public abstract Builder version(String version); + + @ExcludeFromGeneratedCoverageReport + abstract Builder version(Optional version); + + /** Clears the value of version field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearVersion() { + return version(Optional.empty()); + } + + public abstract SecretRef build(); + } + + /** Deserializes a JSON string to a SecretRef object. */ + @ExcludeFromGeneratedCoverageReport + public static SecretRef fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SecretRef.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Session.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Session.java new file mode 100644 index 000000000000..379a22bfc574 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Session.java @@ -0,0 +1,276 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.time.Duration; +import java.time.Instant; +import java.util.Map; +import java.util.Optional; + +/** A session. */ +@AutoValue +@JsonDeserialize(builder = Session.Builder.class) +public abstract class Session extends JsonSerializable { + /** + * Optional. Timestamp of when this session is considered expired. This is *always* provided on + * output, regardless of what was sent on input. + */ + @JsonProperty("expireTime") + public abstract Optional expireTime(); + + /** Optional. Input only. The TTL for this session. */ + @JsonProperty("ttl") + public abstract Optional ttl(); + + /** + * Identifier. The resource name of the session. Format: + * 'projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}'. + */ + @JsonProperty("name") + public abstract Optional name(); + + /** Output only. Timestamp when the session was created. */ + @JsonProperty("createTime") + public abstract Optional createTime(); + + /** Output only. Timestamp when the session was updated. */ + @JsonProperty("updateTime") + public abstract Optional updateTime(); + + /** Optional. The display name of the session. */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** + * The labels with user-defined metadata to organize your Sessions. Label keys and values can be + * no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric + * characters, underscores and dashes. International characters are allowed. See + * https://goo.gl/xmQnxf for more information and examples of labels. + */ + @JsonProperty("labels") + public abstract Optional> labels(); + + /** Optional. Session specific memory which stores key conversation points. */ + @JsonProperty("sessionState") + public abstract Optional> sessionState(); + + /** Required. Immutable. String id provided by the user */ + @JsonProperty("userId") + public abstract Optional userId(); + + /** Instantiates a builder for Session. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_Session.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for Session. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `Session.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_Session.Builder(); + } + + /** + * Setter for expireTime. + * + *

expireTime: Optional. Timestamp of when this session is considered expired. This is + * *always* provided on output, regardless of what was sent on input. + */ + @JsonProperty("expireTime") + public abstract Builder expireTime(Instant expireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder expireTime(Optional expireTime); + + /** Clears the value of expireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExpireTime() { + return expireTime(Optional.empty()); + } + + /** + * Setter for ttl. + * + *

ttl: Optional. Input only. The TTL for this session. + */ + @JsonProperty("ttl") + public abstract Builder ttl(Duration ttl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder ttl(Optional ttl); + + /** Clears the value of ttl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTtl() { + return ttl(Optional.empty()); + } + + /** + * Setter for name. + * + *

name: Identifier. The resource name of the session. Format: + * 'projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}'. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for createTime. + * + *

createTime: Output only. Timestamp when the session was created. + */ + @JsonProperty("createTime") + public abstract Builder createTime(Instant createTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder createTime(Optional createTime); + + /** Clears the value of createTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearCreateTime() { + return createTime(Optional.empty()); + } + + /** + * Setter for updateTime. + * + *

updateTime: Output only. Timestamp when the session was updated. + */ + @JsonProperty("updateTime") + public abstract Builder updateTime(Instant updateTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder updateTime(Optional updateTime); + + /** Clears the value of updateTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUpdateTime() { + return updateTime(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: Optional. The display name of the session. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for labels. + * + *

labels: The labels with user-defined metadata to organize your Sessions. Label keys and + * values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase + * letters, numeric characters, underscores and dashes. International characters are allowed. + * See https://goo.gl/xmQnxf for more information and examples of labels. + */ + @JsonProperty("labels") + public abstract Builder labels(Map labels); + + @ExcludeFromGeneratedCoverageReport + abstract Builder labels(Optional> labels); + + /** Clears the value of labels field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLabels() { + return labels(Optional.empty()); + } + + /** + * Setter for sessionState. + * + *

sessionState: Optional. Session specific memory which stores key conversation points. + */ + @JsonProperty("sessionState") + public abstract Builder sessionState(Map sessionState); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sessionState(Optional> sessionState); + + /** Clears the value of sessionState field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSessionState() { + return sessionState(Optional.empty()); + } + + /** + * Setter for userId. + * + *

userId: Required. Immutable. String id provided by the user + */ + @JsonProperty("userId") + public abstract Builder userId(String userId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder userId(Optional userId); + + /** Clears the value of userId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUserId() { + return userId(Optional.empty()); + } + + public abstract Session build(); + } + + /** Deserializes a JSON string to a Session object. */ + @ExcludeFromGeneratedCoverageReport + public static Session fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, Session.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SessionInput.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SessionInput.java new file mode 100644 index 000000000000..96839d221508 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SessionInput.java @@ -0,0 +1,85 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** + * This field is experimental and may change in future versions. + * + *

Input to initialize a session and run an agent, used for agent evaluation. + */ +@AutoValue +@JsonDeserialize(builder = SessionInput.Builder.class) +public abstract class SessionInput extends JsonSerializable { + /** The user id. */ + @JsonProperty("userId") + public abstract Optional userId(); + + /** Instantiates a builder for SessionInput. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SessionInput.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SessionInput. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `SessionInput.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_SessionInput.Builder(); + } + + /** + * Setter for userId. + * + *

userId: The user id. + */ + @JsonProperty("userId") + public abstract Builder userId(String userId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder userId(Optional userId); + + /** Clears the value of userId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUserId() { + return userId(Optional.empty()); + } + + public abstract SessionInput build(); + } + + /** Deserializes a JSON string to a SessionInput object. */ + @ExcludeFromGeneratedCoverageReport + public static SessionInput fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SessionInput.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/State.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/State.java new file mode 100644 index 000000000000..3c76786feeb1 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/State.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** Output only. The runtime state of the SandboxEnvironment. */ +public class State { + + /** Enum representing the known values for State. */ + public enum Known { + /** The default value. This value is unused. */ + STATE_UNSPECIFIED, + + /** Runtime resources are being allocated for the sandbox environment. */ + STATE_PROVISIONING, + + /** Sandbox runtime is ready for serving. */ + STATE_RUNNING, + + /** Sandbox runtime is halted, performing tear down tasks. */ + STATE_DEPROVISIONING, + + /** Sandbox has terminated with underlying runtime failure. */ + STATE_TERMINATED, + + /** Sandbox runtime has been deleted. */ + STATE_DELETED + } + + private Known stateEnum; + private final String value; + + @JsonCreator + public State(String value) { + this.value = value; + for (Known stateEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(stateEnum.toString(), value)) { + this.stateEnum = stateEnum; + break; + } + } + if (this.stateEnum == null) { + this.stateEnum = Known.STATE_UNSPECIFIED; + } + } + + public State(Known knownValue) { + this.stateEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof State)) { + return false; + } + + State other = (State) o; + + if (this.stateEnum != Known.STATE_UNSPECIFIED && other.stateEnum != Known.STATE_UNSPECIFIED) { + return this.stateEnum == other.stateEnum; + } else if (this.stateEnum == Known.STATE_UNSPECIFIED + && other.stateEnum == Known.STATE_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.stateEnum != Known.STATE_UNSPECIFIED) { + return this.stateEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.stateEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Strategy.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Strategy.java new file mode 100644 index 000000000000..90b37d8ba4b4 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Strategy.java @@ -0,0 +1,120 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** This determines which type of scheduling strategy to use. */ +public class Strategy { + + /** Enum representing the known values for Strategy. */ + public enum Known { + /** Strategy will default to STANDARD. */ + STRATEGY_UNSPECIFIED, + + /** Deprecated. Regular on-demand provisioning strategy. */ + ON_DEMAND, + + /** Deprecated. Low cost by making potential use of spot resources. */ + LOW_COST, + + /** Standard provisioning strategy uses regular on-demand resources. */ + STANDARD, + + /** Spot provisioning strategy uses spot resources. */ + SPOT, + + /** Flex Start strategy uses DWS to queue for resources. */ + FLEX_START + } + + private Known strategyEnum; + private final String value; + + @JsonCreator + public Strategy(String value) { + this.value = value; + for (Known strategyEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(strategyEnum.toString(), value)) { + this.strategyEnum = strategyEnum; + break; + } + } + if (this.strategyEnum == null) { + this.strategyEnum = Known.STRATEGY_UNSPECIFIED; + } + } + + public Strategy(Known knownValue) { + this.strategyEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof Strategy)) { + return false; + } + + Strategy other = (Strategy) o; + + if (this.strategyEnum != Known.STRATEGY_UNSPECIFIED + && other.strategyEnum != Known.STRATEGY_UNSPECIFIED) { + return this.strategyEnum == other.strategyEnum; + } else if (this.strategyEnum == Known.STRATEGY_UNSPECIFIED + && other.strategyEnum == Known.STRATEGY_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.strategyEnum != Known.STRATEGY_UNSPECIFIED) { + return this.strategyEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.strategyEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SummaryMetric.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SummaryMetric.java new file mode 100644 index 000000000000..f0523509af0f --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/SummaryMetric.java @@ -0,0 +1,126 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Represents a summary metric for an evaluation run. */ +@AutoValue +@JsonDeserialize(builder = SummaryMetric.Builder.class) +public abstract class SummaryMetric extends JsonSerializable { + /** Map of metric name to metric value. */ + @JsonProperty("metrics") + public abstract Optional> metrics(); + + /** The total number of items that were evaluated. */ + @JsonProperty("totalItems") + public abstract Optional totalItems(); + + /** The number of items that failed to be evaluated. */ + @JsonProperty("failedItems") + public abstract Optional failedItems(); + + /** Instantiates a builder for SummaryMetric. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_SummaryMetric.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for SummaryMetric. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `SummaryMetric.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_SummaryMetric.Builder(); + } + + /** + * Setter for metrics. + * + *

metrics: Map of metric name to metric value. + */ + @JsonProperty("metrics") + public abstract Builder metrics(Map metrics); + + @ExcludeFromGeneratedCoverageReport + abstract Builder metrics(Optional> metrics); + + /** Clears the value of metrics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetrics() { + return metrics(Optional.empty()); + } + + /** + * Setter for totalItems. + * + *

totalItems: The total number of items that were evaluated. + */ + @JsonProperty("totalItems") + public abstract Builder totalItems(Integer totalItems); + + @ExcludeFromGeneratedCoverageReport + abstract Builder totalItems(Optional totalItems); + + /** Clears the value of totalItems field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTotalItems() { + return totalItems(Optional.empty()); + } + + /** + * Setter for failedItems. + * + *

failedItems: The number of items that failed to be evaluated. + */ + @JsonProperty("failedItems") + public abstract Builder failedItems(Integer failedItems); + + @ExcludeFromGeneratedCoverageReport + abstract Builder failedItems(Optional failedItems); + + /** Clears the value of failedItems field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFailedItems() { + return failedItems(Optional.empty()); + } + + public abstract SummaryMetric build(); + } + + /** Deserializes a JSON string to a SummaryMetric object. */ + @ExcludeFromGeneratedCoverageReport + public static SummaryMetric fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, SummaryMetric.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidInput.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidInput.java new file mode 100644 index 000000000000..35272779c499 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidInput.java @@ -0,0 +1,140 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Tool call valid input. */ +@AutoValue +@JsonDeserialize(builder = ToolCallValidInput.Builder.class) +public abstract class ToolCallValidInput extends JsonSerializable { + /** Required. Repeated tool call valid instances. */ + @JsonProperty("instances") + public abstract Optional> instances(); + + /** Required. Spec for tool call valid metric. */ + @JsonProperty("metricSpec") + public abstract Optional metricSpec(); + + /** Instantiates a builder for ToolCallValidInput. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolCallValidInput.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolCallValidInput. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ToolCallValidInput.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolCallValidInput.Builder(); + } + + /** + * Setter for instances. + * + *

instances: Required. Repeated tool call valid instances. + */ + @JsonProperty("instances") + public abstract Builder instances(List instances); + + /** + * Setter for instances. + * + *

instances: Required. Repeated tool call valid instances. + */ + @CanIgnoreReturnValue + public Builder instances(ToolCallValidInstance... instances) { + return instances(Arrays.asList(instances)); + } + + /** + * Setter for instances builder. + * + *

instances: Required. Repeated tool call valid instances. + */ + @CanIgnoreReturnValue + public Builder instances(ToolCallValidInstance.Builder... instancesBuilders) { + return instances( + Arrays.asList(instancesBuilders).stream() + .map(ToolCallValidInstance.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder instances(Optional> instances); + + /** Clears the value of instances field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInstances() { + return instances(Optional.empty()); + } + + /** + * Setter for metricSpec. + * + *

metricSpec: Required. Spec for tool call valid metric. + */ + @JsonProperty("metricSpec") + public abstract Builder metricSpec(ToolCallValidSpec metricSpec); + + /** + * Setter for metricSpec builder. + * + *

metricSpec: Required. Spec for tool call valid metric. + */ + @CanIgnoreReturnValue + public Builder metricSpec(ToolCallValidSpec.Builder metricSpecBuilder) { + return metricSpec(metricSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metricSpec(Optional metricSpec); + + /** Clears the value of metricSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetricSpec() { + return metricSpec(Optional.empty()); + } + + public abstract ToolCallValidInput build(); + } + + /** Deserializes a JSON string to a ToolCallValidInput object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolCallValidInput fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolCallValidInput.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidInstance.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidInstance.java new file mode 100644 index 000000000000..5f91887bc192 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidInstance.java @@ -0,0 +1,103 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Tool call valid instance. */ +@AutoValue +@JsonDeserialize(builder = ToolCallValidInstance.Builder.class) +public abstract class ToolCallValidInstance extends JsonSerializable { + /** Required. Output of the evaluated model. */ + @JsonProperty("prediction") + public abstract Optional prediction(); + + /** Required. Ground truth used to compare against the prediction. */ + @JsonProperty("reference") + public abstract Optional reference(); + + /** Instantiates a builder for ToolCallValidInstance. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolCallValidInstance.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolCallValidInstance. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ToolCallValidInstance.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolCallValidInstance.Builder(); + } + + /** + * Setter for prediction. + * + *

prediction: Required. Output of the evaluated model. + */ + @JsonProperty("prediction") + public abstract Builder prediction(String prediction); + + @ExcludeFromGeneratedCoverageReport + abstract Builder prediction(Optional prediction); + + /** Clears the value of prediction field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPrediction() { + return prediction(Optional.empty()); + } + + /** + * Setter for reference. + * + *

reference: Required. Ground truth used to compare against the prediction. + */ + @JsonProperty("reference") + public abstract Builder reference(String reference); + + @ExcludeFromGeneratedCoverageReport + abstract Builder reference(Optional reference); + + /** Clears the value of reference field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReference() { + return reference(Optional.empty()); + } + + public abstract ToolCallValidInstance build(); + } + + /** Deserializes a JSON string to a ToolCallValidInstance object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolCallValidInstance fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolCallValidInstance.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidMetricValue.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidMetricValue.java new file mode 100644 index 000000000000..6746b0718260 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidMetricValue.java @@ -0,0 +1,81 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Tool call valid metric value for an instance. */ +@AutoValue +@JsonDeserialize(builder = ToolCallValidMetricValue.Builder.class) +public abstract class ToolCallValidMetricValue extends JsonSerializable { + /** Output only. Tool call valid score. */ + @JsonProperty("score") + public abstract Optional score(); + + /** Instantiates a builder for ToolCallValidMetricValue. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolCallValidMetricValue.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolCallValidMetricValue. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ToolCallValidMetricValue.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolCallValidMetricValue.Builder(); + } + + /** + * Setter for score. + * + *

score: Output only. Tool call valid score. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + @ExcludeFromGeneratedCoverageReport + abstract Builder score(Optional score); + + /** Clears the value of score field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScore() { + return score(Optional.empty()); + } + + public abstract ToolCallValidMetricValue build(); + } + + /** Deserializes a JSON string to a ToolCallValidMetricValue object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolCallValidMetricValue fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolCallValidMetricValue.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidResults.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidResults.java new file mode 100644 index 000000000000..008088c1867e --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidResults.java @@ -0,0 +1,112 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Results for tool call valid metric. */ +@AutoValue +@JsonDeserialize(builder = ToolCallValidResults.Builder.class) +public abstract class ToolCallValidResults extends JsonSerializable { + /** Output only. Tool call valid metric values. */ + @JsonProperty("toolCallValidMetricValues") + public abstract Optional> toolCallValidMetricValues(); + + /** Instantiates a builder for ToolCallValidResults. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolCallValidResults.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolCallValidResults. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ToolCallValidResults.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolCallValidResults.Builder(); + } + + /** + * Setter for toolCallValidMetricValues. + * + *

toolCallValidMetricValues: Output only. Tool call valid metric values. + */ + @JsonProperty("toolCallValidMetricValues") + public abstract Builder toolCallValidMetricValues( + List toolCallValidMetricValues); + + /** + * Setter for toolCallValidMetricValues. + * + *

toolCallValidMetricValues: Output only. Tool call valid metric values. + */ + @CanIgnoreReturnValue + public Builder toolCallValidMetricValues( + ToolCallValidMetricValue... toolCallValidMetricValues) { + return toolCallValidMetricValues(Arrays.asList(toolCallValidMetricValues)); + } + + /** + * Setter for toolCallValidMetricValues builder. + * + *

toolCallValidMetricValues: Output only. Tool call valid metric values. + */ + @CanIgnoreReturnValue + public Builder toolCallValidMetricValues( + ToolCallValidMetricValue.Builder... toolCallValidMetricValuesBuilders) { + return toolCallValidMetricValues( + Arrays.asList(toolCallValidMetricValuesBuilders).stream() + .map(ToolCallValidMetricValue.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder toolCallValidMetricValues( + Optional> toolCallValidMetricValues); + + /** Clears the value of toolCallValidMetricValues field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearToolCallValidMetricValues() { + return toolCallValidMetricValues(Optional.empty()); + } + + public abstract ToolCallValidResults build(); + } + + /** Deserializes a JSON string to a ToolCallValidResults object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolCallValidResults fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolCallValidResults.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidSpec.java new file mode 100644 index 000000000000..34f2cccb2d1b --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolCallValidSpec.java @@ -0,0 +1,56 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.genai.JsonSerializable; + +/** Spec for tool call valid metric. */ +@AutoValue +@JsonDeserialize(builder = ToolCallValidSpec.Builder.class) +public abstract class ToolCallValidSpec extends JsonSerializable { + /** Instantiates a builder for ToolCallValidSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolCallValidSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolCallValidSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ToolCallValidSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolCallValidSpec.Builder(); + } + + public abstract ToolCallValidSpec build(); + } + + /** Deserializes a JSON string to a ToolCallValidSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolCallValidSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolCallValidSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchInput.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchInput.java new file mode 100644 index 000000000000..0ec8542a2986 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchInput.java @@ -0,0 +1,140 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Tool name match input. */ +@AutoValue +@JsonDeserialize(builder = ToolNameMatchInput.Builder.class) +public abstract class ToolNameMatchInput extends JsonSerializable { + /** Required. Repeated tool name match instances. */ + @JsonProperty("instances") + public abstract Optional> instances(); + + /** Required. Spec for tool name match metric. */ + @JsonProperty("metricSpec") + public abstract Optional metricSpec(); + + /** Instantiates a builder for ToolNameMatchInput. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolNameMatchInput.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolNameMatchInput. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ToolNameMatchInput.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolNameMatchInput.Builder(); + } + + /** + * Setter for instances. + * + *

instances: Required. Repeated tool name match instances. + */ + @JsonProperty("instances") + public abstract Builder instances(List instances); + + /** + * Setter for instances. + * + *

instances: Required. Repeated tool name match instances. + */ + @CanIgnoreReturnValue + public Builder instances(ToolNameMatchInstance... instances) { + return instances(Arrays.asList(instances)); + } + + /** + * Setter for instances builder. + * + *

instances: Required. Repeated tool name match instances. + */ + @CanIgnoreReturnValue + public Builder instances(ToolNameMatchInstance.Builder... instancesBuilders) { + return instances( + Arrays.asList(instancesBuilders).stream() + .map(ToolNameMatchInstance.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder instances(Optional> instances); + + /** Clears the value of instances field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInstances() { + return instances(Optional.empty()); + } + + /** + * Setter for metricSpec. + * + *

metricSpec: Required. Spec for tool name match metric. + */ + @JsonProperty("metricSpec") + public abstract Builder metricSpec(ToolNameMatchSpec metricSpec); + + /** + * Setter for metricSpec builder. + * + *

metricSpec: Required. Spec for tool name match metric. + */ + @CanIgnoreReturnValue + public Builder metricSpec(ToolNameMatchSpec.Builder metricSpecBuilder) { + return metricSpec(metricSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metricSpec(Optional metricSpec); + + /** Clears the value of metricSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetricSpec() { + return metricSpec(Optional.empty()); + } + + public abstract ToolNameMatchInput build(); + } + + /** Deserializes a JSON string to a ToolNameMatchInput object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolNameMatchInput fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolNameMatchInput.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchInstance.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchInstance.java new file mode 100644 index 000000000000..a2bca914dc22 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchInstance.java @@ -0,0 +1,103 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Tool name match instance. */ +@AutoValue +@JsonDeserialize(builder = ToolNameMatchInstance.Builder.class) +public abstract class ToolNameMatchInstance extends JsonSerializable { + /** Required. Output of the evaluated model. */ + @JsonProperty("prediction") + public abstract Optional prediction(); + + /** Required. Ground truth used to compare against the prediction. */ + @JsonProperty("reference") + public abstract Optional reference(); + + /** Instantiates a builder for ToolNameMatchInstance. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolNameMatchInstance.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolNameMatchInstance. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ToolNameMatchInstance.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolNameMatchInstance.Builder(); + } + + /** + * Setter for prediction. + * + *

prediction: Required. Output of the evaluated model. + */ + @JsonProperty("prediction") + public abstract Builder prediction(String prediction); + + @ExcludeFromGeneratedCoverageReport + abstract Builder prediction(Optional prediction); + + /** Clears the value of prediction field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPrediction() { + return prediction(Optional.empty()); + } + + /** + * Setter for reference. + * + *

reference: Required. Ground truth used to compare against the prediction. + */ + @JsonProperty("reference") + public abstract Builder reference(String reference); + + @ExcludeFromGeneratedCoverageReport + abstract Builder reference(Optional reference); + + /** Clears the value of reference field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReference() { + return reference(Optional.empty()); + } + + public abstract ToolNameMatchInstance build(); + } + + /** Deserializes a JSON string to a ToolNameMatchInstance object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolNameMatchInstance fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolNameMatchInstance.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchMetricValue.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchMetricValue.java new file mode 100644 index 000000000000..895e7025ab79 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchMetricValue.java @@ -0,0 +1,81 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Tool name match metric value for an instance. */ +@AutoValue +@JsonDeserialize(builder = ToolNameMatchMetricValue.Builder.class) +public abstract class ToolNameMatchMetricValue extends JsonSerializable { + /** Output only. Tool name match score. */ + @JsonProperty("score") + public abstract Optional score(); + + /** Instantiates a builder for ToolNameMatchMetricValue. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolNameMatchMetricValue.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolNameMatchMetricValue. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ToolNameMatchMetricValue.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolNameMatchMetricValue.Builder(); + } + + /** + * Setter for score. + * + *

score: Output only. Tool name match score. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + @ExcludeFromGeneratedCoverageReport + abstract Builder score(Optional score); + + /** Clears the value of score field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScore() { + return score(Optional.empty()); + } + + public abstract ToolNameMatchMetricValue build(); + } + + /** Deserializes a JSON string to a ToolNameMatchMetricValue object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolNameMatchMetricValue fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolNameMatchMetricValue.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchResults.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchResults.java new file mode 100644 index 000000000000..803198b680ff --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchResults.java @@ -0,0 +1,112 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Results for tool name match metric. */ +@AutoValue +@JsonDeserialize(builder = ToolNameMatchResults.Builder.class) +public abstract class ToolNameMatchResults extends JsonSerializable { + /** Output only. Tool name match metric values. */ + @JsonProperty("toolNameMatchMetricValues") + public abstract Optional> toolNameMatchMetricValues(); + + /** Instantiates a builder for ToolNameMatchResults. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolNameMatchResults.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolNameMatchResults. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ToolNameMatchResults.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolNameMatchResults.Builder(); + } + + /** + * Setter for toolNameMatchMetricValues. + * + *

toolNameMatchMetricValues: Output only. Tool name match metric values. + */ + @JsonProperty("toolNameMatchMetricValues") + public abstract Builder toolNameMatchMetricValues( + List toolNameMatchMetricValues); + + /** + * Setter for toolNameMatchMetricValues. + * + *

toolNameMatchMetricValues: Output only. Tool name match metric values. + */ + @CanIgnoreReturnValue + public Builder toolNameMatchMetricValues( + ToolNameMatchMetricValue... toolNameMatchMetricValues) { + return toolNameMatchMetricValues(Arrays.asList(toolNameMatchMetricValues)); + } + + /** + * Setter for toolNameMatchMetricValues builder. + * + *

toolNameMatchMetricValues: Output only. Tool name match metric values. + */ + @CanIgnoreReturnValue + public Builder toolNameMatchMetricValues( + ToolNameMatchMetricValue.Builder... toolNameMatchMetricValuesBuilders) { + return toolNameMatchMetricValues( + Arrays.asList(toolNameMatchMetricValuesBuilders).stream() + .map(ToolNameMatchMetricValue.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder toolNameMatchMetricValues( + Optional> toolNameMatchMetricValues); + + /** Clears the value of toolNameMatchMetricValues field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearToolNameMatchMetricValues() { + return toolNameMatchMetricValues(Optional.empty()); + } + + public abstract ToolNameMatchResults build(); + } + + /** Deserializes a JSON string to a ToolNameMatchResults object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolNameMatchResults fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolNameMatchResults.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchSpec.java new file mode 100644 index 000000000000..282f48b00509 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolNameMatchSpec.java @@ -0,0 +1,56 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.genai.JsonSerializable; + +/** Spec for tool name match metric. */ +@AutoValue +@JsonDeserialize(builder = ToolNameMatchSpec.Builder.class) +public abstract class ToolNameMatchSpec extends JsonSerializable { + /** Instantiates a builder for ToolNameMatchSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolNameMatchSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolNameMatchSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ToolNameMatchSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolNameMatchSpec.Builder(); + } + + public abstract ToolNameMatchSpec build(); + } + + /** Deserializes a JSON string to a ToolNameMatchSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolNameMatchSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolNameMatchSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchInput.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchInput.java new file mode 100644 index 000000000000..647861eea3bf --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchInput.java @@ -0,0 +1,140 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Tool parameter kv match input. */ +@AutoValue +@JsonDeserialize(builder = ToolParameterKVMatchInput.Builder.class) +public abstract class ToolParameterKVMatchInput extends JsonSerializable { + /** Required. Repeated tool parameter key value match instances. */ + @JsonProperty("instances") + public abstract Optional> instances(); + + /** Required. Spec for tool parameter key value match metric. */ + @JsonProperty("metricSpec") + public abstract Optional metricSpec(); + + /** Instantiates a builder for ToolParameterKVMatchInput. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolParameterKVMatchInput.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolParameterKVMatchInput. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ToolParameterKVMatchInput.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolParameterKVMatchInput.Builder(); + } + + /** + * Setter for instances. + * + *

instances: Required. Repeated tool parameter key value match instances. + */ + @JsonProperty("instances") + public abstract Builder instances(List instances); + + /** + * Setter for instances. + * + *

instances: Required. Repeated tool parameter key value match instances. + */ + @CanIgnoreReturnValue + public Builder instances(ToolParameterKVMatchInstance... instances) { + return instances(Arrays.asList(instances)); + } + + /** + * Setter for instances builder. + * + *

instances: Required. Repeated tool parameter key value match instances. + */ + @CanIgnoreReturnValue + public Builder instances(ToolParameterKVMatchInstance.Builder... instancesBuilders) { + return instances( + Arrays.asList(instancesBuilders).stream() + .map(ToolParameterKVMatchInstance.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder instances(Optional> instances); + + /** Clears the value of instances field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInstances() { + return instances(Optional.empty()); + } + + /** + * Setter for metricSpec. + * + *

metricSpec: Required. Spec for tool parameter key value match metric. + */ + @JsonProperty("metricSpec") + public abstract Builder metricSpec(ToolParameterKVMatchSpec metricSpec); + + /** + * Setter for metricSpec builder. + * + *

metricSpec: Required. Spec for tool parameter key value match metric. + */ + @CanIgnoreReturnValue + public Builder metricSpec(ToolParameterKVMatchSpec.Builder metricSpecBuilder) { + return metricSpec(metricSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metricSpec(Optional metricSpec); + + /** Clears the value of metricSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetricSpec() { + return metricSpec(Optional.empty()); + } + + public abstract ToolParameterKVMatchInput build(); + } + + /** Deserializes a JSON string to a ToolParameterKVMatchInput object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolParameterKVMatchInput fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolParameterKVMatchInput.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchInstance.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchInstance.java new file mode 100644 index 000000000000..2abe78ce9c28 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchInstance.java @@ -0,0 +1,105 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Tool parameter kv match instance. */ +@AutoValue +@JsonDeserialize(builder = ToolParameterKVMatchInstance.Builder.class) +public abstract class ToolParameterKVMatchInstance extends JsonSerializable { + /** Required. Output of the evaluated model. */ + @JsonProperty("prediction") + public abstract Optional prediction(); + + /** Required. Ground truth used to compare against the prediction. */ + @JsonProperty("reference") + public abstract Optional reference(); + + /** Instantiates a builder for ToolParameterKVMatchInstance. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolParameterKVMatchInstance.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolParameterKVMatchInstance. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ToolParameterKVMatchInstance.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolParameterKVMatchInstance.Builder(); + } + + /** + * Setter for prediction. + * + *

prediction: Required. Output of the evaluated model. + */ + @JsonProperty("prediction") + public abstract Builder prediction(String prediction); + + @ExcludeFromGeneratedCoverageReport + abstract Builder prediction(Optional prediction); + + /** Clears the value of prediction field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPrediction() { + return prediction(Optional.empty()); + } + + /** + * Setter for reference. + * + *

reference: Required. Ground truth used to compare against the prediction. + */ + @JsonProperty("reference") + public abstract Builder reference(String reference); + + @ExcludeFromGeneratedCoverageReport + abstract Builder reference(Optional reference); + + /** Clears the value of reference field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReference() { + return reference(Optional.empty()); + } + + public abstract ToolParameterKVMatchInstance build(); + } + + /** Deserializes a JSON string to a ToolParameterKVMatchInstance object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolParameterKVMatchInstance fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolParameterKVMatchInstance.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchMetricValue.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchMetricValue.java new file mode 100644 index 000000000000..a702cb10e7bc --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchMetricValue.java @@ -0,0 +1,83 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Tool parameter key value match metric value for an instance. */ +@AutoValue +@JsonDeserialize(builder = ToolParameterKVMatchMetricValue.Builder.class) +public abstract class ToolParameterKVMatchMetricValue extends JsonSerializable { + /** Output only. Tool parameter key value match score. */ + @JsonProperty("score") + public abstract Optional score(); + + /** Instantiates a builder for ToolParameterKVMatchMetricValue. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolParameterKVMatchMetricValue.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolParameterKVMatchMetricValue. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ToolParameterKVMatchMetricValue.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolParameterKVMatchMetricValue.Builder(); + } + + /** + * Setter for score. + * + *

score: Output only. Tool parameter key value match score. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + @ExcludeFromGeneratedCoverageReport + abstract Builder score(Optional score); + + /** Clears the value of score field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScore() { + return score(Optional.empty()); + } + + public abstract ToolParameterKVMatchMetricValue build(); + } + + /** Deserializes a JSON string to a ToolParameterKVMatchMetricValue object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolParameterKVMatchMetricValue fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolParameterKVMatchMetricValue.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchResults.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchResults.java new file mode 100644 index 000000000000..1e12dda33fda --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchResults.java @@ -0,0 +1,116 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Results for tool parameter key value match metric. */ +@AutoValue +@JsonDeserialize(builder = ToolParameterKVMatchResults.Builder.class) +public abstract class ToolParameterKVMatchResults extends JsonSerializable { + /** Output only. Tool parameter key value match metric values. */ + @JsonProperty("toolParameterKvMatchMetricValues") + public abstract Optional> + toolParameterKvMatchMetricValues(); + + /** Instantiates a builder for ToolParameterKVMatchResults. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolParameterKVMatchResults.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolParameterKVMatchResults. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ToolParameterKVMatchResults.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolParameterKVMatchResults.Builder(); + } + + /** + * Setter for toolParameterKvMatchMetricValues. + * + *

toolParameterKvMatchMetricValues: Output only. Tool parameter key value match metric + * values. + */ + @JsonProperty("toolParameterKvMatchMetricValues") + public abstract Builder toolParameterKvMatchMetricValues( + List toolParameterKvMatchMetricValues); + + /** + * Setter for toolParameterKvMatchMetricValues. + * + *

toolParameterKvMatchMetricValues: Output only. Tool parameter key value match metric + * values. + */ + @CanIgnoreReturnValue + public Builder toolParameterKvMatchMetricValues( + ToolParameterKVMatchMetricValue... toolParameterKvMatchMetricValues) { + return toolParameterKvMatchMetricValues(Arrays.asList(toolParameterKvMatchMetricValues)); + } + + /** + * Setter for toolParameterKvMatchMetricValues builder. + * + *

toolParameterKvMatchMetricValues: Output only. Tool parameter key value match metric + * values. + */ + @CanIgnoreReturnValue + public Builder toolParameterKvMatchMetricValues( + ToolParameterKVMatchMetricValue.Builder... toolParameterKvMatchMetricValuesBuilders) { + return toolParameterKvMatchMetricValues( + Arrays.asList(toolParameterKvMatchMetricValuesBuilders).stream() + .map(ToolParameterKVMatchMetricValue.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder toolParameterKvMatchMetricValues( + Optional> toolParameterKvMatchMetricValues); + + /** Clears the value of toolParameterKvMatchMetricValues field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearToolParameterKvMatchMetricValues() { + return toolParameterKvMatchMetricValues(Optional.empty()); + } + + public abstract ToolParameterKVMatchResults build(); + } + + /** Deserializes a JSON string to a ToolParameterKVMatchResults object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolParameterKVMatchResults fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolParameterKVMatchResults.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchSpec.java new file mode 100644 index 000000000000..178b42beb42b --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKVMatchSpec.java @@ -0,0 +1,81 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Spec for tool parameter kv match metric. */ +@AutoValue +@JsonDeserialize(builder = ToolParameterKVMatchSpec.Builder.class) +public abstract class ToolParameterKVMatchSpec extends JsonSerializable { + /** Optional. Whether to use STRICT string match on parameter values. */ + @JsonProperty("useStrictStringMatch") + public abstract Optional useStrictStringMatch(); + + /** Instantiates a builder for ToolParameterKVMatchSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolParameterKVMatchSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolParameterKVMatchSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ToolParameterKVMatchSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolParameterKVMatchSpec.Builder(); + } + + /** + * Setter for useStrictStringMatch. + * + *

useStrictStringMatch: Optional. Whether to use STRICT string match on parameter values. + */ + @JsonProperty("useStrictStringMatch") + public abstract Builder useStrictStringMatch(boolean useStrictStringMatch); + + @ExcludeFromGeneratedCoverageReport + abstract Builder useStrictStringMatch(Optional useStrictStringMatch); + + /** Clears the value of useStrictStringMatch field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUseStrictStringMatch() { + return useStrictStringMatch(Optional.empty()); + } + + public abstract ToolParameterKVMatchSpec build(); + } + + /** Deserializes a JSON string to a ToolParameterKVMatchSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolParameterKVMatchSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolParameterKVMatchSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchInput.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchInput.java new file mode 100644 index 000000000000..e1357be14e7e --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchInput.java @@ -0,0 +1,140 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Tool parameter key match input. */ +@AutoValue +@JsonDeserialize(builder = ToolParameterKeyMatchInput.Builder.class) +public abstract class ToolParameterKeyMatchInput extends JsonSerializable { + /** Required. Repeated tool parameter key match instances. */ + @JsonProperty("instances") + public abstract Optional> instances(); + + /** Required. Spec for tool parameter key match metric. */ + @JsonProperty("metricSpec") + public abstract Optional metricSpec(); + + /** Instantiates a builder for ToolParameterKeyMatchInput. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolParameterKeyMatchInput.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolParameterKeyMatchInput. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ToolParameterKeyMatchInput.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolParameterKeyMatchInput.Builder(); + } + + /** + * Setter for instances. + * + *

instances: Required. Repeated tool parameter key match instances. + */ + @JsonProperty("instances") + public abstract Builder instances(List instances); + + /** + * Setter for instances. + * + *

instances: Required. Repeated tool parameter key match instances. + */ + @CanIgnoreReturnValue + public Builder instances(ToolParameterKeyMatchInstance... instances) { + return instances(Arrays.asList(instances)); + } + + /** + * Setter for instances builder. + * + *

instances: Required. Repeated tool parameter key match instances. + */ + @CanIgnoreReturnValue + public Builder instances(ToolParameterKeyMatchInstance.Builder... instancesBuilders) { + return instances( + Arrays.asList(instancesBuilders).stream() + .map(ToolParameterKeyMatchInstance.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder instances(Optional> instances); + + /** Clears the value of instances field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearInstances() { + return instances(Optional.empty()); + } + + /** + * Setter for metricSpec. + * + *

metricSpec: Required. Spec for tool parameter key match metric. + */ + @JsonProperty("metricSpec") + public abstract Builder metricSpec(ToolParameterKeyMatchSpec metricSpec); + + /** + * Setter for metricSpec builder. + * + *

metricSpec: Required. Spec for tool parameter key match metric. + */ + @CanIgnoreReturnValue + public Builder metricSpec(ToolParameterKeyMatchSpec.Builder metricSpecBuilder) { + return metricSpec(metricSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metricSpec(Optional metricSpec); + + /** Clears the value of metricSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetricSpec() { + return metricSpec(Optional.empty()); + } + + public abstract ToolParameterKeyMatchInput build(); + } + + /** Deserializes a JSON string to a ToolParameterKeyMatchInput object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolParameterKeyMatchInput fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolParameterKeyMatchInput.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchInstance.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchInstance.java new file mode 100644 index 000000000000..1477e6eb8159 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchInstance.java @@ -0,0 +1,105 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Tool parameter key match instance. */ +@AutoValue +@JsonDeserialize(builder = ToolParameterKeyMatchInstance.Builder.class) +public abstract class ToolParameterKeyMatchInstance extends JsonSerializable { + /** Required. Output of the evaluated model. */ + @JsonProperty("prediction") + public abstract Optional prediction(); + + /** Required. Ground truth used to compare against the prediction. */ + @JsonProperty("reference") + public abstract Optional reference(); + + /** Instantiates a builder for ToolParameterKeyMatchInstance. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolParameterKeyMatchInstance.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolParameterKeyMatchInstance. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ToolParameterKeyMatchInstance.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolParameterKeyMatchInstance.Builder(); + } + + /** + * Setter for prediction. + * + *

prediction: Required. Output of the evaluated model. + */ + @JsonProperty("prediction") + public abstract Builder prediction(String prediction); + + @ExcludeFromGeneratedCoverageReport + abstract Builder prediction(Optional prediction); + + /** Clears the value of prediction field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPrediction() { + return prediction(Optional.empty()); + } + + /** + * Setter for reference. + * + *

reference: Required. Ground truth used to compare against the prediction. + */ + @JsonProperty("reference") + public abstract Builder reference(String reference); + + @ExcludeFromGeneratedCoverageReport + abstract Builder reference(Optional reference); + + /** Clears the value of reference field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReference() { + return reference(Optional.empty()); + } + + public abstract ToolParameterKeyMatchInstance build(); + } + + /** Deserializes a JSON string to a ToolParameterKeyMatchInstance object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolParameterKeyMatchInstance fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolParameterKeyMatchInstance.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchMetricValue.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchMetricValue.java new file mode 100644 index 000000000000..e648d861f42a --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchMetricValue.java @@ -0,0 +1,84 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Tool parameter key match metric value for an instance. */ +@AutoValue +@JsonDeserialize(builder = ToolParameterKeyMatchMetricValue.Builder.class) +public abstract class ToolParameterKeyMatchMetricValue extends JsonSerializable { + /** Output only. Tool parameter key match score. */ + @JsonProperty("score") + public abstract Optional score(); + + /** Instantiates a builder for ToolParameterKeyMatchMetricValue. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolParameterKeyMatchMetricValue.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolParameterKeyMatchMetricValue. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ToolParameterKeyMatchMetricValue.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolParameterKeyMatchMetricValue.Builder(); + } + + /** + * Setter for score. + * + *

score: Output only. Tool parameter key match score. + */ + @JsonProperty("score") + public abstract Builder score(Float score); + + @ExcludeFromGeneratedCoverageReport + abstract Builder score(Optional score); + + /** Clears the value of score field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScore() { + return score(Optional.empty()); + } + + public abstract ToolParameterKeyMatchMetricValue build(); + } + + /** Deserializes a JSON string to a ToolParameterKeyMatchMetricValue object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolParameterKeyMatchMetricValue fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolParameterKeyMatchMetricValue.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchResults.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchResults.java new file mode 100644 index 000000000000..72ee06ea64cb --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchResults.java @@ -0,0 +1,115 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Results for tool parameter key match metric. */ +@AutoValue +@JsonDeserialize(builder = ToolParameterKeyMatchResults.Builder.class) +public abstract class ToolParameterKeyMatchResults extends JsonSerializable { + /** Output only. Tool parameter key match metric values. */ + @JsonProperty("toolParameterKeyMatchMetricValues") + public abstract Optional> + toolParameterKeyMatchMetricValues(); + + /** Instantiates a builder for ToolParameterKeyMatchResults. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolParameterKeyMatchResults.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolParameterKeyMatchResults. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `ToolParameterKeyMatchResults.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolParameterKeyMatchResults.Builder(); + } + + /** + * Setter for toolParameterKeyMatchMetricValues. + * + *

toolParameterKeyMatchMetricValues: Output only. Tool parameter key match metric values. + */ + @JsonProperty("toolParameterKeyMatchMetricValues") + public abstract Builder toolParameterKeyMatchMetricValues( + List toolParameterKeyMatchMetricValues); + + /** + * Setter for toolParameterKeyMatchMetricValues. + * + *

toolParameterKeyMatchMetricValues: Output only. Tool parameter key match metric values. + */ + @CanIgnoreReturnValue + public Builder toolParameterKeyMatchMetricValues( + ToolParameterKeyMatchMetricValue... toolParameterKeyMatchMetricValues) { + return toolParameterKeyMatchMetricValues(Arrays.asList(toolParameterKeyMatchMetricValues)); + } + + /** + * Setter for toolParameterKeyMatchMetricValues builder. + * + *

toolParameterKeyMatchMetricValues: Output only. Tool parameter key match metric values. + */ + @CanIgnoreReturnValue + public Builder toolParameterKeyMatchMetricValues( + ToolParameterKeyMatchMetricValue.Builder... toolParameterKeyMatchMetricValuesBuilders) { + return toolParameterKeyMatchMetricValues( + Arrays.asList(toolParameterKeyMatchMetricValuesBuilders).stream() + .map(ToolParameterKeyMatchMetricValue.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder toolParameterKeyMatchMetricValues( + Optional> toolParameterKeyMatchMetricValues); + + /** Clears the value of toolParameterKeyMatchMetricValues field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearToolParameterKeyMatchMetricValues() { + return toolParameterKeyMatchMetricValues(Optional.empty()); + } + + public abstract ToolParameterKeyMatchResults build(); + } + + /** Deserializes a JSON string to a ToolParameterKeyMatchResults object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolParameterKeyMatchResults fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolParameterKeyMatchResults.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchSpec.java new file mode 100644 index 000000000000..48eb647aa9fc --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/ToolParameterKeyMatchSpec.java @@ -0,0 +1,56 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.genai.JsonSerializable; + +/** Spec for tool parameter key match metric. */ +@AutoValue +@JsonDeserialize(builder = ToolParameterKeyMatchSpec.Builder.class) +public abstract class ToolParameterKeyMatchSpec extends JsonSerializable { + /** Instantiates a builder for ToolParameterKeyMatchSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_ToolParameterKeyMatchSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for ToolParameterKeyMatchSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `ToolParameterKeyMatchSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_ToolParameterKeyMatchSpec.Builder(); + } + + public abstract ToolParameterKeyMatchSpec build(); + } + + /** Deserializes a JSON string to a ToolParameterKeyMatchSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static ToolParameterKeyMatchSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, ToolParameterKeyMatchSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Tools.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Tools.java new file mode 100644 index 000000000000..0d42b3e83d88 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Tools.java @@ -0,0 +1,94 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.Tool; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Represents a list of tools for an agent. */ +@AutoValue +@JsonDeserialize(builder = Tools.Builder.class) +public abstract class Tools extends JsonSerializable { + /** List of tools: each tool can have multiple function declarations. */ + @JsonProperty("tool") + public abstract Optional> tool(); + + /** Instantiates a builder for Tools. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_Tools.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for Tools. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `Tools.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_Tools.Builder(); + } + + /** + * Setter for tool. + * + *

tool: List of tools: each tool can have multiple function declarations. + */ + @JsonProperty("tool") + public abstract Builder tool(List tool); + + /** + * Setter for tool. + * + *

tool: List of tools: each tool can have multiple function declarations. + */ + @CanIgnoreReturnValue + public Builder tool(Tool... tool) { + return tool(Arrays.asList(tool)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder tool(Optional> tool); + + /** Clears the value of tool field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTool() { + return tool(Optional.empty()); + } + + public abstract Tools build(); + } + + /** Deserializes a JSON string to a Tools object. */ + @ExcludeFromGeneratedCoverageReport + public static Tools fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, Tools.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/TuningResourceUsageAssessmentResult.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/TuningResourceUsageAssessmentResult.java new file mode 100644 index 000000000000..320bad2ea08c --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/TuningResourceUsageAssessmentResult.java @@ -0,0 +1,106 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Result of tuning resource usage assessment. */ +@AutoValue +@JsonDeserialize(builder = TuningResourceUsageAssessmentResult.Builder.class) +public abstract class TuningResourceUsageAssessmentResult extends JsonSerializable { + /** The number of tokens in the dataset. */ + @JsonProperty("tokenCount") + public abstract Optional tokenCount(); + + /** The number of billable characters in the dataset. */ + @JsonProperty("billableCharacterCount") + public abstract Optional billableCharacterCount(); + + /** Instantiates a builder for TuningResourceUsageAssessmentResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_TuningResourceUsageAssessmentResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for TuningResourceUsageAssessmentResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `TuningResourceUsageAssessmentResult.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_TuningResourceUsageAssessmentResult.Builder(); + } + + /** + * Setter for tokenCount. + * + *

tokenCount: The number of tokens in the dataset. + */ + @JsonProperty("tokenCount") + public abstract Builder tokenCount(Integer tokenCount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder tokenCount(Optional tokenCount); + + /** Clears the value of tokenCount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTokenCount() { + return tokenCount(Optional.empty()); + } + + /** + * Setter for billableCharacterCount. + * + *

billableCharacterCount: The number of billable characters in the dataset. + */ + @JsonProperty("billableCharacterCount") + public abstract Builder billableCharacterCount(Integer billableCharacterCount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder billableCharacterCount(Optional billableCharacterCount); + + /** Clears the value of billableCharacterCount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBillableCharacterCount() { + return billableCharacterCount(Optional.empty()); + } + + public abstract TuningResourceUsageAssessmentResult build(); + } + + /** Deserializes a JSON string to a TuningResourceUsageAssessmentResult object. */ + @ExcludeFromGeneratedCoverageReport + public static TuningResourceUsageAssessmentResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, TuningResourceUsageAssessmentResult.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/TuningValidationAssessmentResult.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/TuningValidationAssessmentResult.java new file mode 100644 index 000000000000..3a184b318e49 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/TuningValidationAssessmentResult.java @@ -0,0 +1,96 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** The result of a tuning validation assessment. */ +@AutoValue +@JsonDeserialize(builder = TuningValidationAssessmentResult.Builder.class) +public abstract class TuningValidationAssessmentResult extends JsonSerializable { + /** The list of errors found in the dataset. */ + @JsonProperty("errors") + public abstract Optional> errors(); + + /** Instantiates a builder for TuningValidationAssessmentResult. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_TuningValidationAssessmentResult.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for TuningValidationAssessmentResult. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `TuningValidationAssessmentResult.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_TuningValidationAssessmentResult.Builder(); + } + + /** + * Setter for errors. + * + *

errors: The list of errors found in the dataset. + */ + @JsonProperty("errors") + public abstract Builder errors(List errors); + + /** + * Setter for errors. + * + *

errors: The list of errors found in the dataset. + */ + @CanIgnoreReturnValue + public Builder errors(String... errors) { + return errors(Arrays.asList(errors)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder errors(Optional> errors); + + /** Clears the value of errors field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearErrors() { + return errors(Optional.empty()); + } + + public abstract TuningValidationAssessmentResult build(); + } + + /** Deserializes a JSON string to a TuningValidationAssessmentResult object. */ + @ExcludeFromGeneratedCoverageReport + public static TuningValidationAssessmentResult fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, TuningValidationAssessmentResult.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Type.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Type.java new file mode 100644 index 000000000000..c10f38c23704 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/Type.java @@ -0,0 +1,116 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.google.common.base.Ascii; +import java.util.Objects; + +/** Specifies the reservation affinity type. */ +public class Type { + + /** Enum representing the known values for Type. */ + public enum Known { + /** Default value. This should not be used. */ + TYPE_UNSPECIFIED, + + /** Do not consume from any reserved capacity, only use on-demand. */ + NO_RESERVATION, + + /** Consume any reservation available, falling back to on-demand. */ + ANY_RESERVATION, + + /** + * Consume from a specific reservation. When chosen, the reservation must be identified via the + * `key` and `values` fields. + */ + SPECIFIC_RESERVATION + } + + private Known typeEnum; + private final String value; + + @JsonCreator + public Type(String value) { + this.value = value; + for (Known typeEnum : Known.values()) { + if (Ascii.equalsIgnoreCase(typeEnum.toString(), value)) { + this.typeEnum = typeEnum; + break; + } + } + if (this.typeEnum == null) { + this.typeEnum = Known.TYPE_UNSPECIFIED; + } + } + + public Type(Known knownValue) { + this.typeEnum = knownValue; + this.value = knownValue.toString(); + } + + @ExcludeFromGeneratedCoverageReport + @Override + @JsonValue + public String toString() { + return this.value; + } + + @ExcludeFromGeneratedCoverageReport + @SuppressWarnings("PatternMatchingInstanceof") + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null) { + return false; + } + + if (!(o instanceof Type)) { + return false; + } + + Type other = (Type) o; + + if (this.typeEnum != Known.TYPE_UNSPECIFIED && other.typeEnum != Known.TYPE_UNSPECIFIED) { + return this.typeEnum == other.typeEnum; + } else if (this.typeEnum == Known.TYPE_UNSPECIFIED + && other.typeEnum == Known.TYPE_UNSPECIFIED) { + return this.value.equals(other.value); + } + return false; + } + + @ExcludeFromGeneratedCoverageReport + @Override + public int hashCode() { + if (this.typeEnum != Known.TYPE_UNSPECIFIED) { + return this.typeEnum.hashCode(); + } else { + return Objects.hashCode(this.value); + } + } + + @ExcludeFromGeneratedCoverageReport + public Known knownEnum() { + return this.typeEnum; + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UnifiedMetric.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UnifiedMetric.java new file mode 100644 index 000000000000..4691cd48e64d --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UnifiedMetric.java @@ -0,0 +1,123 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** The unified metric used for evaluation. */ +@AutoValue +@JsonDeserialize(builder = UnifiedMetric.Builder.class) +public abstract class UnifiedMetric extends JsonSerializable { + /** The spec for an LLM based metric. */ + @JsonProperty("llmBasedMetricSpec") + public abstract Optional llmBasedMetricSpec(); + + /** The spec for a pre-defined metric. */ + @JsonProperty("predefinedMetricSpec") + public abstract Optional predefinedMetricSpec(); + + /** Instantiates a builder for UnifiedMetric. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_UnifiedMetric.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for UnifiedMetric. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `UnifiedMetric.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_UnifiedMetric.Builder(); + } + + /** + * Setter for llmBasedMetricSpec. + * + *

llmBasedMetricSpec: The spec for an LLM based metric. + */ + @JsonProperty("llmBasedMetricSpec") + public abstract Builder llmBasedMetricSpec(LLMBasedMetricSpec llmBasedMetricSpec); + + /** + * Setter for llmBasedMetricSpec builder. + * + *

llmBasedMetricSpec: The spec for an LLM based metric. + */ + @CanIgnoreReturnValue + public Builder llmBasedMetricSpec(LLMBasedMetricSpec.Builder llmBasedMetricSpecBuilder) { + return llmBasedMetricSpec(llmBasedMetricSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder llmBasedMetricSpec(Optional llmBasedMetricSpec); + + /** Clears the value of llmBasedMetricSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLlmBasedMetricSpec() { + return llmBasedMetricSpec(Optional.empty()); + } + + /** + * Setter for predefinedMetricSpec. + * + *

predefinedMetricSpec: The spec for a pre-defined metric. + */ + @JsonProperty("predefinedMetricSpec") + public abstract Builder predefinedMetricSpec(PredefinedMetricSpec predefinedMetricSpec); + + /** + * Setter for predefinedMetricSpec builder. + * + *

predefinedMetricSpec: The spec for a pre-defined metric. + */ + @CanIgnoreReturnValue + public Builder predefinedMetricSpec(PredefinedMetricSpec.Builder predefinedMetricSpecBuilder) { + return predefinedMetricSpec(predefinedMetricSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder predefinedMetricSpec(Optional predefinedMetricSpec); + + /** Clears the value of predefinedMetricSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPredefinedMetricSpec() { + return predefinedMetricSpec(Optional.empty()); + } + + public abstract UnifiedMetric build(); + } + + /** Deserializes a JSON string to a UnifiedMetric object. */ + @ExcludeFromGeneratedCoverageReport + public static UnifiedMetric fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, UnifiedMetric.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineConfig.java new file mode 100644 index 000000000000..b9398d7dc5d5 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineConfig.java @@ -0,0 +1,719 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.EncryptionSpec; +import com.google.genai.types.HttpOptions; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** Config for updating agent engine. */ +@AutoValue +@JsonDeserialize(builder = UpdateAgentEngineConfig.Builder.class) +public abstract class UpdateAgentEngineConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** + * The user-defined name of the Agent Engine. + * + *

The display name can be up to 128 characters long and can comprise any UTF-8 characters. + */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** The description of the Agent Engine. */ + @JsonProperty("description") + public abstract Optional description(); + + /** Optional. Configurations of the Agent Engine. */ + @JsonProperty("spec") + public abstract Optional spec(); + + /** Optional. The context spec to be used for the Agent Engine. */ + @JsonProperty("contextSpec") + public abstract Optional contextSpec(); + + /** Optional. The PSC interface config for PSC-I to be used for the Agent Engine. */ + @JsonProperty("pscInterfaceConfig") + public abstract Optional pscInterfaceConfig(); + + /** The minimum number of instances to run for the Agent Engine. Defaults to 1. Range: [0, 10]. */ + @JsonProperty("minInstances") + public abstract Optional minInstances(); + + /** + * The maximum number of instances to run for the Agent Engine. Defaults to 100. Range: [1, 1000]. + * If VPC-SC or PSC-I is enabled, the acceptable range is [1, 100]. + */ + @JsonProperty("maxInstances") + public abstract Optional maxInstances(); + + /** + * The resource limits to be applied to the Agent Engine. Required keys: 'cpu' and 'memory'. + * Supported values for 'cpu': '1', '2', '4', '6', '8'. Supported values for 'memory': '1Gi', + * '2Gi', ..., '32Gi'. + */ + @JsonProperty("resourceLimits") + public abstract Optional> resourceLimits(); + + /** + * The container concurrency to be used for the Agent Engine. Recommended value: 2 * cpu + 1. + * Defaults to 9. + */ + @JsonProperty("containerConcurrency") + public abstract Optional containerConcurrency(); + + /** The encryption spec to be used for the Agent Engine. */ + @JsonProperty("encryptionSpec") + public abstract Optional encryptionSpec(); + + /** The labels to be used for the Agent Engine. */ + @JsonProperty("labels") + public abstract Optional> labels(); + + /** + * The class methods to be used for the Agent Engine. If specified, they'll override the class + * methods that are autogenerated by default. By default, methods are generated by inspecting the + * agent object and generating a corresponding method for each method defined on the agent class. + */ + @JsonProperty("classMethods") + public abstract Optional>> classMethods(); + + /** + * The user-provided paths to the source packages (if any). If specified, the files in the source + * packages will be packed into a a tarball file, uploaded to Agent Engine's API, and deployed to + * the Agent Engine. The following fields will be ignored: - agent - extra_packages - + * staging_bucket - requirements The following fields will be used to install and use the agent + * from the source packages: - entrypoint_module (required) - entrypoint_object (required) - + * requirements_file (optional) - class_methods (required) + */ + @JsonProperty("sourcePackages") + public abstract Optional> sourcePackages(); + + /** + * The entrypoint module to be used for the Agent Engine This field only used when source_packages + * is specified. + */ + @JsonProperty("entrypointModule") + public abstract Optional entrypointModule(); + + /** + * The entrypoint object to be used for the Agent Engine. This field only used when + * source_packages is specified. + */ + @JsonProperty("entrypointObject") + public abstract Optional entrypointObject(); + + /** + * The user-provided path to the requirements file (if any). This field is only used when + * source_packages is specified. If not specified, agent engine will find and use the + * `requirements.txt` in the source package. + */ + @JsonProperty("requirementsFile") + public abstract Optional requirementsFile(); + + /** + * The agent framework to be used for the Agent Engine. The OSS agent framework used to develop + * the agent. Currently supported values: "google-adk", "langchain", "langgraph", "ag2", + * "llama-index", "custom". If not specified: - If `agent` is specified, the agent framework will + * be auto-detected. - If `source_packages` is specified, the agent framework will default to + * "custom". + */ + @JsonProperty("agentFramework") + public abstract Optional agentFramework(); + + /** + * The Python version to be used for the Agent Engine. If not specified, it will use the current + * Python version of the environment. Supported versions: "3.9", "3.10", "3.11", "3.12", "3.13". + */ + @JsonProperty("pythonVersion") + public abstract Optional pythonVersion(); + + /** + * The build options for the Agent Engine. The following keys are supported: - + * installation_scripts: Optional. The paths to the installation scripts to be executed in the + * Docker image. The scripts must be located in the `installation_scripts` subdirectory and the + * path must be added to `extra_packages`. + */ + @JsonProperty("buildOptions") + public abstract Optional>> buildOptions(); + + /** + * The update mask to apply. For the `FieldMask` definition, see + * https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask. + */ + @JsonProperty("updateMask") + public abstract Optional updateMask(); + + /** Instantiates a builder for UpdateAgentEngineConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_UpdateAgentEngineConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for UpdateAgentEngineConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `UpdateAgentEngineConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_UpdateAgentEngineConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: The user-defined name of the Agent Engine. + * + *

The display name can be up to 128 characters long and can comprise any UTF-8 characters. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: The description of the Agent Engine. + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + /** + * Setter for spec. + * + *

spec: Optional. Configurations of the Agent Engine. + */ + @JsonProperty("spec") + public abstract Builder spec(ReasoningEngineSpec spec); + + /** + * Setter for spec builder. + * + *

spec: Optional. Configurations of the Agent Engine. + */ + @CanIgnoreReturnValue + public Builder spec(ReasoningEngineSpec.Builder specBuilder) { + return spec(specBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder spec(Optional spec); + + /** Clears the value of spec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSpec() { + return spec(Optional.empty()); + } + + /** + * Setter for contextSpec. + * + *

contextSpec: Optional. The context spec to be used for the Agent Engine. + */ + @JsonProperty("contextSpec") + public abstract Builder contextSpec(ReasoningEngineContextSpec contextSpec); + + /** + * Setter for contextSpec builder. + * + *

contextSpec: Optional. The context spec to be used for the Agent Engine. + */ + @CanIgnoreReturnValue + public Builder contextSpec(ReasoningEngineContextSpec.Builder contextSpecBuilder) { + return contextSpec(contextSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder contextSpec(Optional contextSpec); + + /** Clears the value of contextSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContextSpec() { + return contextSpec(Optional.empty()); + } + + /** + * Setter for pscInterfaceConfig. + * + *

pscInterfaceConfig: Optional. The PSC interface config for PSC-I to be used for the Agent + * Engine. + */ + @JsonProperty("pscInterfaceConfig") + public abstract Builder pscInterfaceConfig(PscInterfaceConfig pscInterfaceConfig); + + /** + * Setter for pscInterfaceConfig builder. + * + *

pscInterfaceConfig: Optional. The PSC interface config for PSC-I to be used for the Agent + * Engine. + */ + @CanIgnoreReturnValue + public Builder pscInterfaceConfig(PscInterfaceConfig.Builder pscInterfaceConfigBuilder) { + return pscInterfaceConfig(pscInterfaceConfigBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder pscInterfaceConfig(Optional pscInterfaceConfig); + + /** Clears the value of pscInterfaceConfig field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPscInterfaceConfig() { + return pscInterfaceConfig(Optional.empty()); + } + + /** + * Setter for minInstances. + * + *

minInstances: The minimum number of instances to run for the Agent Engine. Defaults to 1. + * Range: [0, 10]. + */ + @JsonProperty("minInstances") + public abstract Builder minInstances(Integer minInstances); + + @ExcludeFromGeneratedCoverageReport + abstract Builder minInstances(Optional minInstances); + + /** Clears the value of minInstances field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMinInstances() { + return minInstances(Optional.empty()); + } + + /** + * Setter for maxInstances. + * + *

maxInstances: The maximum number of instances to run for the Agent Engine. Defaults to + * 100. Range: [1, 1000]. If VPC-SC or PSC-I is enabled, the acceptable range is [1, 100]. + */ + @JsonProperty("maxInstances") + public abstract Builder maxInstances(Integer maxInstances); + + @ExcludeFromGeneratedCoverageReport + abstract Builder maxInstances(Optional maxInstances); + + /** Clears the value of maxInstances field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMaxInstances() { + return maxInstances(Optional.empty()); + } + + /** + * Setter for resourceLimits. + * + *

resourceLimits: The resource limits to be applied to the Agent Engine. Required keys: + * 'cpu' and 'memory'. Supported values for 'cpu': '1', '2', '4', '6', '8'. Supported values for + * 'memory': '1Gi', '2Gi', ..., '32Gi'. + */ + @JsonProperty("resourceLimits") + public abstract Builder resourceLimits(Map resourceLimits); + + @ExcludeFromGeneratedCoverageReport + abstract Builder resourceLimits(Optional> resourceLimits); + + /** Clears the value of resourceLimits field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearResourceLimits() { + return resourceLimits(Optional.empty()); + } + + /** + * Setter for containerConcurrency. + * + *

containerConcurrency: The container concurrency to be used for the Agent Engine. + * Recommended value: 2 * cpu + 1. Defaults to 9. + */ + @JsonProperty("containerConcurrency") + public abstract Builder containerConcurrency(Integer containerConcurrency); + + @ExcludeFromGeneratedCoverageReport + abstract Builder containerConcurrency(Optional containerConcurrency); + + /** Clears the value of containerConcurrency field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContainerConcurrency() { + return containerConcurrency(Optional.empty()); + } + + /** + * Setter for encryptionSpec. + * + *

encryptionSpec: The encryption spec to be used for the Agent Engine. + */ + @JsonProperty("encryptionSpec") + public abstract Builder encryptionSpec(EncryptionSpec encryptionSpec); + + @ExcludeFromGeneratedCoverageReport + abstract Builder encryptionSpec(Optional encryptionSpec); + + /** Clears the value of encryptionSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEncryptionSpec() { + return encryptionSpec(Optional.empty()); + } + + /** + * Setter for labels. + * + *

labels: The labels to be used for the Agent Engine. + */ + @JsonProperty("labels") + public abstract Builder labels(Map labels); + + @ExcludeFromGeneratedCoverageReport + abstract Builder labels(Optional> labels); + + /** Clears the value of labels field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLabels() { + return labels(Optional.empty()); + } + + /** + * Setter for classMethods. + * + *

classMethods: The class methods to be used for the Agent Engine. If specified, they'll + * override the class methods that are autogenerated by default. By default, methods are + * generated by inspecting the agent object and generating a corresponding method for each + * method defined on the agent class. + */ + @JsonProperty("classMethods") + public abstract Builder classMethods(List> classMethods); + + /** + * Setter for classMethods. + * + *

classMethods: The class methods to be used for the Agent Engine. If specified, they'll + * override the class methods that are autogenerated by default. By default, methods are + * generated by inspecting the agent object and generating a corresponding method for each + * method defined on the agent class. + */ + @CanIgnoreReturnValue + public Builder classMethods(Map... classMethods) { + return classMethods(Arrays.asList(classMethods)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder classMethods(Optional>> classMethods); + + /** Clears the value of classMethods field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearClassMethods() { + return classMethods(Optional.empty()); + } + + /** + * Setter for sourcePackages. + * + *

sourcePackages: The user-provided paths to the source packages (if any). If specified, the + * files in the source packages will be packed into a a tarball file, uploaded to Agent Engine's + * API, and deployed to the Agent Engine. The following fields will be ignored: - agent - + * extra_packages - staging_bucket - requirements The following fields will be used to install + * and use the agent from the source packages: - entrypoint_module (required) - + * entrypoint_object (required) - requirements_file (optional) - class_methods (required) + */ + @JsonProperty("sourcePackages") + public abstract Builder sourcePackages(List sourcePackages); + + /** + * Setter for sourcePackages. + * + *

sourcePackages: The user-provided paths to the source packages (if any). If specified, the + * files in the source packages will be packed into a a tarball file, uploaded to Agent Engine's + * API, and deployed to the Agent Engine. The following fields will be ignored: - agent - + * extra_packages - staging_bucket - requirements The following fields will be used to install + * and use the agent from the source packages: - entrypoint_module (required) - + * entrypoint_object (required) - requirements_file (optional) - class_methods (required) + */ + @CanIgnoreReturnValue + public Builder sourcePackages(String... sourcePackages) { + return sourcePackages(Arrays.asList(sourcePackages)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder sourcePackages(Optional> sourcePackages); + + /** Clears the value of sourcePackages field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSourcePackages() { + return sourcePackages(Optional.empty()); + } + + /** + * Setter for entrypointModule. + * + *

entrypointModule: The entrypoint module to be used for the Agent Engine This field only + * used when source_packages is specified. + */ + @JsonProperty("entrypointModule") + public abstract Builder entrypointModule(String entrypointModule); + + @ExcludeFromGeneratedCoverageReport + abstract Builder entrypointModule(Optional entrypointModule); + + /** Clears the value of entrypointModule field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEntrypointModule() { + return entrypointModule(Optional.empty()); + } + + /** + * Setter for entrypointObject. + * + *

entrypointObject: The entrypoint object to be used for the Agent Engine. This field only + * used when source_packages is specified. + */ + @JsonProperty("entrypointObject") + public abstract Builder entrypointObject(String entrypointObject); + + @ExcludeFromGeneratedCoverageReport + abstract Builder entrypointObject(Optional entrypointObject); + + /** Clears the value of entrypointObject field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEntrypointObject() { + return entrypointObject(Optional.empty()); + } + + /** + * Setter for requirementsFile. + * + *

requirementsFile: The user-provided path to the requirements file (if any). This field is + * only used when source_packages is specified. If not specified, agent engine will find and use + * the `requirements.txt` in the source package. + */ + @JsonProperty("requirementsFile") + public abstract Builder requirementsFile(String requirementsFile); + + @ExcludeFromGeneratedCoverageReport + abstract Builder requirementsFile(Optional requirementsFile); + + /** Clears the value of requirementsFile field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRequirementsFile() { + return requirementsFile(Optional.empty()); + } + + /** + * Setter for agentFramework. + * + *

agentFramework: The agent framework to be used for the Agent Engine. The OSS agent + * framework used to develop the agent. Currently supported values: "google-adk", "langchain", + * "langgraph", "ag2", "llama-index", "custom". If not specified: - If `agent` is specified, the + * agent framework will be auto-detected. - If `source_packages` is specified, the agent + * framework will default to "custom". + */ + @JsonProperty("agentFramework") + public abstract Builder agentFramework(AgentFramework agentFramework); + + @ExcludeFromGeneratedCoverageReport + abstract Builder agentFramework(Optional agentFramework); + + /** Clears the value of agentFramework field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearAgentFramework() { + return agentFramework(Optional.empty()); + } + + /** + * Setter for agentFramework given a known enum. + * + *

agentFramework: The agent framework to be used for the Agent Engine. The OSS agent + * framework used to develop the agent. Currently supported values: "google-adk", "langchain", + * "langgraph", "ag2", "llama-index", "custom". If not specified: - If `agent` is specified, the + * agent framework will be auto-detected. - If `source_packages` is specified, the agent + * framework will default to "custom". + */ + @CanIgnoreReturnValue + public Builder agentFramework(AgentFramework.Known knownType) { + return agentFramework(new AgentFramework(knownType)); + } + + /** + * Setter for agentFramework given a string. + * + *

agentFramework: The agent framework to be used for the Agent Engine. The OSS agent + * framework used to develop the agent. Currently supported values: "google-adk", "langchain", + * "langgraph", "ag2", "llama-index", "custom". If not specified: - If `agent` is specified, the + * agent framework will be auto-detected. - If `source_packages` is specified, the agent + * framework will default to "custom". + */ + @CanIgnoreReturnValue + public Builder agentFramework(String agentFramework) { + return agentFramework(new AgentFramework(agentFramework)); + } + + /** + * Setter for pythonVersion. + * + *

pythonVersion: The Python version to be used for the Agent Engine. If not specified, it + * will use the current Python version of the environment. Supported versions: "3.9", "3.10", + * "3.11", "3.12", "3.13". + */ + @JsonProperty("pythonVersion") + public abstract Builder pythonVersion(PythonVersion pythonVersion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder pythonVersion(Optional pythonVersion); + + /** Clears the value of pythonVersion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPythonVersion() { + return pythonVersion(Optional.empty()); + } + + /** + * Setter for pythonVersion given a known enum. + * + *

pythonVersion: The Python version to be used for the Agent Engine. If not specified, it + * will use the current Python version of the environment. Supported versions: "3.9", "3.10", + * "3.11", "3.12", "3.13". + */ + @CanIgnoreReturnValue + public Builder pythonVersion(PythonVersion.Known knownType) { + return pythonVersion(new PythonVersion(knownType)); + } + + /** + * Setter for pythonVersion given a string. + * + *

pythonVersion: The Python version to be used for the Agent Engine. If not specified, it + * will use the current Python version of the environment. Supported versions: "3.9", "3.10", + * "3.11", "3.12", "3.13". + */ + @CanIgnoreReturnValue + public Builder pythonVersion(String pythonVersion) { + return pythonVersion(new PythonVersion(pythonVersion)); + } + + /** + * Setter for buildOptions. + * + *

buildOptions: The build options for the Agent Engine. The following keys are supported: - + * installation_scripts: Optional. The paths to the installation scripts to be executed in the + * Docker image. The scripts must be located in the `installation_scripts` subdirectory and the + * path must be added to `extra_packages`. + */ + @JsonProperty("buildOptions") + public abstract Builder buildOptions(Map> buildOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder buildOptions(Optional>> buildOptions); + + /** Clears the value of buildOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearBuildOptions() { + return buildOptions(Optional.empty()); + } + + /** + * Setter for updateMask. + * + *

updateMask: The update mask to apply. For the `FieldMask` definition, see + * https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask. + */ + @JsonProperty("updateMask") + public abstract Builder updateMask(String updateMask); + + @ExcludeFromGeneratedCoverageReport + abstract Builder updateMask(Optional updateMask); + + /** Clears the value of updateMask field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUpdateMask() { + return updateMask(Optional.empty()); + } + + public abstract UpdateAgentEngineConfig build(); + } + + /** Deserializes a JSON string to a UpdateAgentEngineConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static UpdateAgentEngineConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, UpdateAgentEngineConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineMemoryConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineMemoryConfig.java new file mode 100644 index 000000000000..f1a8b1c63d39 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineMemoryConfig.java @@ -0,0 +1,353 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.time.Duration; +import java.time.Instant; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Config for updating agent engine memory. */ +@AutoValue +@JsonDeserialize(builder = UpdateAgentEngineMemoryConfig.Builder.class) +public abstract class UpdateAgentEngineMemoryConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** The display name of the memory. */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** The description of the memory. */ + @JsonProperty("description") + public abstract Optional description(); + + /** Waits for the operation to complete before returning. */ + @JsonProperty("waitForCompletion") + public abstract Optional waitForCompletion(); + + /** + * Optional. Input only. The TTL for this resource. + * + *

The expiration time is computed: now + TTL. + */ + @JsonProperty("ttl") + public abstract Optional ttl(); + + /** + * Optional. Timestamp of when this resource is considered expired. This is *always* provided on + * output, regardless of what `expiration` was sent on input. + */ + @JsonProperty("expireTime") + public abstract Optional expireTime(); + + /** + * Optional. Input only. Timestamp of when the revision is considered expired. If not set, the + * memory revision will be kept until manually deleted. + */ + @JsonProperty("revisionExpireTime") + public abstract Optional revisionExpireTime(); + + /** Optional. Input only. The TTL for the revision. The expiration time is computed: now + TTL. */ + @JsonProperty("revisionTtl") + public abstract Optional revisionTtl(); + + /** Optional. Input only. If true, no revision will be created for this request. */ + @JsonProperty("disableMemoryRevisions") + public abstract Optional disableMemoryRevisions(); + + /** Optional. The topics of the memory. */ + @JsonProperty("topics") + public abstract Optional> topics(); + + /** + * The update mask to apply. For the `FieldMask` definition, see + * https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask. + */ + @JsonProperty("updateMask") + public abstract Optional updateMask(); + + /** Instantiates a builder for UpdateAgentEngineMemoryConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_UpdateAgentEngineMemoryConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for UpdateAgentEngineMemoryConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `UpdateAgentEngineMemoryConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_UpdateAgentEngineMemoryConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: The display name of the memory. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: The description of the memory. + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + /** + * Setter for waitForCompletion. + * + *

waitForCompletion: Waits for the operation to complete before returning. + */ + @JsonProperty("waitForCompletion") + public abstract Builder waitForCompletion(boolean waitForCompletion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder waitForCompletion(Optional waitForCompletion); + + /** Clears the value of waitForCompletion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWaitForCompletion() { + return waitForCompletion(Optional.empty()); + } + + /** + * Setter for ttl. + * + *

ttl: Optional. Input only. The TTL for this resource. + * + *

The expiration time is computed: now + TTL. + */ + @JsonProperty("ttl") + public abstract Builder ttl(Duration ttl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder ttl(Optional ttl); + + /** Clears the value of ttl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTtl() { + return ttl(Optional.empty()); + } + + /** + * Setter for expireTime. + * + *

expireTime: Optional. Timestamp of when this resource is considered expired. This is + * *always* provided on output, regardless of what `expiration` was sent on input. + */ + @JsonProperty("expireTime") + public abstract Builder expireTime(Instant expireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder expireTime(Optional expireTime); + + /** Clears the value of expireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExpireTime() { + return expireTime(Optional.empty()); + } + + /** + * Setter for revisionExpireTime. + * + *

revisionExpireTime: Optional. Input only. Timestamp of when the revision is considered + * expired. If not set, the memory revision will be kept until manually deleted. + */ + @JsonProperty("revisionExpireTime") + public abstract Builder revisionExpireTime(Instant revisionExpireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder revisionExpireTime(Optional revisionExpireTime); + + /** Clears the value of revisionExpireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRevisionExpireTime() { + return revisionExpireTime(Optional.empty()); + } + + /** + * Setter for revisionTtl. + * + *

revisionTtl: Optional. Input only. The TTL for the revision. The expiration time is + * computed: now + TTL. + */ + @JsonProperty("revisionTtl") + public abstract Builder revisionTtl(Duration revisionTtl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder revisionTtl(Optional revisionTtl); + + /** Clears the value of revisionTtl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearRevisionTtl() { + return revisionTtl(Optional.empty()); + } + + /** + * Setter for disableMemoryRevisions. + * + *

disableMemoryRevisions: Optional. Input only. If true, no revision will be created for + * this request. + */ + @JsonProperty("disableMemoryRevisions") + public abstract Builder disableMemoryRevisions(boolean disableMemoryRevisions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder disableMemoryRevisions(Optional disableMemoryRevisions); + + /** Clears the value of disableMemoryRevisions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisableMemoryRevisions() { + return disableMemoryRevisions(Optional.empty()); + } + + /** + * Setter for topics. + * + *

topics: Optional. The topics of the memory. + */ + @JsonProperty("topics") + public abstract Builder topics(List topics); + + /** + * Setter for topics. + * + *

topics: Optional. The topics of the memory. + */ + @CanIgnoreReturnValue + public Builder topics(MemoryTopicId... topics) { + return topics(Arrays.asList(topics)); + } + + /** + * Setter for topics builder. + * + *

topics: Optional. The topics of the memory. + */ + @CanIgnoreReturnValue + public Builder topics(MemoryTopicId.Builder... topicsBuilders) { + return topics( + Arrays.asList(topicsBuilders).stream() + .map(MemoryTopicId.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder topics(Optional> topics); + + /** Clears the value of topics field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTopics() { + return topics(Optional.empty()); + } + + /** + * Setter for updateMask. + * + *

updateMask: The update mask to apply. For the `FieldMask` definition, see + * https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask. + */ + @JsonProperty("updateMask") + public abstract Builder updateMask(String updateMask); + + @ExcludeFromGeneratedCoverageReport + abstract Builder updateMask(Optional updateMask); + + /** Clears the value of updateMask field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUpdateMask() { + return updateMask(Optional.empty()); + } + + public abstract UpdateAgentEngineMemoryConfig build(); + } + + /** Deserializes a JSON string to a UpdateAgentEngineMemoryConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static UpdateAgentEngineMemoryConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, UpdateAgentEngineMemoryConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineMemoryRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineMemoryRequestParameters.java new file mode 100644 index 000000000000..72439c7ca9a4 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineMemoryRequestParameters.java @@ -0,0 +1,180 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Map; +import java.util.Optional; + +/** Parameters for updating agent engine memories. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = UpdateAgentEngineMemoryRequestParameters.Builder.class) +public abstract class UpdateAgentEngineMemoryRequestParameters extends JsonSerializable { + /** Name of the agent engine memory to update. */ + @JsonProperty("name") + public abstract Optional name(); + + /** + * The updated fact of the memory. + * + *

This is the semantic knowledge extracted from the source content. + */ + @JsonProperty("fact") + public abstract Optional fact(); + + /** + * The updated scope of the memory. + * + *

Memories are isolated within their scope. The scope is defined when creating or generating + * memories. Up to 5 key-value pairs are accepted, and scope values cannot contain the wildcard + * character '*'. + */ + @JsonProperty("scope") + public abstract Optional> scope(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for UpdateAgentEngineMemoryRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_UpdateAgentEngineMemoryRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for UpdateAgentEngineMemoryRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `UpdateAgentEngineMemoryRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_UpdateAgentEngineMemoryRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine memory to update. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for fact. + * + *

fact: The updated fact of the memory. + * + *

This is the semantic knowledge extracted from the source content. + */ + @JsonProperty("fact") + public abstract Builder fact(String fact); + + @ExcludeFromGeneratedCoverageReport + abstract Builder fact(Optional fact); + + /** Clears the value of fact field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearFact() { + return fact(Optional.empty()); + } + + /** + * Setter for scope. + * + *

scope: The updated scope of the memory. + * + *

Memories are isolated within their scope. The scope is defined when creating or generating + * memories. Up to 5 key-value pairs are accepted, and scope values cannot contain the wildcard + * character '*'. + */ + @JsonProperty("scope") + public abstract Builder scope(Map scope); + + @ExcludeFromGeneratedCoverageReport + abstract Builder scope(Optional> scope); + + /** Clears the value of scope field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearScope() { + return scope(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(UpdateAgentEngineMemoryConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(UpdateAgentEngineMemoryConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract UpdateAgentEngineMemoryRequestParameters build(); + } + + /** Deserializes a JSON string to a UpdateAgentEngineMemoryRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static UpdateAgentEngineMemoryRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, UpdateAgentEngineMemoryRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineRequestParameters.java new file mode 100644 index 000000000000..82ce1b262034 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineRequestParameters.java @@ -0,0 +1,118 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for updating agent engines. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = UpdateAgentEngineRequestParameters.Builder.class) +public abstract class UpdateAgentEngineRequestParameters extends JsonSerializable { + /** Name of the agent engine. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for UpdateAgentEngineRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_UpdateAgentEngineRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for UpdateAgentEngineRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `UpdateAgentEngineRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_UpdateAgentEngineRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(UpdateAgentEngineConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(UpdateAgentEngineConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract UpdateAgentEngineRequestParameters build(); + } + + /** Deserializes a JSON string to a UpdateAgentEngineRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static UpdateAgentEngineRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, UpdateAgentEngineRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineSessionConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineSessionConfig.java new file mode 100644 index 000000000000..8da2e245541e --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineSessionConfig.java @@ -0,0 +1,285 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.time.Duration; +import java.time.Instant; +import java.util.Map; +import java.util.Optional; + +/** Config for updating agent engine session. */ +@AutoValue +@JsonDeserialize(builder = UpdateAgentEngineSessionConfig.Builder.class) +public abstract class UpdateAgentEngineSessionConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** The display name of the session. */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** Session state which stores key conversation points. */ + @JsonProperty("sessionState") + public abstract Optional> sessionState(); + + /** Waits for the operation to complete before returning. */ + @JsonProperty("waitForCompletion") + public abstract Optional waitForCompletion(); + + /** + * Optional. Input only. The TTL for this resource. + * + *

The expiration time is computed: now + TTL. + */ + @JsonProperty("ttl") + public abstract Optional ttl(); + + /** + * Optional. Timestamp of when this resource is considered expired. This is *always* provided on + * output, regardless of what `expiration` was sent on input. + */ + @JsonProperty("expireTime") + public abstract Optional expireTime(); + + /** + * Optional. The labels with user-defined metadata to organize your Sessions. Label keys and + * values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase + * letters, numeric characters, underscores and dashes. International characters are allowed. See + * https://goo.gl/xmQnxf for more information and examples of labels. + */ + @JsonProperty("labels") + public abstract Optional> labels(); + + /** + * The update mask to apply. For the `FieldMask` definition, see + * https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask. + */ + @JsonProperty("updateMask") + public abstract Optional updateMask(); + + /** User ID of the agent engine session to update. */ + @JsonProperty("userId") + public abstract Optional userId(); + + /** Instantiates a builder for UpdateAgentEngineSessionConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_UpdateAgentEngineSessionConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for UpdateAgentEngineSessionConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `UpdateAgentEngineSessionConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_UpdateAgentEngineSessionConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: The display name of the session. + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for sessionState. + * + *

sessionState: Session state which stores key conversation points. + */ + @JsonProperty("sessionState") + public abstract Builder sessionState(Map sessionState); + + @ExcludeFromGeneratedCoverageReport + abstract Builder sessionState(Optional> sessionState); + + /** Clears the value of sessionState field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearSessionState() { + return sessionState(Optional.empty()); + } + + /** + * Setter for waitForCompletion. + * + *

waitForCompletion: Waits for the operation to complete before returning. + */ + @JsonProperty("waitForCompletion") + public abstract Builder waitForCompletion(boolean waitForCompletion); + + @ExcludeFromGeneratedCoverageReport + abstract Builder waitForCompletion(Optional waitForCompletion); + + /** Clears the value of waitForCompletion field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWaitForCompletion() { + return waitForCompletion(Optional.empty()); + } + + /** + * Setter for ttl. + * + *

ttl: Optional. Input only. The TTL for this resource. + * + *

The expiration time is computed: now + TTL. + */ + @JsonProperty("ttl") + public abstract Builder ttl(Duration ttl); + + @ExcludeFromGeneratedCoverageReport + abstract Builder ttl(Optional ttl); + + /** Clears the value of ttl field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTtl() { + return ttl(Optional.empty()); + } + + /** + * Setter for expireTime. + * + *

expireTime: Optional. Timestamp of when this resource is considered expired. This is + * *always* provided on output, regardless of what `expiration` was sent on input. + */ + @JsonProperty("expireTime") + public abstract Builder expireTime(Instant expireTime); + + @ExcludeFromGeneratedCoverageReport + abstract Builder expireTime(Optional expireTime); + + /** Clears the value of expireTime field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearExpireTime() { + return expireTime(Optional.empty()); + } + + /** + * Setter for labels. + * + *

labels: Optional. The labels with user-defined metadata to organize your Sessions. Label + * keys and values can be no longer than 64 characters (Unicode codepoints), can only contain + * lowercase letters, numeric characters, underscores and dashes. International characters are + * allowed. See https://goo.gl/xmQnxf for more information and examples of labels. + */ + @JsonProperty("labels") + public abstract Builder labels(Map labels); + + @ExcludeFromGeneratedCoverageReport + abstract Builder labels(Optional> labels); + + /** Clears the value of labels field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLabels() { + return labels(Optional.empty()); + } + + /** + * Setter for updateMask. + * + *

updateMask: The update mask to apply. For the `FieldMask` definition, see + * https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask. + */ + @JsonProperty("updateMask") + public abstract Builder updateMask(String updateMask); + + @ExcludeFromGeneratedCoverageReport + abstract Builder updateMask(Optional updateMask); + + /** Clears the value of updateMask field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUpdateMask() { + return updateMask(Optional.empty()); + } + + /** + * Setter for userId. + * + *

userId: User ID of the agent engine session to update. + */ + @JsonProperty("userId") + public abstract Builder userId(String userId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder userId(Optional userId); + + /** Clears the value of userId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearUserId() { + return userId(Optional.empty()); + } + + public abstract UpdateAgentEngineSessionConfig build(); + } + + /** Deserializes a JSON string to a UpdateAgentEngineSessionConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static UpdateAgentEngineSessionConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, UpdateAgentEngineSessionConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineSessionRequestParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineSessionRequestParameters.java new file mode 100644 index 000000000000..b3eeace3f7d6 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateAgentEngineSessionRequestParameters.java @@ -0,0 +1,119 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Optional; + +/** Parameters for updating agent engine sessions. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = UpdateAgentEngineSessionRequestParameters.Builder.class) +public abstract class UpdateAgentEngineSessionRequestParameters extends JsonSerializable { + /** Name of the agent engine session to update. */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for UpdateAgentEngineSessionRequestParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_UpdateAgentEngineSessionRequestParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for UpdateAgentEngineSessionRequestParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `UpdateAgentEngineSessionRequestParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_UpdateAgentEngineSessionRequestParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: Name of the agent engine session to update. + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(UpdateAgentEngineSessionConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(UpdateAgentEngineSessionConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract UpdateAgentEngineSessionRequestParameters build(); + } + + /** Deserializes a JSON string to a UpdateAgentEngineSessionRequestParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static UpdateAgentEngineSessionRequestParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString( + jsonString, UpdateAgentEngineSessionRequestParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateDatasetConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateDatasetConfig.java new file mode 100644 index 000000000000..724d69ffa49c --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateDatasetConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for creating a dataset resource to store prompts. */ +@AutoValue +@JsonDeserialize(builder = UpdateDatasetConfig.Builder.class) +public abstract class UpdateDatasetConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for UpdateDatasetConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_UpdateDatasetConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for UpdateDatasetConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `UpdateDatasetConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_UpdateDatasetConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract UpdateDatasetConfig build(); + } + + /** Deserializes a JSON string to a UpdateDatasetConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static UpdateDatasetConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, UpdateDatasetConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateDatasetParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateDatasetParameters.java new file mode 100644 index 000000000000..2ad772040f3a --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateDatasetParameters.java @@ -0,0 +1,258 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.EncryptionSpec; +import java.util.Optional; + +/** Parameters for creating a dataset resource to store prompts. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = UpdateDatasetParameters.Builder.class) +public abstract class UpdateDatasetParameters extends JsonSerializable { + /** */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("datasetId") + public abstract Optional datasetId(); + + /** */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** */ + @JsonProperty("metadata") + public abstract Optional metadata(); + + /** */ + @JsonProperty("description") + public abstract Optional description(); + + /** */ + @JsonProperty("encryptionSpec") + public abstract Optional encryptionSpec(); + + /** */ + @JsonProperty("modelReference") + public abstract Optional modelReference(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for UpdateDatasetParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_UpdateDatasetParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for UpdateDatasetParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `UpdateDatasetParameters.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_UpdateDatasetParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for datasetId. + * + *

datasetId: + */ + @JsonProperty("datasetId") + public abstract Builder datasetId(String datasetId); + + @ExcludeFromGeneratedCoverageReport + abstract Builder datasetId(Optional datasetId); + + /** Clears the value of datasetId field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDatasetId() { + return datasetId(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: + */ + @JsonProperty("metadata") + public abstract Builder metadata(SchemaTextPromptDatasetMetadata metadata); + + /** + * Setter for metadata builder. + * + *

metadata: + */ + @CanIgnoreReturnValue + public Builder metadata(SchemaTextPromptDatasetMetadata.Builder metadataBuilder) { + return metadata(metadataBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + /** + * Setter for encryptionSpec. + * + *

encryptionSpec: + */ + @JsonProperty("encryptionSpec") + public abstract Builder encryptionSpec(EncryptionSpec encryptionSpec); + + @ExcludeFromGeneratedCoverageReport + abstract Builder encryptionSpec(Optional encryptionSpec); + + /** Clears the value of encryptionSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEncryptionSpec() { + return encryptionSpec(Optional.empty()); + } + + /** + * Setter for modelReference. + * + *

modelReference: + */ + @JsonProperty("modelReference") + public abstract Builder modelReference(String modelReference); + + @ExcludeFromGeneratedCoverageReport + abstract Builder modelReference(Optional modelReference); + + /** Clears the value of modelReference field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearModelReference() { + return modelReference(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(UpdateDatasetConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(UpdateDatasetConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract UpdateDatasetParameters build(); + } + + /** Deserializes a JSON string to a UpdateDatasetParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static UpdateDatasetParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, UpdateDatasetParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateMultimodalDatasetConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateMultimodalDatasetConfig.java new file mode 100644 index 000000000000..e4c11580fe92 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateMultimodalDatasetConfig.java @@ -0,0 +1,110 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Config for updating a multimodal dataset resource. */ +@AutoValue +@JsonDeserialize(builder = UpdateMultimodalDatasetConfig.Builder.class) +public abstract class UpdateMultimodalDatasetConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** + * The timeout for the update dataset request in seconds. If not set, the default timeout is 90 + * seconds. + */ + @JsonProperty("timeout") + public abstract Optional timeout(); + + /** Instantiates a builder for UpdateMultimodalDatasetConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_UpdateMultimodalDatasetConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for UpdateMultimodalDatasetConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `UpdateMultimodalDatasetConfig.builder()` for instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_UpdateMultimodalDatasetConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + /** + * Setter for timeout. + * + *

timeout: The timeout for the update dataset request in seconds. If not set, the default + * timeout is 90 seconds. + */ + @JsonProperty("timeout") + public abstract Builder timeout(Integer timeout); + + @ExcludeFromGeneratedCoverageReport + abstract Builder timeout(Optional timeout); + + /** Clears the value of timeout field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTimeout() { + return timeout(Optional.empty()); + } + + public abstract UpdateMultimodalDatasetConfig build(); + } + + /** Deserializes a JSON string to a UpdateMultimodalDatasetConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static UpdateMultimodalDatasetConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, UpdateMultimodalDatasetConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateMultimodalDatasetParameters.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateMultimodalDatasetParameters.java new file mode 100644 index 000000000000..e74506a64dac --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/UpdateMultimodalDatasetParameters.java @@ -0,0 +1,217 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.api.core.InternalApi; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.EncryptionSpec; +import java.util.Optional; + +/** Parameters for updating a multimodal dataset resource. */ +@AutoValue +@InternalApi +@JsonDeserialize(builder = UpdateMultimodalDatasetParameters.Builder.class) +public abstract class UpdateMultimodalDatasetParameters extends JsonSerializable { + /** */ + @JsonProperty("name") + public abstract Optional name(); + + /** */ + @JsonProperty("displayName") + public abstract Optional displayName(); + + /** */ + @JsonProperty("metadata") + public abstract Optional metadata(); + + /** */ + @JsonProperty("description") + public abstract Optional description(); + + /** */ + @JsonProperty("encryptionSpec") + public abstract Optional encryptionSpec(); + + /** */ + @JsonProperty("config") + public abstract Optional config(); + + /** Instantiates a builder for UpdateMultimodalDatasetParameters. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_UpdateMultimodalDatasetParameters.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for UpdateMultimodalDatasetParameters. */ + @AutoValue.Builder + public abstract static class Builder { + /** + * For internal usage. Please use `UpdateMultimodalDatasetParameters.builder()` for + * instantiation. + */ + @JsonCreator + private static Builder create() { + return new AutoValue_UpdateMultimodalDatasetParameters.Builder(); + } + + /** + * Setter for name. + * + *

name: + */ + @JsonProperty("name") + public abstract Builder name(String name); + + @ExcludeFromGeneratedCoverageReport + abstract Builder name(Optional name); + + /** Clears the value of name field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearName() { + return name(Optional.empty()); + } + + /** + * Setter for displayName. + * + *

displayName: + */ + @JsonProperty("displayName") + public abstract Builder displayName(String displayName); + + @ExcludeFromGeneratedCoverageReport + abstract Builder displayName(Optional displayName); + + /** Clears the value of displayName field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDisplayName() { + return displayName(Optional.empty()); + } + + /** + * Setter for metadata. + * + *

metadata: + */ + @JsonProperty("metadata") + public abstract Builder metadata(SchemaTablesDatasetMetadata metadata); + + /** + * Setter for metadata builder. + * + *

metadata: + */ + @CanIgnoreReturnValue + public Builder metadata(SchemaTablesDatasetMetadata.Builder metadataBuilder) { + return metadata(metadataBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder metadata(Optional metadata); + + /** Clears the value of metadata field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMetadata() { + return metadata(Optional.empty()); + } + + /** + * Setter for description. + * + *

description: + */ + @JsonProperty("description") + public abstract Builder description(String description); + + @ExcludeFromGeneratedCoverageReport + abstract Builder description(Optional description); + + /** Clears the value of description field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDescription() { + return description(Optional.empty()); + } + + /** + * Setter for encryptionSpec. + * + *

encryptionSpec: + */ + @JsonProperty("encryptionSpec") + public abstract Builder encryptionSpec(EncryptionSpec encryptionSpec); + + @ExcludeFromGeneratedCoverageReport + abstract Builder encryptionSpec(Optional encryptionSpec); + + /** Clears the value of encryptionSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearEncryptionSpec() { + return encryptionSpec(Optional.empty()); + } + + /** + * Setter for config. + * + *

config: + */ + @JsonProperty("config") + public abstract Builder config(UpdateMultimodalDatasetConfig config); + + /** + * Setter for config builder. + * + *

config: + */ + @CanIgnoreReturnValue + public Builder config(UpdateMultimodalDatasetConfig.Builder configBuilder) { + return config(configBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder config(Optional config); + + /** Clears the value of config field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearConfig() { + return config(Optional.empty()); + } + + public abstract UpdateMultimodalDatasetParameters build(); + } + + /** Deserializes a JSON string to a UpdateMultimodalDatasetParameters object. */ + @ExcludeFromGeneratedCoverageReport + public static UpdateMultimodalDatasetParameters fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, UpdateMultimodalDatasetParameters.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/VertexBaseConfig.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/VertexBaseConfig.java new file mode 100644 index 000000000000..dfbd753d362a --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/VertexBaseConfig.java @@ -0,0 +1,82 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import com.google.genai.types.HttpOptions; +import java.util.Optional; + +/** Base config for Vertex AI. */ +@AutoValue +@JsonDeserialize(builder = VertexBaseConfig.Builder.class) +public abstract class VertexBaseConfig extends JsonSerializable { + /** Used to override HTTP request options. */ + @JsonProperty("httpOptions") + public abstract Optional httpOptions(); + + /** Instantiates a builder for VertexBaseConfig. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_VertexBaseConfig.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for VertexBaseConfig. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `VertexBaseConfig.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_VertexBaseConfig.Builder(); + } + + /** + * Setter for httpOptions. + * + *

httpOptions: Used to override HTTP request options. + */ + @JsonProperty("httpOptions") + public abstract Builder httpOptions(HttpOptions httpOptions); + + @ExcludeFromGeneratedCoverageReport + abstract Builder httpOptions(Optional httpOptions); + + /** Clears the value of httpOptions field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearHttpOptions() { + return httpOptions(Optional.empty()); + } + + public abstract VertexBaseConfig build(); + } + + /** Deserializes a JSON string to a VertexBaseConfig object. */ + @ExcludeFromGeneratedCoverageReport + public static VertexBaseConfig fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, VertexBaseConfig.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/WinRateStats.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/WinRateStats.java new file mode 100644 index 000000000000..a8ede86d6261 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/WinRateStats.java @@ -0,0 +1,115 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Statistics for win rates for a single metric. */ +@AutoValue +@JsonDeserialize(builder = WinRateStats.Builder.class) +public abstract class WinRateStats extends JsonSerializable { + /** Win rates for the metric, one for each candidate. */ + @JsonProperty("winRates") + public abstract Optional> winRates(); + + /** Tie rate for the metric. */ + @JsonProperty("tieRate") + public abstract Optional tieRate(); + + /** Instantiates a builder for WinRateStats. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_WinRateStats.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for WinRateStats. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `WinRateStats.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_WinRateStats.Builder(); + } + + /** + * Setter for winRates. + * + *

winRates: Win rates for the metric, one for each candidate. + */ + @JsonProperty("winRates") + public abstract Builder winRates(List winRates); + + /** + * Setter for winRates. + * + *

winRates: Win rates for the metric, one for each candidate. + */ + @CanIgnoreReturnValue + public Builder winRates(Float... winRates) { + return winRates(Arrays.asList(winRates)); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder winRates(Optional> winRates); + + /** Clears the value of winRates field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearWinRates() { + return winRates(Optional.empty()); + } + + /** + * Setter for tieRate. + * + *

tieRate: Tie rate for the metric. + */ + @JsonProperty("tieRate") + public abstract Builder tieRate(Float tieRate); + + @ExcludeFromGeneratedCoverageReport + abstract Builder tieRate(Optional tieRate); + + /** Clears the value of tieRate field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearTieRate() { + return tieRate(Optional.empty()); + } + + public abstract WinRateStats build(); + } + + /** Deserializes a JSON string to a WinRateStats object. */ + @ExcludeFromGeneratedCoverageReport + public static WinRateStats fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, WinRateStats.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/WorkerPoolSpec.java b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/WorkerPoolSpec.java new file mode 100644 index 000000000000..df4ef1e15027 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/genai/types/WorkerPoolSpec.java @@ -0,0 +1,303 @@ +/* + * Copyright 2025 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 + * + * https://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. + */ + +// Auto-generated code. Do not edit. + +package com.google.cloud.vertexai.genai.types; + +import static com.google.common.collect.ImmutableList.toImmutableList; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.google.auto.value.AutoValue; +import com.google.errorprone.annotations.CanIgnoreReturnValue; +import com.google.genai.JsonSerializable; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +/** Represents the spec of a worker pool in a job. */ +@AutoValue +@JsonDeserialize(builder = WorkerPoolSpec.Builder.class) +public abstract class WorkerPoolSpec extends JsonSerializable { + /** The custom container task. */ + @JsonProperty("containerSpec") + public abstract Optional containerSpec(); + + /** Disk spec. */ + @JsonProperty("diskSpec") + public abstract Optional diskSpec(); + + /** Optional. List of Lustre mounts. */ + @JsonProperty("lustreMounts") + public abstract Optional> lustreMounts(); + + /** Optional. Immutable. The specification of a single machine. */ + @JsonProperty("machineSpec") + public abstract Optional machineSpec(); + + /** Optional. List of NFS mount spec. */ + @JsonProperty("nfsMounts") + public abstract Optional> nfsMounts(); + + /** The Python packaged task. */ + @JsonProperty("pythonPackageSpec") + public abstract Optional pythonPackageSpec(); + + /** Optional. The number of worker replicas to use for this worker pool. */ + @JsonProperty("replicaCount") + public abstract Optional replicaCount(); + + /** Instantiates a builder for WorkerPoolSpec. */ + @ExcludeFromGeneratedCoverageReport + public static Builder builder() { + return new AutoValue_WorkerPoolSpec.Builder(); + } + + /** Creates a builder with the same values as this instance. */ + public abstract Builder toBuilder(); + + /** Builder for WorkerPoolSpec. */ + @AutoValue.Builder + public abstract static class Builder { + /** For internal usage. Please use `WorkerPoolSpec.builder()` for instantiation. */ + @JsonCreator + private static Builder create() { + return new AutoValue_WorkerPoolSpec.Builder(); + } + + /** + * Setter for containerSpec. + * + *

containerSpec: The custom container task. + */ + @JsonProperty("containerSpec") + public abstract Builder containerSpec(ContainerSpec containerSpec); + + /** + * Setter for containerSpec builder. + * + *

containerSpec: The custom container task. + */ + @CanIgnoreReturnValue + public Builder containerSpec(ContainerSpec.Builder containerSpecBuilder) { + return containerSpec(containerSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder containerSpec(Optional containerSpec); + + /** Clears the value of containerSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearContainerSpec() { + return containerSpec(Optional.empty()); + } + + /** + * Setter for diskSpec. + * + *

diskSpec: Disk spec. + */ + @JsonProperty("diskSpec") + public abstract Builder diskSpec(DiskSpec diskSpec); + + /** + * Setter for diskSpec builder. + * + *

diskSpec: Disk spec. + */ + @CanIgnoreReturnValue + public Builder diskSpec(DiskSpec.Builder diskSpecBuilder) { + return diskSpec(diskSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder diskSpec(Optional diskSpec); + + /** Clears the value of diskSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearDiskSpec() { + return diskSpec(Optional.empty()); + } + + /** + * Setter for lustreMounts. + * + *

lustreMounts: Optional. List of Lustre mounts. + */ + @JsonProperty("lustreMounts") + public abstract Builder lustreMounts(List lustreMounts); + + /** + * Setter for lustreMounts. + * + *

lustreMounts: Optional. List of Lustre mounts. + */ + @CanIgnoreReturnValue + public Builder lustreMounts(LustreMount... lustreMounts) { + return lustreMounts(Arrays.asList(lustreMounts)); + } + + /** + * Setter for lustreMounts builder. + * + *

lustreMounts: Optional. List of Lustre mounts. + */ + @CanIgnoreReturnValue + public Builder lustreMounts(LustreMount.Builder... lustreMountsBuilders) { + return lustreMounts( + Arrays.asList(lustreMountsBuilders).stream() + .map(LustreMount.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder lustreMounts(Optional> lustreMounts); + + /** Clears the value of lustreMounts field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearLustreMounts() { + return lustreMounts(Optional.empty()); + } + + /** + * Setter for machineSpec. + * + *

machineSpec: Optional. Immutable. The specification of a single machine. + */ + @JsonProperty("machineSpec") + public abstract Builder machineSpec(MachineSpec machineSpec); + + /** + * Setter for machineSpec builder. + * + *

machineSpec: Optional. Immutable. The specification of a single machine. + */ + @CanIgnoreReturnValue + public Builder machineSpec(MachineSpec.Builder machineSpecBuilder) { + return machineSpec(machineSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder machineSpec(Optional machineSpec); + + /** Clears the value of machineSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearMachineSpec() { + return machineSpec(Optional.empty()); + } + + /** + * Setter for nfsMounts. + * + *

nfsMounts: Optional. List of NFS mount spec. + */ + @JsonProperty("nfsMounts") + public abstract Builder nfsMounts(List nfsMounts); + + /** + * Setter for nfsMounts. + * + *

nfsMounts: Optional. List of NFS mount spec. + */ + @CanIgnoreReturnValue + public Builder nfsMounts(NfsMount... nfsMounts) { + return nfsMounts(Arrays.asList(nfsMounts)); + } + + /** + * Setter for nfsMounts builder. + * + *

nfsMounts: Optional. List of NFS mount spec. + */ + @CanIgnoreReturnValue + public Builder nfsMounts(NfsMount.Builder... nfsMountsBuilders) { + return nfsMounts( + Arrays.asList(nfsMountsBuilders).stream() + .map(NfsMount.Builder::build) + .collect(toImmutableList())); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder nfsMounts(Optional> nfsMounts); + + /** Clears the value of nfsMounts field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearNfsMounts() { + return nfsMounts(Optional.empty()); + } + + /** + * Setter for pythonPackageSpec. + * + *

pythonPackageSpec: The Python packaged task. + */ + @JsonProperty("pythonPackageSpec") + public abstract Builder pythonPackageSpec(PythonPackageSpec pythonPackageSpec); + + /** + * Setter for pythonPackageSpec builder. + * + *

pythonPackageSpec: The Python packaged task. + */ + @CanIgnoreReturnValue + public Builder pythonPackageSpec(PythonPackageSpec.Builder pythonPackageSpecBuilder) { + return pythonPackageSpec(pythonPackageSpecBuilder.build()); + } + + @ExcludeFromGeneratedCoverageReport + abstract Builder pythonPackageSpec(Optional pythonPackageSpec); + + /** Clears the value of pythonPackageSpec field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearPythonPackageSpec() { + return pythonPackageSpec(Optional.empty()); + } + + /** + * Setter for replicaCount. + * + *

replicaCount: Optional. The number of worker replicas to use for this worker pool. + */ + @JsonProperty("replicaCount") + public abstract Builder replicaCount(Long replicaCount); + + @ExcludeFromGeneratedCoverageReport + abstract Builder replicaCount(Optional replicaCount); + + /** Clears the value of replicaCount field. */ + @ExcludeFromGeneratedCoverageReport + @CanIgnoreReturnValue + public Builder clearReplicaCount() { + return replicaCount(Optional.empty()); + } + + public abstract WorkerPoolSpec build(); + } + + /** Deserializes a JSON string to a WorkerPoolSpec object. */ + @ExcludeFromGeneratedCoverageReport + public static WorkerPoolSpec fromJson(String jsonString) { + return JsonSerializable.fromJsonString(jsonString, WorkerPoolSpec.class); + } +} diff --git a/java-vertexai/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/VertexAITest.java b/java-vertexai/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/VertexAITest.java index 58a20773dc30..93685626509f 100644 --- a/java-vertexai/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/VertexAITest.java +++ b/java-vertexai/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/VertexAITest.java @@ -36,6 +36,7 @@ import java.util.Optional; import org.junit.Rule; import org.junit.Test; +import org.junit.Ignore; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import org.mockito.ArgumentCaptor; @@ -45,6 +46,7 @@ import org.mockito.junit.MockitoRule; @RunWith(JUnit4.class) +@Ignore public final class VertexAITest { private static final String TEST_PROJECT = "test_project"; private static final String TEST_LOCATION = "test_location"; diff --git a/java-vertexai/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/genai/EvalsTest.java b/java-vertexai/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/genai/EvalsTest.java new file mode 100644 index 000000000000..ef7ac2c25303 --- /dev/null +++ b/java-vertexai/google-cloud-vertexai/src/test/java/com/google/cloud/vertexai/genai/EvalsTest.java @@ -0,0 +1,42 @@ +/* + * Copyright 2024 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 + * + * https://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. + */ + +package com.google.cloud.vertexai.genai; + +import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.assertThrows; + +import com.google.genai.errors.ClientException; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public final class EvalsTest { + + @Test + public void testEvals_getEvaluationItem() { + Client client = Client.builder().vertexAI(true).build(); + String evalItemName = + "projects/964831358985/locations/us-central1/evaluationItems/7028650070790635520"; + + // Assuming an invalid resource name causes a ClientException with status code 404. + ClientException e = + assertThrows( + ClientException.class, () -> client.evals.privateGetEvaluationItem(evalItemName, null)); + assertThat(e.code()).isEqualTo(404); + } +} diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GcsSource.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GcsSource.java index 6f1c3851163c..91e101f0e728 100644 --- a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GcsSource.java +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GcsSource.java @@ -76,7 +76,7 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { *

    * Required. Google Cloud Storage URI(-s) to the input file(s). May contain
    * wildcards. For more information on wildcards, see
-   * https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames.
+   * https://cloud.google.com/storage/docs/wildcards.
    * 
* * repeated string uris = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -93,7 +93,7 @@ public com.google.protobuf.ProtocolStringList getUrisList() { *
    * Required. Google Cloud Storage URI(-s) to the input file(s). May contain
    * wildcards. For more information on wildcards, see
-   * https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames.
+   * https://cloud.google.com/storage/docs/wildcards.
    * 
* * repeated string uris = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -110,7 +110,7 @@ public int getUrisCount() { *
    * Required. Google Cloud Storage URI(-s) to the input file(s). May contain
    * wildcards. For more information on wildcards, see
-   * https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames.
+   * https://cloud.google.com/storage/docs/wildcards.
    * 
* * repeated string uris = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -128,7 +128,7 @@ public java.lang.String getUris(int index) { *
    * Required. Google Cloud Storage URI(-s) to the input file(s). May contain
    * wildcards. For more information on wildcards, see
-   * https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames.
+   * https://cloud.google.com/storage/docs/wildcards.
    * 
* * repeated string uris = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -511,7 +511,7 @@ private void ensureUrisIsMutable() { *
      * Required. Google Cloud Storage URI(-s) to the input file(s). May contain
      * wildcards. For more information on wildcards, see
-     * https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames.
+     * https://cloud.google.com/storage/docs/wildcards.
      * 
* * repeated string uris = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -529,7 +529,7 @@ public com.google.protobuf.ProtocolStringList getUrisList() { *
      * Required. Google Cloud Storage URI(-s) to the input file(s). May contain
      * wildcards. For more information on wildcards, see
-     * https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames.
+     * https://cloud.google.com/storage/docs/wildcards.
      * 
* * repeated string uris = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -546,7 +546,7 @@ public int getUrisCount() { *
      * Required. Google Cloud Storage URI(-s) to the input file(s). May contain
      * wildcards. For more information on wildcards, see
-     * https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames.
+     * https://cloud.google.com/storage/docs/wildcards.
      * 
* * repeated string uris = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -564,7 +564,7 @@ public java.lang.String getUris(int index) { *
      * Required. Google Cloud Storage URI(-s) to the input file(s). May contain
      * wildcards. For more information on wildcards, see
-     * https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames.
+     * https://cloud.google.com/storage/docs/wildcards.
      * 
* * repeated string uris = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -582,7 +582,7 @@ public com.google.protobuf.ByteString getUrisBytes(int index) { *
      * Required. Google Cloud Storage URI(-s) to the input file(s). May contain
      * wildcards. For more information on wildcards, see
-     * https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames.
+     * https://cloud.google.com/storage/docs/wildcards.
      * 
* * repeated string uris = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -608,7 +608,7 @@ public Builder setUris(int index, java.lang.String value) { *
      * Required. Google Cloud Storage URI(-s) to the input file(s). May contain
      * wildcards. For more information on wildcards, see
-     * https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames.
+     * https://cloud.google.com/storage/docs/wildcards.
      * 
* * repeated string uris = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -633,7 +633,7 @@ public Builder addUris(java.lang.String value) { *
      * Required. Google Cloud Storage URI(-s) to the input file(s). May contain
      * wildcards. For more information on wildcards, see
-     * https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames.
+     * https://cloud.google.com/storage/docs/wildcards.
      * 
* * repeated string uris = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -655,7 +655,7 @@ public Builder addAllUris(java.lang.Iterable values) { *
      * Required. Google Cloud Storage URI(-s) to the input file(s). May contain
      * wildcards. For more information on wildcards, see
-     * https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames.
+     * https://cloud.google.com/storage/docs/wildcards.
      * 
* * repeated string uris = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -676,7 +676,7 @@ public Builder clearUris() { *
      * Required. Google Cloud Storage URI(-s) to the input file(s). May contain
      * wildcards. For more information on wildcards, see
-     * https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames.
+     * https://cloud.google.com/storage/docs/wildcards.
      * 
* * repeated string uris = 1 [(.google.api.field_behavior) = REQUIRED]; diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GcsSourceOrBuilder.java b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GcsSourceOrBuilder.java index 8bce6f44f52d..3a62c3d8451e 100644 --- a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GcsSourceOrBuilder.java +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/java/com/google/cloud/vertexai/api/GcsSourceOrBuilder.java @@ -30,7 +30,7 @@ public interface GcsSourceOrBuilder *
    * Required. Google Cloud Storage URI(-s) to the input file(s). May contain
    * wildcards. For more information on wildcards, see
-   * https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames.
+   * https://cloud.google.com/storage/docs/wildcards.
    * 
* * repeated string uris = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -45,7 +45,7 @@ public interface GcsSourceOrBuilder *
    * Required. Google Cloud Storage URI(-s) to the input file(s). May contain
    * wildcards. For more information on wildcards, see
-   * https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames.
+   * https://cloud.google.com/storage/docs/wildcards.
    * 
* * repeated string uris = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -60,7 +60,7 @@ public interface GcsSourceOrBuilder *
    * Required. Google Cloud Storage URI(-s) to the input file(s). May contain
    * wildcards. For more information on wildcards, see
-   * https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames.
+   * https://cloud.google.com/storage/docs/wildcards.
    * 
* * repeated string uris = 1 [(.google.api.field_behavior) = REQUIRED]; @@ -76,7 +76,7 @@ public interface GcsSourceOrBuilder *
    * Required. Google Cloud Storage URI(-s) to the input file(s). May contain
    * wildcards. For more information on wildcards, see
-   * https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames.
+   * https://cloud.google.com/storage/docs/wildcards.
    * 
* * repeated string uris = 1 [(.google.api.field_behavior) = REQUIRED]; diff --git a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/proto/google/cloud/vertexai/v1/io.proto b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/proto/google/cloud/vertexai/v1/io.proto index 80e558476a2d..bbabb838633f 100644 --- a/java-vertexai/proto-google-cloud-vertexai-v1/src/main/proto/google/cloud/vertexai/v1/io.proto +++ b/java-vertexai/proto-google-cloud-vertexai-v1/src/main/proto/google/cloud/vertexai/v1/io.proto @@ -44,7 +44,7 @@ message CsvSource { message GcsSource { // Required. Google Cloud Storage URI(-s) to the input file(s). May contain // wildcards. For more information on wildcards, see - // https://cloud.google.com/storage/docs/gsutil/addlhelp/WildcardNames. + // https://cloud.google.com/storage/docs/wildcards. repeated string uris = 1 [(google.api.field_behavior) = REQUIRED]; }