models.go

   1// Copyright 2025 Google LLC
   2//
   3// Licensed under the Apache License, Version 2.0 (the "License");
   4// you may not use this file except in compliance with the License.
   5// You may obtain a copy of the License at
   6//
   7//      http://www.apache.org/licenses/LICENSE-2.0
   8//
   9// Unless required by applicable law or agreed to in writing, software
  10// distributed under the License is distributed on an "AS IS" BASIS,
  11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12// See the License for the specific language governing permissions and
  13// limitations under the License.
  14
  15// Code generated by the Google Gen AI SDK generator DO NOT EDIT.
  16
  17package genai
  18
  19import (
  20	"context"
  21	"fmt"
  22	"iter"
  23	"net/http"
  24)
  25
  26func partToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
  27	toObject = make(map[string]any)
  28	if getValueByPath(fromObject, []string{"videoMetadata"}) != nil {
  29		return nil, fmt.Errorf("videoMetadata parameter is not supported in Gemini API")
  30	}
  31
  32	fromThought := getValueByPath(fromObject, []string{"thought"})
  33	if fromThought != nil {
  34		setValueByPath(toObject, []string{"thought"}, fromThought)
  35	}
  36
  37	fromCodeExecutionResult := getValueByPath(fromObject, []string{"codeExecutionResult"})
  38	if fromCodeExecutionResult != nil {
  39		setValueByPath(toObject, []string{"codeExecutionResult"}, fromCodeExecutionResult)
  40	}
  41
  42	fromExecutableCode := getValueByPath(fromObject, []string{"executableCode"})
  43	if fromExecutableCode != nil {
  44		setValueByPath(toObject, []string{"executableCode"}, fromExecutableCode)
  45	}
  46
  47	fromFileData := getValueByPath(fromObject, []string{"fileData"})
  48	if fromFileData != nil {
  49		setValueByPath(toObject, []string{"fileData"}, fromFileData)
  50	}
  51
  52	fromFunctionCall := getValueByPath(fromObject, []string{"functionCall"})
  53	if fromFunctionCall != nil {
  54		setValueByPath(toObject, []string{"functionCall"}, fromFunctionCall)
  55	}
  56
  57	fromFunctionResponse := getValueByPath(fromObject, []string{"functionResponse"})
  58	if fromFunctionResponse != nil {
  59		setValueByPath(toObject, []string{"functionResponse"}, fromFunctionResponse)
  60	}
  61
  62	fromInlineData := getValueByPath(fromObject, []string{"inlineData"})
  63	if fromInlineData != nil {
  64		setValueByPath(toObject, []string{"inlineData"}, fromInlineData)
  65	}
  66
  67	fromText := getValueByPath(fromObject, []string{"text"})
  68	if fromText != nil {
  69		setValueByPath(toObject, []string{"text"}, fromText)
  70	}
  71
  72	return toObject, nil
  73}
  74
  75func contentToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
  76	toObject = make(map[string]any)
  77
  78	fromParts := getValueByPath(fromObject, []string{"parts"})
  79	if fromParts != nil {
  80		fromParts, err = applyConverterToSlice(ac, fromParts.([]any), partToMldev)
  81		if err != nil {
  82			return nil, err
  83		}
  84
  85		setValueByPath(toObject, []string{"parts"}, fromParts)
  86	}
  87
  88	fromRole := getValueByPath(fromObject, []string{"role"})
  89	if fromRole != nil {
  90		setValueByPath(toObject, []string{"role"}, fromRole)
  91	}
  92
  93	return toObject, nil
  94}
  95
  96func modelSelectionConfigToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
  97	toObject = make(map[string]any)
  98	if getValueByPath(fromObject, []string{"featureSelectionPreference"}) != nil {
  99		return nil, fmt.Errorf("featureSelectionPreference parameter is not supported in Gemini API")
 100	}
 101
 102	return toObject, nil
 103}
 104
 105func safetySettingToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 106	toObject = make(map[string]any)
 107	if getValueByPath(fromObject, []string{"method"}) != nil {
 108		return nil, fmt.Errorf("method parameter is not supported in Gemini API")
 109	}
 110
 111	fromCategory := getValueByPath(fromObject, []string{"category"})
 112	if fromCategory != nil {
 113		setValueByPath(toObject, []string{"category"}, fromCategory)
 114	}
 115
 116	fromThreshold := getValueByPath(fromObject, []string{"threshold"})
 117	if fromThreshold != nil {
 118		setValueByPath(toObject, []string{"threshold"}, fromThreshold)
 119	}
 120
 121	return toObject, nil
 122}
 123
 124func googleSearchToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 125	toObject = make(map[string]any)
 126
 127	return toObject, nil
 128}
 129
 130func dynamicRetrievalConfigToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 131	toObject = make(map[string]any)
 132
 133	fromMode := getValueByPath(fromObject, []string{"mode"})
 134	if fromMode != nil {
 135		setValueByPath(toObject, []string{"mode"}, fromMode)
 136	}
 137
 138	fromDynamicThreshold := getValueByPath(fromObject, []string{"dynamicThreshold"})
 139	if fromDynamicThreshold != nil {
 140		setValueByPath(toObject, []string{"dynamicThreshold"}, fromDynamicThreshold)
 141	}
 142
 143	return toObject, nil
 144}
 145
 146func googleSearchRetrievalToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 147	toObject = make(map[string]any)
 148
 149	fromDynamicRetrievalConfig := getValueByPath(fromObject, []string{"dynamicRetrievalConfig"})
 150	if fromDynamicRetrievalConfig != nil {
 151		fromDynamicRetrievalConfig, err = dynamicRetrievalConfigToMldev(ac, fromDynamicRetrievalConfig.(map[string]any), toObject)
 152		if err != nil {
 153			return nil, err
 154		}
 155
 156		setValueByPath(toObject, []string{"dynamicRetrievalConfig"}, fromDynamicRetrievalConfig)
 157	}
 158
 159	return toObject, nil
 160}
 161
 162func toolToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 163	toObject = make(map[string]any)
 164	if getValueByPath(fromObject, []string{"retrieval"}) != nil {
 165		return nil, fmt.Errorf("retrieval parameter is not supported in Gemini API")
 166	}
 167
 168	fromGoogleSearch := getValueByPath(fromObject, []string{"googleSearch"})
 169	if fromGoogleSearch != nil {
 170		fromGoogleSearch, err = googleSearchToMldev(ac, fromGoogleSearch.(map[string]any), toObject)
 171		if err != nil {
 172			return nil, err
 173		}
 174
 175		setValueByPath(toObject, []string{"googleSearch"}, fromGoogleSearch)
 176	}
 177
 178	fromGoogleSearchRetrieval := getValueByPath(fromObject, []string{"googleSearchRetrieval"})
 179	if fromGoogleSearchRetrieval != nil {
 180		fromGoogleSearchRetrieval, err = googleSearchRetrievalToMldev(ac, fromGoogleSearchRetrieval.(map[string]any), toObject)
 181		if err != nil {
 182			return nil, err
 183		}
 184
 185		setValueByPath(toObject, []string{"googleSearchRetrieval"}, fromGoogleSearchRetrieval)
 186	}
 187
 188	fromCodeExecution := getValueByPath(fromObject, []string{"codeExecution"})
 189	if fromCodeExecution != nil {
 190		setValueByPath(toObject, []string{"codeExecution"}, fromCodeExecution)
 191	}
 192
 193	fromFunctionDeclarations := getValueByPath(fromObject, []string{"functionDeclarations"})
 194	if fromFunctionDeclarations != nil {
 195		setValueByPath(toObject, []string{"functionDeclarations"}, fromFunctionDeclarations)
 196	}
 197
 198	return toObject, nil
 199}
 200
 201func functionCallingConfigToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 202	toObject = make(map[string]any)
 203
 204	fromMode := getValueByPath(fromObject, []string{"mode"})
 205	if fromMode != nil {
 206		setValueByPath(toObject, []string{"mode"}, fromMode)
 207	}
 208
 209	fromAllowedFunctionNames := getValueByPath(fromObject, []string{"allowedFunctionNames"})
 210	if fromAllowedFunctionNames != nil {
 211		setValueByPath(toObject, []string{"allowedFunctionNames"}, fromAllowedFunctionNames)
 212	}
 213
 214	return toObject, nil
 215}
 216
 217func toolConfigToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 218	toObject = make(map[string]any)
 219
 220	fromFunctionCallingConfig := getValueByPath(fromObject, []string{"functionCallingConfig"})
 221	if fromFunctionCallingConfig != nil {
 222		fromFunctionCallingConfig, err = functionCallingConfigToMldev(ac, fromFunctionCallingConfig.(map[string]any), toObject)
 223		if err != nil {
 224			return nil, err
 225		}
 226
 227		setValueByPath(toObject, []string{"functionCallingConfig"}, fromFunctionCallingConfig)
 228	}
 229
 230	return toObject, nil
 231}
 232
 233func prebuiltVoiceConfigToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 234	toObject = make(map[string]any)
 235
 236	fromVoiceName := getValueByPath(fromObject, []string{"voiceName"})
 237	if fromVoiceName != nil {
 238		setValueByPath(toObject, []string{"voiceName"}, fromVoiceName)
 239	}
 240
 241	return toObject, nil
 242}
 243
 244func voiceConfigToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 245	toObject = make(map[string]any)
 246
 247	fromPrebuiltVoiceConfig := getValueByPath(fromObject, []string{"prebuiltVoiceConfig"})
 248	if fromPrebuiltVoiceConfig != nil {
 249		fromPrebuiltVoiceConfig, err = prebuiltVoiceConfigToMldev(ac, fromPrebuiltVoiceConfig.(map[string]any), toObject)
 250		if err != nil {
 251			return nil, err
 252		}
 253
 254		setValueByPath(toObject, []string{"prebuiltVoiceConfig"}, fromPrebuiltVoiceConfig)
 255	}
 256
 257	return toObject, nil
 258}
 259
 260func speechConfigToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 261	toObject = make(map[string]any)
 262
 263	fromVoiceConfig := getValueByPath(fromObject, []string{"voiceConfig"})
 264	if fromVoiceConfig != nil {
 265		fromVoiceConfig, err = voiceConfigToMldev(ac, fromVoiceConfig.(map[string]any), toObject)
 266		if err != nil {
 267			return nil, err
 268		}
 269
 270		setValueByPath(toObject, []string{"voiceConfig"}, fromVoiceConfig)
 271	}
 272
 273	fromLanguageCode := getValueByPath(fromObject, []string{"languageCode"})
 274	if fromLanguageCode != nil {
 275		setValueByPath(toObject, []string{"languageCode"}, fromLanguageCode)
 276	}
 277
 278	return toObject, nil
 279}
 280
 281func thinkingConfigToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 282	toObject = make(map[string]any)
 283
 284	fromIncludeThoughts := getValueByPath(fromObject, []string{"includeThoughts"})
 285	if fromIncludeThoughts != nil {
 286		setValueByPath(toObject, []string{"includeThoughts"}, fromIncludeThoughts)
 287	}
 288
 289	fromThinkingBudget := getValueByPath(fromObject, []string{"thinkingBudget"})
 290	if fromThinkingBudget != nil {
 291		setValueByPath(toObject, []string{"thinkingBudget"}, fromThinkingBudget)
 292	}
 293
 294	return toObject, nil
 295}
 296
 297func generateContentConfigToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 298	toObject = make(map[string]any)
 299
 300	fromSystemInstruction := getValueByPath(fromObject, []string{"systemInstruction"})
 301	if fromSystemInstruction != nil {
 302		fromSystemInstruction, err = tContent(ac, fromSystemInstruction)
 303		if err != nil {
 304			return nil, err
 305		}
 306
 307		fromSystemInstruction, err = contentToMldev(ac, fromSystemInstruction.(map[string]any), toObject)
 308		if err != nil {
 309			return nil, err
 310		}
 311
 312		setValueByPath(parentObject, []string{"systemInstruction"}, fromSystemInstruction)
 313	}
 314
 315	fromTemperature := getValueByPath(fromObject, []string{"temperature"})
 316	if fromTemperature != nil {
 317		setValueByPath(toObject, []string{"temperature"}, fromTemperature)
 318	}
 319
 320	fromTopP := getValueByPath(fromObject, []string{"topP"})
 321	if fromTopP != nil {
 322		setValueByPath(toObject, []string{"topP"}, fromTopP)
 323	}
 324
 325	fromTopK := getValueByPath(fromObject, []string{"topK"})
 326	if fromTopK != nil {
 327		setValueByPath(toObject, []string{"topK"}, fromTopK)
 328	}
 329
 330	fromCandidateCount := getValueByPath(fromObject, []string{"candidateCount"})
 331	if fromCandidateCount != nil {
 332		setValueByPath(toObject, []string{"candidateCount"}, fromCandidateCount)
 333	}
 334
 335	fromMaxOutputTokens := getValueByPath(fromObject, []string{"maxOutputTokens"})
 336	if fromMaxOutputTokens != nil {
 337		setValueByPath(toObject, []string{"maxOutputTokens"}, fromMaxOutputTokens)
 338	}
 339
 340	fromStopSequences := getValueByPath(fromObject, []string{"stopSequences"})
 341	if fromStopSequences != nil {
 342		setValueByPath(toObject, []string{"stopSequences"}, fromStopSequences)
 343	}
 344
 345	fromResponseLogprobs := getValueByPath(fromObject, []string{"responseLogprobs"})
 346	if fromResponseLogprobs != nil {
 347		setValueByPath(toObject, []string{"responseLogprobs"}, fromResponseLogprobs)
 348	}
 349
 350	fromLogprobs := getValueByPath(fromObject, []string{"logprobs"})
 351	if fromLogprobs != nil {
 352		setValueByPath(toObject, []string{"logprobs"}, fromLogprobs)
 353	}
 354
 355	fromPresencePenalty := getValueByPath(fromObject, []string{"presencePenalty"})
 356	if fromPresencePenalty != nil {
 357		setValueByPath(toObject, []string{"presencePenalty"}, fromPresencePenalty)
 358	}
 359
 360	fromFrequencyPenalty := getValueByPath(fromObject, []string{"frequencyPenalty"})
 361	if fromFrequencyPenalty != nil {
 362		setValueByPath(toObject, []string{"frequencyPenalty"}, fromFrequencyPenalty)
 363	}
 364
 365	fromSeed := getValueByPath(fromObject, []string{"seed"})
 366	if fromSeed != nil {
 367		setValueByPath(toObject, []string{"seed"}, fromSeed)
 368	}
 369
 370	fromResponseMimeType := getValueByPath(fromObject, []string{"responseMimeType"})
 371	if fromResponseMimeType != nil {
 372		setValueByPath(toObject, []string{"responseMimeType"}, fromResponseMimeType)
 373	}
 374
 375	fromResponseSchema := getValueByPath(fromObject, []string{"responseSchema"})
 376	if fromResponseSchema != nil {
 377		fromResponseSchema, err = tSchema(ac, fromResponseSchema)
 378		if err != nil {
 379			return nil, err
 380		}
 381
 382		setValueByPath(toObject, []string{"responseSchema"}, fromResponseSchema)
 383	}
 384
 385	if getValueByPath(fromObject, []string{"routingConfig"}) != nil {
 386		return nil, fmt.Errorf("routingConfig parameter is not supported in Gemini API")
 387	}
 388
 389	if getValueByPath(fromObject, []string{"modelSelectionConfig"}) != nil {
 390		return nil, fmt.Errorf("modelSelectionConfig parameter is not supported in Gemini API")
 391	}
 392
 393	fromSafetySettings := getValueByPath(fromObject, []string{"safetySettings"})
 394	if fromSafetySettings != nil {
 395		fromSafetySettings, err = applyConverterToSlice(ac, fromSafetySettings.([]any), safetySettingToMldev)
 396		if err != nil {
 397			return nil, err
 398		}
 399
 400		setValueByPath(parentObject, []string{"safetySettings"}, fromSafetySettings)
 401	}
 402
 403	fromTools := getValueByPath(fromObject, []string{"tools"})
 404	if fromTools != nil {
 405		fromTools, err = applyItemTransformerToSlice(ac, fromTools.([]any), tTool)
 406		if err != nil {
 407			return nil, err
 408		}
 409
 410		fromTools, err = tTools(ac, fromTools)
 411		if err != nil {
 412			return nil, err
 413		}
 414
 415		fromTools, err = applyConverterToSlice(ac, fromTools.([]any), toolToMldev)
 416		if err != nil {
 417			return nil, err
 418		}
 419
 420		setValueByPath(parentObject, []string{"tools"}, fromTools)
 421	}
 422
 423	fromToolConfig := getValueByPath(fromObject, []string{"toolConfig"})
 424	if fromToolConfig != nil {
 425		fromToolConfig, err = toolConfigToMldev(ac, fromToolConfig.(map[string]any), toObject)
 426		if err != nil {
 427			return nil, err
 428		}
 429
 430		setValueByPath(parentObject, []string{"toolConfig"}, fromToolConfig)
 431	}
 432
 433	if getValueByPath(fromObject, []string{"labels"}) != nil {
 434		return nil, fmt.Errorf("labels parameter is not supported in Gemini API")
 435	}
 436
 437	fromCachedContent := getValueByPath(fromObject, []string{"cachedContent"})
 438	if fromCachedContent != nil {
 439		fromCachedContent, err = tCachedContentName(ac, fromCachedContent)
 440		if err != nil {
 441			return nil, err
 442		}
 443
 444		setValueByPath(parentObject, []string{"cachedContent"}, fromCachedContent)
 445	}
 446
 447	fromResponseModalities := getValueByPath(fromObject, []string{"responseModalities"})
 448	if fromResponseModalities != nil {
 449		setValueByPath(toObject, []string{"responseModalities"}, fromResponseModalities)
 450	}
 451
 452	fromMediaResolution := getValueByPath(fromObject, []string{"mediaResolution"})
 453	if fromMediaResolution != nil {
 454		setValueByPath(toObject, []string{"mediaResolution"}, fromMediaResolution)
 455	}
 456
 457	fromSpeechConfig := getValueByPath(fromObject, []string{"speechConfig"})
 458	if fromSpeechConfig != nil {
 459		fromSpeechConfig, err = tSpeechConfig(ac, fromSpeechConfig)
 460		if err != nil {
 461			return nil, err
 462		}
 463
 464		fromSpeechConfig, err = speechConfigToMldev(ac, fromSpeechConfig.(map[string]any), toObject)
 465		if err != nil {
 466			return nil, err
 467		}
 468
 469		setValueByPath(toObject, []string{"speechConfig"}, fromSpeechConfig)
 470	}
 471
 472	if getValueByPath(fromObject, []string{"audioTimestamp"}) != nil {
 473		return nil, fmt.Errorf("audioTimestamp parameter is not supported in Gemini API")
 474	}
 475
 476	fromThinkingConfig := getValueByPath(fromObject, []string{"thinkingConfig"})
 477	if fromThinkingConfig != nil {
 478		fromThinkingConfig, err = thinkingConfigToMldev(ac, fromThinkingConfig.(map[string]any), toObject)
 479		if err != nil {
 480			return nil, err
 481		}
 482
 483		setValueByPath(toObject, []string{"thinkingConfig"}, fromThinkingConfig)
 484	}
 485
 486	return toObject, nil
 487}
 488
 489func generateContentParametersToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 490	toObject = make(map[string]any)
 491
 492	fromModel := getValueByPath(fromObject, []string{"model"})
 493	if fromModel != nil {
 494		fromModel, err = tModel(ac, fromModel)
 495		if err != nil {
 496			return nil, err
 497		}
 498
 499		setValueByPath(toObject, []string{"_url", "model"}, fromModel)
 500	}
 501
 502	fromContents := getValueByPath(fromObject, []string{"contents"})
 503	if fromContents != nil {
 504		fromContents, err = tContents(ac, fromContents)
 505		if err != nil {
 506			return nil, err
 507		}
 508
 509		fromContents, err = applyConverterToSlice(ac, fromContents.([]any), contentToMldev)
 510		if err != nil {
 511			return nil, err
 512		}
 513
 514		setValueByPath(toObject, []string{"contents"}, fromContents)
 515	}
 516
 517	fromConfig := getValueByPath(fromObject, []string{"config"})
 518	if fromConfig != nil {
 519		fromConfig, err = generateContentConfigToMldev(ac, fromConfig.(map[string]any), toObject)
 520		if err != nil {
 521			return nil, err
 522		}
 523
 524		setValueByPath(toObject, []string{"generationConfig"}, fromConfig)
 525	}
 526
 527	return toObject, nil
 528}
 529
 530func embedContentConfigToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 531	toObject = make(map[string]any)
 532
 533	fromTaskType := getValueByPath(fromObject, []string{"taskType"})
 534	if fromTaskType != nil {
 535		setValueByPath(parentObject, []string{"requests[]", "taskType"}, fromTaskType)
 536	}
 537
 538	fromTitle := getValueByPath(fromObject, []string{"title"})
 539	if fromTitle != nil {
 540		setValueByPath(parentObject, []string{"requests[]", "title"}, fromTitle)
 541	}
 542
 543	fromOutputDimensionality := getValueByPath(fromObject, []string{"outputDimensionality"})
 544	if fromOutputDimensionality != nil {
 545		setValueByPath(parentObject, []string{"requests[]", "outputDimensionality"}, fromOutputDimensionality)
 546	}
 547
 548	if getValueByPath(fromObject, []string{"mimeType"}) != nil {
 549		return nil, fmt.Errorf("mimeType parameter is not supported in Gemini API")
 550	}
 551
 552	if getValueByPath(fromObject, []string{"autoTruncate"}) != nil {
 553		return nil, fmt.Errorf("autoTruncate parameter is not supported in Gemini API")
 554	}
 555
 556	return toObject, nil
 557}
 558
 559func embedContentParametersToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 560	toObject = make(map[string]any)
 561
 562	fromModel := getValueByPath(fromObject, []string{"model"})
 563	if fromModel != nil {
 564		fromModel, err = tModel(ac, fromModel)
 565		if err != nil {
 566			return nil, err
 567		}
 568
 569		setValueByPath(toObject, []string{"_url", "model"}, fromModel)
 570	}
 571
 572	fromContents := getValueByPath(fromObject, []string{"contents"})
 573	if fromContents != nil {
 574		fromContents, err = tContentsForEmbed(ac, fromContents)
 575		if err != nil {
 576			return nil, err
 577		}
 578
 579		setValueByPath(toObject, []string{"requests[]", "content"}, fromContents)
 580	}
 581
 582	fromConfig := getValueByPath(fromObject, []string{"config"})
 583	if fromConfig != nil {
 584		fromConfig, err = embedContentConfigToMldev(ac, fromConfig.(map[string]any), toObject)
 585		if err != nil {
 586			return nil, err
 587		}
 588
 589		setValueByPath(toObject, []string{"config"}, fromConfig)
 590	}
 591
 592	setValueByPath(toObject, []string{"requests[]", "model"}, fromModel)
 593
 594	return toObject, nil
 595}
 596
 597func generateImagesConfigToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 598	toObject = make(map[string]any)
 599
 600	if getValueByPath(fromObject, []string{"outputGcsUri"}) != nil {
 601		return nil, fmt.Errorf("outputGcsUri parameter is not supported in Gemini API")
 602	}
 603
 604	if getValueByPath(fromObject, []string{"negativePrompt"}) != nil {
 605		return nil, fmt.Errorf("negativePrompt parameter is not supported in Gemini API")
 606	}
 607
 608	fromNumberOfImages := getValueByPath(fromObject, []string{"numberOfImages"})
 609	if fromNumberOfImages != nil {
 610		setValueByPath(parentObject, []string{"parameters", "sampleCount"}, fromNumberOfImages)
 611	}
 612
 613	fromAspectRatio := getValueByPath(fromObject, []string{"aspectRatio"})
 614	if fromAspectRatio != nil {
 615		setValueByPath(parentObject, []string{"parameters", "aspectRatio"}, fromAspectRatio)
 616	}
 617
 618	fromGuidanceScale := getValueByPath(fromObject, []string{"guidanceScale"})
 619	if fromGuidanceScale != nil {
 620		setValueByPath(parentObject, []string{"parameters", "guidanceScale"}, fromGuidanceScale)
 621	}
 622
 623	if getValueByPath(fromObject, []string{"seed"}) != nil {
 624		return nil, fmt.Errorf("seed parameter is not supported in Gemini API")
 625	}
 626
 627	fromSafetyFilterLevel := getValueByPath(fromObject, []string{"safetyFilterLevel"})
 628	if fromSafetyFilterLevel != nil {
 629		setValueByPath(parentObject, []string{"parameters", "safetySetting"}, fromSafetyFilterLevel)
 630	}
 631
 632	fromPersonGeneration := getValueByPath(fromObject, []string{"personGeneration"})
 633	if fromPersonGeneration != nil {
 634		setValueByPath(parentObject, []string{"parameters", "personGeneration"}, fromPersonGeneration)
 635	}
 636
 637	fromIncludeSafetyAttributes := getValueByPath(fromObject, []string{"includeSafetyAttributes"})
 638	if fromIncludeSafetyAttributes != nil {
 639		setValueByPath(parentObject, []string{"parameters", "includeSafetyAttributes"}, fromIncludeSafetyAttributes)
 640	}
 641
 642	fromIncludeRaiReason := getValueByPath(fromObject, []string{"includeRaiReason"})
 643	if fromIncludeRaiReason != nil {
 644		setValueByPath(parentObject, []string{"parameters", "includeRaiReason"}, fromIncludeRaiReason)
 645	}
 646
 647	fromLanguage := getValueByPath(fromObject, []string{"language"})
 648	if fromLanguage != nil {
 649		setValueByPath(parentObject, []string{"parameters", "language"}, fromLanguage)
 650	}
 651
 652	fromOutputMimeType := getValueByPath(fromObject, []string{"outputMimeType"})
 653	if fromOutputMimeType != nil {
 654		setValueByPath(parentObject, []string{"parameters", "outputOptions", "mimeType"}, fromOutputMimeType)
 655	}
 656
 657	fromOutputCompressionQuality := getValueByPath(fromObject, []string{"outputCompressionQuality"})
 658	if fromOutputCompressionQuality != nil {
 659		setValueByPath(parentObject, []string{"parameters", "outputOptions", "compressionQuality"}, fromOutputCompressionQuality)
 660	}
 661
 662	if getValueByPath(fromObject, []string{"addWatermark"}) != nil {
 663		return nil, fmt.Errorf("addWatermark parameter is not supported in Gemini API")
 664	}
 665
 666	if getValueByPath(fromObject, []string{"enhancePrompt"}) != nil {
 667		return nil, fmt.Errorf("enhancePrompt parameter is not supported in Gemini API")
 668	}
 669
 670	return toObject, nil
 671}
 672
 673func generateImagesParametersToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 674	toObject = make(map[string]any)
 675
 676	fromModel := getValueByPath(fromObject, []string{"model"})
 677	if fromModel != nil {
 678		fromModel, err = tModel(ac, fromModel)
 679		if err != nil {
 680			return nil, err
 681		}
 682
 683		setValueByPath(toObject, []string{"_url", "model"}, fromModel)
 684	}
 685
 686	fromPrompt := getValueByPath(fromObject, []string{"prompt"})
 687	if fromPrompt != nil {
 688		setValueByPath(toObject, []string{"instances[0]", "prompt"}, fromPrompt)
 689	}
 690
 691	fromConfig := getValueByPath(fromObject, []string{"config"})
 692	if fromConfig != nil {
 693		fromConfig, err = generateImagesConfigToMldev(ac, fromConfig.(map[string]any), toObject)
 694		if err != nil {
 695			return nil, err
 696		}
 697
 698		setValueByPath(toObject, []string{"config"}, fromConfig)
 699	}
 700
 701	return toObject, nil
 702}
 703
 704func getModelParametersToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 705	toObject = make(map[string]any)
 706
 707	fromModel := getValueByPath(fromObject, []string{"model"})
 708	if fromModel != nil {
 709		fromModel, err = tModel(ac, fromModel)
 710		if err != nil {
 711			return nil, err
 712		}
 713
 714		setValueByPath(toObject, []string{"_url", "name"}, fromModel)
 715	}
 716
 717	fromConfig := getValueByPath(fromObject, []string{"config"})
 718	if fromConfig != nil {
 719		setValueByPath(toObject, []string{"config"}, fromConfig)
 720	}
 721
 722	return toObject, nil
 723}
 724
 725func listModelsConfigToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 726	toObject = make(map[string]any)
 727
 728	fromPageSize := getValueByPath(fromObject, []string{"pageSize"})
 729	if fromPageSize != nil {
 730		setValueByPath(parentObject, []string{"_query", "pageSize"}, fromPageSize)
 731	}
 732
 733	fromPageToken := getValueByPath(fromObject, []string{"pageToken"})
 734	if fromPageToken != nil {
 735		setValueByPath(parentObject, []string{"_query", "pageToken"}, fromPageToken)
 736	}
 737
 738	fromFilter := getValueByPath(fromObject, []string{"filter"})
 739	if fromFilter != nil {
 740		setValueByPath(parentObject, []string{"_query", "filter"}, fromFilter)
 741	}
 742
 743	fromQueryBase := getValueByPath(fromObject, []string{"queryBase"})
 744	if fromQueryBase != nil {
 745		fromQueryBase, err = tModelsURL(ac, fromQueryBase)
 746		if err != nil {
 747			return nil, err
 748		}
 749
 750		setValueByPath(parentObject, []string{"_url", "models_url"}, fromQueryBase)
 751	}
 752
 753	return toObject, nil
 754}
 755
 756func listModelsParametersToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 757	toObject = make(map[string]any)
 758
 759	fromConfig := getValueByPath(fromObject, []string{"config"})
 760	if fromConfig != nil {
 761		fromConfig, err = listModelsConfigToMldev(ac, fromConfig.(map[string]any), toObject)
 762		if err != nil {
 763			return nil, err
 764		}
 765
 766		setValueByPath(toObject, []string{"config"}, fromConfig)
 767	}
 768
 769	return toObject, nil
 770}
 771
 772func updateModelConfigToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 773	toObject = make(map[string]any)
 774
 775	fromDisplayName := getValueByPath(fromObject, []string{"displayName"})
 776	if fromDisplayName != nil {
 777		setValueByPath(parentObject, []string{"displayName"}, fromDisplayName)
 778	}
 779
 780	fromDescription := getValueByPath(fromObject, []string{"description"})
 781	if fromDescription != nil {
 782		setValueByPath(parentObject, []string{"description"}, fromDescription)
 783	}
 784
 785	return toObject, nil
 786}
 787
 788func updateModelParametersToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 789	toObject = make(map[string]any)
 790
 791	fromModel := getValueByPath(fromObject, []string{"model"})
 792	if fromModel != nil {
 793		fromModel, err = tModel(ac, fromModel)
 794		if err != nil {
 795			return nil, err
 796		}
 797
 798		setValueByPath(toObject, []string{"_url", "name"}, fromModel)
 799	}
 800
 801	fromConfig := getValueByPath(fromObject, []string{"config"})
 802	if fromConfig != nil {
 803		fromConfig, err = updateModelConfigToMldev(ac, fromConfig.(map[string]any), toObject)
 804		if err != nil {
 805			return nil, err
 806		}
 807
 808		setValueByPath(toObject, []string{"config"}, fromConfig)
 809	}
 810
 811	return toObject, nil
 812}
 813
 814func deleteModelParametersToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 815	toObject = make(map[string]any)
 816
 817	fromModel := getValueByPath(fromObject, []string{"model"})
 818	if fromModel != nil {
 819		fromModel, err = tModel(ac, fromModel)
 820		if err != nil {
 821			return nil, err
 822		}
 823
 824		setValueByPath(toObject, []string{"_url", "name"}, fromModel)
 825	}
 826
 827	fromConfig := getValueByPath(fromObject, []string{"config"})
 828	if fromConfig != nil {
 829		setValueByPath(toObject, []string{"config"}, fromConfig)
 830	}
 831
 832	return toObject, nil
 833}
 834
 835func countTokensConfigToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 836	toObject = make(map[string]any)
 837
 838	if getValueByPath(fromObject, []string{"systemInstruction"}) != nil {
 839		return nil, fmt.Errorf("systemInstruction parameter is not supported in Gemini API")
 840	}
 841
 842	if getValueByPath(fromObject, []string{"tools"}) != nil {
 843		return nil, fmt.Errorf("tools parameter is not supported in Gemini API")
 844	}
 845
 846	if getValueByPath(fromObject, []string{"generationConfig"}) != nil {
 847		return nil, fmt.Errorf("generationConfig parameter is not supported in Gemini API")
 848	}
 849
 850	return toObject, nil
 851}
 852
 853func countTokensParametersToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 854	toObject = make(map[string]any)
 855
 856	fromModel := getValueByPath(fromObject, []string{"model"})
 857	if fromModel != nil {
 858		fromModel, err = tModel(ac, fromModel)
 859		if err != nil {
 860			return nil, err
 861		}
 862
 863		setValueByPath(toObject, []string{"_url", "model"}, fromModel)
 864	}
 865
 866	fromContents := getValueByPath(fromObject, []string{"contents"})
 867	if fromContents != nil {
 868		fromContents, err = tContents(ac, fromContents)
 869		if err != nil {
 870			return nil, err
 871		}
 872
 873		fromContents, err = applyConverterToSlice(ac, fromContents.([]any), contentToMldev)
 874		if err != nil {
 875			return nil, err
 876		}
 877
 878		setValueByPath(toObject, []string{"contents"}, fromContents)
 879	}
 880
 881	fromConfig := getValueByPath(fromObject, []string{"config"})
 882	if fromConfig != nil {
 883		fromConfig, err = countTokensConfigToMldev(ac, fromConfig.(map[string]any), toObject)
 884		if err != nil {
 885			return nil, err
 886		}
 887
 888		setValueByPath(toObject, []string{"config"}, fromConfig)
 889	}
 890
 891	return toObject, nil
 892}
 893
 894func imageToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 895	toObject = make(map[string]any)
 896	if getValueByPath(fromObject, []string{"gcsUri"}) != nil {
 897		return nil, fmt.Errorf("gcsUri parameter is not supported in Gemini API")
 898	}
 899
 900	fromImageBytes := getValueByPath(fromObject, []string{"imageBytes"})
 901	if fromImageBytes != nil {
 902		fromImageBytes, err = tBytes(ac, fromImageBytes)
 903		if err != nil {
 904			return nil, err
 905		}
 906
 907		setValueByPath(toObject, []string{"bytesBase64Encoded"}, fromImageBytes)
 908	}
 909
 910	fromMimeType := getValueByPath(fromObject, []string{"mimeType"})
 911	if fromMimeType != nil {
 912		setValueByPath(toObject, []string{"mimeType"}, fromMimeType)
 913	}
 914
 915	return toObject, nil
 916}
 917
 918func generateVideosConfigToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 919	toObject = make(map[string]any)
 920
 921	fromNumberOfVideos := getValueByPath(fromObject, []string{"numberOfVideos"})
 922	if fromNumberOfVideos != nil {
 923		setValueByPath(parentObject, []string{"parameters", "sampleCount"}, fromNumberOfVideos)
 924	}
 925
 926	if getValueByPath(fromObject, []string{"outputGcsUri"}) != nil {
 927		return nil, fmt.Errorf("outputGcsUri parameter is not supported in Gemini API")
 928	}
 929
 930	if getValueByPath(fromObject, []string{"fps"}) != nil {
 931		return nil, fmt.Errorf("fps parameter is not supported in Gemini API")
 932	}
 933
 934	fromDurationSeconds := getValueByPath(fromObject, []string{"durationSeconds"})
 935	if fromDurationSeconds != nil {
 936		setValueByPath(parentObject, []string{"parameters", "durationSeconds"}, fromDurationSeconds)
 937	}
 938
 939	if getValueByPath(fromObject, []string{"seed"}) != nil {
 940		return nil, fmt.Errorf("seed parameter is not supported in Gemini API")
 941	}
 942
 943	fromAspectRatio := getValueByPath(fromObject, []string{"aspectRatio"})
 944	if fromAspectRatio != nil {
 945		setValueByPath(parentObject, []string{"parameters", "aspectRatio"}, fromAspectRatio)
 946	}
 947
 948	if getValueByPath(fromObject, []string{"resolution"}) != nil {
 949		return nil, fmt.Errorf("resolution parameter is not supported in Gemini API")
 950	}
 951
 952	fromPersonGeneration := getValueByPath(fromObject, []string{"personGeneration"})
 953	if fromPersonGeneration != nil {
 954		setValueByPath(parentObject, []string{"parameters", "personGeneration"}, fromPersonGeneration)
 955	}
 956
 957	if getValueByPath(fromObject, []string{"pubsubTopic"}) != nil {
 958		return nil, fmt.Errorf("pubsubTopic parameter is not supported in Gemini API")
 959	}
 960
 961	fromNegativePrompt := getValueByPath(fromObject, []string{"negativePrompt"})
 962	if fromNegativePrompt != nil {
 963		setValueByPath(parentObject, []string{"parameters", "negativePrompt"}, fromNegativePrompt)
 964	}
 965
 966	if getValueByPath(fromObject, []string{"enhancePrompt"}) != nil {
 967		return nil, fmt.Errorf("enhancePrompt parameter is not supported in Gemini API")
 968	}
 969
 970	return toObject, nil
 971}
 972
 973func generateVideosParametersToMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
 974	toObject = make(map[string]any)
 975
 976	fromModel := getValueByPath(fromObject, []string{"model"})
 977	if fromModel != nil {
 978		fromModel, err = tModel(ac, fromModel)
 979		if err != nil {
 980			return nil, err
 981		}
 982
 983		setValueByPath(toObject, []string{"_url", "model"}, fromModel)
 984	}
 985
 986	fromPrompt := getValueByPath(fromObject, []string{"prompt"})
 987	if fromPrompt != nil {
 988		setValueByPath(toObject, []string{"instances[0]", "prompt"}, fromPrompt)
 989	}
 990
 991	fromImage := getValueByPath(fromObject, []string{"image"})
 992	if fromImage != nil {
 993		fromImage, err = imageToMldev(ac, fromImage.(map[string]any), toObject)
 994		if err != nil {
 995			return nil, err
 996		}
 997
 998		setValueByPath(toObject, []string{"instances[0]", "image"}, fromImage)
 999	}
1000
1001	fromConfig := getValueByPath(fromObject, []string{"config"})
1002	if fromConfig != nil {
1003		fromConfig, err = generateVideosConfigToMldev(ac, fromConfig.(map[string]any), toObject)
1004		if err != nil {
1005			return nil, err
1006		}
1007
1008		setValueByPath(toObject, []string{"config"}, fromConfig)
1009	}
1010
1011	return toObject, nil
1012}
1013
1014func partToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1015	toObject = make(map[string]any)
1016
1017	fromVideoMetadata := getValueByPath(fromObject, []string{"videoMetadata"})
1018	if fromVideoMetadata != nil {
1019		setValueByPath(toObject, []string{"videoMetadata"}, fromVideoMetadata)
1020	}
1021
1022	fromThought := getValueByPath(fromObject, []string{"thought"})
1023	if fromThought != nil {
1024		setValueByPath(toObject, []string{"thought"}, fromThought)
1025	}
1026
1027	fromCodeExecutionResult := getValueByPath(fromObject, []string{"codeExecutionResult"})
1028	if fromCodeExecutionResult != nil {
1029		setValueByPath(toObject, []string{"codeExecutionResult"}, fromCodeExecutionResult)
1030	}
1031
1032	fromExecutableCode := getValueByPath(fromObject, []string{"executableCode"})
1033	if fromExecutableCode != nil {
1034		setValueByPath(toObject, []string{"executableCode"}, fromExecutableCode)
1035	}
1036
1037	fromFileData := getValueByPath(fromObject, []string{"fileData"})
1038	if fromFileData != nil {
1039		setValueByPath(toObject, []string{"fileData"}, fromFileData)
1040	}
1041
1042	fromFunctionCall := getValueByPath(fromObject, []string{"functionCall"})
1043	if fromFunctionCall != nil {
1044		setValueByPath(toObject, []string{"functionCall"}, fromFunctionCall)
1045	}
1046
1047	fromFunctionResponse := getValueByPath(fromObject, []string{"functionResponse"})
1048	if fromFunctionResponse != nil {
1049		setValueByPath(toObject, []string{"functionResponse"}, fromFunctionResponse)
1050	}
1051
1052	fromInlineData := getValueByPath(fromObject, []string{"inlineData"})
1053	if fromInlineData != nil {
1054		setValueByPath(toObject, []string{"inlineData"}, fromInlineData)
1055	}
1056
1057	fromText := getValueByPath(fromObject, []string{"text"})
1058	if fromText != nil {
1059		setValueByPath(toObject, []string{"text"}, fromText)
1060	}
1061
1062	return toObject, nil
1063}
1064
1065func contentToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1066	toObject = make(map[string]any)
1067
1068	fromParts := getValueByPath(fromObject, []string{"parts"})
1069	if fromParts != nil {
1070		fromParts, err = applyConverterToSlice(ac, fromParts.([]any), partToVertex)
1071		if err != nil {
1072			return nil, err
1073		}
1074
1075		setValueByPath(toObject, []string{"parts"}, fromParts)
1076	}
1077
1078	fromRole := getValueByPath(fromObject, []string{"role"})
1079	if fromRole != nil {
1080		setValueByPath(toObject, []string{"role"}, fromRole)
1081	}
1082
1083	return toObject, nil
1084}
1085
1086func modelSelectionConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1087	toObject = make(map[string]any)
1088
1089	fromFeatureSelectionPreference := getValueByPath(fromObject, []string{"featureSelectionPreference"})
1090	if fromFeatureSelectionPreference != nil {
1091		setValueByPath(toObject, []string{"featureSelectionPreference"}, fromFeatureSelectionPreference)
1092	}
1093
1094	return toObject, nil
1095}
1096
1097func safetySettingToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1098	toObject = make(map[string]any)
1099
1100	fromMethod := getValueByPath(fromObject, []string{"method"})
1101	if fromMethod != nil {
1102		setValueByPath(toObject, []string{"method"}, fromMethod)
1103	}
1104
1105	fromCategory := getValueByPath(fromObject, []string{"category"})
1106	if fromCategory != nil {
1107		setValueByPath(toObject, []string{"category"}, fromCategory)
1108	}
1109
1110	fromThreshold := getValueByPath(fromObject, []string{"threshold"})
1111	if fromThreshold != nil {
1112		setValueByPath(toObject, []string{"threshold"}, fromThreshold)
1113	}
1114
1115	return toObject, nil
1116}
1117
1118func googleSearchToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1119	toObject = make(map[string]any)
1120
1121	return toObject, nil
1122}
1123
1124func dynamicRetrievalConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1125	toObject = make(map[string]any)
1126
1127	fromMode := getValueByPath(fromObject, []string{"mode"})
1128	if fromMode != nil {
1129		setValueByPath(toObject, []string{"mode"}, fromMode)
1130	}
1131
1132	fromDynamicThreshold := getValueByPath(fromObject, []string{"dynamicThreshold"})
1133	if fromDynamicThreshold != nil {
1134		setValueByPath(toObject, []string{"dynamicThreshold"}, fromDynamicThreshold)
1135	}
1136
1137	return toObject, nil
1138}
1139
1140func googleSearchRetrievalToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1141	toObject = make(map[string]any)
1142
1143	fromDynamicRetrievalConfig := getValueByPath(fromObject, []string{"dynamicRetrievalConfig"})
1144	if fromDynamicRetrievalConfig != nil {
1145		fromDynamicRetrievalConfig, err = dynamicRetrievalConfigToVertex(ac, fromDynamicRetrievalConfig.(map[string]any), toObject)
1146		if err != nil {
1147			return nil, err
1148		}
1149
1150		setValueByPath(toObject, []string{"dynamicRetrievalConfig"}, fromDynamicRetrievalConfig)
1151	}
1152
1153	return toObject, nil
1154}
1155
1156func toolToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1157	toObject = make(map[string]any)
1158
1159	fromRetrieval := getValueByPath(fromObject, []string{"retrieval"})
1160	if fromRetrieval != nil {
1161		setValueByPath(toObject, []string{"retrieval"}, fromRetrieval)
1162	}
1163
1164	fromGoogleSearch := getValueByPath(fromObject, []string{"googleSearch"})
1165	if fromGoogleSearch != nil {
1166		fromGoogleSearch, err = googleSearchToVertex(ac, fromGoogleSearch.(map[string]any), toObject)
1167		if err != nil {
1168			return nil, err
1169		}
1170
1171		setValueByPath(toObject, []string{"googleSearch"}, fromGoogleSearch)
1172	}
1173
1174	fromGoogleSearchRetrieval := getValueByPath(fromObject, []string{"googleSearchRetrieval"})
1175	if fromGoogleSearchRetrieval != nil {
1176		fromGoogleSearchRetrieval, err = googleSearchRetrievalToVertex(ac, fromGoogleSearchRetrieval.(map[string]any), toObject)
1177		if err != nil {
1178			return nil, err
1179		}
1180
1181		setValueByPath(toObject, []string{"googleSearchRetrieval"}, fromGoogleSearchRetrieval)
1182	}
1183
1184	fromCodeExecution := getValueByPath(fromObject, []string{"codeExecution"})
1185	if fromCodeExecution != nil {
1186		setValueByPath(toObject, []string{"codeExecution"}, fromCodeExecution)
1187	}
1188
1189	fromFunctionDeclarations := getValueByPath(fromObject, []string{"functionDeclarations"})
1190	if fromFunctionDeclarations != nil {
1191		setValueByPath(toObject, []string{"functionDeclarations"}, fromFunctionDeclarations)
1192	}
1193
1194	return toObject, nil
1195}
1196
1197func functionCallingConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1198	toObject = make(map[string]any)
1199
1200	fromMode := getValueByPath(fromObject, []string{"mode"})
1201	if fromMode != nil {
1202		setValueByPath(toObject, []string{"mode"}, fromMode)
1203	}
1204
1205	fromAllowedFunctionNames := getValueByPath(fromObject, []string{"allowedFunctionNames"})
1206	if fromAllowedFunctionNames != nil {
1207		setValueByPath(toObject, []string{"allowedFunctionNames"}, fromAllowedFunctionNames)
1208	}
1209
1210	return toObject, nil
1211}
1212
1213func toolConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1214	toObject = make(map[string]any)
1215
1216	fromFunctionCallingConfig := getValueByPath(fromObject, []string{"functionCallingConfig"})
1217	if fromFunctionCallingConfig != nil {
1218		fromFunctionCallingConfig, err = functionCallingConfigToVertex(ac, fromFunctionCallingConfig.(map[string]any), toObject)
1219		if err != nil {
1220			return nil, err
1221		}
1222
1223		setValueByPath(toObject, []string{"functionCallingConfig"}, fromFunctionCallingConfig)
1224	}
1225
1226	return toObject, nil
1227}
1228
1229func prebuiltVoiceConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1230	toObject = make(map[string]any)
1231
1232	fromVoiceName := getValueByPath(fromObject, []string{"voiceName"})
1233	if fromVoiceName != nil {
1234		setValueByPath(toObject, []string{"voiceName"}, fromVoiceName)
1235	}
1236
1237	return toObject, nil
1238}
1239
1240func voiceConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1241	toObject = make(map[string]any)
1242
1243	fromPrebuiltVoiceConfig := getValueByPath(fromObject, []string{"prebuiltVoiceConfig"})
1244	if fromPrebuiltVoiceConfig != nil {
1245		fromPrebuiltVoiceConfig, err = prebuiltVoiceConfigToVertex(ac, fromPrebuiltVoiceConfig.(map[string]any), toObject)
1246		if err != nil {
1247			return nil, err
1248		}
1249
1250		setValueByPath(toObject, []string{"prebuiltVoiceConfig"}, fromPrebuiltVoiceConfig)
1251	}
1252
1253	return toObject, nil
1254}
1255
1256func speechConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1257	toObject = make(map[string]any)
1258
1259	fromVoiceConfig := getValueByPath(fromObject, []string{"voiceConfig"})
1260	if fromVoiceConfig != nil {
1261		fromVoiceConfig, err = voiceConfigToVertex(ac, fromVoiceConfig.(map[string]any), toObject)
1262		if err != nil {
1263			return nil, err
1264		}
1265
1266		setValueByPath(toObject, []string{"voiceConfig"}, fromVoiceConfig)
1267	}
1268
1269	fromLanguageCode := getValueByPath(fromObject, []string{"languageCode"})
1270	if fromLanguageCode != nil {
1271		setValueByPath(toObject, []string{"languageCode"}, fromLanguageCode)
1272	}
1273
1274	return toObject, nil
1275}
1276
1277func thinkingConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1278	toObject = make(map[string]any)
1279
1280	fromIncludeThoughts := getValueByPath(fromObject, []string{"includeThoughts"})
1281	if fromIncludeThoughts != nil {
1282		setValueByPath(toObject, []string{"includeThoughts"}, fromIncludeThoughts)
1283	}
1284
1285	fromThinkingBudget := getValueByPath(fromObject, []string{"thinkingBudget"})
1286	if fromThinkingBudget != nil {
1287		setValueByPath(toObject, []string{"thinkingBudget"}, fromThinkingBudget)
1288	}
1289
1290	return toObject, nil
1291}
1292
1293func generateContentConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1294	toObject = make(map[string]any)
1295
1296	fromSystemInstruction := getValueByPath(fromObject, []string{"systemInstruction"})
1297	if fromSystemInstruction != nil {
1298		fromSystemInstruction, err = tContent(ac, fromSystemInstruction)
1299		if err != nil {
1300			return nil, err
1301		}
1302
1303		fromSystemInstruction, err = contentToVertex(ac, fromSystemInstruction.(map[string]any), toObject)
1304		if err != nil {
1305			return nil, err
1306		}
1307
1308		setValueByPath(parentObject, []string{"systemInstruction"}, fromSystemInstruction)
1309	}
1310
1311	fromTemperature := getValueByPath(fromObject, []string{"temperature"})
1312	if fromTemperature != nil {
1313		setValueByPath(toObject, []string{"temperature"}, fromTemperature)
1314	}
1315
1316	fromTopP := getValueByPath(fromObject, []string{"topP"})
1317	if fromTopP != nil {
1318		setValueByPath(toObject, []string{"topP"}, fromTopP)
1319	}
1320
1321	fromTopK := getValueByPath(fromObject, []string{"topK"})
1322	if fromTopK != nil {
1323		setValueByPath(toObject, []string{"topK"}, fromTopK)
1324	}
1325
1326	fromCandidateCount := getValueByPath(fromObject, []string{"candidateCount"})
1327	if fromCandidateCount != nil {
1328		setValueByPath(toObject, []string{"candidateCount"}, fromCandidateCount)
1329	}
1330
1331	fromMaxOutputTokens := getValueByPath(fromObject, []string{"maxOutputTokens"})
1332	if fromMaxOutputTokens != nil {
1333		setValueByPath(toObject, []string{"maxOutputTokens"}, fromMaxOutputTokens)
1334	}
1335
1336	fromStopSequences := getValueByPath(fromObject, []string{"stopSequences"})
1337	if fromStopSequences != nil {
1338		setValueByPath(toObject, []string{"stopSequences"}, fromStopSequences)
1339	}
1340
1341	fromResponseLogprobs := getValueByPath(fromObject, []string{"responseLogprobs"})
1342	if fromResponseLogprobs != nil {
1343		setValueByPath(toObject, []string{"responseLogprobs"}, fromResponseLogprobs)
1344	}
1345
1346	fromLogprobs := getValueByPath(fromObject, []string{"logprobs"})
1347	if fromLogprobs != nil {
1348		setValueByPath(toObject, []string{"logprobs"}, fromLogprobs)
1349	}
1350
1351	fromPresencePenalty := getValueByPath(fromObject, []string{"presencePenalty"})
1352	if fromPresencePenalty != nil {
1353		setValueByPath(toObject, []string{"presencePenalty"}, fromPresencePenalty)
1354	}
1355
1356	fromFrequencyPenalty := getValueByPath(fromObject, []string{"frequencyPenalty"})
1357	if fromFrequencyPenalty != nil {
1358		setValueByPath(toObject, []string{"frequencyPenalty"}, fromFrequencyPenalty)
1359	}
1360
1361	fromSeed := getValueByPath(fromObject, []string{"seed"})
1362	if fromSeed != nil {
1363		setValueByPath(toObject, []string{"seed"}, fromSeed)
1364	}
1365
1366	fromResponseMimeType := getValueByPath(fromObject, []string{"responseMimeType"})
1367	if fromResponseMimeType != nil {
1368		setValueByPath(toObject, []string{"responseMimeType"}, fromResponseMimeType)
1369	}
1370
1371	fromResponseSchema := getValueByPath(fromObject, []string{"responseSchema"})
1372	if fromResponseSchema != nil {
1373		fromResponseSchema, err = tSchema(ac, fromResponseSchema)
1374		if err != nil {
1375			return nil, err
1376		}
1377
1378		setValueByPath(toObject, []string{"responseSchema"}, fromResponseSchema)
1379	}
1380
1381	fromRoutingConfig := getValueByPath(fromObject, []string{"routingConfig"})
1382	if fromRoutingConfig != nil {
1383		setValueByPath(toObject, []string{"routingConfig"}, fromRoutingConfig)
1384	}
1385
1386	fromModelSelectionConfig := getValueByPath(fromObject, []string{"modelSelectionConfig"})
1387	if fromModelSelectionConfig != nil {
1388		fromModelSelectionConfig, err = modelSelectionConfigToVertex(ac, fromModelSelectionConfig.(map[string]any), toObject)
1389		if err != nil {
1390			return nil, err
1391		}
1392
1393		setValueByPath(toObject, []string{"modelConfig"}, fromModelSelectionConfig)
1394	}
1395
1396	fromSafetySettings := getValueByPath(fromObject, []string{"safetySettings"})
1397	if fromSafetySettings != nil {
1398		fromSafetySettings, err = applyConverterToSlice(ac, fromSafetySettings.([]any), safetySettingToVertex)
1399		if err != nil {
1400			return nil, err
1401		}
1402
1403		setValueByPath(parentObject, []string{"safetySettings"}, fromSafetySettings)
1404	}
1405
1406	fromTools := getValueByPath(fromObject, []string{"tools"})
1407	if fromTools != nil {
1408		fromTools, err = applyItemTransformerToSlice(ac, fromTools.([]any), tTool)
1409		if err != nil {
1410			return nil, err
1411		}
1412
1413		fromTools, err = tTools(ac, fromTools)
1414		if err != nil {
1415			return nil, err
1416		}
1417
1418		fromTools, err = applyConverterToSlice(ac, fromTools.([]any), toolToVertex)
1419		if err != nil {
1420			return nil, err
1421		}
1422
1423		setValueByPath(parentObject, []string{"tools"}, fromTools)
1424	}
1425
1426	fromToolConfig := getValueByPath(fromObject, []string{"toolConfig"})
1427	if fromToolConfig != nil {
1428		fromToolConfig, err = toolConfigToVertex(ac, fromToolConfig.(map[string]any), toObject)
1429		if err != nil {
1430			return nil, err
1431		}
1432
1433		setValueByPath(parentObject, []string{"toolConfig"}, fromToolConfig)
1434	}
1435
1436	fromLabels := getValueByPath(fromObject, []string{"labels"})
1437	if fromLabels != nil {
1438		setValueByPath(parentObject, []string{"labels"}, fromLabels)
1439	}
1440
1441	fromCachedContent := getValueByPath(fromObject, []string{"cachedContent"})
1442	if fromCachedContent != nil {
1443		fromCachedContent, err = tCachedContentName(ac, fromCachedContent)
1444		if err != nil {
1445			return nil, err
1446		}
1447
1448		setValueByPath(parentObject, []string{"cachedContent"}, fromCachedContent)
1449	}
1450
1451	fromResponseModalities := getValueByPath(fromObject, []string{"responseModalities"})
1452	if fromResponseModalities != nil {
1453		setValueByPath(toObject, []string{"responseModalities"}, fromResponseModalities)
1454	}
1455
1456	fromMediaResolution := getValueByPath(fromObject, []string{"mediaResolution"})
1457	if fromMediaResolution != nil {
1458		setValueByPath(toObject, []string{"mediaResolution"}, fromMediaResolution)
1459	}
1460
1461	fromSpeechConfig := getValueByPath(fromObject, []string{"speechConfig"})
1462	if fromSpeechConfig != nil {
1463		fromSpeechConfig, err = tSpeechConfig(ac, fromSpeechConfig)
1464		if err != nil {
1465			return nil, err
1466		}
1467
1468		fromSpeechConfig, err = speechConfigToVertex(ac, fromSpeechConfig.(map[string]any), toObject)
1469		if err != nil {
1470			return nil, err
1471		}
1472
1473		setValueByPath(toObject, []string{"speechConfig"}, fromSpeechConfig)
1474	}
1475
1476	fromAudioTimestamp := getValueByPath(fromObject, []string{"audioTimestamp"})
1477	if fromAudioTimestamp != nil {
1478		setValueByPath(toObject, []string{"audioTimestamp"}, fromAudioTimestamp)
1479	}
1480
1481	fromThinkingConfig := getValueByPath(fromObject, []string{"thinkingConfig"})
1482	if fromThinkingConfig != nil {
1483		fromThinkingConfig, err = thinkingConfigToVertex(ac, fromThinkingConfig.(map[string]any), toObject)
1484		if err != nil {
1485			return nil, err
1486		}
1487
1488		setValueByPath(toObject, []string{"thinkingConfig"}, fromThinkingConfig)
1489	}
1490
1491	return toObject, nil
1492}
1493
1494func generateContentParametersToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1495	toObject = make(map[string]any)
1496
1497	fromModel := getValueByPath(fromObject, []string{"model"})
1498	if fromModel != nil {
1499		fromModel, err = tModel(ac, fromModel)
1500		if err != nil {
1501			return nil, err
1502		}
1503
1504		setValueByPath(toObject, []string{"_url", "model"}, fromModel)
1505	}
1506
1507	fromContents := getValueByPath(fromObject, []string{"contents"})
1508	if fromContents != nil {
1509		fromContents, err = tContents(ac, fromContents)
1510		if err != nil {
1511			return nil, err
1512		}
1513
1514		fromContents, err = applyConverterToSlice(ac, fromContents.([]any), contentToVertex)
1515		if err != nil {
1516			return nil, err
1517		}
1518
1519		setValueByPath(toObject, []string{"contents"}, fromContents)
1520	}
1521
1522	fromConfig := getValueByPath(fromObject, []string{"config"})
1523	if fromConfig != nil {
1524		fromConfig, err = generateContentConfigToVertex(ac, fromConfig.(map[string]any), toObject)
1525		if err != nil {
1526			return nil, err
1527		}
1528
1529		setValueByPath(toObject, []string{"generationConfig"}, fromConfig)
1530	}
1531
1532	return toObject, nil
1533}
1534
1535func embedContentConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1536	toObject = make(map[string]any)
1537
1538	fromTaskType := getValueByPath(fromObject, []string{"taskType"})
1539	if fromTaskType != nil {
1540		setValueByPath(parentObject, []string{"instances[]", "task_type"}, fromTaskType)
1541	}
1542
1543	fromTitle := getValueByPath(fromObject, []string{"title"})
1544	if fromTitle != nil {
1545		setValueByPath(parentObject, []string{"instances[]", "title"}, fromTitle)
1546	}
1547
1548	fromOutputDimensionality := getValueByPath(fromObject, []string{"outputDimensionality"})
1549	if fromOutputDimensionality != nil {
1550		setValueByPath(parentObject, []string{"parameters", "outputDimensionality"}, fromOutputDimensionality)
1551	}
1552
1553	fromMimeType := getValueByPath(fromObject, []string{"mimeType"})
1554	if fromMimeType != nil {
1555		setValueByPath(parentObject, []string{"instances[]", "mimeType"}, fromMimeType)
1556	}
1557
1558	fromAutoTruncate := getValueByPath(fromObject, []string{"autoTruncate"})
1559	if fromAutoTruncate != nil {
1560		setValueByPath(parentObject, []string{"parameters", "autoTruncate"}, fromAutoTruncate)
1561	}
1562
1563	return toObject, nil
1564}
1565
1566func embedContentParametersToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1567	toObject = make(map[string]any)
1568
1569	fromModel := getValueByPath(fromObject, []string{"model"})
1570	if fromModel != nil {
1571		fromModel, err = tModel(ac, fromModel)
1572		if err != nil {
1573			return nil, err
1574		}
1575
1576		setValueByPath(toObject, []string{"_url", "model"}, fromModel)
1577	}
1578
1579	fromContents := getValueByPath(fromObject, []string{"contents"})
1580	if fromContents != nil {
1581		fromContents, err = tContentsForEmbed(ac, fromContents)
1582		if err != nil {
1583			return nil, err
1584		}
1585
1586		setValueByPath(toObject, []string{"instances[]", "content"}, fromContents)
1587	}
1588
1589	fromConfig := getValueByPath(fromObject, []string{"config"})
1590	if fromConfig != nil {
1591		fromConfig, err = embedContentConfigToVertex(ac, fromConfig.(map[string]any), toObject)
1592		if err != nil {
1593			return nil, err
1594		}
1595
1596		setValueByPath(toObject, []string{"config"}, fromConfig)
1597	}
1598
1599	return toObject, nil
1600}
1601
1602func generateImagesConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1603	toObject = make(map[string]any)
1604
1605	fromOutputGcsUri := getValueByPath(fromObject, []string{"outputGcsUri"})
1606	if fromOutputGcsUri != nil {
1607		setValueByPath(parentObject, []string{"parameters", "storageUri"}, fromOutputGcsUri)
1608	}
1609
1610	fromNegativePrompt := getValueByPath(fromObject, []string{"negativePrompt"})
1611	if fromNegativePrompt != nil {
1612		setValueByPath(parentObject, []string{"parameters", "negativePrompt"}, fromNegativePrompt)
1613	}
1614
1615	fromNumberOfImages := getValueByPath(fromObject, []string{"numberOfImages"})
1616	if fromNumberOfImages != nil {
1617		setValueByPath(parentObject, []string{"parameters", "sampleCount"}, fromNumberOfImages)
1618	}
1619
1620	fromAspectRatio := getValueByPath(fromObject, []string{"aspectRatio"})
1621	if fromAspectRatio != nil {
1622		setValueByPath(parentObject, []string{"parameters", "aspectRatio"}, fromAspectRatio)
1623	}
1624
1625	fromGuidanceScale := getValueByPath(fromObject, []string{"guidanceScale"})
1626	if fromGuidanceScale != nil {
1627		setValueByPath(parentObject, []string{"parameters", "guidanceScale"}, fromGuidanceScale)
1628	}
1629
1630	fromSeed := getValueByPath(fromObject, []string{"seed"})
1631	if fromSeed != nil {
1632		setValueByPath(parentObject, []string{"parameters", "seed"}, fromSeed)
1633	}
1634
1635	fromSafetyFilterLevel := getValueByPath(fromObject, []string{"safetyFilterLevel"})
1636	if fromSafetyFilterLevel != nil {
1637		setValueByPath(parentObject, []string{"parameters", "safetySetting"}, fromSafetyFilterLevel)
1638	}
1639
1640	fromPersonGeneration := getValueByPath(fromObject, []string{"personGeneration"})
1641	if fromPersonGeneration != nil {
1642		setValueByPath(parentObject, []string{"parameters", "personGeneration"}, fromPersonGeneration)
1643	}
1644
1645	fromIncludeSafetyAttributes := getValueByPath(fromObject, []string{"includeSafetyAttributes"})
1646	if fromIncludeSafetyAttributes != nil {
1647		setValueByPath(parentObject, []string{"parameters", "includeSafetyAttributes"}, fromIncludeSafetyAttributes)
1648	}
1649
1650	fromIncludeRaiReason := getValueByPath(fromObject, []string{"includeRaiReason"})
1651	if fromIncludeRaiReason != nil {
1652		setValueByPath(parentObject, []string{"parameters", "includeRaiReason"}, fromIncludeRaiReason)
1653	}
1654
1655	fromLanguage := getValueByPath(fromObject, []string{"language"})
1656	if fromLanguage != nil {
1657		setValueByPath(parentObject, []string{"parameters", "language"}, fromLanguage)
1658	}
1659
1660	fromOutputMimeType := getValueByPath(fromObject, []string{"outputMimeType"})
1661	if fromOutputMimeType != nil {
1662		setValueByPath(parentObject, []string{"parameters", "outputOptions", "mimeType"}, fromOutputMimeType)
1663	}
1664
1665	fromOutputCompressionQuality := getValueByPath(fromObject, []string{"outputCompressionQuality"})
1666	if fromOutputCompressionQuality != nil {
1667		setValueByPath(parentObject, []string{"parameters", "outputOptions", "compressionQuality"}, fromOutputCompressionQuality)
1668	}
1669
1670	fromAddWatermark := getValueByPath(fromObject, []string{"addWatermark"})
1671	if fromAddWatermark != nil {
1672		setValueByPath(parentObject, []string{"parameters", "addWatermark"}, fromAddWatermark)
1673	}
1674
1675	fromEnhancePrompt := getValueByPath(fromObject, []string{"enhancePrompt"})
1676	if fromEnhancePrompt != nil {
1677		setValueByPath(parentObject, []string{"parameters", "enhancePrompt"}, fromEnhancePrompt)
1678	}
1679
1680	return toObject, nil
1681}
1682
1683func generateImagesParametersToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1684	toObject = make(map[string]any)
1685
1686	fromModel := getValueByPath(fromObject, []string{"model"})
1687	if fromModel != nil {
1688		fromModel, err = tModel(ac, fromModel)
1689		if err != nil {
1690			return nil, err
1691		}
1692
1693		setValueByPath(toObject, []string{"_url", "model"}, fromModel)
1694	}
1695
1696	fromPrompt := getValueByPath(fromObject, []string{"prompt"})
1697	if fromPrompt != nil {
1698		setValueByPath(toObject, []string{"instances[0]", "prompt"}, fromPrompt)
1699	}
1700
1701	fromConfig := getValueByPath(fromObject, []string{"config"})
1702	if fromConfig != nil {
1703		fromConfig, err = generateImagesConfigToVertex(ac, fromConfig.(map[string]any), toObject)
1704		if err != nil {
1705			return nil, err
1706		}
1707
1708		setValueByPath(toObject, []string{"config"}, fromConfig)
1709	}
1710
1711	return toObject, nil
1712}
1713
1714func imageToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1715	toObject = make(map[string]any)
1716
1717	fromGcsUri := getValueByPath(fromObject, []string{"gcsUri"})
1718	if fromGcsUri != nil {
1719		setValueByPath(toObject, []string{"gcsUri"}, fromGcsUri)
1720	}
1721
1722	fromImageBytes := getValueByPath(fromObject, []string{"imageBytes"})
1723	if fromImageBytes != nil {
1724		fromImageBytes, err = tBytes(ac, fromImageBytes)
1725		if err != nil {
1726			return nil, err
1727		}
1728
1729		setValueByPath(toObject, []string{"bytesBase64Encoded"}, fromImageBytes)
1730	}
1731
1732	fromMimeType := getValueByPath(fromObject, []string{"mimeType"})
1733	if fromMimeType != nil {
1734		setValueByPath(toObject, []string{"mimeType"}, fromMimeType)
1735	}
1736
1737	return toObject, nil
1738}
1739
1740func maskReferenceConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1741	toObject = make(map[string]any)
1742
1743	fromMaskMode := getValueByPath(fromObject, []string{"maskMode"})
1744	if fromMaskMode != nil {
1745		setValueByPath(toObject, []string{"maskMode"}, fromMaskMode)
1746	}
1747
1748	fromSegmentationClasses := getValueByPath(fromObject, []string{"segmentationClasses"})
1749	if fromSegmentationClasses != nil {
1750		setValueByPath(toObject, []string{"maskClasses"}, fromSegmentationClasses)
1751	}
1752
1753	fromMaskDilation := getValueByPath(fromObject, []string{"maskDilation"})
1754	if fromMaskDilation != nil {
1755		setValueByPath(toObject, []string{"dilation"}, fromMaskDilation)
1756	}
1757
1758	return toObject, nil
1759}
1760
1761func controlReferenceConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1762	toObject = make(map[string]any)
1763
1764	fromControlType := getValueByPath(fromObject, []string{"controlType"})
1765	if fromControlType != nil {
1766		setValueByPath(toObject, []string{"controlType"}, fromControlType)
1767	}
1768
1769	fromEnableControlImageComputation := getValueByPath(fromObject, []string{"enableControlImageComputation"})
1770	if fromEnableControlImageComputation != nil {
1771		setValueByPath(toObject, []string{"computeControl"}, fromEnableControlImageComputation)
1772	}
1773
1774	return toObject, nil
1775}
1776
1777func styleReferenceConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1778	toObject = make(map[string]any)
1779
1780	fromStyleDescription := getValueByPath(fromObject, []string{"styleDescription"})
1781	if fromStyleDescription != nil {
1782		setValueByPath(toObject, []string{"styleDescription"}, fromStyleDescription)
1783	}
1784
1785	return toObject, nil
1786}
1787
1788func subjectReferenceConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1789	toObject = make(map[string]any)
1790
1791	fromSubjectType := getValueByPath(fromObject, []string{"subjectType"})
1792	if fromSubjectType != nil {
1793		setValueByPath(toObject, []string{"subjectType"}, fromSubjectType)
1794	}
1795
1796	fromSubjectDescription := getValueByPath(fromObject, []string{"subjectDescription"})
1797	if fromSubjectDescription != nil {
1798		setValueByPath(toObject, []string{"subjectDescription"}, fromSubjectDescription)
1799	}
1800
1801	return toObject, nil
1802}
1803
1804func referenceImageAPIToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1805	toObject = make(map[string]any)
1806
1807	fromReferenceImage := getValueByPath(fromObject, []string{"referenceImage"})
1808	if fromReferenceImage != nil {
1809		fromReferenceImage, err = imageToVertex(ac, fromReferenceImage.(map[string]any), toObject)
1810		if err != nil {
1811			return nil, err
1812		}
1813
1814		setValueByPath(toObject, []string{"referenceImage"}, fromReferenceImage)
1815	}
1816
1817	fromReferenceId := getValueByPath(fromObject, []string{"referenceId"})
1818	if fromReferenceId != nil {
1819		setValueByPath(toObject, []string{"referenceId"}, fromReferenceId)
1820	}
1821
1822	fromReferenceType := getValueByPath(fromObject, []string{"referenceType"})
1823	if fromReferenceType != nil {
1824		setValueByPath(toObject, []string{"referenceType"}, fromReferenceType)
1825	}
1826
1827	fromMaskImageConfig := getValueByPath(fromObject, []string{"maskImageConfig"})
1828	if fromMaskImageConfig != nil {
1829		fromMaskImageConfig, err = maskReferenceConfigToVertex(ac, fromMaskImageConfig.(map[string]any), toObject)
1830		if err != nil {
1831			return nil, err
1832		}
1833
1834		setValueByPath(toObject, []string{"maskImageConfig"}, fromMaskImageConfig)
1835	}
1836
1837	fromControlImageConfig := getValueByPath(fromObject, []string{"controlImageConfig"})
1838	if fromControlImageConfig != nil {
1839		fromControlImageConfig, err = controlReferenceConfigToVertex(ac, fromControlImageConfig.(map[string]any), toObject)
1840		if err != nil {
1841			return nil, err
1842		}
1843
1844		setValueByPath(toObject, []string{"controlImageConfig"}, fromControlImageConfig)
1845	}
1846
1847	fromStyleImageConfig := getValueByPath(fromObject, []string{"styleImageConfig"})
1848	if fromStyleImageConfig != nil {
1849		fromStyleImageConfig, err = styleReferenceConfigToVertex(ac, fromStyleImageConfig.(map[string]any), toObject)
1850		if err != nil {
1851			return nil, err
1852		}
1853
1854		setValueByPath(toObject, []string{"styleImageConfig"}, fromStyleImageConfig)
1855	}
1856
1857	fromSubjectImageConfig := getValueByPath(fromObject, []string{"subjectImageConfig"})
1858	if fromSubjectImageConfig != nil {
1859		fromSubjectImageConfig, err = subjectReferenceConfigToVertex(ac, fromSubjectImageConfig.(map[string]any), toObject)
1860		if err != nil {
1861			return nil, err
1862		}
1863
1864		setValueByPath(toObject, []string{"subjectImageConfig"}, fromSubjectImageConfig)
1865	}
1866
1867	return toObject, nil
1868}
1869
1870func editImageConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1871	toObject = make(map[string]any)
1872
1873	fromOutputGcsUri := getValueByPath(fromObject, []string{"outputGcsUri"})
1874	if fromOutputGcsUri != nil {
1875		setValueByPath(parentObject, []string{"parameters", "storageUri"}, fromOutputGcsUri)
1876	}
1877
1878	fromNegativePrompt := getValueByPath(fromObject, []string{"negativePrompt"})
1879	if fromNegativePrompt != nil {
1880		setValueByPath(parentObject, []string{"parameters", "negativePrompt"}, fromNegativePrompt)
1881	}
1882
1883	fromNumberOfImages := getValueByPath(fromObject, []string{"numberOfImages"})
1884	if fromNumberOfImages != nil {
1885		setValueByPath(parentObject, []string{"parameters", "sampleCount"}, fromNumberOfImages)
1886	}
1887
1888	fromAspectRatio := getValueByPath(fromObject, []string{"aspectRatio"})
1889	if fromAspectRatio != nil {
1890		setValueByPath(parentObject, []string{"parameters", "aspectRatio"}, fromAspectRatio)
1891	}
1892
1893	fromGuidanceScale := getValueByPath(fromObject, []string{"guidanceScale"})
1894	if fromGuidanceScale != nil {
1895		setValueByPath(parentObject, []string{"parameters", "guidanceScale"}, fromGuidanceScale)
1896	}
1897
1898	fromSeed := getValueByPath(fromObject, []string{"seed"})
1899	if fromSeed != nil {
1900		setValueByPath(parentObject, []string{"parameters", "seed"}, fromSeed)
1901	}
1902
1903	fromSafetyFilterLevel := getValueByPath(fromObject, []string{"safetyFilterLevel"})
1904	if fromSafetyFilterLevel != nil {
1905		setValueByPath(parentObject, []string{"parameters", "safetySetting"}, fromSafetyFilterLevel)
1906	}
1907
1908	fromPersonGeneration := getValueByPath(fromObject, []string{"personGeneration"})
1909	if fromPersonGeneration != nil {
1910		setValueByPath(parentObject, []string{"parameters", "personGeneration"}, fromPersonGeneration)
1911	}
1912
1913	fromIncludeSafetyAttributes := getValueByPath(fromObject, []string{"includeSafetyAttributes"})
1914	if fromIncludeSafetyAttributes != nil {
1915		setValueByPath(parentObject, []string{"parameters", "includeSafetyAttributes"}, fromIncludeSafetyAttributes)
1916	}
1917
1918	fromIncludeRaiReason := getValueByPath(fromObject, []string{"includeRaiReason"})
1919	if fromIncludeRaiReason != nil {
1920		setValueByPath(parentObject, []string{"parameters", "includeRaiReason"}, fromIncludeRaiReason)
1921	}
1922
1923	fromLanguage := getValueByPath(fromObject, []string{"language"})
1924	if fromLanguage != nil {
1925		setValueByPath(parentObject, []string{"parameters", "language"}, fromLanguage)
1926	}
1927
1928	fromOutputMimeType := getValueByPath(fromObject, []string{"outputMimeType"})
1929	if fromOutputMimeType != nil {
1930		setValueByPath(parentObject, []string{"parameters", "outputOptions", "mimeType"}, fromOutputMimeType)
1931	}
1932
1933	fromOutputCompressionQuality := getValueByPath(fromObject, []string{"outputCompressionQuality"})
1934	if fromOutputCompressionQuality != nil {
1935		setValueByPath(parentObject, []string{"parameters", "outputOptions", "compressionQuality"}, fromOutputCompressionQuality)
1936	}
1937
1938	fromEditMode := getValueByPath(fromObject, []string{"editMode"})
1939	if fromEditMode != nil {
1940		setValueByPath(parentObject, []string{"parameters", "editMode"}, fromEditMode)
1941	}
1942
1943	fromBaseSteps := getValueByPath(fromObject, []string{"baseSteps"})
1944	if fromBaseSteps != nil {
1945		setValueByPath(parentObject, []string{"parameters", "editConfig", "baseSteps"}, fromBaseSteps)
1946	}
1947
1948	return toObject, nil
1949}
1950
1951func editImageParametersToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1952	toObject = make(map[string]any)
1953
1954	fromModel := getValueByPath(fromObject, []string{"model"})
1955	if fromModel != nil {
1956		fromModel, err = tModel(ac, fromModel)
1957		if err != nil {
1958			return nil, err
1959		}
1960
1961		setValueByPath(toObject, []string{"_url", "model"}, fromModel)
1962	}
1963
1964	fromPrompt := getValueByPath(fromObject, []string{"prompt"})
1965	if fromPrompt != nil {
1966		setValueByPath(toObject, []string{"instances[0]", "prompt"}, fromPrompt)
1967	}
1968
1969	fromReferenceImages := getValueByPath(fromObject, []string{"referenceImages"})
1970	if fromReferenceImages != nil {
1971		fromReferenceImages, err = applyConverterToSlice(ac, fromReferenceImages.([]any), referenceImageAPIToVertex)
1972		if err != nil {
1973			return nil, err
1974		}
1975
1976		setValueByPath(toObject, []string{"instances[0]", "referenceImages"}, fromReferenceImages)
1977	}
1978
1979	fromConfig := getValueByPath(fromObject, []string{"config"})
1980	if fromConfig != nil {
1981		fromConfig, err = editImageConfigToVertex(ac, fromConfig.(map[string]any), toObject)
1982		if err != nil {
1983			return nil, err
1984		}
1985
1986		setValueByPath(toObject, []string{"config"}, fromConfig)
1987	}
1988
1989	return toObject, nil
1990}
1991
1992func upscaleImageAPIConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
1993	toObject = make(map[string]any)
1994
1995	fromIncludeRaiReason := getValueByPath(fromObject, []string{"includeRaiReason"})
1996	if fromIncludeRaiReason != nil {
1997		setValueByPath(parentObject, []string{"parameters", "includeRaiReason"}, fromIncludeRaiReason)
1998	}
1999
2000	fromOutputMimeType := getValueByPath(fromObject, []string{"outputMimeType"})
2001	if fromOutputMimeType != nil {
2002		setValueByPath(parentObject, []string{"parameters", "outputOptions", "mimeType"}, fromOutputMimeType)
2003	}
2004
2005	fromOutputCompressionQuality := getValueByPath(fromObject, []string{"outputCompressionQuality"})
2006	if fromOutputCompressionQuality != nil {
2007		setValueByPath(parentObject, []string{"parameters", "outputOptions", "compressionQuality"}, fromOutputCompressionQuality)
2008	}
2009
2010	fromNumberOfImages := getValueByPath(fromObject, []string{"numberOfImages"})
2011	if fromNumberOfImages != nil {
2012		setValueByPath(parentObject, []string{"parameters", "sampleCount"}, fromNumberOfImages)
2013	}
2014
2015	fromMode := getValueByPath(fromObject, []string{"mode"})
2016	if fromMode != nil {
2017		setValueByPath(parentObject, []string{"parameters", "mode"}, fromMode)
2018	}
2019
2020	return toObject, nil
2021}
2022
2023func upscaleImageAPIParametersToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2024	toObject = make(map[string]any)
2025
2026	fromModel := getValueByPath(fromObject, []string{"model"})
2027	if fromModel != nil {
2028		fromModel, err = tModel(ac, fromModel)
2029		if err != nil {
2030			return nil, err
2031		}
2032
2033		setValueByPath(toObject, []string{"_url", "model"}, fromModel)
2034	}
2035
2036	fromImage := getValueByPath(fromObject, []string{"image"})
2037	if fromImage != nil {
2038		fromImage, err = imageToVertex(ac, fromImage.(map[string]any), toObject)
2039		if err != nil {
2040			return nil, err
2041		}
2042
2043		setValueByPath(toObject, []string{"instances[0]", "image"}, fromImage)
2044	}
2045
2046	fromUpscaleFactor := getValueByPath(fromObject, []string{"upscaleFactor"})
2047	if fromUpscaleFactor != nil {
2048		setValueByPath(toObject, []string{"parameters", "upscaleConfig", "upscaleFactor"}, fromUpscaleFactor)
2049	}
2050
2051	fromConfig := getValueByPath(fromObject, []string{"config"})
2052	if fromConfig != nil {
2053		fromConfig, err = upscaleImageAPIConfigToVertex(ac, fromConfig.(map[string]any), toObject)
2054		if err != nil {
2055			return nil, err
2056		}
2057
2058		setValueByPath(toObject, []string{"config"}, fromConfig)
2059	}
2060
2061	return toObject, nil
2062}
2063
2064func getModelParametersToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2065	toObject = make(map[string]any)
2066
2067	fromModel := getValueByPath(fromObject, []string{"model"})
2068	if fromModel != nil {
2069		fromModel, err = tModel(ac, fromModel)
2070		if err != nil {
2071			return nil, err
2072		}
2073
2074		setValueByPath(toObject, []string{"_url", "name"}, fromModel)
2075	}
2076
2077	fromConfig := getValueByPath(fromObject, []string{"config"})
2078	if fromConfig != nil {
2079		setValueByPath(toObject, []string{"config"}, fromConfig)
2080	}
2081
2082	return toObject, nil
2083}
2084
2085func listModelsConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2086	toObject = make(map[string]any)
2087
2088	fromPageSize := getValueByPath(fromObject, []string{"pageSize"})
2089	if fromPageSize != nil {
2090		setValueByPath(parentObject, []string{"_query", "pageSize"}, fromPageSize)
2091	}
2092
2093	fromPageToken := getValueByPath(fromObject, []string{"pageToken"})
2094	if fromPageToken != nil {
2095		setValueByPath(parentObject, []string{"_query", "pageToken"}, fromPageToken)
2096	}
2097
2098	fromFilter := getValueByPath(fromObject, []string{"filter"})
2099	if fromFilter != nil {
2100		setValueByPath(parentObject, []string{"_query", "filter"}, fromFilter)
2101	}
2102
2103	fromQueryBase := getValueByPath(fromObject, []string{"queryBase"})
2104	if fromQueryBase != nil {
2105		fromQueryBase, err = tModelsURL(ac, fromQueryBase)
2106		if err != nil {
2107			return nil, err
2108		}
2109
2110		setValueByPath(parentObject, []string{"_url", "models_url"}, fromQueryBase)
2111	}
2112
2113	return toObject, nil
2114}
2115
2116func listModelsParametersToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2117	toObject = make(map[string]any)
2118
2119	fromConfig := getValueByPath(fromObject, []string{"config"})
2120	if fromConfig != nil {
2121		fromConfig, err = listModelsConfigToVertex(ac, fromConfig.(map[string]any), toObject)
2122		if err != nil {
2123			return nil, err
2124		}
2125
2126		setValueByPath(toObject, []string{"config"}, fromConfig)
2127	}
2128
2129	return toObject, nil
2130}
2131
2132func updateModelConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2133	toObject = make(map[string]any)
2134
2135	fromDisplayName := getValueByPath(fromObject, []string{"displayName"})
2136	if fromDisplayName != nil {
2137		setValueByPath(parentObject, []string{"displayName"}, fromDisplayName)
2138	}
2139
2140	fromDescription := getValueByPath(fromObject, []string{"description"})
2141	if fromDescription != nil {
2142		setValueByPath(parentObject, []string{"description"}, fromDescription)
2143	}
2144
2145	return toObject, nil
2146}
2147
2148func updateModelParametersToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2149	toObject = make(map[string]any)
2150
2151	fromModel := getValueByPath(fromObject, []string{"model"})
2152	if fromModel != nil {
2153		fromModel, err = tModel(ac, fromModel)
2154		if err != nil {
2155			return nil, err
2156		}
2157
2158		setValueByPath(toObject, []string{"_url", "model"}, fromModel)
2159	}
2160
2161	fromConfig := getValueByPath(fromObject, []string{"config"})
2162	if fromConfig != nil {
2163		fromConfig, err = updateModelConfigToVertex(ac, fromConfig.(map[string]any), toObject)
2164		if err != nil {
2165			return nil, err
2166		}
2167
2168		setValueByPath(toObject, []string{"config"}, fromConfig)
2169	}
2170
2171	return toObject, nil
2172}
2173
2174func deleteModelParametersToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2175	toObject = make(map[string]any)
2176
2177	fromModel := getValueByPath(fromObject, []string{"model"})
2178	if fromModel != nil {
2179		fromModel, err = tModel(ac, fromModel)
2180		if err != nil {
2181			return nil, err
2182		}
2183
2184		setValueByPath(toObject, []string{"_url", "name"}, fromModel)
2185	}
2186
2187	fromConfig := getValueByPath(fromObject, []string{"config"})
2188	if fromConfig != nil {
2189		setValueByPath(toObject, []string{"config"}, fromConfig)
2190	}
2191
2192	return toObject, nil
2193}
2194
2195func countTokensConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2196	toObject = make(map[string]any)
2197
2198	fromSystemInstruction := getValueByPath(fromObject, []string{"systemInstruction"})
2199	if fromSystemInstruction != nil {
2200		fromSystemInstruction, err = tContent(ac, fromSystemInstruction)
2201		if err != nil {
2202			return nil, err
2203		}
2204
2205		fromSystemInstruction, err = contentToVertex(ac, fromSystemInstruction.(map[string]any), toObject)
2206		if err != nil {
2207			return nil, err
2208		}
2209
2210		setValueByPath(parentObject, []string{"systemInstruction"}, fromSystemInstruction)
2211	}
2212
2213	fromTools := getValueByPath(fromObject, []string{"tools"})
2214	if fromTools != nil {
2215		fromTools, err = applyConverterToSlice(ac, fromTools.([]any), toolToVertex)
2216		if err != nil {
2217			return nil, err
2218		}
2219
2220		setValueByPath(parentObject, []string{"tools"}, fromTools)
2221	}
2222
2223	fromGenerationConfig := getValueByPath(fromObject, []string{"generationConfig"})
2224	if fromGenerationConfig != nil {
2225		setValueByPath(parentObject, []string{"generationConfig"}, fromGenerationConfig)
2226	}
2227
2228	return toObject, nil
2229}
2230
2231func countTokensParametersToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2232	toObject = make(map[string]any)
2233
2234	fromModel := getValueByPath(fromObject, []string{"model"})
2235	if fromModel != nil {
2236		fromModel, err = tModel(ac, fromModel)
2237		if err != nil {
2238			return nil, err
2239		}
2240
2241		setValueByPath(toObject, []string{"_url", "model"}, fromModel)
2242	}
2243
2244	fromContents := getValueByPath(fromObject, []string{"contents"})
2245	if fromContents != nil {
2246		fromContents, err = tContents(ac, fromContents)
2247		if err != nil {
2248			return nil, err
2249		}
2250
2251		fromContents, err = applyConverterToSlice(ac, fromContents.([]any), contentToVertex)
2252		if err != nil {
2253			return nil, err
2254		}
2255
2256		setValueByPath(toObject, []string{"contents"}, fromContents)
2257	}
2258
2259	fromConfig := getValueByPath(fromObject, []string{"config"})
2260	if fromConfig != nil {
2261		fromConfig, err = countTokensConfigToVertex(ac, fromConfig.(map[string]any), toObject)
2262		if err != nil {
2263			return nil, err
2264		}
2265
2266		setValueByPath(toObject, []string{"config"}, fromConfig)
2267	}
2268
2269	return toObject, nil
2270}
2271
2272func computeTokensParametersToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2273	toObject = make(map[string]any)
2274
2275	fromModel := getValueByPath(fromObject, []string{"model"})
2276	if fromModel != nil {
2277		fromModel, err = tModel(ac, fromModel)
2278		if err != nil {
2279			return nil, err
2280		}
2281
2282		setValueByPath(toObject, []string{"_url", "model"}, fromModel)
2283	}
2284
2285	fromContents := getValueByPath(fromObject, []string{"contents"})
2286	if fromContents != nil {
2287		fromContents, err = tContents(ac, fromContents)
2288		if err != nil {
2289			return nil, err
2290		}
2291
2292		fromContents, err = applyConverterToSlice(ac, fromContents.([]any), contentToVertex)
2293		if err != nil {
2294			return nil, err
2295		}
2296
2297		setValueByPath(toObject, []string{"contents"}, fromContents)
2298	}
2299
2300	fromConfig := getValueByPath(fromObject, []string{"config"})
2301	if fromConfig != nil {
2302		setValueByPath(toObject, []string{"config"}, fromConfig)
2303	}
2304
2305	return toObject, nil
2306}
2307
2308func generateVideosConfigToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2309	toObject = make(map[string]any)
2310
2311	fromNumberOfVideos := getValueByPath(fromObject, []string{"numberOfVideos"})
2312	if fromNumberOfVideos != nil {
2313		setValueByPath(parentObject, []string{"parameters", "sampleCount"}, fromNumberOfVideos)
2314	}
2315
2316	fromOutputGcsUri := getValueByPath(fromObject, []string{"outputGcsUri"})
2317	if fromOutputGcsUri != nil {
2318		setValueByPath(parentObject, []string{"parameters", "storageUri"}, fromOutputGcsUri)
2319	}
2320
2321	fromFps := getValueByPath(fromObject, []string{"fps"})
2322	if fromFps != nil {
2323		setValueByPath(parentObject, []string{"parameters", "fps"}, fromFps)
2324	}
2325
2326	fromDurationSeconds := getValueByPath(fromObject, []string{"durationSeconds"})
2327	if fromDurationSeconds != nil {
2328		setValueByPath(parentObject, []string{"parameters", "durationSeconds"}, fromDurationSeconds)
2329	}
2330
2331	fromSeed := getValueByPath(fromObject, []string{"seed"})
2332	if fromSeed != nil {
2333		setValueByPath(parentObject, []string{"parameters", "seed"}, fromSeed)
2334	}
2335
2336	fromAspectRatio := getValueByPath(fromObject, []string{"aspectRatio"})
2337	if fromAspectRatio != nil {
2338		setValueByPath(parentObject, []string{"parameters", "aspectRatio"}, fromAspectRatio)
2339	}
2340
2341	fromResolution := getValueByPath(fromObject, []string{"resolution"})
2342	if fromResolution != nil {
2343		setValueByPath(parentObject, []string{"parameters", "resolution"}, fromResolution)
2344	}
2345
2346	fromPersonGeneration := getValueByPath(fromObject, []string{"personGeneration"})
2347	if fromPersonGeneration != nil {
2348		setValueByPath(parentObject, []string{"parameters", "personGeneration"}, fromPersonGeneration)
2349	}
2350
2351	fromPubsubTopic := getValueByPath(fromObject, []string{"pubsubTopic"})
2352	if fromPubsubTopic != nil {
2353		setValueByPath(parentObject, []string{"parameters", "pubsubTopic"}, fromPubsubTopic)
2354	}
2355
2356	fromNegativePrompt := getValueByPath(fromObject, []string{"negativePrompt"})
2357	if fromNegativePrompt != nil {
2358		setValueByPath(parentObject, []string{"parameters", "negativePrompt"}, fromNegativePrompt)
2359	}
2360
2361	fromEnhancePrompt := getValueByPath(fromObject, []string{"enhancePrompt"})
2362	if fromEnhancePrompt != nil {
2363		setValueByPath(parentObject, []string{"parameters", "enhancePrompt"}, fromEnhancePrompt)
2364	}
2365
2366	return toObject, nil
2367}
2368
2369func generateVideosParametersToVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2370	toObject = make(map[string]any)
2371
2372	fromModel := getValueByPath(fromObject, []string{"model"})
2373	if fromModel != nil {
2374		fromModel, err = tModel(ac, fromModel)
2375		if err != nil {
2376			return nil, err
2377		}
2378
2379		setValueByPath(toObject, []string{"_url", "model"}, fromModel)
2380	}
2381
2382	fromPrompt := getValueByPath(fromObject, []string{"prompt"})
2383	if fromPrompt != nil {
2384		setValueByPath(toObject, []string{"instances[0]", "prompt"}, fromPrompt)
2385	}
2386
2387	fromImage := getValueByPath(fromObject, []string{"image"})
2388	if fromImage != nil {
2389		fromImage, err = imageToVertex(ac, fromImage.(map[string]any), toObject)
2390		if err != nil {
2391			return nil, err
2392		}
2393
2394		setValueByPath(toObject, []string{"instances[0]", "image"}, fromImage)
2395	}
2396
2397	fromConfig := getValueByPath(fromObject, []string{"config"})
2398	if fromConfig != nil {
2399		fromConfig, err = generateVideosConfigToVertex(ac, fromConfig.(map[string]any), toObject)
2400		if err != nil {
2401			return nil, err
2402		}
2403
2404		setValueByPath(toObject, []string{"config"}, fromConfig)
2405	}
2406
2407	return toObject, nil
2408}
2409
2410func partFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2411	toObject = make(map[string]any)
2412
2413	fromThought := getValueByPath(fromObject, []string{"thought"})
2414	if fromThought != nil {
2415		setValueByPath(toObject, []string{"thought"}, fromThought)
2416	}
2417
2418	fromCodeExecutionResult := getValueByPath(fromObject, []string{"codeExecutionResult"})
2419	if fromCodeExecutionResult != nil {
2420		setValueByPath(toObject, []string{"codeExecutionResult"}, fromCodeExecutionResult)
2421	}
2422
2423	fromExecutableCode := getValueByPath(fromObject, []string{"executableCode"})
2424	if fromExecutableCode != nil {
2425		setValueByPath(toObject, []string{"executableCode"}, fromExecutableCode)
2426	}
2427
2428	fromFileData := getValueByPath(fromObject, []string{"fileData"})
2429	if fromFileData != nil {
2430		setValueByPath(toObject, []string{"fileData"}, fromFileData)
2431	}
2432
2433	fromFunctionCall := getValueByPath(fromObject, []string{"functionCall"})
2434	if fromFunctionCall != nil {
2435		setValueByPath(toObject, []string{"functionCall"}, fromFunctionCall)
2436	}
2437
2438	fromFunctionResponse := getValueByPath(fromObject, []string{"functionResponse"})
2439	if fromFunctionResponse != nil {
2440		setValueByPath(toObject, []string{"functionResponse"}, fromFunctionResponse)
2441	}
2442
2443	fromInlineData := getValueByPath(fromObject, []string{"inlineData"})
2444	if fromInlineData != nil {
2445		setValueByPath(toObject, []string{"inlineData"}, fromInlineData)
2446	}
2447
2448	fromText := getValueByPath(fromObject, []string{"text"})
2449	if fromText != nil {
2450		setValueByPath(toObject, []string{"text"}, fromText)
2451	}
2452
2453	return toObject, nil
2454}
2455
2456func contentFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2457	toObject = make(map[string]any)
2458
2459	fromParts := getValueByPath(fromObject, []string{"parts"})
2460	if fromParts != nil {
2461		fromParts, err = applyConverterToSlice(ac, fromParts.([]any), partFromMldev)
2462		if err != nil {
2463			return nil, err
2464		}
2465
2466		setValueByPath(toObject, []string{"parts"}, fromParts)
2467	}
2468
2469	fromRole := getValueByPath(fromObject, []string{"role"})
2470	if fromRole != nil {
2471		setValueByPath(toObject, []string{"role"}, fromRole)
2472	}
2473
2474	return toObject, nil
2475}
2476
2477func citationMetadataFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2478	toObject = make(map[string]any)
2479
2480	fromCitations := getValueByPath(fromObject, []string{"citationSources"})
2481	if fromCitations != nil {
2482		setValueByPath(toObject, []string{"citations"}, fromCitations)
2483	}
2484
2485	return toObject, nil
2486}
2487
2488func candidateFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2489	toObject = make(map[string]any)
2490
2491	fromContent := getValueByPath(fromObject, []string{"content"})
2492	if fromContent != nil {
2493		fromContent, err = contentFromMldev(ac, fromContent.(map[string]any), toObject)
2494		if err != nil {
2495			return nil, err
2496		}
2497
2498		setValueByPath(toObject, []string{"content"}, fromContent)
2499	}
2500
2501	fromCitationMetadata := getValueByPath(fromObject, []string{"citationMetadata"})
2502	if fromCitationMetadata != nil {
2503		fromCitationMetadata, err = citationMetadataFromMldev(ac, fromCitationMetadata.(map[string]any), toObject)
2504		if err != nil {
2505			return nil, err
2506		}
2507
2508		setValueByPath(toObject, []string{"citationMetadata"}, fromCitationMetadata)
2509	}
2510
2511	fromTokenCount := getValueByPath(fromObject, []string{"tokenCount"})
2512	if fromTokenCount != nil {
2513		setValueByPath(toObject, []string{"tokenCount"}, fromTokenCount)
2514	}
2515
2516	fromFinishReason := getValueByPath(fromObject, []string{"finishReason"})
2517	if fromFinishReason != nil {
2518		setValueByPath(toObject, []string{"finishReason"}, fromFinishReason)
2519	}
2520
2521	fromAvgLogprobs := getValueByPath(fromObject, []string{"avgLogprobs"})
2522	if fromAvgLogprobs != nil {
2523		setValueByPath(toObject, []string{"avgLogprobs"}, fromAvgLogprobs)
2524	}
2525
2526	fromGroundingMetadata := getValueByPath(fromObject, []string{"groundingMetadata"})
2527	if fromGroundingMetadata != nil {
2528		setValueByPath(toObject, []string{"groundingMetadata"}, fromGroundingMetadata)
2529	}
2530
2531	fromIndex := getValueByPath(fromObject, []string{"index"})
2532	if fromIndex != nil {
2533		setValueByPath(toObject, []string{"index"}, fromIndex)
2534	}
2535
2536	fromLogprobsResult := getValueByPath(fromObject, []string{"logprobsResult"})
2537	if fromLogprobsResult != nil {
2538		setValueByPath(toObject, []string{"logprobsResult"}, fromLogprobsResult)
2539	}
2540
2541	fromSafetyRatings := getValueByPath(fromObject, []string{"safetyRatings"})
2542	if fromSafetyRatings != nil {
2543		setValueByPath(toObject, []string{"safetyRatings"}, fromSafetyRatings)
2544	}
2545
2546	return toObject, nil
2547}
2548
2549func generateContentResponseFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2550	toObject = make(map[string]any)
2551
2552	fromCandidates := getValueByPath(fromObject, []string{"candidates"})
2553	if fromCandidates != nil {
2554		fromCandidates, err = applyConverterToSlice(ac, fromCandidates.([]any), candidateFromMldev)
2555		if err != nil {
2556			return nil, err
2557		}
2558
2559		setValueByPath(toObject, []string{"candidates"}, fromCandidates)
2560	}
2561
2562	fromModelVersion := getValueByPath(fromObject, []string{"modelVersion"})
2563	if fromModelVersion != nil {
2564		setValueByPath(toObject, []string{"modelVersion"}, fromModelVersion)
2565	}
2566
2567	fromPromptFeedback := getValueByPath(fromObject, []string{"promptFeedback"})
2568	if fromPromptFeedback != nil {
2569		setValueByPath(toObject, []string{"promptFeedback"}, fromPromptFeedback)
2570	}
2571
2572	fromUsageMetadata := getValueByPath(fromObject, []string{"usageMetadata"})
2573	if fromUsageMetadata != nil {
2574		setValueByPath(toObject, []string{"usageMetadata"}, fromUsageMetadata)
2575	}
2576
2577	return toObject, nil
2578}
2579
2580func contentEmbeddingStatisticsFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2581	toObject = make(map[string]any)
2582
2583	return toObject, nil
2584}
2585
2586func contentEmbeddingFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2587	toObject = make(map[string]any)
2588
2589	fromValues := getValueByPath(fromObject, []string{"values"})
2590	if fromValues != nil {
2591		setValueByPath(toObject, []string{"values"}, fromValues)
2592	}
2593
2594	return toObject, nil
2595}
2596
2597func embedContentMetadataFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2598	toObject = make(map[string]any)
2599
2600	return toObject, nil
2601}
2602
2603func embedContentResponseFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2604	toObject = make(map[string]any)
2605
2606	fromEmbeddings := getValueByPath(fromObject, []string{"embeddings"})
2607	if fromEmbeddings != nil {
2608		fromEmbeddings, err = applyConverterToSlice(ac, fromEmbeddings.([]any), contentEmbeddingFromMldev)
2609		if err != nil {
2610			return nil, err
2611		}
2612
2613		setValueByPath(toObject, []string{"embeddings"}, fromEmbeddings)
2614	}
2615
2616	fromMetadata := getValueByPath(fromObject, []string{"metadata"})
2617	if fromMetadata != nil {
2618		fromMetadata, err = embedContentMetadataFromMldev(ac, fromMetadata.(map[string]any), toObject)
2619		if err != nil {
2620			return nil, err
2621		}
2622
2623		setValueByPath(toObject, []string{"metadata"}, fromMetadata)
2624	}
2625
2626	return toObject, nil
2627}
2628
2629func imageFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2630	toObject = make(map[string]any)
2631
2632	fromImageBytes := getValueByPath(fromObject, []string{"bytesBase64Encoded"})
2633	if fromImageBytes != nil {
2634		fromImageBytes, err = tBytes(ac, fromImageBytes)
2635		if err != nil {
2636			return nil, err
2637		}
2638
2639		setValueByPath(toObject, []string{"imageBytes"}, fromImageBytes)
2640	}
2641
2642	fromMimeType := getValueByPath(fromObject, []string{"mimeType"})
2643	if fromMimeType != nil {
2644		setValueByPath(toObject, []string{"mimeType"}, fromMimeType)
2645	}
2646
2647	return toObject, nil
2648}
2649
2650func safetyAttributesFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2651	toObject = make(map[string]any)
2652
2653	fromCategories := getValueByPath(fromObject, []string{"safetyAttributes", "categories"})
2654	if fromCategories != nil {
2655		setValueByPath(toObject, []string{"categories"}, fromCategories)
2656	}
2657
2658	fromScores := getValueByPath(fromObject, []string{"safetyAttributes", "scores"})
2659	if fromScores != nil {
2660		setValueByPath(toObject, []string{"scores"}, fromScores)
2661	}
2662
2663	fromContentType := getValueByPath(fromObject, []string{"contentType"})
2664	if fromContentType != nil {
2665		setValueByPath(toObject, []string{"contentType"}, fromContentType)
2666	}
2667
2668	return toObject, nil
2669}
2670
2671func generatedImageFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2672	toObject = make(map[string]any)
2673
2674	fromImage := getValueByPath(fromObject, []string{"_self"})
2675	if fromImage != nil {
2676		fromImage, err = imageFromMldev(ac, fromImage.(map[string]any), toObject)
2677		if err != nil {
2678			return nil, err
2679		}
2680
2681		setValueByPath(toObject, []string{"image"}, fromImage)
2682	}
2683
2684	fromRaiFilteredReason := getValueByPath(fromObject, []string{"raiFilteredReason"})
2685	if fromRaiFilteredReason != nil {
2686		setValueByPath(toObject, []string{"raiFilteredReason"}, fromRaiFilteredReason)
2687	}
2688
2689	fromSafetyAttributes := getValueByPath(fromObject, []string{"_self"})
2690	if fromSafetyAttributes != nil {
2691		fromSafetyAttributes, err = safetyAttributesFromMldev(ac, fromSafetyAttributes.(map[string]any), toObject)
2692		if err != nil {
2693			return nil, err
2694		}
2695
2696		setValueByPath(toObject, []string{"safetyAttributes"}, fromSafetyAttributes)
2697	}
2698
2699	return toObject, nil
2700}
2701
2702func generateImagesResponseFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2703	toObject = make(map[string]any)
2704
2705	fromGeneratedImages := getValueByPath(fromObject, []string{"predictions"})
2706	if fromGeneratedImages != nil {
2707		fromGeneratedImages, err = applyConverterToSlice(ac, fromGeneratedImages.([]any), generatedImageFromMldev)
2708		if err != nil {
2709			return nil, err
2710		}
2711
2712		setValueByPath(toObject, []string{"generatedImages"}, fromGeneratedImages)
2713	}
2714
2715	fromPositivePromptSafetyAttributes := getValueByPath(fromObject, []string{"positivePromptSafetyAttributes"})
2716	if fromPositivePromptSafetyAttributes != nil {
2717		fromPositivePromptSafetyAttributes, err = safetyAttributesFromMldev(ac, fromPositivePromptSafetyAttributes.(map[string]any), toObject)
2718		if err != nil {
2719			return nil, err
2720		}
2721
2722		setValueByPath(toObject, []string{"positivePromptSafetyAttributes"}, fromPositivePromptSafetyAttributes)
2723	}
2724
2725	return toObject, nil
2726}
2727
2728func endpointFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2729	toObject = make(map[string]any)
2730
2731	return toObject, nil
2732}
2733
2734func tunedModelInfoFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2735	toObject = make(map[string]any)
2736
2737	fromBaseModel := getValueByPath(fromObject, []string{"baseModel"})
2738	if fromBaseModel != nil {
2739		setValueByPath(toObject, []string{"baseModel"}, fromBaseModel)
2740	}
2741
2742	fromCreateTime := getValueByPath(fromObject, []string{"createTime"})
2743	if fromCreateTime != nil {
2744		setValueByPath(toObject, []string{"createTime"}, fromCreateTime)
2745	}
2746
2747	fromUpdateTime := getValueByPath(fromObject, []string{"updateTime"})
2748	if fromUpdateTime != nil {
2749		setValueByPath(toObject, []string{"updateTime"}, fromUpdateTime)
2750	}
2751
2752	return toObject, nil
2753}
2754
2755func modelFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2756	toObject = make(map[string]any)
2757
2758	fromName := getValueByPath(fromObject, []string{"name"})
2759	if fromName != nil {
2760		setValueByPath(toObject, []string{"name"}, fromName)
2761	}
2762
2763	fromDisplayName := getValueByPath(fromObject, []string{"displayName"})
2764	if fromDisplayName != nil {
2765		setValueByPath(toObject, []string{"displayName"}, fromDisplayName)
2766	}
2767
2768	fromDescription := getValueByPath(fromObject, []string{"description"})
2769	if fromDescription != nil {
2770		setValueByPath(toObject, []string{"description"}, fromDescription)
2771	}
2772
2773	fromVersion := getValueByPath(fromObject, []string{"version"})
2774	if fromVersion != nil {
2775		setValueByPath(toObject, []string{"version"}, fromVersion)
2776	}
2777
2778	fromTunedModelInfo := getValueByPath(fromObject, []string{"_self"})
2779	if fromTunedModelInfo != nil {
2780		fromTunedModelInfo, err = tunedModelInfoFromMldev(ac, fromTunedModelInfo.(map[string]any), toObject)
2781		if err != nil {
2782			return nil, err
2783		}
2784
2785		setValueByPath(toObject, []string{"tunedModelInfo"}, fromTunedModelInfo)
2786	}
2787
2788	fromInputTokenLimit := getValueByPath(fromObject, []string{"inputTokenLimit"})
2789	if fromInputTokenLimit != nil {
2790		setValueByPath(toObject, []string{"inputTokenLimit"}, fromInputTokenLimit)
2791	}
2792
2793	fromOutputTokenLimit := getValueByPath(fromObject, []string{"outputTokenLimit"})
2794	if fromOutputTokenLimit != nil {
2795		setValueByPath(toObject, []string{"outputTokenLimit"}, fromOutputTokenLimit)
2796	}
2797
2798	fromSupportedActions := getValueByPath(fromObject, []string{"supportedGenerationMethods"})
2799	if fromSupportedActions != nil {
2800		setValueByPath(toObject, []string{"supportedActions"}, fromSupportedActions)
2801	}
2802
2803	return toObject, nil
2804}
2805
2806func listModelsResponseFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2807	toObject = make(map[string]any)
2808
2809	fromNextPageToken := getValueByPath(fromObject, []string{"nextPageToken"})
2810	if fromNextPageToken != nil {
2811		setValueByPath(toObject, []string{"nextPageToken"}, fromNextPageToken)
2812	}
2813
2814	fromModels := getValueByPath(fromObject, []string{"_self"})
2815	if fromModels != nil {
2816		fromModels, err = tExtractModels(ac, fromModels)
2817		if err != nil {
2818			return nil, err
2819		}
2820
2821		fromModels, err = applyConverterToSlice(ac, fromModels.([]any), modelFromMldev)
2822		if err != nil {
2823			return nil, err
2824		}
2825
2826		setValueByPath(toObject, []string{"models"}, fromModels)
2827	}
2828
2829	return toObject, nil
2830}
2831
2832func deleteModelResponseFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2833	toObject = make(map[string]any)
2834
2835	return toObject, nil
2836}
2837
2838func countTokensResponseFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2839	toObject = make(map[string]any)
2840
2841	fromTotalTokens := getValueByPath(fromObject, []string{"totalTokens"})
2842	if fromTotalTokens != nil {
2843		setValueByPath(toObject, []string{"totalTokens"}, fromTotalTokens)
2844	}
2845
2846	fromCachedContentTokenCount := getValueByPath(fromObject, []string{"cachedContentTokenCount"})
2847	if fromCachedContentTokenCount != nil {
2848		setValueByPath(toObject, []string{"cachedContentTokenCount"}, fromCachedContentTokenCount)
2849	}
2850
2851	return toObject, nil
2852}
2853
2854func videoFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2855	toObject = make(map[string]any)
2856
2857	fromUri := getValueByPath(fromObject, []string{"video", "uri"})
2858	if fromUri != nil {
2859		setValueByPath(toObject, []string{"uri"}, fromUri)
2860	}
2861
2862	fromVideoBytes := getValueByPath(fromObject, []string{"video", "encodedVideo"})
2863	if fromVideoBytes != nil {
2864		fromVideoBytes, err = tBytes(ac, fromVideoBytes)
2865		if err != nil {
2866			return nil, err
2867		}
2868
2869		setValueByPath(toObject, []string{"videoBytes"}, fromVideoBytes)
2870	}
2871
2872	fromMimeType := getValueByPath(fromObject, []string{"encoding"})
2873	if fromMimeType != nil {
2874		setValueByPath(toObject, []string{"mimeType"}, fromMimeType)
2875	}
2876
2877	return toObject, nil
2878}
2879
2880func generatedVideoFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2881	toObject = make(map[string]any)
2882
2883	fromVideo := getValueByPath(fromObject, []string{"_self"})
2884	if fromVideo != nil {
2885		fromVideo, err = videoFromMldev(ac, fromVideo.(map[string]any), toObject)
2886		if err != nil {
2887			return nil, err
2888		}
2889
2890		setValueByPath(toObject, []string{"video"}, fromVideo)
2891	}
2892
2893	return toObject, nil
2894}
2895
2896func generateVideosResponseFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2897	toObject = make(map[string]any)
2898
2899	fromGeneratedVideos := getValueByPath(fromObject, []string{"generatedSamples"})
2900	if fromGeneratedVideos != nil {
2901		fromGeneratedVideos, err = applyConverterToSlice(ac, fromGeneratedVideos.([]any), generatedVideoFromMldev)
2902		if err != nil {
2903			return nil, err
2904		}
2905
2906		setValueByPath(toObject, []string{"generatedVideos"}, fromGeneratedVideos)
2907	}
2908
2909	fromRaiMediaFilteredCount := getValueByPath(fromObject, []string{"raiMediaFilteredCount"})
2910	if fromRaiMediaFilteredCount != nil {
2911		setValueByPath(toObject, []string{"raiMediaFilteredCount"}, fromRaiMediaFilteredCount)
2912	}
2913
2914	fromRaiMediaFilteredReasons := getValueByPath(fromObject, []string{"raiMediaFilteredReasons"})
2915	if fromRaiMediaFilteredReasons != nil {
2916		setValueByPath(toObject, []string{"raiMediaFilteredReasons"}, fromRaiMediaFilteredReasons)
2917	}
2918
2919	return toObject, nil
2920}
2921
2922func generateVideosOperationFromMldev(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2923	toObject = make(map[string]any)
2924
2925	fromName := getValueByPath(fromObject, []string{"name"})
2926	if fromName != nil {
2927		setValueByPath(toObject, []string{"name"}, fromName)
2928	}
2929
2930	fromMetadata := getValueByPath(fromObject, []string{"metadata"})
2931	if fromMetadata != nil {
2932		setValueByPath(toObject, []string{"metadata"}, fromMetadata)
2933	}
2934
2935	fromDone := getValueByPath(fromObject, []string{"done"})
2936	if fromDone != nil {
2937		setValueByPath(toObject, []string{"done"}, fromDone)
2938	}
2939
2940	fromError := getValueByPath(fromObject, []string{"error"})
2941	if fromError != nil {
2942		setValueByPath(toObject, []string{"error"}, fromError)
2943	}
2944
2945	fromResponse := getValueByPath(fromObject, []string{"response", "generateVideoResponse"})
2946	if fromResponse != nil {
2947		fromResponse, err = generateVideosResponseFromMldev(ac, fromResponse.(map[string]any), toObject)
2948		if err != nil {
2949			return nil, err
2950		}
2951
2952		setValueByPath(toObject, []string{"response"}, fromResponse)
2953	}
2954
2955	return toObject, nil
2956}
2957
2958func partFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
2959	toObject = make(map[string]any)
2960
2961	fromVideoMetadata := getValueByPath(fromObject, []string{"videoMetadata"})
2962	if fromVideoMetadata != nil {
2963		setValueByPath(toObject, []string{"videoMetadata"}, fromVideoMetadata)
2964	}
2965
2966	fromThought := getValueByPath(fromObject, []string{"thought"})
2967	if fromThought != nil {
2968		setValueByPath(toObject, []string{"thought"}, fromThought)
2969	}
2970
2971	fromCodeExecutionResult := getValueByPath(fromObject, []string{"codeExecutionResult"})
2972	if fromCodeExecutionResult != nil {
2973		setValueByPath(toObject, []string{"codeExecutionResult"}, fromCodeExecutionResult)
2974	}
2975
2976	fromExecutableCode := getValueByPath(fromObject, []string{"executableCode"})
2977	if fromExecutableCode != nil {
2978		setValueByPath(toObject, []string{"executableCode"}, fromExecutableCode)
2979	}
2980
2981	fromFileData := getValueByPath(fromObject, []string{"fileData"})
2982	if fromFileData != nil {
2983		setValueByPath(toObject, []string{"fileData"}, fromFileData)
2984	}
2985
2986	fromFunctionCall := getValueByPath(fromObject, []string{"functionCall"})
2987	if fromFunctionCall != nil {
2988		setValueByPath(toObject, []string{"functionCall"}, fromFunctionCall)
2989	}
2990
2991	fromFunctionResponse := getValueByPath(fromObject, []string{"functionResponse"})
2992	if fromFunctionResponse != nil {
2993		setValueByPath(toObject, []string{"functionResponse"}, fromFunctionResponse)
2994	}
2995
2996	fromInlineData := getValueByPath(fromObject, []string{"inlineData"})
2997	if fromInlineData != nil {
2998		setValueByPath(toObject, []string{"inlineData"}, fromInlineData)
2999	}
3000
3001	fromText := getValueByPath(fromObject, []string{"text"})
3002	if fromText != nil {
3003		setValueByPath(toObject, []string{"text"}, fromText)
3004	}
3005
3006	return toObject, nil
3007}
3008
3009func contentFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3010	toObject = make(map[string]any)
3011
3012	fromParts := getValueByPath(fromObject, []string{"parts"})
3013	if fromParts != nil {
3014		fromParts, err = applyConverterToSlice(ac, fromParts.([]any), partFromVertex)
3015		if err != nil {
3016			return nil, err
3017		}
3018
3019		setValueByPath(toObject, []string{"parts"}, fromParts)
3020	}
3021
3022	fromRole := getValueByPath(fromObject, []string{"role"})
3023	if fromRole != nil {
3024		setValueByPath(toObject, []string{"role"}, fromRole)
3025	}
3026
3027	return toObject, nil
3028}
3029
3030func citationMetadataFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3031	toObject = make(map[string]any)
3032
3033	fromCitations := getValueByPath(fromObject, []string{"citations"})
3034	if fromCitations != nil {
3035		setValueByPath(toObject, []string{"citations"}, fromCitations)
3036	}
3037
3038	return toObject, nil
3039}
3040
3041func candidateFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3042	toObject = make(map[string]any)
3043
3044	fromContent := getValueByPath(fromObject, []string{"content"})
3045	if fromContent != nil {
3046		fromContent, err = contentFromVertex(ac, fromContent.(map[string]any), toObject)
3047		if err != nil {
3048			return nil, err
3049		}
3050
3051		setValueByPath(toObject, []string{"content"}, fromContent)
3052	}
3053
3054	fromCitationMetadata := getValueByPath(fromObject, []string{"citationMetadata"})
3055	if fromCitationMetadata != nil {
3056		fromCitationMetadata, err = citationMetadataFromVertex(ac, fromCitationMetadata.(map[string]any), toObject)
3057		if err != nil {
3058			return nil, err
3059		}
3060
3061		setValueByPath(toObject, []string{"citationMetadata"}, fromCitationMetadata)
3062	}
3063
3064	fromFinishMessage := getValueByPath(fromObject, []string{"finishMessage"})
3065	if fromFinishMessage != nil {
3066		setValueByPath(toObject, []string{"finishMessage"}, fromFinishMessage)
3067	}
3068
3069	fromFinishReason := getValueByPath(fromObject, []string{"finishReason"})
3070	if fromFinishReason != nil {
3071		setValueByPath(toObject, []string{"finishReason"}, fromFinishReason)
3072	}
3073
3074	fromAvgLogprobs := getValueByPath(fromObject, []string{"avgLogprobs"})
3075	if fromAvgLogprobs != nil {
3076		setValueByPath(toObject, []string{"avgLogprobs"}, fromAvgLogprobs)
3077	}
3078
3079	fromGroundingMetadata := getValueByPath(fromObject, []string{"groundingMetadata"})
3080	if fromGroundingMetadata != nil {
3081		setValueByPath(toObject, []string{"groundingMetadata"}, fromGroundingMetadata)
3082	}
3083
3084	fromIndex := getValueByPath(fromObject, []string{"index"})
3085	if fromIndex != nil {
3086		setValueByPath(toObject, []string{"index"}, fromIndex)
3087	}
3088
3089	fromLogprobsResult := getValueByPath(fromObject, []string{"logprobsResult"})
3090	if fromLogprobsResult != nil {
3091		setValueByPath(toObject, []string{"logprobsResult"}, fromLogprobsResult)
3092	}
3093
3094	fromSafetyRatings := getValueByPath(fromObject, []string{"safetyRatings"})
3095	if fromSafetyRatings != nil {
3096		setValueByPath(toObject, []string{"safetyRatings"}, fromSafetyRatings)
3097	}
3098
3099	return toObject, nil
3100}
3101
3102func generateContentResponseFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3103	toObject = make(map[string]any)
3104
3105	fromCandidates := getValueByPath(fromObject, []string{"candidates"})
3106	if fromCandidates != nil {
3107		fromCandidates, err = applyConverterToSlice(ac, fromCandidates.([]any), candidateFromVertex)
3108		if err != nil {
3109			return nil, err
3110		}
3111
3112		setValueByPath(toObject, []string{"candidates"}, fromCandidates)
3113	}
3114
3115	fromCreateTime := getValueByPath(fromObject, []string{"createTime"})
3116	if fromCreateTime != nil {
3117		setValueByPath(toObject, []string{"createTime"}, fromCreateTime)
3118	}
3119
3120	fromResponseId := getValueByPath(fromObject, []string{"responseId"})
3121	if fromResponseId != nil {
3122		setValueByPath(toObject, []string{"responseId"}, fromResponseId)
3123	}
3124
3125	fromModelVersion := getValueByPath(fromObject, []string{"modelVersion"})
3126	if fromModelVersion != nil {
3127		setValueByPath(toObject, []string{"modelVersion"}, fromModelVersion)
3128	}
3129
3130	fromPromptFeedback := getValueByPath(fromObject, []string{"promptFeedback"})
3131	if fromPromptFeedback != nil {
3132		setValueByPath(toObject, []string{"promptFeedback"}, fromPromptFeedback)
3133	}
3134
3135	fromUsageMetadata := getValueByPath(fromObject, []string{"usageMetadata"})
3136	if fromUsageMetadata != nil {
3137		setValueByPath(toObject, []string{"usageMetadata"}, fromUsageMetadata)
3138	}
3139
3140	return toObject, nil
3141}
3142
3143func contentEmbeddingStatisticsFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3144	toObject = make(map[string]any)
3145
3146	fromTruncated := getValueByPath(fromObject, []string{"truncated"})
3147	if fromTruncated != nil {
3148		setValueByPath(toObject, []string{"truncated"}, fromTruncated)
3149	}
3150
3151	fromTokenCount := getValueByPath(fromObject, []string{"token_count"})
3152	if fromTokenCount != nil {
3153		setValueByPath(toObject, []string{"tokenCount"}, fromTokenCount)
3154	}
3155
3156	return toObject, nil
3157}
3158
3159func contentEmbeddingFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3160	toObject = make(map[string]any)
3161
3162	fromValues := getValueByPath(fromObject, []string{"values"})
3163	if fromValues != nil {
3164		setValueByPath(toObject, []string{"values"}, fromValues)
3165	}
3166
3167	fromStatistics := getValueByPath(fromObject, []string{"statistics"})
3168	if fromStatistics != nil {
3169		fromStatistics, err = contentEmbeddingStatisticsFromVertex(ac, fromStatistics.(map[string]any), toObject)
3170		if err != nil {
3171			return nil, err
3172		}
3173
3174		setValueByPath(toObject, []string{"statistics"}, fromStatistics)
3175	}
3176
3177	return toObject, nil
3178}
3179
3180func embedContentMetadataFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3181	toObject = make(map[string]any)
3182
3183	fromBillableCharacterCount := getValueByPath(fromObject, []string{"billableCharacterCount"})
3184	if fromBillableCharacterCount != nil {
3185		setValueByPath(toObject, []string{"billableCharacterCount"}, fromBillableCharacterCount)
3186	}
3187
3188	return toObject, nil
3189}
3190
3191func embedContentResponseFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3192	toObject = make(map[string]any)
3193
3194	fromEmbeddings := getValueByPath(fromObject, []string{"predictions[]", "embeddings"})
3195	if fromEmbeddings != nil {
3196		fromEmbeddings, err = applyConverterToSlice(ac, fromEmbeddings.([]any), contentEmbeddingFromVertex)
3197		if err != nil {
3198			return nil, err
3199		}
3200
3201		setValueByPath(toObject, []string{"embeddings"}, fromEmbeddings)
3202	}
3203
3204	fromMetadata := getValueByPath(fromObject, []string{"metadata"})
3205	if fromMetadata != nil {
3206		fromMetadata, err = embedContentMetadataFromVertex(ac, fromMetadata.(map[string]any), toObject)
3207		if err != nil {
3208			return nil, err
3209		}
3210
3211		setValueByPath(toObject, []string{"metadata"}, fromMetadata)
3212	}
3213
3214	return toObject, nil
3215}
3216
3217func imageFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3218	toObject = make(map[string]any)
3219
3220	fromGcsUri := getValueByPath(fromObject, []string{"gcsUri"})
3221	if fromGcsUri != nil {
3222		setValueByPath(toObject, []string{"gcsUri"}, fromGcsUri)
3223	}
3224
3225	fromImageBytes := getValueByPath(fromObject, []string{"bytesBase64Encoded"})
3226	if fromImageBytes != nil {
3227		fromImageBytes, err = tBytes(ac, fromImageBytes)
3228		if err != nil {
3229			return nil, err
3230		}
3231
3232		setValueByPath(toObject, []string{"imageBytes"}, fromImageBytes)
3233	}
3234
3235	fromMimeType := getValueByPath(fromObject, []string{"mimeType"})
3236	if fromMimeType != nil {
3237		setValueByPath(toObject, []string{"mimeType"}, fromMimeType)
3238	}
3239
3240	return toObject, nil
3241}
3242
3243func safetyAttributesFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3244	toObject = make(map[string]any)
3245
3246	fromCategories := getValueByPath(fromObject, []string{"safetyAttributes", "categories"})
3247	if fromCategories != nil {
3248		setValueByPath(toObject, []string{"categories"}, fromCategories)
3249	}
3250
3251	fromScores := getValueByPath(fromObject, []string{"safetyAttributes", "scores"})
3252	if fromScores != nil {
3253		setValueByPath(toObject, []string{"scores"}, fromScores)
3254	}
3255
3256	fromContentType := getValueByPath(fromObject, []string{"contentType"})
3257	if fromContentType != nil {
3258		setValueByPath(toObject, []string{"contentType"}, fromContentType)
3259	}
3260
3261	return toObject, nil
3262}
3263
3264func generatedImageFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3265	toObject = make(map[string]any)
3266
3267	fromImage := getValueByPath(fromObject, []string{"_self"})
3268	if fromImage != nil {
3269		fromImage, err = imageFromVertex(ac, fromImage.(map[string]any), toObject)
3270		if err != nil {
3271			return nil, err
3272		}
3273
3274		setValueByPath(toObject, []string{"image"}, fromImage)
3275	}
3276
3277	fromRaiFilteredReason := getValueByPath(fromObject, []string{"raiFilteredReason"})
3278	if fromRaiFilteredReason != nil {
3279		setValueByPath(toObject, []string{"raiFilteredReason"}, fromRaiFilteredReason)
3280	}
3281
3282	fromSafetyAttributes := getValueByPath(fromObject, []string{"_self"})
3283	if fromSafetyAttributes != nil {
3284		fromSafetyAttributes, err = safetyAttributesFromVertex(ac, fromSafetyAttributes.(map[string]any), toObject)
3285		if err != nil {
3286			return nil, err
3287		}
3288
3289		setValueByPath(toObject, []string{"safetyAttributes"}, fromSafetyAttributes)
3290	}
3291
3292	fromEnhancedPrompt := getValueByPath(fromObject, []string{"prompt"})
3293	if fromEnhancedPrompt != nil {
3294		setValueByPath(toObject, []string{"enhancedPrompt"}, fromEnhancedPrompt)
3295	}
3296
3297	return toObject, nil
3298}
3299
3300func generateImagesResponseFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3301	toObject = make(map[string]any)
3302
3303	fromGeneratedImages := getValueByPath(fromObject, []string{"predictions"})
3304	if fromGeneratedImages != nil {
3305		fromGeneratedImages, err = applyConverterToSlice(ac, fromGeneratedImages.([]any), generatedImageFromVertex)
3306		if err != nil {
3307			return nil, err
3308		}
3309
3310		setValueByPath(toObject, []string{"generatedImages"}, fromGeneratedImages)
3311	}
3312
3313	fromPositivePromptSafetyAttributes := getValueByPath(fromObject, []string{"positivePromptSafetyAttributes"})
3314	if fromPositivePromptSafetyAttributes != nil {
3315		fromPositivePromptSafetyAttributes, err = safetyAttributesFromVertex(ac, fromPositivePromptSafetyAttributes.(map[string]any), toObject)
3316		if err != nil {
3317			return nil, err
3318		}
3319
3320		setValueByPath(toObject, []string{"positivePromptSafetyAttributes"}, fromPositivePromptSafetyAttributes)
3321	}
3322
3323	return toObject, nil
3324}
3325
3326func editImageResponseFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3327	toObject = make(map[string]any)
3328
3329	fromGeneratedImages := getValueByPath(fromObject, []string{"predictions"})
3330	if fromGeneratedImages != nil {
3331		fromGeneratedImages, err = applyConverterToSlice(ac, fromGeneratedImages.([]any), generatedImageFromVertex)
3332		if err != nil {
3333			return nil, err
3334		}
3335
3336		setValueByPath(toObject, []string{"generatedImages"}, fromGeneratedImages)
3337	}
3338
3339	return toObject, nil
3340}
3341
3342func upscaleImageResponseFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3343	toObject = make(map[string]any)
3344
3345	fromGeneratedImages := getValueByPath(fromObject, []string{"predictions"})
3346	if fromGeneratedImages != nil {
3347		fromGeneratedImages, err = applyConverterToSlice(ac, fromGeneratedImages.([]any), generatedImageFromVertex)
3348		if err != nil {
3349			return nil, err
3350		}
3351
3352		setValueByPath(toObject, []string{"generatedImages"}, fromGeneratedImages)
3353	}
3354
3355	return toObject, nil
3356}
3357
3358func endpointFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3359	toObject = make(map[string]any)
3360
3361	fromName := getValueByPath(fromObject, []string{"endpoint"})
3362	if fromName != nil {
3363		setValueByPath(toObject, []string{"name"}, fromName)
3364	}
3365
3366	fromDeployedModelId := getValueByPath(fromObject, []string{"deployedModelId"})
3367	if fromDeployedModelId != nil {
3368		setValueByPath(toObject, []string{"deployedModelId"}, fromDeployedModelId)
3369	}
3370
3371	return toObject, nil
3372}
3373
3374func tunedModelInfoFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3375	toObject = make(map[string]any)
3376
3377	fromBaseModel := getValueByPath(fromObject, []string{"labels", "google-vertex-llm-tuning-base-model-id"})
3378	if fromBaseModel != nil {
3379		setValueByPath(toObject, []string{"baseModel"}, fromBaseModel)
3380	}
3381
3382	fromCreateTime := getValueByPath(fromObject, []string{"createTime"})
3383	if fromCreateTime != nil {
3384		setValueByPath(toObject, []string{"createTime"}, fromCreateTime)
3385	}
3386
3387	fromUpdateTime := getValueByPath(fromObject, []string{"updateTime"})
3388	if fromUpdateTime != nil {
3389		setValueByPath(toObject, []string{"updateTime"}, fromUpdateTime)
3390	}
3391
3392	return toObject, nil
3393}
3394
3395func modelFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3396	toObject = make(map[string]any)
3397
3398	fromName := getValueByPath(fromObject, []string{"name"})
3399	if fromName != nil {
3400		setValueByPath(toObject, []string{"name"}, fromName)
3401	}
3402
3403	fromDisplayName := getValueByPath(fromObject, []string{"displayName"})
3404	if fromDisplayName != nil {
3405		setValueByPath(toObject, []string{"displayName"}, fromDisplayName)
3406	}
3407
3408	fromDescription := getValueByPath(fromObject, []string{"description"})
3409	if fromDescription != nil {
3410		setValueByPath(toObject, []string{"description"}, fromDescription)
3411	}
3412
3413	fromVersion := getValueByPath(fromObject, []string{"versionId"})
3414	if fromVersion != nil {
3415		setValueByPath(toObject, []string{"version"}, fromVersion)
3416	}
3417
3418	fromEndpoints := getValueByPath(fromObject, []string{"deployedModels"})
3419	if fromEndpoints != nil {
3420		fromEndpoints, err = applyConverterToSlice(ac, fromEndpoints.([]any), endpointFromVertex)
3421		if err != nil {
3422			return nil, err
3423		}
3424
3425		setValueByPath(toObject, []string{"endpoints"}, fromEndpoints)
3426	}
3427
3428	fromLabels := getValueByPath(fromObject, []string{"labels"})
3429	if fromLabels != nil {
3430		setValueByPath(toObject, []string{"labels"}, fromLabels)
3431	}
3432
3433	fromTunedModelInfo := getValueByPath(fromObject, []string{"_self"})
3434	if fromTunedModelInfo != nil {
3435		fromTunedModelInfo, err = tunedModelInfoFromVertex(ac, fromTunedModelInfo.(map[string]any), toObject)
3436		if err != nil {
3437			return nil, err
3438		}
3439
3440		setValueByPath(toObject, []string{"tunedModelInfo"}, fromTunedModelInfo)
3441	}
3442
3443	return toObject, nil
3444}
3445
3446func listModelsResponseFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3447	toObject = make(map[string]any)
3448
3449	fromNextPageToken := getValueByPath(fromObject, []string{"nextPageToken"})
3450	if fromNextPageToken != nil {
3451		setValueByPath(toObject, []string{"nextPageToken"}, fromNextPageToken)
3452	}
3453
3454	fromModels := getValueByPath(fromObject, []string{"_self"})
3455	if fromModels != nil {
3456		fromModels, err = tExtractModels(ac, fromModels)
3457		if err != nil {
3458			return nil, err
3459		}
3460
3461		fromModels, err = applyConverterToSlice(ac, fromModels.([]any), modelFromVertex)
3462		if err != nil {
3463			return nil, err
3464		}
3465
3466		setValueByPath(toObject, []string{"models"}, fromModels)
3467	}
3468
3469	return toObject, nil
3470}
3471
3472func deleteModelResponseFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3473	toObject = make(map[string]any)
3474
3475	return toObject, nil
3476}
3477
3478func countTokensResponseFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3479	toObject = make(map[string]any)
3480
3481	fromTotalTokens := getValueByPath(fromObject, []string{"totalTokens"})
3482	if fromTotalTokens != nil {
3483		setValueByPath(toObject, []string{"totalTokens"}, fromTotalTokens)
3484	}
3485
3486	return toObject, nil
3487}
3488
3489func computeTokensResponseFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3490	toObject = make(map[string]any)
3491
3492	fromTokensInfo := getValueByPath(fromObject, []string{"tokensInfo"})
3493	if fromTokensInfo != nil {
3494		setValueByPath(toObject, []string{"tokensInfo"}, fromTokensInfo)
3495	}
3496
3497	return toObject, nil
3498}
3499
3500func videoFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3501	toObject = make(map[string]any)
3502
3503	fromUri := getValueByPath(fromObject, []string{"gcsUri"})
3504	if fromUri != nil {
3505		setValueByPath(toObject, []string{"uri"}, fromUri)
3506	}
3507
3508	fromVideoBytes := getValueByPath(fromObject, []string{"bytesBase64Encoded"})
3509	if fromVideoBytes != nil {
3510		fromVideoBytes, err = tBytes(ac, fromVideoBytes)
3511		if err != nil {
3512			return nil, err
3513		}
3514
3515		setValueByPath(toObject, []string{"videoBytes"}, fromVideoBytes)
3516	}
3517
3518	fromMimeType := getValueByPath(fromObject, []string{"mimeType"})
3519	if fromMimeType != nil {
3520		setValueByPath(toObject, []string{"mimeType"}, fromMimeType)
3521	}
3522
3523	return toObject, nil
3524}
3525
3526func generatedVideoFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3527	toObject = make(map[string]any)
3528
3529	fromVideo := getValueByPath(fromObject, []string{"_self"})
3530	if fromVideo != nil {
3531		fromVideo, err = videoFromVertex(ac, fromVideo.(map[string]any), toObject)
3532		if err != nil {
3533			return nil, err
3534		}
3535
3536		setValueByPath(toObject, []string{"video"}, fromVideo)
3537	}
3538
3539	return toObject, nil
3540}
3541
3542func generateVideosResponseFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3543	toObject = make(map[string]any)
3544
3545	fromGeneratedVideos := getValueByPath(fromObject, []string{"videos"})
3546	if fromGeneratedVideos != nil {
3547		fromGeneratedVideos, err = applyConverterToSlice(ac, fromGeneratedVideos.([]any), generatedVideoFromVertex)
3548		if err != nil {
3549			return nil, err
3550		}
3551
3552		setValueByPath(toObject, []string{"generatedVideos"}, fromGeneratedVideos)
3553	}
3554
3555	fromRaiMediaFilteredCount := getValueByPath(fromObject, []string{"raiMediaFilteredCount"})
3556	if fromRaiMediaFilteredCount != nil {
3557		setValueByPath(toObject, []string{"raiMediaFilteredCount"}, fromRaiMediaFilteredCount)
3558	}
3559
3560	fromRaiMediaFilteredReasons := getValueByPath(fromObject, []string{"raiMediaFilteredReasons"})
3561	if fromRaiMediaFilteredReasons != nil {
3562		setValueByPath(toObject, []string{"raiMediaFilteredReasons"}, fromRaiMediaFilteredReasons)
3563	}
3564
3565	return toObject, nil
3566}
3567
3568func generateVideosOperationFromVertex(ac *apiClient, fromObject map[string]any, parentObject map[string]any) (toObject map[string]any, err error) {
3569	toObject = make(map[string]any)
3570
3571	fromName := getValueByPath(fromObject, []string{"name"})
3572	if fromName != nil {
3573		setValueByPath(toObject, []string{"name"}, fromName)
3574	}
3575
3576	fromMetadata := getValueByPath(fromObject, []string{"metadata"})
3577	if fromMetadata != nil {
3578		setValueByPath(toObject, []string{"metadata"}, fromMetadata)
3579	}
3580
3581	fromDone := getValueByPath(fromObject, []string{"done"})
3582	if fromDone != nil {
3583		setValueByPath(toObject, []string{"done"}, fromDone)
3584	}
3585
3586	fromError := getValueByPath(fromObject, []string{"error"})
3587	if fromError != nil {
3588		setValueByPath(toObject, []string{"error"}, fromError)
3589	}
3590
3591	fromResponse := getValueByPath(fromObject, []string{"response"})
3592	if fromResponse != nil {
3593		fromResponse, err = generateVideosResponseFromVertex(ac, fromResponse.(map[string]any), toObject)
3594		if err != nil {
3595			return nil, err
3596		}
3597
3598		setValueByPath(toObject, []string{"response"}, fromResponse)
3599	}
3600
3601	return toObject, nil
3602}
3603
3604// Models provides methods for interacting with the available language models.
3605// You don't need to initiate this struct. Create a client instance via NewClient, and
3606// then access Models through client.Models field.
3607type Models struct {
3608	apiClient *apiClient
3609}
3610
3611func (m Models) generateContent(ctx context.Context, model string, contents []*Content, config *GenerateContentConfig) (*GenerateContentResponse, error) {
3612	parameterMap := make(map[string]any)
3613
3614	kwargs := map[string]any{"model": model, "contents": contents, "config": config}
3615	deepMarshal(kwargs, &parameterMap)
3616
3617	var httpOptions *HTTPOptions
3618	if config == nil {
3619		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, nil)
3620	} else {
3621		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, config.HTTPOptions)
3622		config.HTTPOptions = nil
3623	}
3624	var response = new(GenerateContentResponse)
3625	var responseMap map[string]any
3626	var fromConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
3627	var toConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
3628	if m.apiClient.clientConfig.Backend == BackendVertexAI {
3629		toConverter = generateContentParametersToVertex
3630		fromConverter = generateContentResponseFromVertex
3631	} else {
3632		toConverter = generateContentParametersToMldev
3633		fromConverter = generateContentResponseFromMldev
3634	}
3635
3636	body, err := toConverter(m.apiClient, parameterMap, nil)
3637	if err != nil {
3638		return nil, err
3639	}
3640	var path string
3641	var urlParams map[string]any
3642	if _, ok := body["_url"]; ok {
3643		urlParams = body["_url"].(map[string]any)
3644		delete(body, "_url")
3645	}
3646	if m.apiClient.clientConfig.Backend == BackendVertexAI {
3647		path, err = formatMap("{model}:generateContent", urlParams)
3648	} else {
3649		path, err = formatMap("{model}:generateContent", urlParams)
3650	}
3651	if err != nil {
3652		return nil, fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err)
3653	}
3654	if _, ok := body["_query"]; ok {
3655		query, err := createURLQuery(body["_query"].(map[string]any))
3656		if err != nil {
3657			return nil, err
3658		}
3659		path += "?" + query
3660		delete(body, "_query")
3661	}
3662
3663	if _, ok := body["config"]; ok {
3664		delete(body, "config")
3665	}
3666	responseMap, err = sendRequest(ctx, m.apiClient, path, http.MethodPost, body, httpOptions)
3667	if err != nil {
3668		return nil, err
3669	}
3670	responseMap, err = fromConverter(m.apiClient, responseMap, nil)
3671	if err != nil {
3672		return nil, err
3673	}
3674	err = mapToStruct(responseMap, response)
3675	if err != nil {
3676		return nil, err
3677	}
3678	return response, nil
3679}
3680
3681func (m Models) generateContentStream(ctx context.Context, model string, contents []*Content, config *GenerateContentConfig) iter.Seq2[*GenerateContentResponse, error] {
3682	parameterMap := make(map[string]any)
3683
3684	kwargs := map[string]any{"model": model, "contents": contents, "config": config}
3685	deepMarshal(kwargs, &parameterMap)
3686
3687	var httpOptions *HTTPOptions
3688	if config == nil {
3689		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, nil)
3690	} else {
3691		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, config.HTTPOptions)
3692		config.HTTPOptions = nil
3693	}
3694	var rs responseStream[GenerateContentResponse]
3695	var fromConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
3696	var toConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
3697	if m.apiClient.clientConfig.Backend == BackendVertexAI {
3698		toConverter = generateContentParametersToVertex
3699		fromConverter = generateContentResponseFromVertex
3700	} else {
3701		toConverter = generateContentParametersToMldev
3702		fromConverter = generateContentResponseFromMldev
3703	}
3704
3705	body, err := toConverter(m.apiClient, parameterMap, nil)
3706	if err != nil {
3707		return yieldErrorAndEndIterator[GenerateContentResponse](err)
3708	}
3709	var path string
3710	var urlParams map[string]any
3711	if _, ok := body["_url"]; ok {
3712		urlParams = body["_url"].(map[string]any)
3713		delete(body, "_url")
3714	}
3715	if m.apiClient.clientConfig.Backend == BackendVertexAI {
3716		path, err = formatMap("{model}:streamGenerateContent?alt=sse", urlParams)
3717	} else {
3718		path, err = formatMap("{model}:streamGenerateContent?alt=sse", urlParams)
3719	}
3720	if err != nil {
3721		return yieldErrorAndEndIterator[GenerateContentResponse](fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err))
3722	}
3723	delete(body, "_url")
3724	delete(body, "config")
3725	err = sendStreamRequest(ctx, m.apiClient, path, http.MethodPost, body, httpOptions, &rs)
3726	if err != nil {
3727		return yieldErrorAndEndIterator[GenerateContentResponse](err)
3728	}
3729	return iterateResponseStream(&rs, func(responseMap map[string]any) (*GenerateContentResponse, error) {
3730		responseMap, err := fromConverter(m.apiClient, responseMap, nil)
3731		if err != nil {
3732			return nil, err
3733		}
3734		var response = new(GenerateContentResponse)
3735		err = mapToStruct(responseMap, response)
3736		if err != nil {
3737			return nil, err
3738		}
3739		return response, nil
3740	})
3741}
3742
3743// EmbedContent generates embeddings for the provided contents using the specified model.
3744func (m Models) EmbedContent(ctx context.Context, model string, contents []*Content, config *EmbedContentConfig) (*EmbedContentResponse, error) {
3745	parameterMap := make(map[string]any)
3746
3747	kwargs := map[string]any{"model": model, "contents": contents, "config": config}
3748	deepMarshal(kwargs, &parameterMap)
3749
3750	var httpOptions *HTTPOptions
3751	if config == nil {
3752		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, nil)
3753	} else {
3754		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, config.HTTPOptions)
3755		config.HTTPOptions = nil
3756	}
3757	var response = new(EmbedContentResponse)
3758	var responseMap map[string]any
3759	var fromConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
3760	var toConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
3761	if m.apiClient.clientConfig.Backend == BackendVertexAI {
3762		toConverter = embedContentParametersToVertex
3763		fromConverter = embedContentResponseFromVertex
3764	} else {
3765		toConverter = embedContentParametersToMldev
3766		fromConverter = embedContentResponseFromMldev
3767	}
3768
3769	body, err := toConverter(m.apiClient, parameterMap, nil)
3770	if err != nil {
3771		return nil, err
3772	}
3773	var path string
3774	var urlParams map[string]any
3775	if _, ok := body["_url"]; ok {
3776		urlParams = body["_url"].(map[string]any)
3777		delete(body, "_url")
3778	}
3779	if m.apiClient.clientConfig.Backend == BackendVertexAI {
3780		path, err = formatMap("{model}:predict", urlParams)
3781	} else {
3782		path, err = formatMap("{model}:batchEmbedContents", urlParams)
3783	}
3784	if err != nil {
3785		return nil, fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err)
3786	}
3787	if _, ok := body["_query"]; ok {
3788		query, err := createURLQuery(body["_query"].(map[string]any))
3789		if err != nil {
3790			return nil, err
3791		}
3792		path += "?" + query
3793		delete(body, "_query")
3794	}
3795
3796	if _, ok := body["config"]; ok {
3797		delete(body, "config")
3798	}
3799	responseMap, err = sendRequest(ctx, m.apiClient, path, http.MethodPost, body, httpOptions)
3800	if err != nil {
3801		return nil, err
3802	}
3803	responseMap, err = fromConverter(m.apiClient, responseMap, nil)
3804	if err != nil {
3805		return nil, err
3806	}
3807	err = mapToStruct(responseMap, response)
3808	if err != nil {
3809		return nil, err
3810	}
3811	return response, nil
3812}
3813
3814func (m Models) generateImages(ctx context.Context, model string, prompt string, config *GenerateImagesConfig) (*GenerateImagesResponse, error) {
3815	parameterMap := make(map[string]any)
3816
3817	kwargs := map[string]any{"model": model, "prompt": prompt, "config": config}
3818	deepMarshal(kwargs, &parameterMap)
3819
3820	var httpOptions *HTTPOptions
3821	if config == nil {
3822		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, nil)
3823	} else {
3824		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, config.HTTPOptions)
3825		config.HTTPOptions = nil
3826	}
3827	var response = new(GenerateImagesResponse)
3828	var responseMap map[string]any
3829	var fromConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
3830	var toConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
3831	if m.apiClient.clientConfig.Backend == BackendVertexAI {
3832		toConverter = generateImagesParametersToVertex
3833		fromConverter = generateImagesResponseFromVertex
3834	} else {
3835		toConverter = generateImagesParametersToMldev
3836		fromConverter = generateImagesResponseFromMldev
3837	}
3838
3839	body, err := toConverter(m.apiClient, parameterMap, nil)
3840	if err != nil {
3841		return nil, err
3842	}
3843	var path string
3844	var urlParams map[string]any
3845	if _, ok := body["_url"]; ok {
3846		urlParams = body["_url"].(map[string]any)
3847		delete(body, "_url")
3848	}
3849	if m.apiClient.clientConfig.Backend == BackendVertexAI {
3850		path, err = formatMap("{model}:predict", urlParams)
3851	} else {
3852		path, err = formatMap("{model}:predict", urlParams)
3853	}
3854	if err != nil {
3855		return nil, fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err)
3856	}
3857	if _, ok := body["_query"]; ok {
3858		query, err := createURLQuery(body["_query"].(map[string]any))
3859		if err != nil {
3860			return nil, err
3861		}
3862		path += "?" + query
3863		delete(body, "_query")
3864	}
3865
3866	if _, ok := body["config"]; ok {
3867		delete(body, "config")
3868	}
3869	responseMap, err = sendRequest(ctx, m.apiClient, path, http.MethodPost, body, httpOptions)
3870	if err != nil {
3871		return nil, err
3872	}
3873	responseMap, err = fromConverter(m.apiClient, responseMap, nil)
3874	if err != nil {
3875		return nil, err
3876	}
3877	err = mapToStruct(responseMap, response)
3878	if err != nil {
3879		return nil, err
3880	}
3881	return response, nil
3882}
3883
3884func (m Models) editImage(ctx context.Context, model string, prompt string, referenceImages []*referenceImageAPI, config *EditImageConfig) (*EditImageResponse, error) {
3885	parameterMap := make(map[string]any)
3886
3887	kwargs := map[string]any{"model": model, "prompt": prompt, "referenceImages": referenceImages, "config": config}
3888	deepMarshal(kwargs, &parameterMap)
3889
3890	var httpOptions *HTTPOptions
3891	if config == nil {
3892		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, nil)
3893	} else {
3894		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, config.HTTPOptions)
3895		config.HTTPOptions = nil
3896	}
3897	var response = new(EditImageResponse)
3898	var responseMap map[string]any
3899	var fromConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
3900	var toConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
3901	if m.apiClient.clientConfig.Backend == BackendVertexAI {
3902		toConverter = editImageParametersToVertex
3903		fromConverter = editImageResponseFromVertex
3904	} else {
3905
3906		return nil, fmt.Errorf("method EditImage is only supported in the Vertex AI client. You can choose to use Vertex AI by setting ClientConfig.Backend to BackendVertexAI.")
3907
3908	}
3909
3910	body, err := toConverter(m.apiClient, parameterMap, nil)
3911	if err != nil {
3912		return nil, err
3913	}
3914	var path string
3915	var urlParams map[string]any
3916	if _, ok := body["_url"]; ok {
3917		urlParams = body["_url"].(map[string]any)
3918		delete(body, "_url")
3919	}
3920	if m.apiClient.clientConfig.Backend == BackendVertexAI {
3921		path, err = formatMap("{model}:predict", urlParams)
3922	} else {
3923		path, err = formatMap("None", urlParams)
3924	}
3925	if err != nil {
3926		return nil, fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err)
3927	}
3928	if _, ok := body["_query"]; ok {
3929		query, err := createURLQuery(body["_query"].(map[string]any))
3930		if err != nil {
3931			return nil, err
3932		}
3933		path += "?" + query
3934		delete(body, "_query")
3935	}
3936
3937	if _, ok := body["config"]; ok {
3938		delete(body, "config")
3939	}
3940	responseMap, err = sendRequest(ctx, m.apiClient, path, http.MethodPost, body, httpOptions)
3941	if err != nil {
3942		return nil, err
3943	}
3944	responseMap, err = fromConverter(m.apiClient, responseMap, nil)
3945	if err != nil {
3946		return nil, err
3947	}
3948	err = mapToStruct(responseMap, response)
3949	if err != nil {
3950		return nil, err
3951	}
3952	return response, nil
3953}
3954
3955func (m Models) upscaleImage(ctx context.Context, model string, image *Image, upscaleFactor string, config *upscaleImageAPIConfig) (*UpscaleImageResponse, error) {
3956	parameterMap := make(map[string]any)
3957
3958	kwargs := map[string]any{"model": model, "image": image, "upscaleFactor": upscaleFactor, "config": config}
3959	deepMarshal(kwargs, &parameterMap)
3960
3961	var httpOptions *HTTPOptions
3962	if config == nil {
3963		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, nil)
3964	} else {
3965		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, config.HTTPOptions)
3966		config.HTTPOptions = nil
3967	}
3968	var response = new(UpscaleImageResponse)
3969	var responseMap map[string]any
3970	var fromConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
3971	var toConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
3972	if m.apiClient.clientConfig.Backend == BackendVertexAI {
3973		toConverter = upscaleImageAPIParametersToVertex
3974		fromConverter = upscaleImageResponseFromVertex
3975	} else {
3976
3977		return nil, fmt.Errorf("method UpscaleImage is only supported in the Vertex AI client. You can choose to use Vertex AI by setting ClientConfig.Backend to BackendVertexAI.")
3978
3979	}
3980
3981	body, err := toConverter(m.apiClient, parameterMap, nil)
3982	if err != nil {
3983		return nil, err
3984	}
3985	var path string
3986	var urlParams map[string]any
3987	if _, ok := body["_url"]; ok {
3988		urlParams = body["_url"].(map[string]any)
3989		delete(body, "_url")
3990	}
3991	if m.apiClient.clientConfig.Backend == BackendVertexAI {
3992		path, err = formatMap("{model}:predict", urlParams)
3993	} else {
3994		path, err = formatMap("None", urlParams)
3995	}
3996	if err != nil {
3997		return nil, fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err)
3998	}
3999	if _, ok := body["_query"]; ok {
4000		query, err := createURLQuery(body["_query"].(map[string]any))
4001		if err != nil {
4002			return nil, err
4003		}
4004		path += "?" + query
4005		delete(body, "_query")
4006	}
4007
4008	if _, ok := body["config"]; ok {
4009		delete(body, "config")
4010	}
4011	responseMap, err = sendRequest(ctx, m.apiClient, path, http.MethodPost, body, httpOptions)
4012	if err != nil {
4013		return nil, err
4014	}
4015	responseMap, err = fromConverter(m.apiClient, responseMap, nil)
4016	if err != nil {
4017		return nil, err
4018	}
4019	err = mapToStruct(responseMap, response)
4020	if err != nil {
4021		return nil, err
4022	}
4023	return response, nil
4024}
4025
4026// Get retrieves a specific model resource by its name.
4027func (m Models) Get(ctx context.Context, model string, config *GetModelConfig) (*Model, error) {
4028	parameterMap := make(map[string]any)
4029
4030	kwargs := map[string]any{"model": model, "config": config}
4031	deepMarshal(kwargs, &parameterMap)
4032
4033	var httpOptions *HTTPOptions
4034	if config == nil {
4035		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, nil)
4036	} else {
4037		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, config.HTTPOptions)
4038		config.HTTPOptions = nil
4039	}
4040	var response = new(Model)
4041	var responseMap map[string]any
4042	var fromConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
4043	var toConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
4044	if m.apiClient.clientConfig.Backend == BackendVertexAI {
4045		toConverter = getModelParametersToVertex
4046		fromConverter = modelFromVertex
4047	} else {
4048		toConverter = getModelParametersToMldev
4049		fromConverter = modelFromMldev
4050	}
4051
4052	body, err := toConverter(m.apiClient, parameterMap, nil)
4053	if err != nil {
4054		return nil, err
4055	}
4056	var path string
4057	var urlParams map[string]any
4058	if _, ok := body["_url"]; ok {
4059		urlParams = body["_url"].(map[string]any)
4060		delete(body, "_url")
4061	}
4062	if m.apiClient.clientConfig.Backend == BackendVertexAI {
4063		path, err = formatMap("{name}", urlParams)
4064	} else {
4065		path, err = formatMap("{name}", urlParams)
4066	}
4067	if err != nil {
4068		return nil, fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err)
4069	}
4070	if _, ok := body["_query"]; ok {
4071		query, err := createURLQuery(body["_query"].(map[string]any))
4072		if err != nil {
4073			return nil, err
4074		}
4075		path += "?" + query
4076		delete(body, "_query")
4077	}
4078
4079	if _, ok := body["config"]; ok {
4080		delete(body, "config")
4081	}
4082	responseMap, err = sendRequest(ctx, m.apiClient, path, http.MethodGet, body, httpOptions)
4083	if err != nil {
4084		return nil, err
4085	}
4086	responseMap, err = fromConverter(m.apiClient, responseMap, nil)
4087	if err != nil {
4088		return nil, err
4089	}
4090	err = mapToStruct(responseMap, response)
4091	if err != nil {
4092		return nil, err
4093	}
4094	return response, nil
4095}
4096
4097func (m Models) list(ctx context.Context, config *ListModelsConfig) (*ListModelsResponse, error) {
4098	parameterMap := make(map[string]any)
4099
4100	kwargs := map[string]any{"config": config}
4101	deepMarshal(kwargs, &parameterMap)
4102
4103	var httpOptions *HTTPOptions
4104	if config == nil {
4105		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, nil)
4106	} else {
4107		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, config.HTTPOptions)
4108		config.HTTPOptions = nil
4109	}
4110	var response = new(ListModelsResponse)
4111	var responseMap map[string]any
4112	var fromConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
4113	var toConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
4114	if m.apiClient.clientConfig.Backend == BackendVertexAI {
4115		toConverter = listModelsParametersToVertex
4116		fromConverter = listModelsResponseFromVertex
4117	} else {
4118		toConverter = listModelsParametersToMldev
4119		fromConverter = listModelsResponseFromMldev
4120	}
4121
4122	body, err := toConverter(m.apiClient, parameterMap, nil)
4123	if err != nil {
4124		return nil, err
4125	}
4126	var path string
4127	var urlParams map[string]any
4128	if _, ok := body["_url"]; ok {
4129		urlParams = body["_url"].(map[string]any)
4130		delete(body, "_url")
4131	}
4132	if m.apiClient.clientConfig.Backend == BackendVertexAI {
4133		path, err = formatMap("{models_url}", urlParams)
4134	} else {
4135		path, err = formatMap("{models_url}", urlParams)
4136	}
4137	if err != nil {
4138		return nil, fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err)
4139	}
4140	if _, ok := body["_query"]; ok {
4141		query, err := createURLQuery(body["_query"].(map[string]any))
4142		if err != nil {
4143			return nil, err
4144		}
4145		path += "?" + query
4146		delete(body, "_query")
4147	}
4148
4149	if _, ok := body["config"]; ok {
4150		delete(body, "config")
4151	}
4152	responseMap, err = sendRequest(ctx, m.apiClient, path, http.MethodGet, body, httpOptions)
4153	if err != nil {
4154		return nil, err
4155	}
4156	responseMap, err = fromConverter(m.apiClient, responseMap, nil)
4157	if err != nil {
4158		return nil, err
4159	}
4160	err = mapToStruct(responseMap, response)
4161	if err != nil {
4162		return nil, err
4163	}
4164	return response, nil
4165}
4166
4167// Update updates a specific model resource.
4168func (m Models) Update(ctx context.Context, model string, config *UpdateModelConfig) (*Model, error) {
4169	parameterMap := make(map[string]any)
4170
4171	kwargs := map[string]any{"model": model, "config": config}
4172	deepMarshal(kwargs, &parameterMap)
4173
4174	var httpOptions *HTTPOptions
4175	if config == nil {
4176		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, nil)
4177	} else {
4178		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, config.HTTPOptions)
4179		config.HTTPOptions = nil
4180	}
4181	var response = new(Model)
4182	var responseMap map[string]any
4183	var fromConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
4184	var toConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
4185	if m.apiClient.clientConfig.Backend == BackendVertexAI {
4186		toConverter = updateModelParametersToVertex
4187		fromConverter = modelFromVertex
4188	} else {
4189		toConverter = updateModelParametersToMldev
4190		fromConverter = modelFromMldev
4191	}
4192
4193	body, err := toConverter(m.apiClient, parameterMap, nil)
4194	if err != nil {
4195		return nil, err
4196	}
4197	var path string
4198	var urlParams map[string]any
4199	if _, ok := body["_url"]; ok {
4200		urlParams = body["_url"].(map[string]any)
4201		delete(body, "_url")
4202	}
4203	if m.apiClient.clientConfig.Backend == BackendVertexAI {
4204		path, err = formatMap("{model}", urlParams)
4205	} else {
4206		path, err = formatMap("{name}", urlParams)
4207	}
4208	if err != nil {
4209		return nil, fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err)
4210	}
4211	if _, ok := body["_query"]; ok {
4212		query, err := createURLQuery(body["_query"].(map[string]any))
4213		if err != nil {
4214			return nil, err
4215		}
4216		path += "?" + query
4217		delete(body, "_query")
4218	}
4219
4220	if _, ok := body["config"]; ok {
4221		delete(body, "config")
4222	}
4223	responseMap, err = sendRequest(ctx, m.apiClient, path, http.MethodPatch, body, httpOptions)
4224	if err != nil {
4225		return nil, err
4226	}
4227	responseMap, err = fromConverter(m.apiClient, responseMap, nil)
4228	if err != nil {
4229		return nil, err
4230	}
4231	err = mapToStruct(responseMap, response)
4232	if err != nil {
4233		return nil, err
4234	}
4235	return response, nil
4236}
4237
4238// Delete deletes a specific model resource by its name.
4239func (m Models) Delete(ctx context.Context, model string, config *DeleteModelConfig) (*DeleteModelResponse, error) {
4240	parameterMap := make(map[string]any)
4241
4242	kwargs := map[string]any{"model": model, "config": config}
4243	deepMarshal(kwargs, &parameterMap)
4244
4245	var httpOptions *HTTPOptions
4246	if config == nil {
4247		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, nil)
4248	} else {
4249		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, config.HTTPOptions)
4250		config.HTTPOptions = nil
4251	}
4252	var response = new(DeleteModelResponse)
4253	var responseMap map[string]any
4254	var fromConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
4255	var toConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
4256	if m.apiClient.clientConfig.Backend == BackendVertexAI {
4257		toConverter = deleteModelParametersToVertex
4258		fromConverter = deleteModelResponseFromVertex
4259	} else {
4260		toConverter = deleteModelParametersToMldev
4261		fromConverter = deleteModelResponseFromMldev
4262	}
4263
4264	body, err := toConverter(m.apiClient, parameterMap, nil)
4265	if err != nil {
4266		return nil, err
4267	}
4268	var path string
4269	var urlParams map[string]any
4270	if _, ok := body["_url"]; ok {
4271		urlParams = body["_url"].(map[string]any)
4272		delete(body, "_url")
4273	}
4274	if m.apiClient.clientConfig.Backend == BackendVertexAI {
4275		path, err = formatMap("{name}", urlParams)
4276	} else {
4277		path, err = formatMap("{name}", urlParams)
4278	}
4279	if err != nil {
4280		return nil, fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err)
4281	}
4282	if _, ok := body["_query"]; ok {
4283		query, err := createURLQuery(body["_query"].(map[string]any))
4284		if err != nil {
4285			return nil, err
4286		}
4287		path += "?" + query
4288		delete(body, "_query")
4289	}
4290
4291	if _, ok := body["config"]; ok {
4292		delete(body, "config")
4293	}
4294	responseMap, err = sendRequest(ctx, m.apiClient, path, http.MethodDelete, body, httpOptions)
4295	if err != nil {
4296		return nil, err
4297	}
4298	responseMap, err = fromConverter(m.apiClient, responseMap, nil)
4299	if err != nil {
4300		return nil, err
4301	}
4302	err = mapToStruct(responseMap, response)
4303	if err != nil {
4304		return nil, err
4305	}
4306	return response, nil
4307}
4308
4309// CountTokens counts the number of tokens in the provided contents.
4310func (m Models) CountTokens(ctx context.Context, model string, contents []*Content, config *CountTokensConfig) (*CountTokensResponse, error) {
4311	parameterMap := make(map[string]any)
4312
4313	kwargs := map[string]any{"model": model, "contents": contents, "config": config}
4314	deepMarshal(kwargs, &parameterMap)
4315
4316	var httpOptions *HTTPOptions
4317	if config == nil {
4318		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, nil)
4319	} else {
4320		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, config.HTTPOptions)
4321		config.HTTPOptions = nil
4322	}
4323	var response = new(CountTokensResponse)
4324	var responseMap map[string]any
4325	var fromConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
4326	var toConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
4327	if m.apiClient.clientConfig.Backend == BackendVertexAI {
4328		toConverter = countTokensParametersToVertex
4329		fromConverter = countTokensResponseFromVertex
4330	} else {
4331		toConverter = countTokensParametersToMldev
4332		fromConverter = countTokensResponseFromMldev
4333	}
4334
4335	body, err := toConverter(m.apiClient, parameterMap, nil)
4336	if err != nil {
4337		return nil, err
4338	}
4339	var path string
4340	var urlParams map[string]any
4341	if _, ok := body["_url"]; ok {
4342		urlParams = body["_url"].(map[string]any)
4343		delete(body, "_url")
4344	}
4345	if m.apiClient.clientConfig.Backend == BackendVertexAI {
4346		path, err = formatMap("{model}:countTokens", urlParams)
4347	} else {
4348		path, err = formatMap("{model}:countTokens", urlParams)
4349	}
4350	if err != nil {
4351		return nil, fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err)
4352	}
4353	if _, ok := body["_query"]; ok {
4354		query, err := createURLQuery(body["_query"].(map[string]any))
4355		if err != nil {
4356			return nil, err
4357		}
4358		path += "?" + query
4359		delete(body, "_query")
4360	}
4361
4362	if _, ok := body["config"]; ok {
4363		delete(body, "config")
4364	}
4365	responseMap, err = sendRequest(ctx, m.apiClient, path, http.MethodPost, body, httpOptions)
4366	if err != nil {
4367		return nil, err
4368	}
4369	responseMap, err = fromConverter(m.apiClient, responseMap, nil)
4370	if err != nil {
4371		return nil, err
4372	}
4373	err = mapToStruct(responseMap, response)
4374	if err != nil {
4375		return nil, err
4376	}
4377	return response, nil
4378}
4379
4380// ComputeTokens computes the number of tokens for the provided contents.
4381func (m Models) ComputeTokens(ctx context.Context, model string, contents []*Content, config *ComputeTokensConfig) (*ComputeTokensResponse, error) {
4382	parameterMap := make(map[string]any)
4383
4384	kwargs := map[string]any{"model": model, "contents": contents, "config": config}
4385	deepMarshal(kwargs, &parameterMap)
4386
4387	var httpOptions *HTTPOptions
4388	if config == nil {
4389		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, nil)
4390	} else {
4391		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, config.HTTPOptions)
4392		config.HTTPOptions = nil
4393	}
4394	var response = new(ComputeTokensResponse)
4395	var responseMap map[string]any
4396	var fromConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
4397	var toConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
4398	if m.apiClient.clientConfig.Backend == BackendVertexAI {
4399		toConverter = computeTokensParametersToVertex
4400		fromConverter = computeTokensResponseFromVertex
4401	} else {
4402
4403		return nil, fmt.Errorf("method ComputeTokens is only supported in the Vertex AI client. You can choose to use Vertex AI by setting ClientConfig.Backend to BackendVertexAI.")
4404
4405	}
4406
4407	body, err := toConverter(m.apiClient, parameterMap, nil)
4408	if err != nil {
4409		return nil, err
4410	}
4411	var path string
4412	var urlParams map[string]any
4413	if _, ok := body["_url"]; ok {
4414		urlParams = body["_url"].(map[string]any)
4415		delete(body, "_url")
4416	}
4417	if m.apiClient.clientConfig.Backend == BackendVertexAI {
4418		path, err = formatMap("{model}:computeTokens", urlParams)
4419	} else {
4420		path, err = formatMap("None", urlParams)
4421	}
4422	if err != nil {
4423		return nil, fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err)
4424	}
4425	if _, ok := body["_query"]; ok {
4426		query, err := createURLQuery(body["_query"].(map[string]any))
4427		if err != nil {
4428			return nil, err
4429		}
4430		path += "?" + query
4431		delete(body, "_query")
4432	}
4433
4434	if _, ok := body["config"]; ok {
4435		delete(body, "config")
4436	}
4437	responseMap, err = sendRequest(ctx, m.apiClient, path, http.MethodPost, body, httpOptions)
4438	if err != nil {
4439		return nil, err
4440	}
4441	responseMap, err = fromConverter(m.apiClient, responseMap, nil)
4442	if err != nil {
4443		return nil, err
4444	}
4445	err = mapToStruct(responseMap, response)
4446	if err != nil {
4447		return nil, err
4448	}
4449	return response, nil
4450}
4451
4452// GenerateVideos creates a long-running video generation operation.
4453func (m Models) GenerateVideos(ctx context.Context, model string, prompt string, image *Image, config *GenerateVideosConfig) (*GenerateVideosOperation, error) {
4454	parameterMap := make(map[string]any)
4455
4456	kwargs := map[string]any{"model": model, "prompt": prompt, "image": image, "config": config}
4457	deepMarshal(kwargs, &parameterMap)
4458
4459	var httpOptions *HTTPOptions
4460	if config == nil {
4461		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, nil)
4462	} else {
4463		httpOptions = mergeHTTPOptions(m.apiClient.clientConfig, config.HTTPOptions)
4464		config.HTTPOptions = nil
4465	}
4466	var response = new(GenerateVideosOperation)
4467	var responseMap map[string]any
4468	var fromConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
4469	var toConverter func(*apiClient, map[string]any, map[string]any) (map[string]any, error)
4470	if m.apiClient.clientConfig.Backend == BackendVertexAI {
4471		toConverter = generateVideosParametersToVertex
4472		fromConverter = generateVideosOperationFromVertex
4473	} else {
4474		toConverter = generateVideosParametersToMldev
4475		fromConverter = generateVideosOperationFromMldev
4476	}
4477
4478	body, err := toConverter(m.apiClient, parameterMap, nil)
4479	if err != nil {
4480		return nil, err
4481	}
4482	var path string
4483	var urlParams map[string]any
4484	if _, ok := body["_url"]; ok {
4485		urlParams = body["_url"].(map[string]any)
4486		delete(body, "_url")
4487	}
4488	if m.apiClient.clientConfig.Backend == BackendVertexAI {
4489		path, err = formatMap("{model}:predictLongRunning", urlParams)
4490	} else {
4491		path, err = formatMap("{model}:predictLongRunning", urlParams)
4492	}
4493	if err != nil {
4494		return nil, fmt.Errorf("invalid url params: %#v.\n%w", urlParams, err)
4495	}
4496	if _, ok := body["_query"]; ok {
4497		query, err := createURLQuery(body["_query"].(map[string]any))
4498		if err != nil {
4499			return nil, err
4500		}
4501		path += "?" + query
4502		delete(body, "_query")
4503	}
4504
4505	if _, ok := body["config"]; ok {
4506		delete(body, "config")
4507	}
4508	responseMap, err = sendRequest(ctx, m.apiClient, path, http.MethodPost, body, httpOptions)
4509	if err != nil {
4510		return nil, err
4511	}
4512	responseMap, err = fromConverter(m.apiClient, responseMap, nil)
4513	if err != nil {
4514		return nil, err
4515	}
4516	err = mapToStruct(responseMap, response)
4517	if err != nil {
4518		return nil, err
4519	}
4520	return response, nil
4521}
4522
4523// GenerateContent generates content based on the provided model, contents, and configuration.
4524func (m Models) GenerateContent(ctx context.Context, model string, contents []*Content, config *GenerateContentConfig) (*GenerateContentResponse, error) {
4525	if config != nil {
4526		config.setDefaults()
4527	}
4528	return m.generateContent(ctx, model, contents, config)
4529}
4530
4531// GenerateContentStream generates a stream of content based on the provided model, contents, and configuration.
4532func (m Models) GenerateContentStream(ctx context.Context, model string, contents []*Content, config *GenerateContentConfig) iter.Seq2[*GenerateContentResponse, error] {
4533	if config != nil {
4534		config.setDefaults()
4535	}
4536	return m.generateContentStream(ctx, model, contents, config)
4537}
4538
4539// List retrieves a paginated list of models resources.
4540func (m Models) List(ctx context.Context, config *ListModelsConfig) (Page[Model], error) {
4541	listFunc := func(ctx context.Context, config map[string]any) ([]*Model, string, error) {
4542		var c ListModelsConfig
4543		if err := mapToStruct(config, &c); err != nil {
4544			return nil, "", err
4545		}
4546		if c.QueryBase == nil {
4547			c.QueryBase = Ptr(true)
4548		}
4549		if m.apiClient.clientConfig.Backend == BackendVertexAI && !*c.QueryBase {
4550			if c.Filter != "" {
4551				c.Filter += "&filter="
4552			}
4553			c.Filter += "labels.tune-type:*"
4554		}
4555		resp, err := m.list(ctx, &c)
4556		if err != nil {
4557			return nil, "", err
4558		}
4559		return resp.Models, resp.NextPageToken, nil
4560	}
4561	c := make(map[string]any)
4562	deepMarshal(config, &c)
4563	return newPage(ctx, "models", c, listFunc)
4564}
4565
4566// All retrieves all models resources.
4567//
4568// This method handles pagination internally, making multiple API calls as needed
4569// to fetch all entries. It returns an iterator that yields each cached
4570// content entry one by one. You do not need to manage pagination
4571// tokens or make multiple calls to retrieve all data.
4572func (m Models) All(ctx context.Context) iter.Seq2[*Model, error] {
4573	listFunc := func(ctx context.Context, config map[string]any) ([]*Model, string, error) {
4574		var c ListModelsConfig
4575		if err := mapToStruct(config, &c); err != nil {
4576			return nil, "", err
4577		}
4578		if c.QueryBase == nil {
4579			c.QueryBase = Ptr(true)
4580		}
4581
4582		resp, err := m.list(ctx, &c)
4583		if err != nil {
4584			return nil, "", err
4585		}
4586		return resp.Models, resp.NextPageToken, nil
4587	}
4588	p, err := newPage(ctx, "models", map[string]any{}, listFunc)
4589	if err != nil {
4590		return yieldErrorAndEndIterator[Model](err)
4591	}
4592	return p.all(ctx)
4593}
4594
4595// GenerateImages generates images based on the provided model, prompt, and configuration.
4596func (m Models) GenerateImages(ctx context.Context, model string, prompt string, config *GenerateImagesConfig) (*GenerateImagesResponse, error) {
4597	apiResponse, err := m.generateImages(ctx, model, prompt, config)
4598	if err != nil {
4599		return nil, err
4600	}
4601	var positivePromptSafetyAttributes *SafetyAttributes
4602	generatedImages := []*GeneratedImage{}
4603
4604	for _, generatedImage := range apiResponse.GeneratedImages {
4605		if generatedImage.SafetyAttributes != nil && generatedImage.SafetyAttributes.ContentType == "Positive Prompt" {
4606			positivePromptSafetyAttributes = generatedImage.SafetyAttributes
4607		} else {
4608			generatedImages = append(generatedImages, generatedImage)
4609		}
4610	}
4611
4612	return &GenerateImagesResponse{
4613		GeneratedImages:                generatedImages,
4614		PositivePromptSafetyAttributes: positivePromptSafetyAttributes,
4615	}, nil
4616}
4617
4618// UpscaleImage upscales an image using the specified model, image, upscale factor, and configuration.
4619func (m Models) UpscaleImage(ctx context.Context, model string, image *Image, upscaleFactor string, config *UpscaleImageConfig) (*UpscaleImageResponse, error) {
4620	// Convert to API config.
4621	apiConfig := &upscaleImageAPIConfig{Mode: "upscale", NumberOfImages: 1}
4622
4623	if config != nil {
4624		apiConfig.OutputMIMEType = config.OutputMIMEType
4625		apiConfig.OutputCompressionQuality = config.OutputCompressionQuality
4626		apiConfig.IncludeRAIReason = config.IncludeRAIReason
4627	}
4628
4629	return m.upscaleImage(ctx, model, image, upscaleFactor, apiConfig)
4630}
4631
4632// EditImage edits an image based on the provided model, prompt, reference images, and configuration.
4633func (m Models) EditImage(ctx context.Context, model, prompt string, referenceImages []ReferenceImage, config *EditImageConfig) (*EditImageResponse, error) {
4634	refImages := make([]*referenceImageAPI, len(referenceImages))
4635	for i, img := range referenceImages {
4636		refImages[i] = img.referenceImageAPI()
4637	}
4638	return m.editImage(ctx, model, prompt, refImages, config)
4639}