@@ -69,6 +69,27 @@ internal JsonNode ContentToMldev(JsonNode fromObject, JsonObject parentObject) {
6969 return toObject ;
7070 }
7171
72+ internal JsonNode ContentToVertex ( JsonNode fromObject , JsonObject parentObject ) {
73+ JsonObject toObject = new JsonObject ( ) ;
74+
75+ if ( Common . GetValueByPath ( fromObject , new string [ ] { "parts" } ) != null ) {
76+ JsonArray keyArray = ( JsonArray ) Common . GetValueByPath ( fromObject , new string [ ] { "parts" } ) ;
77+ JsonArray result = new JsonArray ( ) ;
78+
79+ foreach ( var record in keyArray ) {
80+ result . Add ( PartToVertex ( JsonNode . Parse ( JsonSerializer . Serialize ( record ) ) , toObject ) ) ;
81+ }
82+ Common . SetValueByPath ( toObject , new string [ ] { "parts" } , result ) ;
83+ }
84+
85+ if ( Common . GetValueByPath ( fromObject , new string [ ] { "role" } ) != null ) {
86+ Common . SetValueByPath ( toObject , new string [ ] { "role" } ,
87+ Common . GetValueByPath ( fromObject , new string [ ] { "role" } ) ) ;
88+ }
89+
90+ return toObject ;
91+ }
92+
7293 internal JsonNode CreateCachedContentConfigToMldev ( JsonNode fromObject ,
7394 JsonObject parentObject ) {
7495 JsonObject toObject = new JsonObject ( ) ;
@@ -153,15 +174,23 @@ internal JsonNode CreateCachedContentConfigToVertex(JsonNode fromObject,
153174 }
154175
155176 if ( Common . GetValueByPath ( fromObject , new string [ ] { "contents" } ) != null ) {
156- Common . SetValueByPath (
157- parentObject , new string [ ] { "contents" } ,
158- Transformers . TContents ( Common . GetValueByPath ( fromObject , new string [ ] { "contents" } ) ) ) ;
177+ var keyList =
178+ Transformers . TContents ( Common . GetValueByPath ( fromObject , new string [ ] { "contents" } ) ) ;
179+ JsonArray result = new JsonArray ( ) ;
180+
181+ foreach ( var record in keyList ) {
182+ result . Add ( ContentToVertex ( JsonNode . Parse ( JsonSerializer . Serialize ( record ) ) , toObject ) ) ;
183+ }
184+ Common . SetValueByPath ( parentObject , new string [ ] { "contents" } , result ) ;
159185 }
160186
161187 if ( Common . GetValueByPath ( fromObject , new string [ ] { "systemInstruction" } ) != null ) {
162- Common . SetValueByPath ( parentObject , new string [ ] { "systemInstruction" } ,
163- Transformers . TContent ( Common . GetValueByPath (
164- fromObject , new string [ ] { "systemInstruction" } ) ) ) ;
188+ Common . SetValueByPath (
189+ parentObject , new string [ ] { "systemInstruction" } ,
190+ ContentToVertex (
191+ JsonNode . Parse ( JsonSerializer . Serialize ( Transformers . TContent (
192+ Common . GetValueByPath ( fromObject , new string [ ] { "systemInstruction" } ) ) ) ) ,
193+ toObject ) ) ;
165194 }
166195
167196 if ( Common . GetValueByPath ( fromObject , new string [ ] { "tools" } ) != null ) {
@@ -441,34 +470,19 @@ internal JsonNode GetCachedContentParametersToVertex(ApiClient apiClient, JsonNo
441470 return toObject ;
442471 }
443472
444- internal JsonNode GoogleMapsToMldev ( JsonNode fromObject , JsonObject parentObject ) {
445- JsonObject toObject = new JsonObject ( ) ;
446-
447- if ( ! Common . IsZero ( Common . GetValueByPath ( fromObject , new string [ ] { "authConfig" } ) ) ) {
448- throw new NotSupportedException ( "authConfig parameter is not supported in Gemini API." ) ;
449- }
450-
451- if ( Common . GetValueByPath ( fromObject , new string [ ] { "enableWidget" } ) != null ) {
452- Common . SetValueByPath ( toObject , new string [ ] { "enableWidget" } ,
453- Common . GetValueByPath ( fromObject , new string [ ] { "enableWidget" } ) ) ;
454- }
455-
456- return toObject ;
457- }
458-
459473 internal JsonNode GoogleSearchToMldev ( JsonNode fromObject , JsonObject parentObject ) {
460474 JsonObject toObject = new JsonObject ( ) ;
461475
462- if ( ! Common . IsZero ( Common . GetValueByPath ( fromObject , new string [ ] { "excludeDomains" } ) ) ) {
463- throw new NotSupportedException ( "excludeDomains parameter is not supported in Gemini API." ) ;
464- }
465-
466476 if ( ! Common . IsZero (
467477 Common . GetValueByPath ( fromObject , new string [ ] { "blockingConfidence" } ) ) ) {
468478 throw new NotSupportedException (
469479 "blockingConfidence parameter is not supported in Gemini API." ) ;
470480 }
471481
482+ if ( ! Common . IsZero ( Common . GetValueByPath ( fromObject , new string [ ] { "excludeDomains" } ) ) ) {
483+ throw new NotSupportedException ( "excludeDomains parameter is not supported in Gemini API." ) ;
484+ }
485+
472486 if ( Common . GetValueByPath ( fromObject , new string [ ] { "timeRangeFilter" } ) != null ) {
473487 Common . SetValueByPath (
474488 toObject , new string [ ] { "timeRangeFilter" } ,
@@ -657,6 +671,80 @@ internal JsonNode PartToMldev(JsonNode fromObject, JsonObject parentObject) {
657671 Common . GetValueByPath ( fromObject , new string [ ] { "videoMetadata" } ) ) ;
658672 }
659673
674+ if ( Common . GetValueByPath ( fromObject , new string [ ] { "partMetadata" } ) != null ) {
675+ Common . SetValueByPath ( toObject , new string [ ] { "partMetadata" } ,
676+ Common . GetValueByPath ( fromObject , new string [ ] { "partMetadata" } ) ) ;
677+ }
678+
679+ return toObject ;
680+ }
681+
682+ internal JsonNode PartToVertex ( JsonNode fromObject , JsonObject parentObject ) {
683+ JsonObject toObject = new JsonObject ( ) ;
684+
685+ if ( Common . GetValueByPath ( fromObject , new string [ ] { "mediaResolution" } ) != null ) {
686+ Common . SetValueByPath (
687+ toObject , new string [ ] { "mediaResolution" } ,
688+ Common . GetValueByPath ( fromObject , new string [ ] { "mediaResolution" } ) ) ;
689+ }
690+
691+ if ( Common . GetValueByPath ( fromObject , new string [ ] { "codeExecutionResult" } ) != null ) {
692+ Common . SetValueByPath (
693+ toObject , new string [ ] { "codeExecutionResult" } ,
694+ Common . GetValueByPath ( fromObject , new string [ ] { "codeExecutionResult" } ) ) ;
695+ }
696+
697+ if ( Common . GetValueByPath ( fromObject , new string [ ] { "executableCode" } ) != null ) {
698+ Common . SetValueByPath ( toObject , new string [ ] { "executableCode" } ,
699+ Common . GetValueByPath ( fromObject , new string [ ] { "executableCode" } ) ) ;
700+ }
701+
702+ if ( Common . GetValueByPath ( fromObject , new string [ ] { "fileData" } ) != null ) {
703+ Common . SetValueByPath ( toObject , new string [ ] { "fileData" } ,
704+ Common . GetValueByPath ( fromObject , new string [ ] { "fileData" } ) ) ;
705+ }
706+
707+ if ( Common . GetValueByPath ( fromObject , new string [ ] { "functionCall" } ) != null ) {
708+ Common . SetValueByPath ( toObject , new string [ ] { "functionCall" } ,
709+ Common . GetValueByPath ( fromObject , new string [ ] { "functionCall" } ) ) ;
710+ }
711+
712+ if ( Common . GetValueByPath ( fromObject , new string [ ] { "functionResponse" } ) != null ) {
713+ Common . SetValueByPath (
714+ toObject , new string [ ] { "functionResponse" } ,
715+ Common . GetValueByPath ( fromObject , new string [ ] { "functionResponse" } ) ) ;
716+ }
717+
718+ if ( Common . GetValueByPath ( fromObject , new string [ ] { "inlineData" } ) != null ) {
719+ Common . SetValueByPath ( toObject , new string [ ] { "inlineData" } ,
720+ Common . GetValueByPath ( fromObject , new string [ ] { "inlineData" } ) ) ;
721+ }
722+
723+ if ( Common . GetValueByPath ( fromObject , new string [ ] { "text" } ) != null ) {
724+ Common . SetValueByPath ( toObject , new string [ ] { "text" } ,
725+ Common . GetValueByPath ( fromObject , new string [ ] { "text" } ) ) ;
726+ }
727+
728+ if ( Common . GetValueByPath ( fromObject , new string [ ] { "thought" } ) != null ) {
729+ Common . SetValueByPath ( toObject , new string [ ] { "thought" } ,
730+ Common . GetValueByPath ( fromObject , new string [ ] { "thought" } ) ) ;
731+ }
732+
733+ if ( Common . GetValueByPath ( fromObject , new string [ ] { "thoughtSignature" } ) != null ) {
734+ Common . SetValueByPath (
735+ toObject , new string [ ] { "thoughtSignature" } ,
736+ Common . GetValueByPath ( fromObject , new string [ ] { "thoughtSignature" } ) ) ;
737+ }
738+
739+ if ( Common . GetValueByPath ( fromObject , new string [ ] { "videoMetadata" } ) != null ) {
740+ Common . SetValueByPath ( toObject , new string [ ] { "videoMetadata" } ,
741+ Common . GetValueByPath ( fromObject , new string [ ] { "videoMetadata" } ) ) ;
742+ }
743+
744+ if ( ! Common . IsZero ( Common . GetValueByPath ( fromObject , new string [ ] { "partMetadata" } ) ) ) {
745+ throw new NotSupportedException ( "partMetadata parameter is not supported in Vertex AI." ) ;
746+ }
747+
660748 return toObject ;
661749 }
662750
@@ -716,11 +804,8 @@ internal JsonNode ToolToMldev(JsonNode fromObject, JsonObject parentObject) {
716804 }
717805
718806 if ( Common . GetValueByPath ( fromObject , new string [ ] { "googleMaps" } ) != null ) {
719- Common . SetValueByPath (
720- toObject , new string [ ] { "googleMaps" } ,
721- GoogleMapsToMldev ( JsonNode . Parse ( JsonSerializer . Serialize ( Common . GetValueByPath (
722- fromObject , new string [ ] { "googleMaps" } ) ) ) ,
723- toObject ) ) ;
807+ Common . SetValueByPath ( toObject , new string [ ] { "googleMaps" } ,
808+ Common . GetValueByPath ( fromObject , new string [ ] { "googleMaps" } ) ) ;
724809 }
725810
726811 if ( Common . GetValueByPath ( fromObject , new string [ ] { "googleSearch" } ) != null ) {
0 commit comments