blob: 7295d4dd481e53951475ee03715b4abfa4515db7 [file] [edit]
// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
package agentplatform
import (
"context"
"fmt"
"net/http"
"reflect"
"cloud.google.com/go/agentplatform/types"
"google.golang.org/genai"
)
func agentEngineOperationFromVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromName := genai.InternalGetValueByPath(fromObject, []string{"name"})
if fromName != nil {
genai.InternalSetValueByPath(toObject, []string{"name"}, fromName)
}
fromMetadata := genai.InternalGetValueByPath(fromObject, []string{"metadata"})
if fromMetadata != nil {
genai.InternalSetValueByPath(toObject, []string{"metadata"}, fromMetadata)
}
fromDone := genai.InternalGetValueByPath(fromObject, []string{"done"})
if fromDone != nil {
genai.InternalSetValueByPath(toObject, []string{"done"}, fromDone)
}
fromError := genai.InternalGetValueByPath(fromObject, []string{"error"})
if fromError != nil {
genai.InternalSetValueByPath(toObject, []string{"error"}, fromError)
}
fromResponse := genai.InternalGetValueByPath(fromObject, []string{"response"})
if fromResponse != nil {
fromResponse, err = reasoningEngineFromVertex(fromResponse.(map[string]any), toObject, rootObject)
if err != nil {
return nil, err
}
genai.InternalSetValueByPath(toObject, []string{"response"}, fromResponse)
}
return toObject, nil
}
func createAgentEngineConfigToVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromDisplayName := genai.InternalGetValueByPath(fromObject, []string{"displayName"})
if fromDisplayName != nil {
genai.InternalSetValueByPath(parentObject, []string{"displayName"}, fromDisplayName)
}
fromDescription := genai.InternalGetValueByPath(fromObject, []string{"description"})
if fromDescription != nil {
genai.InternalSetValueByPath(parentObject, []string{"description"}, fromDescription)
}
fromSpec := genai.InternalGetValueByPath(fromObject, []string{"spec"})
if fromSpec != nil {
genai.InternalSetValueByPath(parentObject, []string{"spec"}, fromSpec)
}
fromContextSpec := genai.InternalGetValueByPath(fromObject, []string{"contextSpec"})
if fromContextSpec != nil {
fromContextSpec, err = reasoningEngineContextSpecToVertex(fromContextSpec.(map[string]any), toObject, rootObject)
if err != nil {
return nil, err
}
genai.InternalSetValueByPath(parentObject, []string{"contextSpec"}, fromContextSpec)
}
fromPscInterfaceConfig := genai.InternalGetValueByPath(fromObject, []string{"pscInterfaceConfig"})
if fromPscInterfaceConfig != nil {
genai.InternalSetValueByPath(parentObject, []string{"pscInterfaceConfig"}, fromPscInterfaceConfig)
}
fromEncryptionSpec := genai.InternalGetValueByPath(fromObject, []string{"encryptionSpec"})
if fromEncryptionSpec != nil {
genai.InternalSetValueByPath(parentObject, []string{"encryptionSpec"}, fromEncryptionSpec)
}
fromLabels := genai.InternalGetValueByPath(fromObject, []string{"labels"})
if fromLabels != nil {
genai.InternalSetValueByPath(parentObject, []string{"labels"}, fromLabels)
}
fromSourcePackages := genai.InternalGetValueByPath(fromObject, []string{"sourcePackages"})
if fromSourcePackages != nil {
genai.InternalSetValueByPath(parentObject, []string{"sourcePackages"}, fromSourcePackages)
}
fromEntrypointModule := genai.InternalGetValueByPath(fromObject, []string{"entrypointModule"})
if fromEntrypointModule != nil {
genai.InternalSetValueByPath(parentObject, []string{"entrypointModule"}, fromEntrypointModule)
}
fromEntrypointObject := genai.InternalGetValueByPath(fromObject, []string{"entrypointObject"})
if fromEntrypointObject != nil {
genai.InternalSetValueByPath(parentObject, []string{"entrypointObject"}, fromEntrypointObject)
}
fromRequirementsFile := genai.InternalGetValueByPath(fromObject, []string{"requirementsFile"})
if fromRequirementsFile != nil {
genai.InternalSetValueByPath(parentObject, []string{"requirementsFile"}, fromRequirementsFile)
}
fromAgentFramework := genai.InternalGetValueByPath(fromObject, []string{"agentFramework"})
if fromAgentFramework != nil {
genai.InternalSetValueByPath(parentObject, []string{"agentFramework"}, fromAgentFramework)
}
fromPythonVersion := genai.InternalGetValueByPath(fromObject, []string{"pythonVersion"})
if fromPythonVersion != nil {
genai.InternalSetValueByPath(parentObject, []string{"pythonVersion"}, fromPythonVersion)
}
fromAgentGatewayConfig := genai.InternalGetValueByPath(fromObject, []string{"agentGatewayConfig"})
if fromAgentGatewayConfig != nil {
genai.InternalSetValueByPath(parentObject, []string{"agentGatewayConfig"}, fromAgentGatewayConfig)
}
return toObject, nil
}
func createAgentEngineRequestParametersToVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromConfig := genai.InternalGetValueByPath(fromObject, []string{"config"})
if fromConfig != nil {
_, err = createAgentEngineConfigToVertex(fromConfig.(map[string]any), toObject, rootObject)
if err != nil {
return nil, err
}
}
return toObject, nil
}
func deleteAgentEngineRequestParametersToVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromName := genai.InternalGetValueByPath(fromObject, []string{"name"})
if fromName != nil {
genai.InternalSetValueByPath(toObject, []string{"_url", "name"}, fromName)
}
fromForce := genai.InternalGetValueByPath(fromObject, []string{"force"})
if fromForce != nil {
genai.InternalSetValueByPath(toObject, []string{"force"}, fromForce)
}
return toObject, nil
}
func getAgentEngineOperationParametersToVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromOperationName := genai.InternalGetValueByPath(fromObject, []string{"operationName"})
if fromOperationName != nil {
genai.InternalSetValueByPath(toObject, []string{"_url", "operationName"}, fromOperationName)
}
return toObject, nil
}
func getAgentEngineRequestParametersToVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromName := genai.InternalGetValueByPath(fromObject, []string{"name"})
if fromName != nil {
genai.InternalSetValueByPath(toObject, []string{"_url", "name"}, fromName)
}
return toObject, nil
}
func listAgentEngineConfigToVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromPageSize := genai.InternalGetValueByPath(fromObject, []string{"pageSize"})
if fromPageSize != nil {
genai.InternalSetValueByPath(parentObject, []string{"_query", "pageSize"}, fromPageSize)
}
fromPageToken := genai.InternalGetValueByPath(fromObject, []string{"pageToken"})
if fromPageToken != nil {
genai.InternalSetValueByPath(parentObject, []string{"_query", "pageToken"}, fromPageToken)
}
fromFilter := genai.InternalGetValueByPath(fromObject, []string{"filter"})
if fromFilter != nil {
genai.InternalSetValueByPath(parentObject, []string{"_query", "filter"}, fromFilter)
}
return toObject, nil
}
func listAgentEngineRequestParametersToVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromConfig := genai.InternalGetValueByPath(fromObject, []string{"config"})
if fromConfig != nil {
_, err = listAgentEngineConfigToVertex(fromConfig.(map[string]any), toObject, rootObject)
if err != nil {
return nil, err
}
}
return toObject, nil
}
func listReasoningEnginesResponseFromVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromSdkHttpResponse := genai.InternalGetValueByPath(fromObject, []string{"sdkHttpResponse"})
if fromSdkHttpResponse != nil {
genai.InternalSetValueByPath(toObject, []string{"sdkHttpResponse"}, fromSdkHttpResponse)
}
fromNextPageToken := genai.InternalGetValueByPath(fromObject, []string{"nextPageToken"})
if fromNextPageToken != nil {
genai.InternalSetValueByPath(toObject, []string{"nextPageToken"}, fromNextPageToken)
}
fromReasoningEngines := genai.InternalGetValueByPath(fromObject, []string{"reasoningEngines"})
if fromReasoningEngines != nil {
fromReasoningEngines, err = genai.InternalApplyConverterToSliceWithRoot(fromReasoningEngines.([]any), reasoningEngineFromVertex, rootObject)
if err != nil {
return nil, err
}
genai.InternalSetValueByPath(toObject, []string{"reasoningEngines"}, fromReasoningEngines)
}
return toObject, nil
}
func queryAgentEngineConfigToVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromClassMethod := genai.InternalGetValueByPath(fromObject, []string{"classMethod"})
if fromClassMethod != nil {
genai.InternalSetValueByPath(parentObject, []string{"classMethod"}, fromClassMethod)
}
fromInput := genai.InternalGetValueByPath(fromObject, []string{"input"})
if fromInput != nil {
genai.InternalSetValueByPath(parentObject, []string{"input"}, fromInput)
}
fromIncludeAllFields := genai.InternalGetValueByPath(fromObject, []string{"includeAllFields"})
if fromIncludeAllFields != nil {
genai.InternalSetValueByPath(toObject, []string{"includeAllFields"}, fromIncludeAllFields)
}
return toObject, nil
}
func queryAgentEngineRequestParametersToVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromName := genai.InternalGetValueByPath(fromObject, []string{"name"})
if fromName != nil {
genai.InternalSetValueByPath(toObject, []string{"_url", "name"}, fromName)
}
fromConfig := genai.InternalGetValueByPath(fromObject, []string{"config"})
if fromConfig != nil {
_, err = queryAgentEngineConfigToVertex(fromConfig.(map[string]any), toObject, rootObject)
if err != nil {
return nil, err
}
}
return toObject, nil
}
func reasoningEngineContextSpecFromVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromMemoryBankConfig := genai.InternalGetValueByPath(fromObject, []string{"memoryBankConfig"})
if fromMemoryBankConfig != nil {
fromMemoryBankConfig, err = reasoningEngineContextSpecMemoryBankConfigFromVertex(fromMemoryBankConfig.(map[string]any), toObject, rootObject)
if err != nil {
return nil, err
}
genai.InternalSetValueByPath(toObject, []string{"memoryBankConfig"}, fromMemoryBankConfig)
}
return toObject, nil
}
func reasoningEngineContextSpecMemoryBankConfigFromVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromCustomizationConfigs := genai.InternalGetValueByPath(fromObject, []string{"customizationConfigs"})
if fromCustomizationConfigs != nil {
genai.InternalSetValueByPath(toObject, []string{"customizationConfigs"}, fromCustomizationConfigs)
}
fromDisableMemoryRevisions := genai.InternalGetValueByPath(fromObject, []string{"disableMemoryRevisions"})
if fromDisableMemoryRevisions != nil {
genai.InternalSetValueByPath(toObject, []string{"disableMemoryRevisions"}, fromDisableMemoryRevisions)
}
fromGenerationConfig := genai.InternalGetValueByPath(fromObject, []string{"generationConfig"})
if fromGenerationConfig != nil {
genai.InternalSetValueByPath(toObject, []string{"generationConfig"}, fromGenerationConfig)
}
fromSimilaritySearchConfig := genai.InternalGetValueByPath(fromObject, []string{"similaritySearchConfig"})
if fromSimilaritySearchConfig != nil {
genai.InternalSetValueByPath(toObject, []string{"similaritySearchConfig"}, fromSimilaritySearchConfig)
}
fromTtlConfig := genai.InternalGetValueByPath(fromObject, []string{"ttlConfig"})
if fromTtlConfig != nil {
genai.InternalSetValueByPath(toObject, []string{"ttlConfig"}, fromTtlConfig)
}
fromStructuredMemoryConfigs := genai.InternalGetValueByPath(fromObject, []string{"structuredMemoryConfigs"})
if fromStructuredMemoryConfigs != nil {
fromStructuredMemoryConfigs, err = genai.InternalApplyConverterToSliceWithRoot(fromStructuredMemoryConfigs.([]any), structuredMemoryConfigFromVertex, rootObject)
if err != nil {
return nil, err
}
genai.InternalSetValueByPath(toObject, []string{"structuredMemoryConfigs"}, fromStructuredMemoryConfigs)
}
return toObject, nil
}
func reasoningEngineContextSpecMemoryBankConfigToVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromCustomizationConfigs := genai.InternalGetValueByPath(fromObject, []string{"customizationConfigs"})
if fromCustomizationConfigs != nil {
genai.InternalSetValueByPath(toObject, []string{"customizationConfigs"}, fromCustomizationConfigs)
}
fromDisableMemoryRevisions := genai.InternalGetValueByPath(fromObject, []string{"disableMemoryRevisions"})
if fromDisableMemoryRevisions != nil {
genai.InternalSetValueByPath(toObject, []string{"disableMemoryRevisions"}, fromDisableMemoryRevisions)
}
fromGenerationConfig := genai.InternalGetValueByPath(fromObject, []string{"generationConfig"})
if fromGenerationConfig != nil {
genai.InternalSetValueByPath(toObject, []string{"generationConfig"}, fromGenerationConfig)
}
fromSimilaritySearchConfig := genai.InternalGetValueByPath(fromObject, []string{"similaritySearchConfig"})
if fromSimilaritySearchConfig != nil {
genai.InternalSetValueByPath(toObject, []string{"similaritySearchConfig"}, fromSimilaritySearchConfig)
}
fromTtlConfig := genai.InternalGetValueByPath(fromObject, []string{"ttlConfig"})
if fromTtlConfig != nil {
genai.InternalSetValueByPath(toObject, []string{"ttlConfig"}, fromTtlConfig)
}
fromStructuredMemoryConfigs := genai.InternalGetValueByPath(fromObject, []string{"structuredMemoryConfigs"})
if fromStructuredMemoryConfigs != nil {
fromStructuredMemoryConfigs, err = genai.InternalApplyConverterToSliceWithRoot(fromStructuredMemoryConfigs.([]any), structuredMemoryConfigToVertex, rootObject)
if err != nil {
return nil, err
}
genai.InternalSetValueByPath(toObject, []string{"structuredMemoryConfigs"}, fromStructuredMemoryConfigs)
}
return toObject, nil
}
func reasoningEngineContextSpecToVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromMemoryBankConfig := genai.InternalGetValueByPath(fromObject, []string{"memoryBankConfig"})
if fromMemoryBankConfig != nil {
fromMemoryBankConfig, err = reasoningEngineContextSpecMemoryBankConfigToVertex(fromMemoryBankConfig.(map[string]any), toObject, rootObject)
if err != nil {
return nil, err
}
genai.InternalSetValueByPath(toObject, []string{"memoryBankConfig"}, fromMemoryBankConfig)
}
return toObject, nil
}
func reasoningEngineFromVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromEncryptionSpec := genai.InternalGetValueByPath(fromObject, []string{"encryptionSpec"})
if fromEncryptionSpec != nil {
genai.InternalSetValueByPath(toObject, []string{"encryptionSpec"}, fromEncryptionSpec)
}
fromContextSpec := genai.InternalGetValueByPath(fromObject, []string{"contextSpec"})
if fromContextSpec != nil {
fromContextSpec, err = reasoningEngineContextSpecFromVertex(fromContextSpec.(map[string]any), toObject, rootObject)
if err != nil {
return nil, err
}
genai.InternalSetValueByPath(toObject, []string{"contextSpec"}, fromContextSpec)
}
fromCreateTime := genai.InternalGetValueByPath(fromObject, []string{"createTime"})
if fromCreateTime != nil {
genai.InternalSetValueByPath(toObject, []string{"createTime"}, fromCreateTime)
}
fromDescription := genai.InternalGetValueByPath(fromObject, []string{"description"})
if fromDescription != nil {
genai.InternalSetValueByPath(toObject, []string{"description"}, fromDescription)
}
fromDisplayName := genai.InternalGetValueByPath(fromObject, []string{"displayName"})
if fromDisplayName != nil {
genai.InternalSetValueByPath(toObject, []string{"displayName"}, fromDisplayName)
}
fromEtag := genai.InternalGetValueByPath(fromObject, []string{"etag"})
if fromEtag != nil {
genai.InternalSetValueByPath(toObject, []string{"etag"}, fromEtag)
}
fromLabels := genai.InternalGetValueByPath(fromObject, []string{"labels"})
if fromLabels != nil {
genai.InternalSetValueByPath(toObject, []string{"labels"}, fromLabels)
}
fromName := genai.InternalGetValueByPath(fromObject, []string{"name"})
if fromName != nil {
genai.InternalSetValueByPath(toObject, []string{"name"}, fromName)
}
fromSpec := genai.InternalGetValueByPath(fromObject, []string{"spec"})
if fromSpec != nil {
genai.InternalSetValueByPath(toObject, []string{"spec"}, fromSpec)
}
fromUpdateTime := genai.InternalGetValueByPath(fromObject, []string{"updateTime"})
if fromUpdateTime != nil {
genai.InternalSetValueByPath(toObject, []string{"updateTime"}, fromUpdateTime)
}
fromTrafficConfig := genai.InternalGetValueByPath(fromObject, []string{"trafficConfig"})
if fromTrafficConfig != nil {
genai.InternalSetValueByPath(toObject, []string{"trafficConfig"}, fromTrafficConfig)
}
return toObject, nil
}
func structuredMemoryConfigFromVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromSchemaConfigs := genai.InternalGetValueByPath(fromObject, []string{"schemaConfigs"})
if fromSchemaConfigs != nil {
fromSchemaConfigs, err = genai.InternalApplyConverterToSliceWithRoot(fromSchemaConfigs.([]any), structuredMemorySchemaConfigFromVertex, rootObject)
if err != nil {
return nil, err
}
genai.InternalSetValueByPath(toObject, []string{"schemaConfigs"}, fromSchemaConfigs)
}
fromScopeKeys := genai.InternalGetValueByPath(fromObject, []string{"scopeKeys"})
if fromScopeKeys != nil {
genai.InternalSetValueByPath(toObject, []string{"scopeKeys"}, fromScopeKeys)
}
return toObject, nil
}
func structuredMemoryConfigToVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromSchemaConfigs := genai.InternalGetValueByPath(fromObject, []string{"schemaConfigs"})
if fromSchemaConfigs != nil {
fromSchemaConfigs, err = genai.InternalApplyConverterToSliceWithRoot(fromSchemaConfigs.([]any), structuredMemorySchemaConfigToVertex, rootObject)
if err != nil {
return nil, err
}
genai.InternalSetValueByPath(toObject, []string{"schemaConfigs"}, fromSchemaConfigs)
}
fromScopeKeys := genai.InternalGetValueByPath(fromObject, []string{"scopeKeys"})
if fromScopeKeys != nil {
genai.InternalSetValueByPath(toObject, []string{"scopeKeys"}, fromScopeKeys)
}
return toObject, nil
}
func structuredMemorySchemaConfigFromVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromMemorySchema := genai.InternalGetValueByPath(fromObject, []string{"schema"})
if fromMemorySchema != nil {
genai.InternalSetValueByPath(toObject, []string{"memorySchema"}, fromMemorySchema)
}
fromId := genai.InternalGetValueByPath(fromObject, []string{"id"})
if fromId != nil {
genai.InternalSetValueByPath(toObject, []string{"id"}, fromId)
}
fromMemoryType := genai.InternalGetValueByPath(fromObject, []string{"memoryType"})
if fromMemoryType != nil {
genai.InternalSetValueByPath(toObject, []string{"memoryType"}, fromMemoryType)
}
return toObject, nil
}
func structuredMemorySchemaConfigToVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromMemorySchema := genai.InternalGetValueByPath(fromObject, []string{"memorySchema"})
if fromMemorySchema != nil {
genai.InternalSetValueByPath(toObject, []string{"schema"}, fromMemorySchema)
}
fromId := genai.InternalGetValueByPath(fromObject, []string{"id"})
if fromId != nil {
genai.InternalSetValueByPath(toObject, []string{"id"}, fromId)
}
fromMemoryType := genai.InternalGetValueByPath(fromObject, []string{"memoryType"})
if fromMemoryType != nil {
genai.InternalSetValueByPath(toObject, []string{"memoryType"}, fromMemoryType)
}
return toObject, nil
}
func updateAgentEngineConfigToVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromDisplayName := genai.InternalGetValueByPath(fromObject, []string{"displayName"})
if fromDisplayName != nil {
genai.InternalSetValueByPath(parentObject, []string{"displayName"}, fromDisplayName)
}
fromDescription := genai.InternalGetValueByPath(fromObject, []string{"description"})
if fromDescription != nil {
genai.InternalSetValueByPath(parentObject, []string{"description"}, fromDescription)
}
fromSpec := genai.InternalGetValueByPath(fromObject, []string{"spec"})
if fromSpec != nil {
genai.InternalSetValueByPath(parentObject, []string{"spec"}, fromSpec)
}
fromContextSpec := genai.InternalGetValueByPath(fromObject, []string{"contextSpec"})
if fromContextSpec != nil {
fromContextSpec, err = reasoningEngineContextSpecToVertex(fromContextSpec.(map[string]any), toObject, rootObject)
if err != nil {
return nil, err
}
genai.InternalSetValueByPath(parentObject, []string{"contextSpec"}, fromContextSpec)
}
fromPscInterfaceConfig := genai.InternalGetValueByPath(fromObject, []string{"pscInterfaceConfig"})
if fromPscInterfaceConfig != nil {
genai.InternalSetValueByPath(parentObject, []string{"pscInterfaceConfig"}, fromPscInterfaceConfig)
}
fromEncryptionSpec := genai.InternalGetValueByPath(fromObject, []string{"encryptionSpec"})
if fromEncryptionSpec != nil {
genai.InternalSetValueByPath(parentObject, []string{"encryptionSpec"}, fromEncryptionSpec)
}
fromLabels := genai.InternalGetValueByPath(fromObject, []string{"labels"})
if fromLabels != nil {
genai.InternalSetValueByPath(parentObject, []string{"labels"}, fromLabels)
}
fromSourcePackages := genai.InternalGetValueByPath(fromObject, []string{"sourcePackages"})
if fromSourcePackages != nil {
genai.InternalSetValueByPath(parentObject, []string{"sourcePackages"}, fromSourcePackages)
}
fromEntrypointModule := genai.InternalGetValueByPath(fromObject, []string{"entrypointModule"})
if fromEntrypointModule != nil {
genai.InternalSetValueByPath(parentObject, []string{"entrypointModule"}, fromEntrypointModule)
}
fromEntrypointObject := genai.InternalGetValueByPath(fromObject, []string{"entrypointObject"})
if fromEntrypointObject != nil {
genai.InternalSetValueByPath(parentObject, []string{"entrypointObject"}, fromEntrypointObject)
}
fromRequirementsFile := genai.InternalGetValueByPath(fromObject, []string{"requirementsFile"})
if fromRequirementsFile != nil {
genai.InternalSetValueByPath(parentObject, []string{"requirementsFile"}, fromRequirementsFile)
}
fromAgentFramework := genai.InternalGetValueByPath(fromObject, []string{"agentFramework"})
if fromAgentFramework != nil {
genai.InternalSetValueByPath(parentObject, []string{"agentFramework"}, fromAgentFramework)
}
fromPythonVersion := genai.InternalGetValueByPath(fromObject, []string{"pythonVersion"})
if fromPythonVersion != nil {
genai.InternalSetValueByPath(parentObject, []string{"pythonVersion"}, fromPythonVersion)
}
fromAgentGatewayConfig := genai.InternalGetValueByPath(fromObject, []string{"agentGatewayConfig"})
if fromAgentGatewayConfig != nil {
genai.InternalSetValueByPath(parentObject, []string{"agentGatewayConfig"}, fromAgentGatewayConfig)
}
fromUpdateMask := genai.InternalGetValueByPath(fromObject, []string{"updateMask"})
if fromUpdateMask != nil {
genai.InternalSetValueByPath(parentObject, []string{"_query", "updateMask"}, fromUpdateMask)
}
return toObject, nil
}
func updateAgentEngineRequestParametersToVertex(fromObject map[string]any, parentObject map[string]any, rootObject map[string]any) (toObject map[string]any, err error) {
toObject = make(map[string]any)
fromName := genai.InternalGetValueByPath(fromObject, []string{"name"})
if fromName != nil {
genai.InternalSetValueByPath(toObject, []string{"_url", "name"}, fromName)
}
fromConfig := genai.InternalGetValueByPath(fromObject, []string{"config"})
if fromConfig != nil {
_, err = updateAgentEngineConfigToVertex(fromConfig.(map[string]any), toObject, rootObject)
if err != nil {
return nil, err
}
}
return toObject, nil
}
type AgentEngines struct {
apiClient *genai.InternalAPIClient
Sessions *Sessions
Sandboxes *Sandboxes
Memories *Memories
}
func (m AgentEngines) create(ctx context.Context, config *types.CreateAgentEngineConfig) (*types.AgentEngineOperation, error) {
parameterMap := make(map[string]any)
kwargs := map[string]any{"config": config}
genai.InternalDeepMarshal(kwargs, &parameterMap)
var httpOptions *genai.HTTPOptions
if config == nil || config.HTTPOptions == nil {
httpOptions = &genai.HTTPOptions{}
} else {
httpOptions = config.HTTPOptions
}
if httpOptions.Headers == nil {
httpOptions.Headers = http.Header{}
}
var response = new(types.AgentEngineOperation)
var responseMap map[string]any
var fromConverter func(map[string]any, map[string]any, map[string]any) (map[string]any, error)
var toConverter func(map[string]any, map[string]any, map[string]any) (map[string]any, error)
if m.apiClient.ClientConfig().Backend == genai.BackendVertexAI {
toConverter = createAgentEngineRequestParametersToVertex
fromConverter = agentEngineOperationFromVertex
} else {
return nil, fmt.Errorf("method Create is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode. You can choose to use Gemini Enterprise Agent Platform by setting ClientConfig.Backend to BackendEnterprise.")
}
body, err := toConverter(parameterMap, nil, parameterMap)
if err != nil {
return nil, err
}
delete(body, "config")
var path string
var urlParams map[string]any
if _, ok := body["_url"]; ok {
urlParams = body["_url"].(map[string]any)
delete(body, "_url")
}
if m.apiClient.ClientConfig().Backend == genai.BackendVertexAI {
path, err = genai.InternalFormatMap("reasoningEngines", urlParams)
} else {
path, err = genai.InternalFormatMap("None", urlParams)
}
if err != nil {
return nil, fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err)
}
if _, ok := body["_query"]; ok {
query, err := genai.InternalCreateURLQuery(body["_query"].(map[string]any))
if err != nil {
return nil, err
}
path += "?" + query
delete(body, "_query")
}
responseMap, err = genai.SendRequest(ctx, m.apiClient, path, http.MethodPost, body, httpOptions)
if err != nil {
return nil, err
}
if fromConverter != nil {
responseMap, err = fromConverter(responseMap, nil, parameterMap)
}
if err != nil {
return nil, err
}
err = genai.InternalMapToStruct(responseMap, response)
if err != nil {
return nil, err
}
if field, ok := reflect.TypeOf(response).Elem().FieldByName("SDKHTTPResponse"); ok {
{
if reflect.ValueOf(response).Elem().FieldByName("SDKHTTPResponse").IsValid() {
{
reflect.ValueOf(response).Elem().FieldByName("SDKHTTPResponse").Set(reflect.Zero(field.Type))
}
}
}
}
return response, nil
}
func (m AgentEngines) delete(ctx context.Context, name string, force *bool, config *types.DeleteAgentEngineConfig) (*types.DeleteAgentEngineOperation, error) {
parameterMap := make(map[string]any)
kwargs := map[string]any{"name": name, "force": force, "config": config}
genai.InternalDeepMarshal(kwargs, &parameterMap)
var httpOptions *genai.HTTPOptions
if config == nil || config.HTTPOptions == nil {
httpOptions = &genai.HTTPOptions{}
} else {
httpOptions = config.HTTPOptions
}
if httpOptions.Headers == nil {
httpOptions.Headers = http.Header{}
}
var response = new(types.DeleteAgentEngineOperation)
var responseMap map[string]any
var toConverter func(map[string]any, map[string]any, map[string]any) (map[string]any, error)
if m.apiClient.ClientConfig().Backend == genai.BackendVertexAI {
toConverter = deleteAgentEngineRequestParametersToVertex
} else {
return nil, fmt.Errorf("method Delete is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode. You can choose to use Gemini Enterprise Agent Platform by setting ClientConfig.Backend to BackendEnterprise.")
}
body, err := toConverter(parameterMap, nil, parameterMap)
if err != nil {
return nil, err
}
delete(body, "config")
var path string
var urlParams map[string]any
if _, ok := body["_url"]; ok {
urlParams = body["_url"].(map[string]any)
delete(body, "_url")
}
if m.apiClient.ClientConfig().Backend == genai.BackendVertexAI {
path, err = genai.InternalFormatMap("{name}", urlParams)
} else {
path, err = genai.InternalFormatMap("None", urlParams)
}
if err != nil {
return nil, fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err)
}
if _, ok := body["_query"]; ok {
query, err := genai.InternalCreateURLQuery(body["_query"].(map[string]any))
if err != nil {
return nil, err
}
path += "?" + query
delete(body, "_query")
}
responseMap, err = genai.SendRequest(ctx, m.apiClient, path, http.MethodDelete, body, httpOptions)
if err != nil {
return nil, err
}
err = genai.InternalMapToStruct(responseMap, response)
if err != nil {
return nil, err
}
if field, ok := reflect.TypeOf(response).Elem().FieldByName("SDKHTTPResponse"); ok {
{
if reflect.ValueOf(response).Elem().FieldByName("SDKHTTPResponse").IsValid() {
{
reflect.ValueOf(response).Elem().FieldByName("SDKHTTPResponse").Set(reflect.Zero(field.Type))
}
}
}
}
return response, nil
}
func (m AgentEngines) get(ctx context.Context, name string, config *types.GetAgentEngineConfig) (*types.ReasoningEngine, error) {
parameterMap := make(map[string]any)
kwargs := map[string]any{"name": name, "config": config}
genai.InternalDeepMarshal(kwargs, &parameterMap)
var httpOptions *genai.HTTPOptions
if config == nil || config.HTTPOptions == nil {
httpOptions = &genai.HTTPOptions{}
} else {
httpOptions = config.HTTPOptions
}
if httpOptions.Headers == nil {
httpOptions.Headers = http.Header{}
}
var response = new(types.ReasoningEngine)
var responseMap map[string]any
var fromConverter func(map[string]any, map[string]any, map[string]any) (map[string]any, error)
var toConverter func(map[string]any, map[string]any, map[string]any) (map[string]any, error)
if m.apiClient.ClientConfig().Backend == genai.BackendVertexAI {
toConverter = getAgentEngineRequestParametersToVertex
fromConverter = reasoningEngineFromVertex
} else {
return nil, fmt.Errorf("method Get is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode. You can choose to use Gemini Enterprise Agent Platform by setting ClientConfig.Backend to BackendEnterprise.")
}
body, err := toConverter(parameterMap, nil, parameterMap)
if err != nil {
return nil, err
}
delete(body, "config")
var path string
var urlParams map[string]any
if _, ok := body["_url"]; ok {
urlParams = body["_url"].(map[string]any)
delete(body, "_url")
}
if m.apiClient.ClientConfig().Backend == genai.BackendVertexAI {
path, err = genai.InternalFormatMap("{name}", urlParams)
} else {
path, err = genai.InternalFormatMap("None", urlParams)
}
if err != nil {
return nil, fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err)
}
if _, ok := body["_query"]; ok {
query, err := genai.InternalCreateURLQuery(body["_query"].(map[string]any))
if err != nil {
return nil, err
}
path += "?" + query
delete(body, "_query")
}
responseMap, err = genai.SendRequest(ctx, m.apiClient, path, http.MethodGet, body, httpOptions)
if err != nil {
return nil, err
}
if fromConverter != nil {
responseMap, err = fromConverter(responseMap, nil, parameterMap)
}
if err != nil {
return nil, err
}
err = genai.InternalMapToStruct(responseMap, response)
if err != nil {
return nil, err
}
if field, ok := reflect.TypeOf(response).Elem().FieldByName("SDKHTTPResponse"); ok {
{
if reflect.ValueOf(response).Elem().FieldByName("SDKHTTPResponse").IsValid() {
{
reflect.ValueOf(response).Elem().FieldByName("SDKHTTPResponse").Set(reflect.Zero(field.Type))
}
}
}
}
return response, nil
}
func (m AgentEngines) list(ctx context.Context, config *types.ListAgentEngineConfig) (*types.ListReasoningEnginesResponse, error) {
parameterMap := make(map[string]any)
kwargs := map[string]any{"config": config}
genai.InternalDeepMarshal(kwargs, &parameterMap)
var httpOptions *genai.HTTPOptions
if config == nil || config.HTTPOptions == nil {
httpOptions = &genai.HTTPOptions{}
} else {
httpOptions = config.HTTPOptions
}
if httpOptions.Headers == nil {
httpOptions.Headers = http.Header{}
}
var response = new(types.ListReasoningEnginesResponse)
var responseMap map[string]any
var fromConverter func(map[string]any, map[string]any, map[string]any) (map[string]any, error)
var toConverter func(map[string]any, map[string]any, map[string]any) (map[string]any, error)
if m.apiClient.ClientConfig().Backend == genai.BackendVertexAI {
toConverter = listAgentEngineRequestParametersToVertex
fromConverter = listReasoningEnginesResponseFromVertex
} else {
return nil, fmt.Errorf("method List is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode. You can choose to use Gemini Enterprise Agent Platform by setting ClientConfig.Backend to BackendEnterprise.")
}
body, err := toConverter(parameterMap, nil, parameterMap)
if err != nil {
return nil, err
}
delete(body, "config")
var path string
var urlParams map[string]any
if _, ok := body["_url"]; ok {
urlParams = body["_url"].(map[string]any)
delete(body, "_url")
}
if m.apiClient.ClientConfig().Backend == genai.BackendVertexAI {
path, err = genai.InternalFormatMap("reasoningEngines", urlParams)
} else {
path, err = genai.InternalFormatMap("None", urlParams)
}
if err != nil {
return nil, fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err)
}
if _, ok := body["_query"]; ok {
query, err := genai.InternalCreateURLQuery(body["_query"].(map[string]any))
if err != nil {
return nil, err
}
path += "?" + query
delete(body, "_query")
}
responseMap, err = genai.SendRequest(ctx, m.apiClient, path, http.MethodGet, body, httpOptions)
if err != nil {
return nil, err
}
if fromConverter != nil {
responseMap, err = fromConverter(responseMap, nil, parameterMap)
}
if err != nil {
return nil, err
}
err = genai.InternalMapToStruct(responseMap, response)
if err != nil {
return nil, err
}
if field, ok := reflect.TypeOf(response).Elem().FieldByName("SDKHTTPResponse"); ok {
{
if reflect.ValueOf(response).Elem().FieldByName("SDKHTTPResponse").IsValid() {
{
reflect.ValueOf(response).Elem().FieldByName("SDKHTTPResponse").Set(reflect.Zero(field.Type))
}
}
}
}
return response, nil
}
func (m AgentEngines) getAgentOperation(ctx context.Context, operationName string, config *types.GetAgentEngineOperationConfig) (*types.AgentEngineOperation, error) {
parameterMap := make(map[string]any)
kwargs := map[string]any{"operationName": operationName, "config": config}
genai.InternalDeepMarshal(kwargs, &parameterMap)
var httpOptions *genai.HTTPOptions
if config == nil || config.HTTPOptions == nil {
httpOptions = &genai.HTTPOptions{}
} else {
httpOptions = config.HTTPOptions
}
if httpOptions.Headers == nil {
httpOptions.Headers = http.Header{}
}
var response = new(types.AgentEngineOperation)
var responseMap map[string]any
var fromConverter func(map[string]any, map[string]any, map[string]any) (map[string]any, error)
var toConverter func(map[string]any, map[string]any, map[string]any) (map[string]any, error)
if m.apiClient.ClientConfig().Backend == genai.BackendVertexAI {
toConverter = getAgentEngineOperationParametersToVertex
fromConverter = agentEngineOperationFromVertex
} else {
return nil, fmt.Errorf("method GetAgentOperation is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode. You can choose to use Gemini Enterprise Agent Platform by setting ClientConfig.Backend to BackendEnterprise.")
}
body, err := toConverter(parameterMap, nil, parameterMap)
if err != nil {
return nil, err
}
delete(body, "config")
var path string
var urlParams map[string]any
if _, ok := body["_url"]; ok {
urlParams = body["_url"].(map[string]any)
delete(body, "_url")
}
if m.apiClient.ClientConfig().Backend == genai.BackendVertexAI {
path, err = genai.InternalFormatMap("{operationName}", urlParams)
} else {
path, err = genai.InternalFormatMap("None", urlParams)
}
if err != nil {
return nil, fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err)
}
if _, ok := body["_query"]; ok {
query, err := genai.InternalCreateURLQuery(body["_query"].(map[string]any))
if err != nil {
return nil, err
}
path += "?" + query
delete(body, "_query")
}
responseMap, err = genai.SendRequest(ctx, m.apiClient, path, http.MethodGet, body, httpOptions)
if err != nil {
return nil, err
}
if fromConverter != nil {
responseMap, err = fromConverter(responseMap, nil, parameterMap)
}
if err != nil {
return nil, err
}
err = genai.InternalMapToStruct(responseMap, response)
if err != nil {
return nil, err
}
if field, ok := reflect.TypeOf(response).Elem().FieldByName("SDKHTTPResponse"); ok {
{
if reflect.ValueOf(response).Elem().FieldByName("SDKHTTPResponse").IsValid() {
{
reflect.ValueOf(response).Elem().FieldByName("SDKHTTPResponse").Set(reflect.Zero(field.Type))
}
}
}
}
return response, nil
}
func (m AgentEngines) query(ctx context.Context, name string, config *types.QueryAgentEngineConfig) (*types.QueryReasoningEngineResponse, error) {
parameterMap := make(map[string]any)
kwargs := map[string]any{"name": name, "config": config}
genai.InternalDeepMarshal(kwargs, &parameterMap)
var httpOptions *genai.HTTPOptions
if config == nil || config.HTTPOptions == nil {
httpOptions = &genai.HTTPOptions{}
} else {
httpOptions = config.HTTPOptions
}
if httpOptions.Headers == nil {
httpOptions.Headers = http.Header{}
}
var response = new(types.QueryReasoningEngineResponse)
var responseMap map[string]any
var toConverter func(map[string]any, map[string]any, map[string]any) (map[string]any, error)
if m.apiClient.ClientConfig().Backend == genai.BackendVertexAI {
toConverter = queryAgentEngineRequestParametersToVertex
} else {
return nil, fmt.Errorf("method Query is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode. You can choose to use Gemini Enterprise Agent Platform by setting ClientConfig.Backend to BackendEnterprise.")
}
body, err := toConverter(parameterMap, nil, parameterMap)
if err != nil {
return nil, err
}
delete(body, "config")
var path string
var urlParams map[string]any
if _, ok := body["_url"]; ok {
urlParams = body["_url"].(map[string]any)
delete(body, "_url")
}
if m.apiClient.ClientConfig().Backend == genai.BackendVertexAI {
path, err = genai.InternalFormatMap("{name}:query", urlParams)
} else {
path, err = genai.InternalFormatMap("None", urlParams)
}
if err != nil {
return nil, fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err)
}
if _, ok := body["_query"]; ok {
query, err := genai.InternalCreateURLQuery(body["_query"].(map[string]any))
if err != nil {
return nil, err
}
path += "?" + query
delete(body, "_query")
}
responseMap, err = genai.SendRequest(ctx, m.apiClient, path, http.MethodPost, body, httpOptions)
if err != nil {
return nil, err
}
err = genai.InternalMapToStruct(responseMap, response)
if err != nil {
return nil, err
}
if field, ok := reflect.TypeOf(response).Elem().FieldByName("SDKHTTPResponse"); ok {
{
if reflect.ValueOf(response).Elem().FieldByName("SDKHTTPResponse").IsValid() {
{
reflect.ValueOf(response).Elem().FieldByName("SDKHTTPResponse").Set(reflect.Zero(field.Type))
}
}
}
}
return response, nil
}
func (m AgentEngines) update(ctx context.Context, name string, config *types.UpdateAgentEngineConfig) (*types.AgentEngineOperation, error) {
parameterMap := make(map[string]any)
kwargs := map[string]any{"name": name, "config": config}
genai.InternalDeepMarshal(kwargs, &parameterMap)
var httpOptions *genai.HTTPOptions
if config == nil || config.HTTPOptions == nil {
httpOptions = &genai.HTTPOptions{}
} else {
httpOptions = config.HTTPOptions
}
if httpOptions.Headers == nil {
httpOptions.Headers = http.Header{}
}
var response = new(types.AgentEngineOperation)
var responseMap map[string]any
var fromConverter func(map[string]any, map[string]any, map[string]any) (map[string]any, error)
var toConverter func(map[string]any, map[string]any, map[string]any) (map[string]any, error)
if m.apiClient.ClientConfig().Backend == genai.BackendVertexAI {
toConverter = updateAgentEngineRequestParametersToVertex
fromConverter = agentEngineOperationFromVertex
} else {
return nil, fmt.Errorf("method Update is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode. You can choose to use Gemini Enterprise Agent Platform by setting ClientConfig.Backend to BackendEnterprise.")
}
body, err := toConverter(parameterMap, nil, parameterMap)
if err != nil {
return nil, err
}
delete(body, "config")
var path string
var urlParams map[string]any
if _, ok := body["_url"]; ok {
urlParams = body["_url"].(map[string]any)
delete(body, "_url")
}
if m.apiClient.ClientConfig().Backend == genai.BackendVertexAI {
path, err = genai.InternalFormatMap("{name}", urlParams)
} else {
path, err = genai.InternalFormatMap("None", urlParams)
}
if err != nil {
return nil, fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err)
}
if _, ok := body["_query"]; ok {
query, err := genai.InternalCreateURLQuery(body["_query"].(map[string]any))
if err != nil {
return nil, err
}
path += "?" + query
delete(body, "_query")
}
responseMap, err = genai.SendRequest(ctx, m.apiClient, path, http.MethodPatch, body, httpOptions)
if err != nil {
return nil, err
}
if fromConverter != nil {
responseMap, err = fromConverter(responseMap, nil, parameterMap)
}
if err != nil {
return nil, err
}
err = genai.InternalMapToStruct(responseMap, response)
if err != nil {
return nil, err
}
if field, ok := reflect.TypeOf(response).Elem().FieldByName("SDKHTTPResponse"); ok {
{
if reflect.ValueOf(response).Elem().FieldByName("SDKHTTPResponse").IsValid() {
{
reflect.ValueOf(response).Elem().FieldByName("SDKHTTPResponse").Set(reflect.Zero(field.Type))
}
}
}
}
return response, nil
}
// Create creates an agent engine based on the provided configuration and returns the operation
// object representing the creation process.
func (m AgentEngines) Create(ctx context.Context, config *types.CreateAgentEngineConfig) (*types.AgentEngineOperation, error) {
return m.create(ctx, config)
}
// Delete deletes the agent engine with the specified name and returns the operation object
// representing the deletion process.
func (m AgentEngines) Delete(ctx context.Context, name string, force *bool, config *types.DeleteAgentEngineConfig) (*types.DeleteAgentEngineOperation, error) {
return m.delete(ctx, name, force, config)
}
// Get returns the agent engine with the specified name and returns the agent engine object
// representing the get agent engine process.
func (m AgentEngines) Get(ctx context.Context, name string, config *types.GetAgentEngineConfig) (*types.ReasoningEngine, error) {
return m.get(ctx, name, config)
}
// GetAgentOperation returns the operation object representing the get agent operation process.
func (m AgentEngines) GetAgentOperation(ctx context.Context, operationName string, config *types.GetAgentEngineOperationConfig) (*types.AgentEngineOperation, error) {
return m.getAgentOperation(ctx, operationName, config)
}
// List lists the agent engines that match the provided configuration and returns the list of
// agent engines and the operation object representing the listing process.
func (m AgentEngines) List(ctx context.Context, config *types.ListAgentEngineConfig) (*types.ListReasoningEnginesResponse, error) {
return m.list(ctx, config)
}
// Query queries the agent engine with the specified name and returns the response object
// representing the query agent engine process.
func (m AgentEngines) Query(ctx context.Context, name string, config *types.QueryAgentEngineConfig) (*types.QueryReasoningEngineResponse, error) {
return m.query(ctx, name, config)
}
// Update updates the agent engine with the specified name and returns the operation object
// representing the update process.
func (m AgentEngines) Update(ctx context.Context, name string, config *types.UpdateAgentEngineConfig) (*types.AgentEngineOperation, error) {
return m.update(ctx, name, config)
}