@@ -182,6 +182,69 @@ function Request-Response {
182182 [Parameter ()]
183183 [System.Collections.IDictionary ]$MCPOptionalHeaders ,
184184 # endregion Remote MCP
185+
186+ # region Code Interpreter
187+ [Parameter ()]
188+ [switch ]$UseCodeInterpreter ,
189+
190+ [Parameter (DontShow)]
191+ [string ]$CodeInterpreterType = ' code_interpreter' , # Always 'code_interpreter'
192+
193+ [Parameter ()]
194+ [string ]$ContainerId = ' auto' ,
195+
196+ [Parameter ()]
197+ [string []]$ContainerFileIds ,
198+ # endregion Code Interpreter
199+
200+ # region Image Generation
201+ [Parameter ()]
202+ [switch ]$UseImageGeneration ,
203+
204+ [Parameter (DontShow)]
205+ [string ]$ImageGenerationType = ' image_generation' , # Always 'image_generation'
206+
207+ [Parameter ()]
208+ [Completions (' gpt-image-1' )]
209+ [string ]$ImageGenerationModel ,
210+
211+ [Parameter ()]
212+ [Completions (' transparent' , ' opaque' , ' auto' )]
213+ [string ]$ImageGenerationBackGround = ' auto' ,
214+
215+ [Parameter ()]
216+ [string ]$ImageGenerationInputImageMask ,
217+
218+ [Parameter ()]
219+ [string ]$ImageGenerationModeration = ' auto' ,
220+
221+ [Parameter ()]
222+ [ValidateRange (0 , 100 )]
223+ [int ]$ImageGenerationOutputCompression ,
224+
225+ [Parameter ()]
226+ [ValidateSet (' png' , ' jpeg' , ' webp' )]
227+ [string ][LowerCaseTransformation ()]$ImageGenerationOutputFormat = ' png' ,
228+
229+ [Parameter ()]
230+ [ValidateRange (0 , 3 )]
231+ [int ]$ImageGenerationPartialImages ,
232+
233+ [Parameter ()]
234+ [ValidateSet (' low' , ' medium' , ' high' , ' auto' )]
235+ [string ][LowerCaseTransformation ()]$ImageGenerationQuality = ' auto' ,
236+
237+ [Parameter ()]
238+ [ValidateSet (' auto' , ' 1024x1024' , ' 1536x1024' , ' 1024x1536' )]
239+ [string ]$ImageGenerationSize = ' auto' ,
240+ # endregion Image Generation
241+
242+ # region Local shell
243+ [Parameter ()]
244+ [switch ]$UseLocalShell ,
245+
246+ [Parameter (DontShow)]
247+ [string ]$LocalShellType = ' local_shell' , # Always 'local_shell'
185248 # endregion Tools
186249
187250 [Parameter ()]
@@ -449,7 +512,7 @@ function Request-Response {
449512 $Tools += $Functions
450513 }
451514
452- # File Search
515+ # region File Search
453516 if ($UseFileSearch ) {
454517 if ($FileSearchVectorStoreIds.Count -eq 0 ) {
455518 Write-Error ' VectorStore Ids must be specified.'
@@ -481,7 +544,7 @@ function Request-Response {
481544 }
482545 }
483546
484- # Web Search
547+ # region Web Search
485548 if ($UseWebSearch ) {
486549 $UserLocation = @ {}
487550 $WebSearchTool = @ {
@@ -512,7 +575,7 @@ function Request-Response {
512575 $Tools += $WebSearchTool
513576 }
514577
515- # Computer Use
578+ # region Computer Use
516579 if ($UseComputerUse ) {
517580 # Computer Use should be used with 'truncation=auto'
518581 $PostBody.truncation = ' auto'
@@ -541,7 +604,7 @@ function Request-Response {
541604 $Tools += $ComputerUseTool
542605 }
543606
544- # Remote MCP
607+ # region Remote MCP
545608 if ($UseMCP ) {
546609 # Server label and URL are required.
547610 if ([string ]::IsNullOrWhiteSpace($MCPServerLabel )) {
@@ -587,6 +650,74 @@ function Request-Response {
587650 $Tools += $MCPTool
588651 }
589652
653+ # region Code Interpreter
654+ if ($UseCodeInterpreter ) {
655+ $CodeInterpreterTool = @ {
656+ type = $CodeInterpreterType
657+ container = $ContainerId
658+ }
659+ if ($ContainerId -eq ' auto' ) {
660+ # Auto container
661+ $CodeInterpreterTool.container = @ {type = ' auto' }
662+ if ($PSBoundParameters.ContainsKey (' ContainerFileIds' )) {
663+ $CodeInterpreterTool.container.file_ids = $ContainerFileIds
664+ }
665+ }
666+ $Tools += $CodeInterpreterTool
667+ }
668+
669+ # region Image Generation
670+ if ($UseImageGeneration ) {
671+ $ImageGenerationTool = @ {
672+ type = $ImageGenerationType
673+ }
674+ if ($PSBoundParameters.ContainsKey (' ImageGenerationModel' )) {
675+ $ImageGenerationTool.model = $ImageGenerationModel
676+ }
677+ if ($PSBoundParameters.ContainsKey (' ImageGenerationBackGround' )) {
678+ $ImageGenerationTool.background = $ImageGenerationBackGround
679+ }
680+ if ($PSBoundParameters.ContainsKey (' ImageGenerationInputImageMask' )) {
681+ if (Test-Path - LiteralPath $ImageGenerationInputImageMask - PathType Leaf) {
682+ # local file
683+ $image_url = Convert-ImageToDataURL $ImageGenerationInputImageMask
684+ $ImageGenerationTool.input_image_mask = @ {image_url = $image_url }
685+ }
686+ else {
687+ # File id
688+ $ImageGenerationTool.input_image_mask = @ {file_id = $ImageGenerationInputImageMask }
689+ }
690+ }
691+ if ($PSBoundParameters.ContainsKey (' ImageGenerationModeration' )) {
692+ $ImageGenerationTool.moderation = $ImageGenerationModeration
693+ }
694+ if ($PSBoundParameters.ContainsKey (' ImageGenerationOutputCompression' )) {
695+ $ImageGenerationTool.output_compression = $ImageGenerationOutputCompression
696+ }
697+ if ($PSBoundParameters.ContainsKey (' ImageGenerationOutputFormat' )) {
698+ $ImageGenerationTool.output_format = $ImageGenerationOutputFormat
699+ }
700+ if ($PSBoundParameters.ContainsKey (' ImageGenerationPartialImages' )) {
701+ $ImageGenerationTool.partial_images = $ImageGenerationPartialImages
702+ }
703+ if ($PSBoundParameters.ContainsKey (' ImageGenerationQuality' )) {
704+ $ImageGenerationTool.quality = $ImageGenerationQuality
705+ }
706+ if ($PSBoundParameters.ContainsKey (' ImageGenerationSize' )) {
707+ $ImageGenerationTool.size = $ImageGenerationSize
708+ }
709+
710+ $Tools += $ImageGenerationTool
711+ }
712+
713+ # region Local Shell
714+ if ($UseLocalShell ) {
715+ $LocalShellTool = @ {
716+ type = $LocalShellType
717+ }
718+ $Tools += $LocalShellTool
719+ }
720+
590721 if ($Tools.Count -gt 0 ) {
591722 $PostBody.tools = $Tools
592723 }
0 commit comments