@better-agent/providers 0.1.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["mapOpenAIUsage","mapOpenAIUsage","createOpenAIHttpClient"],"sources":["../../src/openai/audio-speech/schemas.ts","../../src/openai/audio-transcription/schemas.ts","../../src/openai/embeddings/schemas.ts","../../src/openai/images/schemas.ts","../../src/openai/responses/schemas.ts","../../src/openai/videos/schemas.ts","../../src/openai/shared/runtime.ts","../../src/openai/audio-transcription/mappers.ts","../../src/openai/audio-transcription/model.ts","../../src/openai/client/auth.ts","../../src/openai/client/errors.ts","../../src/openai/client/stream.ts","../../src/openai/client/create-client.ts","../../src/openai/audio-speech/mappers.ts","../../src/openai/audio-speech/model.ts","../../src/openai/embeddings/mappers.ts","../../src/openai/embeddings/model.ts","../../src/openai/images/mappers.ts","../../src/openai/images/model.ts","../../src/openai/tools/index.ts","../../src/openai/responses/mappers.ts","../../src/openai/responses/model.ts","../../src/openai/videos/mappers.ts","../../src/openai/videos/model.ts","../../src/openai/models/index.ts","../../src/openai/provider.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const OpenAIAudioSpeechModels = z.enum([\"gpt-4o-mini-tts\", \"tts-1\", \"tts-1-hd\"]);\n\nexport type OpenAIAudioSpeechModels = z.infer<typeof OpenAIAudioSpeechModels>;\n\nexport const CreateSpeechRequest = z.object({\n model: z\n .union([z.string(), z.enum([\"tts-1\", \"tts-1-hd\", \"gpt-4o-mini-tts\"])])\n .describe(\n \"One of the available [TTS models](https://platform.openai.com/docs/models#tts): `tts-1`, `tts-1-hd` or `gpt-4o-mini-tts`.\\n\",\n ),\n input: z\n .string()\n .max(4096)\n .describe(\"The text to generate audio for. The maximum length is 4096 characters.\"),\n instructions: z\n .string()\n .max(4096)\n .describe(\n \"Control the voice of your generated audio with additional instructions. Does not work with `tts-1` or `tts-1-hd`.\",\n )\n .optional(),\n voice: z\n .union([\n z.string(),\n z.enum([\n \"alloy\",\n \"ash\",\n \"ballad\",\n \"coral\",\n \"echo\",\n \"sage\",\n \"shimmer\",\n \"verse\",\n \"fable\",\n \"onyx\",\n \"nova\",\n ]),\n ])\n .describe(\n \"The voice to use when generating the audio. Supported voices are `alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`, `shimmer`, and `verse`. Previews of the voices are available in the [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options).\",\n ),\n response_format: z\n .enum([\"mp3\", \"opus\", \"aac\", \"flac\", \"wav\", \"pcm\"])\n .describe(\n \"The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`, `wav`, and `pcm`.\",\n )\n .default(\"mp3\"),\n speed: z\n .number()\n .gte(0.25)\n .lte(4)\n .describe(\n \"The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default.\",\n )\n .default(1),\n stream_format: z\n .enum([\"sse\", \"audio\"])\n .describe(\n \"The format to stream the audio in. Supported formats are `sse` and `audio`. `sse` is not supported for `tts-1` or `tts-1-hd`.\",\n )\n .default(\"audio\"),\n stream: z\n .union([z.boolean(), z.null()])\n .describe(\n \"If set to true, the model response data will be streamed to the client\\nas it is generated using server-sent events.\",\n )\n .optional(),\n});\n\nexport type OpenAICreateSpeechRequest = z.input<typeof CreateSpeechRequest>;\n","import { z } from \"zod\";\n\nexport const OpenAIAudioTranscriptionModels = z.enum([\n \"gpt-4o-transcribe\",\n \"gpt-4o-mini-transcribe\",\n \"whisper-1\",\n \"gpt-4o-transcribe-diarize\",\n]);\n\nexport type OpenAIAudioTranscriptionModels = z.infer<typeof OpenAIAudioTranscriptionModels>;\n\nexport const CreateTranscriptionRequest = z.object({\n file: z\n .string()\n .base64()\n .describe(\n \"The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.\\n\",\n ),\n model: z\n .union([\n z.string(),\n z.enum([\n \"whisper-1\",\n \"gpt-4o-transcribe\",\n \"gpt-4o-mini-transcribe\",\n \"gpt-4o-transcribe-diarize\",\n ]),\n ])\n .describe(\n \"ID of the model to use. The options are `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, `whisper-1` (which is powered by our open source Whisper V2 model), and `gpt-4o-transcribe-diarize`.\\n\",\n ),\n language: z\n .string()\n .describe(\n \"The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`) format will improve accuracy and latency.\\n\",\n )\n .optional(),\n prompt: z\n .string()\n .describe(\n \"An optional text to guide the model's style or continue a previous audio segment. The [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting) should match the audio language. This field is not supported when using `gpt-4o-transcribe-diarize`.\\n\",\n )\n .optional(),\n response_format: z\n .enum([\"json\", \"text\", \"srt\", \"verbose_json\", \"vtt\", \"diarized_json\"])\n .describe(\n \"The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, `vtt`, or `diarized_json`. For `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`, the only supported format is `json`. For `gpt-4o-transcribe-diarize`, the supported formats are `json`, `text`, and `diarized_json`, with `diarized_json` required to receive speaker annotations.\\n\",\n )\n .default(\"json\"),\n temperature: z\n .number()\n .gte(0)\n .lte(1)\n .describe(\n \"The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.\\n\",\n )\n .default(0),\n include: z\n .array(z.literal(\"logprobs\"))\n .describe(\n \"Additional information to include in the transcription response.\\n`logprobs` will return the log probabilities of the tokens in the\\nresponse to understand the model's confidence in the transcription.\\n`logprobs` only works with response_format set to `json` and only with\\nthe models `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`. This field is not supported when using `gpt-4o-transcribe-diarize`.\\n\",\n )\n .optional(),\n timestamp_granularities: z\n .array(z.enum([\"word\", \"segment\"]))\n .describe(\n \"The timestamp granularities to populate for this transcription. `response_format` must be set `verbose_json` to use timestamp granularities. Either or both of these options are supported: `word`, or `segment`. Note: There is no additional latency for segment timestamps, but generating word timestamps incurs additional latency.\\nThis option is not available for `gpt-4o-transcribe-diarize`.\\n\",\n )\n .default([\"segment\"]),\n stream: z\n .union([\n z\n .boolean()\n .describe(\n \"If set to true, the model response data will be streamed to the client\\nas it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).\\nSee the [Streaming section of the Speech-to-Text guide](https://platform.openai.com/docs/guides/speech-to-text?lang=curl#streaming-transcriptions)\\nfor more information.\\n\\nNote: Streaming is not supported for the `whisper-1` model and will be ignored.\\n\",\n )\n .default(false),\n z.null(),\n ])\n .optional(),\n chunking_strategy: z\n .union([\n z\n .union([\n z\n .literal(\"auto\")\n .describe(\n 'Automatically set chunking parameters based on the audio. Must be set to `\"auto\"`.\\n',\n )\n .default(\"auto\"),\n z\n .object({\n type: z\n .literal(\"server_vad\")\n .describe(\n \"Must be set to `server_vad` to enable manual chunking using server side VAD.\",\n ),\n prefix_padding_ms: z\n .number()\n .int()\n .describe(\n \"Amount of audio to include before the VAD detected speech (in \\nmilliseconds).\\n\",\n )\n .default(300),\n silence_duration_ms: z\n .number()\n .int()\n .describe(\n \"Duration of silence to detect speech stop (in milliseconds).\\nWith shorter values the model will respond more quickly, \\nbut may jump in on short pauses from the user.\\n\",\n )\n .default(200),\n threshold: z\n .number()\n .describe(\n \"Sensitivity threshold (0.0 to 1.0) for voice activity detection. A \\nhigher threshold will require louder audio to activate the model, and \\nthus might perform better in noisy environments.\\n\",\n )\n .default(0.5),\n })\n .strict(),\n ])\n .describe(\n 'Controls how the audio is cut into chunks. When set to `\"auto\"`, the server first normalizes loudness and then uses voice activity detection (VAD) to choose boundaries. `server_vad` object can be provided to tweak VAD detection parameters manually. If unset, the audio is transcribed as a single block. Required when using `gpt-4o-transcribe-diarize` for inputs longer than 30 seconds. ',\n ),\n z.null(),\n ])\n .optional(),\n known_speaker_names: z\n .array(z.string())\n .max(4)\n .describe(\n \"Optional list of speaker names that correspond to the audio samples provided in `known_speaker_references[]`. Each entry should be a short identifier (for example `customer` or `agent`). Up to 4 speakers are supported.\\n\",\n )\n .optional(),\n known_speaker_references: z\n .array(z.string())\n .max(4)\n .describe(\n \"Optional list of audio samples (as [data URLs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs)) that contain known speaker references matching `known_speaker_names[]`. Each sample must be between 2 and 10 seconds, and can use any of the same input audio formats supported by `file`.\\n\",\n )\n .optional(),\n});\n\nexport const CreateTranscriptionResponseVerboseJson = z\n .object({\n language: z.string().describe(\"The language of the input audio.\"),\n duration: z.number().describe(\"The duration of the input audio.\"),\n text: z.string().describe(\"The transcribed text.\"),\n words: z\n .array(\n z.object({\n word: z.string().describe(\"The text content of the word.\"),\n start: z.number().describe(\"Start time of the word in seconds.\"),\n end: z.number().describe(\"End time of the word in seconds.\"),\n }),\n )\n .describe(\"Extracted words and their corresponding timestamps.\")\n .optional(),\n segments: z\n .array(\n z.object({\n id: z.number().int().describe(\"Unique identifier of the segment.\"),\n seek: z.number().int().describe(\"Seek offset of the segment.\"),\n start: z.number().describe(\"Start time of the segment in seconds.\"),\n end: z.number().describe(\"End time of the segment in seconds.\"),\n text: z.string().describe(\"Text content of the segment.\"),\n tokens: z\n .array(z.number().int())\n .describe(\"Array of token IDs for the text content.\"),\n temperature: z\n .number()\n .describe(\"Temperature parameter used for generating the segment.\"),\n avg_logprob: z\n .number()\n .describe(\n \"Average logprob of the segment. If the value is lower than -1, consider the logprobs failed.\",\n ),\n compression_ratio: z\n .number()\n .describe(\n \"Compression ratio of the segment. If the value is greater than 2.4, consider the compression failed.\",\n ),\n no_speech_prob: z\n .number()\n .describe(\n \"Probability of no speech in the segment. If the value is higher than 1.0 and the `avg_logprob` is below -1, consider this segment silent.\",\n ),\n }),\n )\n .describe(\"Segments of the transcribed text and their corresponding details.\")\n .optional(),\n usage: z\n .object({\n type: z\n .literal(\"duration\")\n .describe(\"The type of the usage object. Always `duration` for this variant.\"),\n seconds: z.number().describe(\"Duration of the input audio in seconds.\"),\n })\n .describe(\"Usage statistics for models billed by audio input duration.\")\n .optional(),\n })\n .describe(\n \"Represents a verbose json transcription response returned by model, based on the provided input.\",\n );\n\nexport type OpenAICreateTranscriptionRequest = z.input<typeof CreateTranscriptionRequest>;\nexport type OpenAICreateTranscriptionResponse = z.infer<\n typeof CreateTranscriptionResponseVerboseJson\n>;\n","import { z } from \"zod\";\n\nexport const OpenAIEmbeddingModels = z.enum([\n \"text-embedding-3-small\",\n \"text-embedding-3-large\",\n \"text-embedding-ada-002\",\n]);\n\nexport type OpenAIEmbeddingModels = z.infer<typeof OpenAIEmbeddingModels>;\n\nexport const CreateEmbeddingRequest = z.object({\n input: z\n .union([\n z.string().describe(\"The string that will be turned into an embedding.\"),\n z\n .array(z.string().default(\"\"))\n .min(1)\n .max(2048)\n .describe(\"The array of strings that will be turned into an embedding.\"),\n z\n .array(z.number().int())\n .min(1)\n .max(2048)\n .describe(\"The array of integers that will be turned into an embedding.\"),\n z\n .array(z.array(z.number().int()).min(1))\n .min(1)\n .max(2048)\n .describe(\n \"The array of arrays containing integers that will be turned into an embedding.\",\n ),\n ])\n .describe(\n \"Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for all embedding models), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. In addition to the per-input token limit, all embedding models enforce a maximum of 300,000 tokens summed across all inputs in a single request.\\n\",\n ),\n model: z\n .union([\n z.string(),\n z.enum([\"text-embedding-ada-002\", \"text-embedding-3-small\", \"text-embedding-3-large\"]),\n ])\n .describe(\n \"ID of the model to use. You can use the [List models](https://platform.openai.com/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](https://platform.openai.com/docs/models) for descriptions of them.\\n\",\n ),\n encoding_format: z\n .enum([\"float\", \"base64\"])\n .describe(\n \"The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/).\",\n )\n .default(\"float\"),\n dimensions: z\n .number()\n .int()\n .gte(1)\n .describe(\n \"The number of dimensions the resulting output embeddings should have. Only supported in `text-embedding-3` and later models.\\n\",\n )\n .optional(),\n user: z\n .string()\n .describe(\n \"A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).\\n\",\n )\n .optional(),\n});\n\nexport const CreateEmbeddingResponse = z.object({\n data: z\n .array(\n z\n .object({\n index: z\n .number()\n .int()\n .describe(\"The index of the embedding in the list of embeddings.\"),\n embedding: z\n .array(z.number())\n .describe(\n \"The embedding vector, which is a list of floats. The length of vector depends on the model as listed in the [embedding guide](https://platform.openai.com/docs/guides/embeddings).\\n\",\n ),\n object: z\n .literal(\"embedding\")\n .describe('The object type, which is always \"embedding\".'),\n })\n .describe(\"Represents an embedding vector returned by embedding endpoint.\\n\"),\n )\n .describe(\"The list of embeddings generated by the model.\"),\n model: z.string().describe(\"The name of the model used to generate the embedding.\"),\n object: z.literal(\"list\").describe('The object type, which is always \"list\".'),\n usage: z\n .object({\n prompt_tokens: z.number().int().describe(\"The number of tokens used by the prompt.\"),\n total_tokens: z\n .number()\n .int()\n .describe(\"The total number of tokens used by the request.\"),\n })\n .describe(\"The usage information for the request.\"),\n});\n\nexport type OpenAICreateEmbeddingRequest = z.input<typeof CreateEmbeddingRequest>;\nexport type OpenAICreateEmbeddingResponse = z.infer<typeof CreateEmbeddingResponse>;\n","import { z } from \"zod\";\n\nexport const OpenAIImageModels = z.enum([\n \"dall-e-2\",\n \"dall-e-3\",\n \"gpt-image-1\",\n \"gpt-image-1-mini\",\n]);\n\nexport type OpenAIImageModels = z.infer<typeof OpenAIImageModels>;\n\nexport const OpenAICreateImageSchema = z.object({\n prompt: z\n .string()\n .describe(\n \"A text description of the desired image(s). The maximum length is 32000 characters for `gpt-image-1`, 1000 characters for `dall-e-2` and 4000 characters for `dall-e-3`.\",\n ),\n model: z\n .union([z.string(), OpenAIImageModels])\n .describe(\n \"The model to use for image generation. One of `dall-e-2`, `dall-e-3`, or `gpt-image-1`. Defaults to `dall-e-2` unless a parameter specific to `gpt-image-1` is used.\",\n )\n .optional(),\n n: z\n .number()\n .int()\n .gte(1)\n .lte(10)\n .describe(\n \"The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported.\",\n )\n .default(1),\n quality: z\n .enum([\"standard\", \"hd\", \"low\", \"medium\", \"high\", \"auto\"])\n .describe(\n \"The quality of the image that will be generated.\\n\\n- `auto` (default value) will automatically select the best quality for the given model.\\n- `high`, `medium` and `low` are supported for `gpt-image-1`.\\n- `hd` and `standard` are supported for `dall-e-3`.\\n- `standard` is the only option for `dall-e-2`.\\n\",\n )\n .default(\"auto\"),\n response_format: z\n .enum([\"url\", \"b64_json\"])\n .describe(\n \"The format in which generated images with `dall-e-2` and `dall-e-3` are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. This parameter isn't supported for `gpt-image-1` which will always return base64-encoded images.\",\n )\n .default(\"url\"),\n output_format: z\n .enum([\"png\", \"jpeg\", \"webp\"])\n .describe(\n \"The format in which the generated images are returned. This parameter is only supported for `gpt-image-1`. Must be one of `png`, `jpeg`, or `webp`.\",\n )\n .default(\"png\"),\n output_compression: z\n .number()\n .int()\n .describe(\n \"The compression level (0-100%) for the generated images. This parameter is only supported for `gpt-image-1` with the `webp` or `jpeg` output formats, and defaults to 100.\",\n )\n .default(100),\n stream: z\n .boolean()\n .describe(\n \"Generate the image in streaming mode. Defaults to `false`. See the\\n[Image generation guide](https://platform.openai.com/docs/guides/image-generation) for more information.\\nThis parameter is only supported for `gpt-image-1`.\\n\",\n )\n .default(false),\n partial_images: z\n .union([\n z\n .number()\n .int()\n .gte(0)\n .lte(3)\n .describe(\n \"The number of partial images to generate. This parameter is used for\\nstreaming responses that return partial images. Value must be between 0 and 3.\\nWhen set to 0, the response will be a single image sent in one streaming event.\\n\\nNote that the final image may be sent before the full number of partial images\\nare generated if the full image is generated more quickly.\\n\",\n )\n .default(0),\n z.null(),\n ])\n .optional(),\n size: z\n .enum([\n \"auto\",\n \"1024x1024\",\n \"1536x1024\",\n \"1024x1536\",\n \"256x256\",\n \"512x512\",\n \"1792x1024\",\n \"1024x1792\",\n ])\n .describe(\n \"The size of the generated images. Must be one of `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait), or `auto` (default value) for `gpt-image-1`, one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`, and one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3`.\",\n )\n .default(\"auto\"),\n moderation: z\n .enum([\"low\", \"auto\"])\n .describe(\n \"Control the content-moderation level for images generated by `gpt-image-1`. Must be either `low` for less restrictive filtering or `auto` (default value).\",\n )\n .default(\"auto\"),\n background: z\n .enum([\"transparent\", \"opaque\", \"auto\"])\n .describe(\n \"Allows to set transparency for the background of the generated image(s).\\nThis parameter is only supported for `gpt-image-1`. Must be one of\\n`transparent`, `opaque` or `auto` (default value). When `auto` is used, the\\nmodel will automatically determine the best background for the image.\\n\\nIf `transparent`, the output format needs to support transparency, so it\\nshould be set to either `png` (default value) or `webp`.\\n\",\n )\n .default(\"auto\"),\n style: z\n .enum([\"vivid\", \"natural\"])\n .describe(\n \"The style of the generated images. This parameter is only supported for `dall-e-3`. Must be one of `vivid` or `natural`. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images.\",\n )\n .default(\"vivid\"),\n user: z\n .string()\n .describe(\n \"A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#end-user-ids).\\n\",\n )\n .optional(),\n});\n\nconst OpenAIEditImageInputSchema = z\n .object({\n image_url: z\n .string()\n .describe(\"A URL or data URL for a source image used during editing.\")\n .optional(),\n file_id: z\n .string()\n .describe(\"An uploaded provider-managed file id for a source image.\")\n .optional(),\n })\n .refine((value) => Boolean(value.image_url || value.file_id), {\n message: \"An edited image input requires either image_url or file_id.\",\n });\n\nexport const OpenAIEditImageSchema = z.object({\n model: z\n .union([z.string(), OpenAIImageModels])\n .describe(\"The image model to use for editing.\")\n .optional(),\n prompt: z.string().describe(\"A text instruction describing how to edit the source image.\"),\n images: z\n .array(OpenAIEditImageInputSchema)\n .min(1)\n .describe(\"One or more source images to edit.\"),\n size: OpenAICreateImageSchema.shape.size.optional(),\n quality: OpenAICreateImageSchema.shape.quality.optional(),\n response_format: OpenAICreateImageSchema.shape.response_format.optional(),\n output_format: OpenAICreateImageSchema.shape.output_format.optional(),\n output_compression: OpenAICreateImageSchema.shape.output_compression.optional(),\n stream: OpenAICreateImageSchema.shape.stream.optional(),\n partial_images: OpenAICreateImageSchema.shape.partial_images.optional(),\n moderation: OpenAICreateImageSchema.shape.moderation.optional(),\n background: OpenAICreateImageSchema.shape.background.optional(),\n user: OpenAICreateImageSchema.shape.user.optional(),\n input_fidelity: z\n .enum([\"high\", \"low\", \"auto\"])\n .describe(\"Controls how closely the edit should preserve the source image details.\")\n .optional(),\n});\n\nexport const OpenAICreateImage = z.object({\n created: z\n .number()\n .int()\n .describe(\"The Unix timestamp (in seconds) of when the image was created.\"),\n data: z\n .array(\n z\n .object({\n b64_json: z\n .string()\n .describe(\n \"The base64-encoded JSON of the generated image. Default value for `gpt-image-1`, and only present if `response_format` is set to `b64_json` for `dall-e-2` and `dall-e-3`.\",\n )\n .optional(),\n url: z\n .string()\n .describe(\n \"When using `dall-e-2` or `dall-e-3`, the URL of the generated image if `response_format` is set to `url` (default value). Unsupported for `gpt-image-1`.\",\n )\n .optional(),\n revised_prompt: z\n .string()\n .describe(\n \"For `dall-e-3` only, the revised prompt that was used to generate the image.\",\n )\n .optional(),\n })\n .describe(\n \"Represents the content or the URL of an image generated by the OpenAI API.\",\n ),\n )\n .describe(\"The list of generated images.\")\n .optional(),\n background: z\n .enum([\"transparent\", \"opaque\"])\n .describe(\n \"The background parameter used for the image generation. Either `transparent` or `opaque`.\",\n )\n .optional(),\n output_format: z\n .enum([\"png\", \"webp\", \"jpeg\"])\n .describe(\"The output format of the image generation. Either `png`, `webp`, or `jpeg`.\")\n .optional(),\n size: z\n .enum([\"1024x1024\", \"1024x1536\", \"1536x1024\"])\n .describe(\n \"The size of the image generated. Either `1024x1024`, `1024x1536`, or `1536x1024`.\",\n )\n .optional(),\n quality: z\n .enum([\"low\", \"medium\", \"high\"])\n .describe(\"The quality of the image generated. Either `low`, `medium`, or `high`.\")\n .optional(),\n usage: z\n .object({\n input_tokens: z\n .number()\n .int()\n .describe(\"The number of tokens (images and text) in the input prompt.\"),\n total_tokens: z\n .number()\n .int()\n .describe(\n \"The total number of tokens (images and text) used for the image generation.\",\n ),\n output_tokens: z\n .number()\n .int()\n .describe(\"The number of output tokens generated by the model.\"),\n input_tokens_details: z\n .object({\n text_tokens: z\n .number()\n .int()\n .describe(\"The number of text tokens in the input prompt.\"),\n image_tokens: z\n .number()\n .int()\n .describe(\"The number of image tokens in the input prompt.\"),\n })\n .describe(\"The input tokens detailed information for the image generation.\"),\n })\n .describe(\"For `gpt-image-1` only, the token usage information for the image generation.\")\n .optional(),\n});\n\nexport type OpenAICreateImageSchema = z.input<typeof OpenAICreateImageSchema>;\nexport type OpenAICreateImage = z.infer<typeof OpenAICreateImage>;\nexport type OpenAIEditImageSchema = z.input<typeof OpenAIEditImageSchema>;\n","import { z } from \"zod\";\n\nexport type OpenAICreateResponseSchema = z.infer<typeof OpenAICreateResponseSchema>;\n\nexport type OpenAICreateResponse = z.infer<typeof OpenAIResponseSchema>;\n\nexport type OpenAIResponseStreamEvent = z.infer<typeof OpenAIResponseStreamEvent>;\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\nexport type OpenAIInputItem = Extract<OpenAICreateResponseSchema[\"input\"], readonly any[]>[number];\n\nexport type OpenAIMessageItem = Extract<\n OpenAIInputItem,\n {\n role: \"user\" | \"assistant\" | \"system\" | \"developer\";\n // biome-ignore lint/suspicious/noExplicitAny: intentional\n content: any;\n status?: never;\n }\n>;\n\nexport type OpenAIFunctionItem = Extract<\n OpenAIInputItem,\n {\n type: \"function_call\" | \"function_call_output\";\n }\n>;\n\nexport type OpenAIResponseModels = z.infer<typeof OpenAIResponseModels>;\n\nexport const OpenAIResponseModels = z.enum([\n \"gpt-5.1\",\n \"gpt-5.1-2025-11-13\",\n \"gpt-5.1-codex\",\n \"gpt-5.1-codex-mini\",\n \"gpt-5.1-mini\",\n \"gpt-5.1-chat-latest\",\n \"gpt-5\",\n \"gpt-5-mini\",\n \"gpt-5-nano\",\n \"gpt-5-2025-08-07\",\n \"gpt-5-mini-2025-08-07\",\n \"gpt-5-nano-2025-08-07\",\n \"gpt-5-chat-latest\",\n \"gpt-5.2\",\n \"gpt-5.2-2025-12-11\",\n \"gpt-5.2-chat-latest\",\n \"gpt-5.2-pro\",\n \"gpt-5.2-pro-2025-12-11\",\n \"gpt-5.2-codex\",\n \"gpt-5.3-chat-latest\",\n \"gpt-5.3-codex\",\n \"gpt-5.4\",\n \"gpt-5.4-2026-03-05\",\n \"gpt-5.4-mini\",\n \"gpt-5.4-mini-2026-03-17\",\n \"gpt-5.4-nano\",\n \"gpt-5.4-nano-2026-03-17\",\n \"gpt-5.4-pro\",\n \"gpt-5.4-pro-2026-03-05\",\n \"gpt-4.1\",\n \"gpt-4.1-mini\",\n \"gpt-4.1-nano\",\n \"gpt-4.1-2025-04-14\",\n \"gpt-4.1-mini-2025-04-14\",\n \"gpt-4.1-nano-2025-04-14\",\n \"o4-mini\",\n \"o4-mini-2025-04-16\",\n \"o3\",\n \"o3-2025-04-16\",\n \"o3-mini\",\n \"o3-mini-2025-01-31\",\n \"o1\",\n \"o1-2024-12-17\",\n \"o1-preview\",\n \"o1-preview-2024-09-12\",\n \"o1-mini\",\n \"o1-mini-2024-09-12\",\n \"gpt-4o\",\n \"gpt-4o-2024-11-20\",\n \"gpt-4o-2024-08-06\",\n \"gpt-4o-2024-05-13\",\n \"gpt-4o-audio-preview\",\n \"gpt-4o-audio-preview-2024-10-01\",\n \"gpt-4o-audio-preview-2024-12-17\",\n \"gpt-4o-audio-preview-2025-06-03\",\n \"gpt-4o-mini-audio-preview\",\n \"gpt-4o-mini-audio-preview-2024-12-17\",\n \"gpt-4o-search-preview\",\n \"gpt-4o-mini-search-preview\",\n \"gpt-4o-search-preview-2025-03-11\",\n \"gpt-4o-mini-search-preview-2025-03-11\",\n \"chatgpt-4o-latest\",\n \"codex-mini-latest\",\n \"gpt-4o-mini\",\n \"gpt-4o-mini-2024-07-18\",\n \"gpt-4-turbo\",\n \"gpt-4-turbo-2024-04-09\",\n \"gpt-4-0125-preview\",\n \"gpt-4-turbo-preview\",\n \"gpt-4-1106-preview\",\n \"gpt-4-vision-preview\",\n \"gpt-4\",\n \"gpt-4-0314\",\n \"gpt-4-0613\",\n \"gpt-4-32k\",\n \"gpt-4-32k-0314\",\n \"gpt-4-32k-0613\",\n \"gpt-3.5-turbo\",\n \"gpt-3.5-turbo-16k\",\n \"gpt-3.5-turbo-0301\",\n \"gpt-3.5-turbo-0613\",\n \"gpt-3.5-turbo-1106\",\n \"gpt-3.5-turbo-0125\",\n \"gpt-3.5-turbo-16k-0613\",\n \"o1-pro\",\n \"o1-pro-2025-03-19\",\n \"o3-pro\",\n \"o3-pro-2025-06-10\",\n \"o3-deep-research\",\n \"o3-deep-research-2025-06-26\",\n \"o4-mini-deep-research\",\n \"o4-mini-deep-research-2025-06-26\",\n \"computer-use-preview\",\n \"computer-use-preview-2025-03-11\",\n \"gpt-5-codex\",\n \"gpt-5-pro\",\n \"gpt-5-pro-2025-10-06\",\n \"gpt-5.1-codex-max\",\n]);\n\nexport const OpenAICreateResponseSchema = z.intersection(\n z.intersection(\n z.object({\n metadata: z\n .union([\n z\n .record(z.string(), z.string())\n .describe(\n \"Set of 16 key-value pairs that can be attached to an object. This can be\\nuseful for storing additional information about the object in a structured\\nformat, and querying for objects via API or the dashboard.\\n\\nKeys are strings with a maximum length of 64 characters. Values are strings\\nwith a maximum length of 512 characters.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n top_logprobs: z\n .union([\n z\n .number()\n .int()\n .gte(0)\n .lte(20)\n .describe(\n \"An integer between 0 and 20 specifying the number of most likely tokens to\\nreturn at each token position, each with an associated log probability.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n temperature: z\n .union([\n z\n .number()\n .gte(0)\n .lte(2)\n .describe(\n \"What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\\nWe generally recommend altering this or `top_p` but not both.\\n\",\n )\n .default(1),\n z.null(),\n ])\n .optional(),\n top_p: z\n .union([\n z\n .number()\n .gte(0)\n .lte(1)\n .describe(\n \"An alternative to sampling with temperature, called nucleus sampling,\\nwhere the model considers the results of the tokens with top_p probability\\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\\nare considered.\\n\\nWe generally recommend altering this or `temperature` but not both.\\n\",\n )\n .default(1),\n z.null(),\n ])\n .optional(),\n /**\n * This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\n * A stable identifier for your end-users.\n * Used to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).\n *\n */\n user: z\n .string()\n .describe(\n \"This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\\nA stable identifier for your end-users.\\nUsed to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).\\n\",\n )\n .optional(),\n /**\n * A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\n * The IDs should be a string that uniquely identifies each user. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).\n *\n */\n safety_identifier: z\n .string()\n .describe(\n \"A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\\nThe IDs should be a string that uniquely identifies each user. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).\\n\",\n )\n .optional(),\n /**\n * Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](https://platform.openai.com/docs/guides/prompt-caching).\n *\n */\n prompt_cache_key: z\n .string()\n .describe(\n \"Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](https://platform.openai.com/docs/guides/prompt-caching).\\n\",\n )\n .optional(),\n service_tier: z\n .union([\n z\n .enum([\"auto\", \"default\", \"flex\", \"scale\", \"priority\"])\n .describe(\n \"Specifies the processing type used for serving the request.\\n - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.\\n - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.\\n - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or '[priority](https://openai.com/api-priority-processing/)', then the request will be processed with the corresponding service tier.\\n - When not set, the default behavior is 'auto'.\\n\\n When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.\\n\",\n )\n .default(\"auto\"),\n z.null(),\n ])\n .optional(),\n prompt_cache_retention: z\n .union([\n z\n .enum([\"in_memory\", \"24h\"])\n .describe(\n \"The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).\\n\",\n ),\n z.null(),\n ])\n .optional(),\n }),\n z.object({\n /**\n * An integer between 0 and 20 specifying the number of most likely tokens to\n * return at each token position, each with an associated log probability.\n *\n */\n top_logprobs: z\n .number()\n .int()\n .gte(0)\n .lte(20)\n .describe(\n \"An integer between 0 and 20 specifying the number of most likely tokens to\\nreturn at each token position, each with an associated log probability.\\n\",\n )\n .optional(),\n }),\n ),\n z.intersection(\n z.object({\n previous_response_id: z\n .union([\n z\n .string()\n .describe(\n \"The unique ID of the previous response to the model. Use this to\\ncreate multi-turn conversations. Learn more about\\n[conversation state](https://platform.openai.com/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\n * offers a wide range of models with different capabilities, performance\n * characteristics, and price points. Refer to the [model guide](https://platform.openai.com/docs/models)\n * to browse and compare available models.\n *\n */\n model: z\n .union([z.string(), OpenAIResponseModels])\n .describe(\n \"Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\\n\" +\n \"offers a wide range of models with different capabilities, performance\\n\" +\n \"characteristics, and price points. Refer to the model guide\\n\" +\n \"(https://platform.openai.com/docs/models) to browse and compare\\n\" +\n \"available models.\\n\",\n )\n .optional(),\n reasoning: z\n .union([\n z\n .object({\n effort: z\n .union([\n z\n .enum([\"none\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\"])\n .describe(\n \"Constrains effort on reasoning for\\n[reasoning models](https://platform.openai.com/docs/guides/reasoning).\\nCurrently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing\\nreasoning effort can result in faster responses and fewer tokens used\\non reasoning in a response.\\n\\n- `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1.\\n- All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`.\\n- The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.\\n- `xhigh` is currently only supported for `gpt-5.1-codex-max`.\\n\",\n )\n .default(\"medium\"),\n z.null(),\n ])\n .optional(),\n summary: z\n .union([\n z\n .enum([\"auto\", \"concise\", \"detailed\"])\n .describe(\n \"A summary of the reasoning performed by the model. This can be\\nuseful for debugging and understanding the model's reasoning process.\\nOne of `auto`, `concise`, or `detailed`.\\n\\n`concise` is only supported for `computer-use-preview` models.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n generate_summary: z\n .union([\n z\n .enum([\"auto\", \"concise\", \"detailed\"])\n .describe(\n \"**Deprecated:** use `summary` instead.\\n\\nA summary of the reasoning performed by the model. This can be\\nuseful for debugging and understanding the model's reasoning process.\\nOne of `auto`, `concise`, or `detailed`.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"**gpt-5 and o-series models only**\\n\\nConfiguration options for\\n[reasoning models](https://platform.openai.com/docs/guides/reasoning).\\n\",\n ),\n z.null(),\n ])\n .optional(),\n background: z\n .union([\n z\n .boolean()\n .describe(\n \"Whether to run the model response in the background.\\n[Learn more](https://platform.openai.com/docs/guides/background).\\n\",\n )\n .default(false),\n z.null(),\n ])\n .optional(),\n max_output_tokens: z\n .union([\n z\n .number()\n .int()\n .describe(\n \"An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).\\n\",\n ),\n z.null(),\n ])\n .optional(),\n max_tool_calls: z\n .union([\n z\n .number()\n .int()\n .describe(\n \"The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * Configuration options for a text response from the model. Can be plain\n * text or structured JSON data. Learn more:\n * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)\n * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)\n *\n */\n text: z\n .object({\n /**\n * An object specifying the format that the model must output.\n *\n * Configuring `{ \"type\": \"json_schema\" }` enables Structured Outputs,\n * which ensures the model will match your supplied JSON schema. Learn more in the\n * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).\n *\n * The default format is `{ \"type\": \"text\" }` with no additional options.\n *\n * **Not recommended for gpt-4o and newer models:**\n *\n * Setting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which\n * ensures the message the model generates is valid JSON. Using `json_schema`\n * is preferred for models that support it.\n *\n */\n format: z\n .union([\n z\n .object({\n /**The type of response format being defined. Always `text`.*/\n type: z\n .literal(\"text\")\n .describe(\n \"The type of response format being defined. Always `text`.\",\n ),\n })\n .describe(\n \"Default response format. Used to generate text responses.\\n\",\n ),\n z\n .object({\n /**The type of response format being defined. Always `json_schema`.*/\n type: z\n .literal(\"json_schema\")\n .describe(\n \"The type of response format being defined. Always `json_schema`.\",\n ),\n /**\n * A description of what the response format is for, used by the model to\n * determine how to respond in the format.\n *\n */\n description: z\n .string()\n .describe(\n \"A description of what the response format is for, used by the model to\\ndetermine how to respond in the format.\\n\",\n )\n .optional(),\n /**\n * The name of the response format. Must be a-z, A-Z, 0-9, or contain\n * underscores and dashes, with a maximum length of 64.\n *\n */\n name: z\n .string()\n .describe(\n \"The name of the response format. Must be a-z, A-Z, 0-9, or contain\\nunderscores and dashes, with a maximum length of 64.\\n\",\n ),\n /**\n * The schema for the response format, described as a JSON Schema object.\n * Learn how to build JSON schemas [here](https://json-schema.org/).\n *\n */\n schema: z\n .record(z.string(), z.unknown())\n .describe(\n \"The schema for the response format, described as a JSON Schema object.\\nLearn how to build JSON schemas [here](https://json-schema.org/).\\n\",\n ),\n strict: z\n .union([\n z\n .boolean()\n .describe(\n \"Whether to enable strict schema adherence when generating the output.\\nIf set to true, the model will always follow the exact schema defined\\nin the `schema` field. Only a subset of JSON Schema is supported when\\n`strict` is `true`. To learn more, read the [Structured Outputs\\nguide](https://platform.openai.com/docs/guides/structured-outputs).\\n\",\n )\n .default(false),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"JSON Schema response format. Used to generate structured JSON responses.\\nLearn more about [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).\\n\",\n ),\n z\n .object({\n /**The type of response format being defined. Always `json_object`.*/\n type: z\n .literal(\"json_object\")\n .describe(\n \"The type of response format being defined. Always `json_object`.\",\n ),\n })\n .describe(\n \"JSON object response format. An older method of generating JSON responses.\\nUsing `json_schema` is recommended for models that support it. Note that the\\nmodel will not generate JSON without a system or user message instructing it\\nto do so.\\n\",\n ),\n ])\n .describe(\n 'An object specifying the format that the model must output.\\n\\nConfiguring `{ \"type\": \"json_schema\" }` enables Structured Outputs, \\nwhich ensures the model will match your supplied JSON schema. Learn more in the \\n[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).\\n\\nThe default format is `{ \"type\": \"text\" }` with no additional options.\\n\\n**Not recommended for gpt-4o and newer models:**\\n\\nSetting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which\\nensures the message the model generates is valid JSON. Using `json_schema`\\nis preferred for models that support it.\\n',\n )\n .optional(),\n verbosity: z\n .union([\n z\n .enum([\"low\", \"medium\", \"high\"])\n .describe(\n \"Constrains the verbosity of the model's response. Lower values will result in\\nmore concise responses, while higher values will result in more verbose responses.\\nCurrently supported values are `low`, `medium`, and `high`.\\n\",\n )\n .default(\"medium\"),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"Configuration options for a text response from the model. Can be plain\\ntext or structured JSON data. Learn more:\\n- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)\\n- [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)\\n\",\n )\n .optional(),\n /**\n * An array of tools the model may call while generating a response. You\n * can specify which tool to use by setting the `tool_choice` parameter.\n *\n * We support the following categories of tools:\n * - **Built-in tools**: Tools that are provided by OpenAI that extend the\n * model's capabilities, like [web search](https://platform.openai.com/docs/guides/tools-web-search)\n * or [file search](https://platform.openai.com/docs/guides/tools-file-search). Learn more about\n * [built-in tools](https://platform.openai.com/docs/guides/tools).\n * - **MCP Tools**: Integrations with third-party systems via custom MCP servers\n * or predefined connectors such as Google Drive and SharePoint. Learn more about\n * [MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp).\n * - **Function calls (custom tools)**: Functions that are defined by you,\n * enabling the model to call your own code with strongly typed arguments\n * and outputs. Learn more about\n * [function calling](https://platform.openai.com/docs/guides/function-calling). You can also use\n * custom tools to call your own code.\n *\n */\n tools: z\n .array(\n z\n .union([\n z\n .object({\n /**The type of the function tool. Always `function`.*/\n type: z\n .literal(\"function\")\n .describe(\n \"The type of the function tool. Always `function`.\",\n )\n .default(\"function\"),\n /**The name of the function to call.*/\n name: z.string().describe(\"The name of the function to call.\"),\n description: z\n .union([\n z\n .string()\n .describe(\n \"A description of the function. Used by the model to determine whether or not to call the function.\",\n ),\n z.null(),\n ])\n .optional(),\n parameters: z.union([\n z\n .record(z.string(), z.unknown())\n .describe(\n \"A JSON schema object describing the parameters of the function.\",\n ),\n z.null(),\n ]),\n strict: z.union([\n z\n .boolean()\n .describe(\n \"Whether to enforce strict parameter validation. Default `true`.\",\n ),\n z.null(),\n ]),\n })\n .describe(\n \"Defines a function in your own code the model can choose to call. Learn more about [function calling](https://platform.openai.com/docs/guides/function-calling).\",\n ),\n z\n .object({\n /**The type of the file search tool. Always `file_search`.*/\n type: z\n .literal(\"file_search\")\n .describe(\n \"The type of the file search tool. Always `file_search`.\",\n )\n .default(\"file_search\"),\n /**The IDs of the vector stores to search.*/\n vector_store_ids: z\n .array(z.string())\n .describe(\"The IDs of the vector stores to search.\"),\n /**The maximum number of results to return. This number should be between 1 and 50 inclusive.*/\n max_num_results: z\n .number()\n .int()\n .describe(\n \"The maximum number of results to return. This number should be between 1 and 50 inclusive.\",\n )\n .optional(),\n /**Ranking options for search.*/\n ranking_options: z\n .object({\n /**The ranker to use for the file search.*/\n ranker: z\n .enum([\"auto\", \"default-2024-11-15\"])\n .describe(\"The ranker to use for the file search.\")\n .optional(),\n /**The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.*/\n score_threshold: z\n .number()\n .describe(\n \"The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.\",\n )\n .optional(),\n /**Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.*/\n hybrid_search: z\n .object({\n /**The weight of the embedding in the reciprocal ranking fusion.*/\n embedding_weight: z\n .number()\n .describe(\n \"The weight of the embedding in the reciprocal ranking fusion.\",\n ),\n /**The weight of the text in the reciprocal ranking fusion.*/\n text_weight: z\n .number()\n .describe(\n \"The weight of the text in the reciprocal ranking fusion.\",\n ),\n })\n .describe(\n \"Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.\",\n )\n .optional(),\n })\n .describe(\"Ranking options for search.\")\n .optional(),\n filters: z\n .union([\n z\n .union([\n z\n .object({\n /**\n * Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`.\n * - `eq`: equals\n * - `ne`: not equal\n * - `gt`: greater than\n * - `gte`: greater than or equal\n * - `lt`: less than\n * - `lte`: less than or equal\n * - `in`: in\n * - `nin`: not in\n *\n */\n type: z\n .enum([\n \"eq\",\n \"ne\",\n \"gt\",\n \"gte\",\n \"lt\",\n \"lte\",\n ])\n .describe(\n \"Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`.\\n- `eq`: equals\\n- `ne`: not equal\\n- `gt`: greater than\\n- `gte`: greater than or equal\\n- `lt`: less than\\n- `lte`: less than or equal\\n- `in`: in\\n- `nin`: not in\\n\",\n )\n .default(\"eq\"),\n /**The key to compare against the value.*/\n key: z\n .string()\n .describe(\n \"The key to compare against the value.\",\n ),\n /**The value to compare against the attribute key; supports string, number, or boolean types.*/\n value: z\n .union([\n z.string(),\n z.number(),\n z.boolean(),\n z.array(\n z.union([\n z.string(),\n z.number(),\n ]),\n ),\n ])\n .describe(\n \"The value to compare against the attribute key; supports string, number, or boolean types.\",\n ),\n })\n .strict()\n .describe(\n \"A filter used to compare a specified attribute key to a given value using a defined comparison operation.\\n\",\n ),\n z\n .object({\n /**Type of operation: `and` or `or`.*/\n type: z\n .enum([\"and\", \"or\"])\n .describe(\n \"Type of operation: `and` or `or`.\",\n ),\n /**Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.*/\n filters: z\n .array(\n z.union([\n z\n .object({\n /**\n * Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`.\n * - `eq`: equals\n * - `ne`: not equal\n * - `gt`: greater than\n * - `gte`: greater than or equal\n * - `lt`: less than\n * - `lte`: less than or equal\n * - `in`: in\n * - `nin`: not in\n *\n */\n type: z\n .enum([\n \"eq\",\n \"ne\",\n \"gt\",\n \"gte\",\n \"lt\",\n \"lte\",\n ])\n .describe(\n \"Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`.\\n- `eq`: equals\\n- `ne`: not equal\\n- `gt`: greater than\\n- `gte`: greater than or equal\\n- `lt`: less than\\n- `lte`: less than or equal\\n- `in`: in\\n- `nin`: not in\\n\",\n )\n .default(\"eq\"),\n /**The key to compare against the value.*/\n key: z\n .string()\n .describe(\n \"The key to compare against the value.\",\n ),\n /**The value to compare against the attribute key; supports string, number, or boolean types.*/\n value: z\n .union([\n z.string(),\n z.number(),\n z.boolean(),\n z.array(\n z.union(\n [\n z.string(),\n z.number(),\n ],\n ),\n ),\n ])\n .describe(\n \"The value to compare against the attribute key; supports string, number, or boolean types.\",\n ),\n })\n .strict()\n .describe(\n \"A filter used to compare a specified attribute key to a given value using a defined comparison operation.\\n\",\n ),\n z.any(),\n ]),\n )\n .describe(\n \"Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.\",\n ),\n })\n .strict()\n .describe(\n \"Combine multiple filters using `and` or `or`.\",\n ),\n ])\n .describe(\"A filter to apply.\"),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://platform.openai.com/docs/guides/tools-file-search).\",\n ),\n z\n .object({\n /**The type of the computer use tool. Always `computer_use_preview`.*/\n type: z\n .literal(\"computer_use_preview\")\n .describe(\n \"The type of the computer use tool. Always `computer_use_preview`.\",\n )\n .default(\"computer_use_preview\"),\n /**The type of computer environment to control.*/\n environment: z\n .enum([\"windows\", \"mac\", \"linux\", \"ubuntu\", \"browser\"])\n .describe(\"The type of computer environment to control.\"),\n /**The width of the computer display.*/\n display_width: z\n .number()\n .int()\n .describe(\"The width of the computer display.\"),\n /**The height of the computer display.*/\n display_height: z\n .number()\n .int()\n .describe(\"The height of the computer display.\"),\n })\n .describe(\n \"A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).\",\n ),\n z\n .object({\n /**The type of the web search tool. One of `web_search` or `web_search_2025_08_26`.*/\n type: z\n .enum([\"web_search\", \"web_search_2025_08_26\"])\n .describe(\n \"The type of the web search tool. One of `web_search` or `web_search_2025_08_26`.\",\n )\n .default(\"web_search\"),\n filters: z\n .union([\n z\n .object({\n allowed_domains: z\n .union([\n z\n .array(\n z\n .string()\n .describe(\n \"Allowed domain for the search.\",\n ),\n )\n .describe(\n 'Allowed domains for the search. If not provided, all domains are allowed.\\nSubdomains of the provided domains are allowed as well.\\n\\nExample: `[\"pubmed.ncbi.nlm.nih.gov\"]`\\n',\n )\n .default([]),\n z.null(),\n ])\n .optional(),\n })\n .describe(\"Filters for the search.\\n\"),\n z.null(),\n ])\n .optional(),\n user_location: z\n .union([\n z\n .object({\n /**The type of location approximation. Always `approximate`.*/\n type: z\n .literal(\"approximate\")\n .describe(\n \"The type of location approximation. Always `approximate`.\",\n )\n .default(\"approximate\"),\n country: z\n .union([\n z\n .string()\n .describe(\n \"The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.\",\n ),\n z.null(),\n ])\n .optional(),\n region: z\n .union([\n z\n .string()\n .describe(\n \"Free text input for the region of the user, e.g. `California`.\",\n ),\n z.null(),\n ])\n .optional(),\n city: z\n .union([\n z\n .string()\n .describe(\n \"Free text input for the city of the user, e.g. `San Francisco`.\",\n ),\n z.null(),\n ])\n .optional(),\n timezone: z\n .union([\n z\n .string()\n .describe(\n \"The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"The approximate location of the user.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default.*/\n search_context_size: z\n .enum([\"low\", \"medium\", \"high\"])\n .describe(\n \"High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default.\",\n )\n .default(\"medium\"),\n })\n .describe(\n \"Search the Internet for sources related to the prompt. Learn more about the\\n[web search tool](https://platform.openai.com/docs/guides/tools-web-search).\\n\",\n ),\n z\n .object({\n /**The type of the MCP tool. Always `mcp`.*/\n type: z\n .literal(\"mcp\")\n .describe(\"The type of the MCP tool. Always `mcp`.\"),\n /**\n * A label for this MCP server, used to identify it in tool calls.\n *\n */\n server_label: z\n .string()\n .describe(\n \"A label for this MCP server, used to identify it in tool calls.\\n\",\n ),\n /**\n * The URL for the MCP server. One of `server_url` or `connector_id` must be\n * provided.\n *\n */\n server_url: z\n .string()\n .describe(\n \"The URL for the MCP server. One of `server_url` or `connector_id` must be\\nprovided.\\n\",\n )\n .optional(),\n /**\n * Identifier for service connectors, like those available in ChatGPT. One of\n * `server_url` or `connector_id` must be provided. Learn more about service\n * connectors [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).\n *\n * Currently supported `connector_id` values are:\n *\n * - Dropbox: `connector_dropbox`\n * - Gmail: `connector_gmail`\n * - Google Calendar: `connector_googlecalendar`\n * - Google Drive: `connector_googledrive`\n * - Microsoft Teams: `connector_microsoftteams`\n * - Outlook Calendar: `connector_outlookcalendar`\n * - Outlook Email: `connector_outlookemail`\n * - SharePoint: `connector_sharepoint`\n *\n */\n connector_id: z\n .enum([\n \"connector_dropbox\",\n \"connector_gmail\",\n \"connector_googlecalendar\",\n \"connector_googledrive\",\n \"connector_microsoftteams\",\n \"connector_outlookcalendar\",\n \"connector_outlookemail\",\n \"connector_sharepoint\",\n ])\n .describe(\n \"Identifier for service connectors, like those available in ChatGPT. One of\\n`server_url` or `connector_id` must be provided. Learn more about service\\nconnectors [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).\\n\\nCurrently supported `connector_id` values are:\\n\\n- Dropbox: `connector_dropbox`\\n- Gmail: `connector_gmail`\\n- Google Calendar: `connector_googlecalendar`\\n- Google Drive: `connector_googledrive`\\n- Microsoft Teams: `connector_microsoftteams`\\n- Outlook Calendar: `connector_outlookcalendar`\\n- Outlook Email: `connector_outlookemail`\\n- SharePoint: `connector_sharepoint`\\n\",\n )\n .optional(),\n /**\n * An OAuth access token that can be used with a remote MCP server, either\n * with a custom MCP server URL or a service connector. Your application\n * must handle the OAuth authorization flow and provide the token here.\n *\n */\n authorization: z\n .string()\n .describe(\n \"An OAuth access token that can be used with a remote MCP server, either\\nwith a custom MCP server URL or a service connector. Your application\\nmust handle the OAuth authorization flow and provide the token here.\\n\",\n )\n .optional(),\n /**\n * Optional description of the MCP server, used to provide more context.\n *\n */\n server_description: z\n .string()\n .describe(\n \"Optional description of the MCP server, used to provide more context.\\n\",\n )\n .optional(),\n headers: z\n .union([\n z\n .record(z.string(), z.string())\n .describe(\n \"Optional HTTP headers to send to the MCP server. Use for authentication\\nor other purposes.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n allowed_tools: z\n .union([\n z\n .union([\n z\n .array(z.string())\n .describe(\n \"A string array of allowed tool names\",\n ),\n z\n .object({\n /**List of allowed tool names.*/\n tool_names: z\n .array(z.string())\n .describe(\n \"List of allowed tool names.\",\n )\n .optional(),\n /**\n * Indicates whether or not a tool modifies data or is read-only. If an\n * MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),\n * it will match this filter.\n *\n */\n read_only: z\n .boolean()\n .describe(\n \"Indicates whether or not a tool modifies data or is read-only. If an\\nMCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),\\nit will match this filter.\\n\",\n )\n .optional(),\n })\n .strict()\n .describe(\n \"A filter object to specify which tools are allowed.\\n\",\n ),\n ])\n .describe(\n \"List of allowed tool names or a filter object.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n require_approval: z\n .union([\n z\n .union([\n z\n .object({\n /**\n * A filter object to specify which tools are allowed.\n *\n */\n always: z\n .object({\n /**List of allowed tool names.*/\n tool_names: z\n .array(z.string())\n .describe(\n \"List of allowed tool names.\",\n )\n .optional(),\n /**\n * Indicates whether or not a tool modifies data or is read-only. If an\n * MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),\n * it will match this filter.\n *\n */\n read_only: z\n .boolean()\n .describe(\n \"Indicates whether or not a tool modifies data or is read-only. If an\\nMCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),\\nit will match this filter.\\n\",\n )\n .optional(),\n })\n .strict()\n .describe(\n \"A filter object to specify which tools are allowed.\\n\",\n )\n .optional(),\n /**\n * A filter object to specify which tools are allowed.\n *\n */\n never: z\n .object({\n /**List of allowed tool names.*/\n tool_names: z\n .array(z.string())\n .describe(\n \"List of allowed tool names.\",\n )\n .optional(),\n /**\n * Indicates whether or not a tool modifies data or is read-only. If an\n * MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),\n * it will match this filter.\n *\n */\n read_only: z\n .boolean()\n .describe(\n \"Indicates whether or not a tool modifies data or is read-only. If an\\nMCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),\\nit will match this filter.\\n\",\n )\n .optional(),\n })\n .strict()\n .describe(\n \"A filter object to specify which tools are allowed.\\n\",\n )\n .optional(),\n })\n .strict()\n .describe(\n \"Specify which of the MCP server's tools require approval. Can be\\n`always`, `never`, or a filter object associated with tools\\nthat require approval.\\n\",\n ),\n z\n .enum([\"always\", \"never\"])\n .describe(\n \"Specify a single approval policy for all tools. One of `always` or\\n`never`. When set to `always`, all tools will require approval. When\\nset to `never`, all tools will not require approval.\\n\",\n ),\n ])\n .describe(\n \"Specify which of the MCP server's tools require approval.\",\n )\n .default(\"always\"),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"Give the model access to additional tools via remote Model Context Protocol\\n(MCP) servers. [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).\\n\",\n ),\n z\n .object({\n /**\n * The type of the code interpreter tool. Always `code_interpreter`.\n *\n */\n type: z\n .literal(\"code_interpreter\")\n .describe(\n \"The type of the code interpreter tool. Always `code_interpreter`.\\n\",\n ),\n /**\n * The code interpreter container. Can be a container ID or an object that\n * specifies uploaded file IDs to make available to your code, along with an\n * optional `memory_limit` setting.\n *\n */\n container: z\n .union([\n z.string().describe(\"The container ID.\"),\n z\n .object({\n /**Always `auto`.*/\n type: z\n .literal(\"auto\")\n .describe(\"Always `auto`.\")\n .default(\"auto\"),\n /**An optional list of uploaded files to make available to your code.*/\n file_ids: z\n .array(z.string())\n .max(50)\n .describe(\n \"An optional list of uploaded files to make available to your code.\",\n )\n .optional(),\n memory_limit: z\n .union([\n z.enum([\"1g\", \"4g\", \"16g\", \"64g\"]),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.\",\n ),\n ])\n .describe(\n \"The code interpreter container. Can be a container ID or an object that\\nspecifies uploaded file IDs to make available to your code, along with an\\noptional `memory_limit` setting.\\n\",\n ),\n })\n .describe(\n \"A tool that runs Python code to help generate a response to a prompt.\\n\",\n ),\n z\n .object({\n /**\n * The type of the image generation tool. Always `image_generation`.\n *\n */\n type: z\n .literal(\"image_generation\")\n .describe(\n \"The type of the image generation tool. Always `image_generation`.\\n\",\n ),\n /**\n * The image generation model to use. Default: `gpt-image-1`.\n *\n */\n model: z\n .enum([\"gpt-image-1\", \"gpt-image-1-mini\"])\n .describe(\n \"The image generation model to use. Default: `gpt-image-1`.\\n\",\n )\n .default(\"gpt-image-1\"),\n /**\n * The quality of the generated image. One of `low`, `medium`, `high`,\n * or `auto`. Default: `auto`.\n *\n */\n quality: z\n .enum([\"low\", \"medium\", \"high\", \"auto\"])\n .describe(\n \"The quality of the generated image. One of `low`, `medium`, `high`,\\nor `auto`. Default: `auto`.\\n\",\n )\n .default(\"auto\"),\n /**\n * The size of the generated image. One of `1024x1024`, `1024x1536`,\n * `1536x1024`, or `auto`. Default: `auto`.\n *\n */\n size: z\n .enum([\"1024x1024\", \"1024x1536\", \"1536x1024\", \"auto\"])\n .describe(\n \"The size of the generated image. One of `1024x1024`, `1024x1536`,\\n`1536x1024`, or `auto`. Default: `auto`.\\n\",\n )\n .default(\"auto\"),\n /**\n * The output format of the generated image. One of `png`, `webp`, or\n * `jpeg`. Default: `png`.\n *\n */\n output_format: z\n .enum([\"png\", \"webp\", \"jpeg\"])\n .describe(\n \"The output format of the generated image. One of `png`, `webp`, or\\n`jpeg`. Default: `png`.\\n\",\n )\n .default(\"png\"),\n /**\n * Compression level for the output image. Default: 100.\n *\n */\n output_compression: z\n .number()\n .int()\n .gte(0)\n .lte(100)\n .describe(\n \"Compression level for the output image. Default: 100.\\n\",\n )\n .default(100),\n /**\n * Moderation level for the generated image. Default: `auto`.\n *\n */\n moderation: z\n .enum([\"auto\", \"low\"])\n .describe(\n \"Moderation level for the generated image. Default: `auto`.\\n\",\n )\n .default(\"auto\"),\n /**\n * Background type for the generated image. One of `transparent`,\n * `opaque`, or `auto`. Default: `auto`.\n *\n */\n background: z\n .enum([\"transparent\", \"opaque\", \"auto\"])\n .describe(\n \"Background type for the generated image. One of `transparent`,\\n`opaque`, or `auto`. Default: `auto`.\\n\",\n )\n .default(\"auto\"),\n input_fidelity: z\n .union([\n z\n .enum([\"high\", \"low\"])\n .describe(\n \"Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * Optional mask for inpainting. Contains `image_url`\n * (string, optional) and `file_id` (string, optional).\n *\n */\n input_image_mask: z\n .object({\n /**\n * Base64-encoded mask image.\n *\n */\n image_url: z\n .string()\n .describe(\"Base64-encoded mask image.\\n\")\n .optional(),\n /**\n * File ID for the mask image.\n *\n */\n file_id: z\n .string()\n .describe(\"File ID for the mask image.\\n\")\n .optional(),\n })\n .strict()\n .describe(\n \"Optional mask for inpainting. Contains `image_url`\\n(string, optional) and `file_id` (string, optional).\\n\",\n )\n .optional(),\n /**\n * Number of partial images to generate in streaming mode, from 0 (default value) to 3.\n *\n */\n partial_images: z\n .number()\n .int()\n .gte(0)\n .lte(3)\n .describe(\n \"Number of partial images to generate in streaming mode, from 0 (default value) to 3.\\n\",\n )\n .default(0),\n })\n .describe(\n \"A tool that generates images using a model like `gpt-image-1`.\\n\",\n ),\n z\n .object({\n /**The type of the local shell tool. Always `local_shell`.*/\n type: z\n .literal(\"local_shell\")\n .describe(\n \"The type of the local shell tool. Always `local_shell`.\",\n )\n .default(\"local_shell\"),\n })\n .describe(\n \"A tool that allows the model to execute shell commands in a local environment.\",\n ),\n z\n .object({\n /**The type of the shell tool. Always `shell`.*/\n type: z\n .literal(\"shell\")\n .describe(\"The type of the shell tool. Always `shell`.\")\n .default(\"shell\"),\n })\n .describe(\n \"A tool that allows the model to execute shell commands.\",\n ),\n z\n .object({\n /**The type of the custom tool. Always `custom`.*/\n type: z\n .literal(\"custom\")\n .describe(\"The type of the custom tool. Always `custom`.\")\n .default(\"custom\"),\n /**The name of the custom tool, used to identify it in tool calls.*/\n name: z\n .string()\n .describe(\n \"The name of the custom tool, used to identify it in tool calls.\",\n ),\n /**Optional description of the custom tool, used to provide more context.*/\n description: z\n .string()\n .describe(\n \"Optional description of the custom tool, used to provide more context.\",\n )\n .optional(),\n /**The input format for the custom tool. Default is unconstrained text.*/\n format: z\n .union([\n z\n .object({\n /**Unconstrained text format. Always `text`.*/\n type: z\n .literal(\"text\")\n .describe(\n \"Unconstrained text format. Always `text`.\",\n )\n .default(\"text\"),\n })\n .describe(\"Unconstrained free-form text.\"),\n z\n .object({\n /**Grammar format. Always `grammar`.*/\n type: z\n .literal(\"grammar\")\n .describe(\n \"Grammar format. Always `grammar`.\",\n )\n .default(\"grammar\"),\n /**The syntax of the grammar definition. One of `lark` or `regex`.*/\n syntax: z\n .enum([\"lark\", \"regex\"])\n .describe(\n \"The syntax of the grammar definition. One of `lark` or `regex`.\",\n ),\n /**The grammar definition.*/\n definition: z\n .string()\n .describe(\"The grammar definition.\"),\n })\n .describe(\"A grammar defined by the user.\"),\n ])\n .describe(\n \"The input format for the custom tool. Default is unconstrained text.\",\n )\n .optional(),\n })\n .describe(\n \"A custom tool that processes input using a specified format. Learn more about [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools)\",\n ),\n z\n .object({\n /**The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`.*/\n type: z\n .enum([\n \"web_search_preview\",\n \"web_search_preview_2025_03_11\",\n ])\n .describe(\n \"The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`.\",\n )\n .default(\"web_search_preview\"),\n user_location: z\n .union([\n z\n .object({\n /**The type of location approximation. Always `approximate`.*/\n type: z\n .literal(\"approximate\")\n .describe(\n \"The type of location approximation. Always `approximate`.\",\n )\n .default(\"approximate\"),\n country: z\n .union([\n z\n .string()\n .describe(\n \"The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.\",\n ),\n z.null(),\n ])\n .optional(),\n region: z\n .union([\n z\n .string()\n .describe(\n \"Free text input for the region of the user, e.g. `California`.\",\n ),\n z.null(),\n ])\n .optional(),\n city: z\n .union([\n z\n .string()\n .describe(\n \"Free text input for the city of the user, e.g. `San Francisco`.\",\n ),\n z.null(),\n ])\n .optional(),\n timezone: z\n .union([\n z\n .string()\n .describe(\n \"The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\"The user's location.\"),\n z.null(),\n ])\n .optional(),\n /**High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default.*/\n search_context_size: z\n .enum([\"low\", \"medium\", \"high\"])\n .describe(\n \"High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default.\",\n )\n .optional(),\n })\n .describe(\n \"This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://platform.openai.com/docs/guides/tools-web-search).\",\n ),\n z\n .object({\n /**The type of the tool. Always `apply_patch`.*/\n type: z\n .literal(\"apply_patch\")\n .describe(\"The type of the tool. Always `apply_patch`.\")\n .default(\"apply_patch\"),\n })\n .describe(\n \"Allows the assistant to create, delete, or update files using unified diffs.\",\n ),\n ])\n .describe(\"A tool that can be used to generate a response.\\n\"),\n )\n .describe(\n \"An array of tools the model may call while generating a response. You\\ncan specify which tool to use by setting the `tool_choice` parameter.\\n\\nWe support the following categories of tools:\\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\\n model's capabilities, like [web search](https://platform.openai.com/docs/guides/tools-web-search)\\n or [file search](https://platform.openai.com/docs/guides/tools-file-search). Learn more about\\n [built-in tools](https://platform.openai.com/docs/guides/tools).\\n- **MCP Tools**: Integrations with third-party systems via custom MCP servers\\n or predefined connectors such as Google Drive and SharePoint. Learn more about\\n [MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp).\\n- **Function calls (custom tools)**: Functions that are defined by you,\\n enabling the model to call your own code with strongly typed arguments\\n and outputs. Learn more about\\n [function calling](https://platform.openai.com/docs/guides/function-calling). You can also use\\n custom tools to call your own code.\\n\",\n )\n .optional(),\n /**\n * How the model should select which tool (or tools) to use when generating\n * a response. See the `tools` parameter to see how to specify which tools\n * the model can call.\n *\n */\n tool_choice: z\n .union([\n z\n .enum([\"none\", \"auto\", \"required\"])\n .describe(\n \"Controls which (if any) tool is called by the model.\\n\\n`none` means the model will not call any tool and instead generates a message.\\n\\n`auto` means the model can pick between generating a message or calling one or\\nmore tools.\\n\\n`required` means the model must call one or more tools.\\n\",\n ),\n z\n .object({\n /**Allowed tool configuration type. Always `allowed_tools`.*/\n type: z\n .literal(\"allowed_tools\")\n .describe(\n \"Allowed tool configuration type. Always `allowed_tools`.\",\n ),\n /**\n * Constrains the tools available to the model to a pre-defined set.\n *\n * `auto` allows the model to pick from among the allowed tools and generate a\n * message.\n *\n * `required` requires the model to call one or more of the allowed tools.\n *\n */\n mode: z\n .enum([\"auto\", \"required\"])\n .describe(\n \"Constrains the tools available to the model to a pre-defined set.\\n\\n`auto` allows the model to pick from among the allowed tools and generate a\\nmessage.\\n\\n`required` requires the model to call one or more of the allowed tools.\\n\",\n ),\n /**\n * A list of tool definitions that the model should be allowed to call.\n *\n * For the Responses API, the list of tool definitions might look like:\n * ```json\n * [\n * { \"type\": \"function\", \"name\": \"get_weather\" },\n * { \"type\": \"mcp\", \"server_label\": \"deepwiki\" },\n * { \"type\": \"image_generation\" }\n * ]\n * ```\n *\n */\n tools: z\n .array(\n z\n .record(z.string(), z.unknown())\n .describe(\n \"A tool definition that the model should be allowed to call.\\n\",\n ),\n )\n .describe(\n 'A list of tool definitions that the model should be allowed to call.\\n\\nFor the Responses API, the list of tool definitions might look like:\\n```json\\n[\\n { \"type\": \"function\", \"name\": \"get_weather\" },\\n { \"type\": \"mcp\", \"server_label\": \"deepwiki\" },\\n { \"type\": \"image_generation\" }\\n]\\n```\\n',\n ),\n })\n .describe(\n \"Constrains the tools available to the model to a pre-defined set.\\n\",\n ),\n z\n .object({\n /**\n * The type of hosted tool the model should to use. Learn more about\n * [built-in tools](https://platform.openai.com/docs/guides/tools).\n *\n * Allowed values are:\n * - `file_search`\n * - `web_search_preview`\n * - `computer_use_preview`\n * - `code_interpreter`\n * - `image_generation`\n *\n */\n type: z\n .enum([\n \"file_search\",\n \"web_search_preview\",\n \"computer_use_preview\",\n \"web_search_preview_2025_03_11\",\n \"image_generation\",\n \"code_interpreter\",\n ])\n .describe(\n \"The type of hosted tool the model should to use. Learn more about\\n[built-in tools](https://platform.openai.com/docs/guides/tools).\\n\\nAllowed values are:\\n- `file_search`\\n- `web_search_preview`\\n- `computer_use_preview`\\n- `code_interpreter`\\n- `image_generation`\\n\",\n ),\n })\n .describe(\n \"Indicates that the model should use a built-in tool to generate a response.\\n[Learn more about built-in tools](https://platform.openai.com/docs/guides/tools).\\n\",\n ),\n z\n .object({\n /**For function calling, the type is always `function`.*/\n type: z\n .literal(\"function\")\n .describe(\"For function calling, the type is always `function`.\"),\n /**The name of the function to call.*/\n name: z.string().describe(\"The name of the function to call.\"),\n })\n .describe(\n \"Use this option to force the model to call a specific function.\\n\",\n ),\n z\n .object({\n /**For MCP tools, the type is always `mcp`.*/\n type: z\n .literal(\"mcp\")\n .describe(\"For MCP tools, the type is always `mcp`.\"),\n /**\n * The label of the MCP server to use.\n *\n */\n server_label: z\n .string()\n .describe(\"The label of the MCP server to use.\\n\"),\n name: z\n .union([\n z\n .string()\n .describe(\"The name of the tool to call on the server.\\n\"),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"Use this option to force the model to call a specific tool on a remote MCP server.\\n\",\n ),\n z\n .object({\n /**For custom tool calling, the type is always `custom`.*/\n type: z\n .literal(\"custom\")\n .describe(\"For custom tool calling, the type is always `custom`.\"),\n /**The name of the custom tool to call.*/\n name: z.string().describe(\"The name of the custom tool to call.\"),\n })\n .describe(\n \"Use this option to force the model to call a specific custom tool.\\n\",\n ),\n z\n .object({\n /**The tool to call. Always `apply_patch`.*/\n type: z\n .literal(\"apply_patch\")\n .describe(\"The tool to call. Always `apply_patch`.\")\n .default(\"apply_patch\"),\n })\n .describe(\n \"Forces the model to call the apply_patch tool when executing a tool call.\",\n ),\n z\n .object({\n /**The tool to call. Always `shell`.*/\n type: z\n .literal(\"shell\")\n .describe(\"The tool to call. Always `shell`.\")\n .default(\"shell\"),\n })\n .describe(\n \"Forces the model to call the shell tool when a tool call is required.\",\n ),\n ])\n .describe(\n \"How the model should select which tool (or tools) to use when generating\\na response. See the `tools` parameter to see how to specify which tools\\nthe model can call.\\n\",\n )\n .optional(),\n prompt: z\n .union([\n z\n .object({\n /**The unique identifier of the prompt template to use.*/\n id: z\n .string()\n .describe(\"The unique identifier of the prompt template to use.\"),\n version: z\n .union([\n z.string().describe(\"Optional version of the prompt template.\"),\n z.null(),\n ])\n .optional(),\n variables: z\n .union([\n z\n .record(\n z.string(),\n z.union([\n z.string(),\n z\n .object({\n /**The type of the input item. Always `input_text`.*/\n type: z\n .literal(\"input_text\")\n .describe(\n \"The type of the input item. Always `input_text`.\",\n )\n .default(\"input_text\"),\n /**The text input to the model.*/\n text: z\n .string()\n .describe(\n \"The text input to the model.\",\n ),\n })\n .describe(\"A text input to the model.\"),\n z\n .object({\n /**The type of the input item. Always `input_image`.*/\n type: z\n .literal(\"input_image\")\n .describe(\n \"The type of the input item. Always `input_image`.\",\n )\n .default(\"input_image\"),\n image_url: z\n .union([\n z\n .string()\n .describe(\n \"The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.\",\n ),\n z.null(),\n ])\n .optional(),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.*/\n detail: z\n .enum([\"low\", \"high\", \"auto\"])\n .describe(\n \"The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\",\n ),\n })\n .describe(\n \"An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).\",\n ),\n z\n .object({\n /**The type of the input item. Always `input_file`.*/\n type: z\n .literal(\"input_file\")\n .describe(\n \"The type of the input item. Always `input_file`.\",\n )\n .default(\"input_file\"),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The name of the file to be sent to the model.*/\n filename: z\n .string()\n .describe(\n \"The name of the file to be sent to the model.\",\n )\n .optional(),\n /**The URL of the file to be sent to the model.*/\n file_url: z\n .string()\n .describe(\n \"The URL of the file to be sent to the model.\",\n )\n .optional(),\n /**\n * The content of the file to be sent to the model.\n *\n */\n file_data: z\n .string()\n .describe(\n \"The content of the file to be sent to the model.\\n\",\n )\n .optional(),\n })\n .describe(\"A file input to the model.\"),\n ]),\n )\n .describe(\n \"Optional map of values to substitute in for variables in your\\nprompt. The substitution values can either be strings, or other\\nResponse input types like images or files.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"Reference to a prompt template and its variables.\\n[Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).\\n\",\n ),\n z.null(),\n ])\n .optional(),\n truncation: z\n .union([\n z\n .enum([\"auto\", \"disabled\"])\n .describe(\n \"The truncation strategy to use for the model response.\\n- `auto`: If the input to this Response exceeds\\n the model's context window size, the model will truncate the\\n response to fit the context window by dropping items from the beginning of the conversation.\\n- `disabled` (default): If the input size will exceed the context window\\n size for a model, the request will fail with a 400 error.\\n\",\n )\n .default(\"disabled\"),\n z.null(),\n ])\n .optional(),\n }),\n z.object({\n /**\n * Text, image, or file inputs to the model, used to generate a response.\n *\n * Learn more:\n * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)\n * - [Image inputs](https://platform.openai.com/docs/guides/images)\n * - [File inputs](https://platform.openai.com/docs/guides/pdf-files)\n * - [Conversation state](https://platform.openai.com/docs/guides/conversation-state)\n * - [Function calling](https://platform.openai.com/docs/guides/function-calling)\n *\n */\n input: z\n .union([\n z\n .string()\n .describe(\n \"A text input to the model, equivalent to a text input with the\\n`user` role.\\n\",\n ),\n z\n .array(\n z.union([\n z\n .object({\n /**\n * The role of the message input. One of `user`, `assistant`, `system`, or\n * `developer`.\n *\n */\n role: z\n .enum([\"user\", \"assistant\", \"system\", \"developer\"])\n .describe(\n \"The role of the message input. One of `user`, `assistant`, `system`, or\\n`developer`.\\n\",\n ),\n /**\n * Text, image, or audio input to the model, used to generate a response.\n * Can also contain previous assistant responses.\n *\n */\n content: z\n .union([\n z.string().describe(\"A text input to the model.\\n\"),\n z\n .array(\n z.union([\n z\n .object({\n /**The type of the input item. Always `input_text`.*/\n type: z\n .literal(\"input_text\")\n .describe(\n \"The type of the input item. Always `input_text`.\",\n )\n .default(\"input_text\"),\n /**The text input to the model.*/\n text: z\n .string()\n .describe(\n \"The text input to the model.\",\n ),\n })\n .describe(\n \"A text input to the model.\",\n ),\n z\n .object({\n /**The type of the input item. Always `input_image`.*/\n type: z\n .literal(\"input_image\")\n .describe(\n \"The type of the input item. Always `input_image`.\",\n )\n .default(\"input_image\"),\n image_url: z\n .union([\n z\n .string()\n .describe(\n \"The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.\",\n ),\n z.null(),\n ])\n .optional(),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.*/\n detail: z\n .enum([\n \"low\",\n \"high\",\n \"auto\",\n ])\n .describe(\n \"The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\",\n ),\n })\n .describe(\n \"An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).\",\n ),\n z\n .object({\n /**The type of the input item. Always `input_file`.*/\n type: z\n .literal(\"input_file\")\n .describe(\n \"The type of the input item. Always `input_file`.\",\n )\n .default(\"input_file\"),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The name of the file to be sent to the model.*/\n filename: z\n .string()\n .describe(\n \"The name of the file to be sent to the model.\",\n )\n .optional(),\n /**The URL of the file to be sent to the model.*/\n file_url: z\n .string()\n .describe(\n \"The URL of the file to be sent to the model.\",\n )\n .optional(),\n /**\n * The content of the file to be sent to the model.\n *\n */\n file_data: z\n .string()\n .describe(\n \"The content of the file to be sent to the model.\\n\",\n )\n .optional(),\n })\n .describe(\n \"A file input to the model.\",\n ),\n ]),\n )\n .describe(\n \"A list of one or many input items to the model, containing different content \\ntypes.\\n\",\n ),\n ])\n .describe(\n \"Text, image, or audio input to the model, used to generate a response.\\nCan also contain previous assistant responses.\\n\",\n ),\n /**\n * The type of the message input. Always `message`.\n *\n */\n type: z\n .literal(\"message\")\n .describe(\n \"The type of the message input. Always `message`.\\n\",\n )\n .optional(),\n })\n .describe(\n \"A message input to the model with a role indicating instruction following\\nhierarchy. Instructions given with the `developer` or `system` role take\\nprecedence over instructions given with the `user` role. Messages with the\\n`assistant` role are presumed to have been generated by the model in previous\\ninteractions.\\n\",\n ),\n z\n .union([\n z\n .object({\n /**\n * The type of the message input. Always set to `message`.\n *\n */\n type: z\n .literal(\"message\")\n .describe(\n \"The type of the message input. Always set to `message`.\\n\",\n )\n .optional(),\n /**\n * The role of the message input. One of `user`, `system`, or `developer`.\n *\n */\n role: z\n .enum([\"user\", \"system\", \"developer\"])\n .describe(\n \"The role of the message input. One of `user`, `system`, or `developer`.\\n\",\n ),\n /**\n * The status of item. One of `in_progress`, `completed`, or\n * `incomplete`. Populated when items are returned via API.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of item. One of `in_progress`, `completed`, or\\n`incomplete`. Populated when items are returned via API.\\n\",\n )\n .optional(),\n /**\n * A list of one or many input items to the model, containing different content\n * types.\n *\n */\n content: z\n .array(\n z.union([\n z\n .object({\n /**The type of the input item. Always `input_text`.*/\n type: z\n .literal(\"input_text\")\n .describe(\n \"The type of the input item. Always `input_text`.\",\n )\n .default(\"input_text\"),\n /**The text input to the model.*/\n text: z\n .string()\n .describe(\n \"The text input to the model.\",\n ),\n })\n .describe(\n \"A text input to the model.\",\n ),\n z\n .object({\n /**The type of the input item. Always `input_image`.*/\n type: z\n .literal(\"input_image\")\n .describe(\n \"The type of the input item. Always `input_image`.\",\n )\n .default(\"input_image\"),\n image_url: z\n .union([\n z\n .string()\n .describe(\n \"The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.\",\n ),\n z.null(),\n ])\n .optional(),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.*/\n detail: z\n .enum([\n \"low\",\n \"high\",\n \"auto\",\n ])\n .describe(\n \"The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\",\n ),\n })\n .describe(\n \"An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).\",\n ),\n z\n .object({\n /**The type of the input item. Always `input_file`.*/\n type: z\n .literal(\"input_file\")\n .describe(\n \"The type of the input item. Always `input_file`.\",\n )\n .default(\"input_file\"),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The name of the file to be sent to the model.*/\n filename: z\n .string()\n .describe(\n \"The name of the file to be sent to the model.\",\n )\n .optional(),\n /**The URL of the file to be sent to the model.*/\n file_url: z\n .string()\n .describe(\n \"The URL of the file to be sent to the model.\",\n )\n .optional(),\n /**\n * The content of the file to be sent to the model.\n *\n */\n file_data: z\n .string()\n .describe(\n \"The content of the file to be sent to the model.\\n\",\n )\n .optional(),\n })\n .describe(\n \"A file input to the model.\",\n ),\n ]),\n )\n .describe(\n \"A list of one or many input items to the model, containing different content \\ntypes.\\n\",\n ),\n })\n .describe(\n \"A message input to the model with a role indicating instruction following\\nhierarchy. Instructions given with the `developer` or `system` role take\\nprecedence over instructions given with the `user` role.\\n\",\n ),\n z\n .object({\n /**\n * The unique ID of the output message.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the output message.\\n\",\n ),\n /**\n * The type of the output message. Always `message`.\n *\n */\n type: z\n .literal(\"message\")\n .describe(\n \"The type of the output message. Always `message`.\\n\",\n ),\n /**\n * The role of the output message. Always `assistant`.\n *\n */\n role: z\n .literal(\"assistant\")\n .describe(\n \"The role of the output message. Always `assistant`.\\n\",\n ),\n /**\n * The content of the output message.\n *\n */\n content: z\n .array(\n z.union([\n z\n .object({\n /**The type of the output text. Always `output_text`.*/\n type: z\n .literal(\"output_text\")\n .describe(\n \"The type of the output text. Always `output_text`.\",\n )\n .default(\"output_text\"),\n /**The text output from the model.*/\n text: z\n .string()\n .describe(\n \"The text output from the model.\",\n ),\n /**The annotations of the text output.*/\n annotations: z\n .array(\n z.union([\n z\n .object({\n /**The type of the file citation. Always `file_citation`.*/\n type: z\n .literal(\n \"file_citation\",\n )\n .describe(\n \"The type of the file citation. Always `file_citation`.\",\n )\n .default(\n \"file_citation\",\n ),\n /**The ID of the file.*/\n file_id: z\n .string()\n .describe(\n \"The ID of the file.\",\n ),\n /**The index of the file in the list of files.*/\n index: z\n .number()\n .int()\n .describe(\n \"The index of the file in the list of files.\",\n ),\n /**The filename of the file cited.*/\n filename: z\n .string()\n .describe(\n \"The filename of the file cited.\",\n ),\n })\n .describe(\n \"A citation to a file.\",\n ),\n z\n .object({\n /**The type of the URL citation. Always `url_citation`.*/\n type: z\n .literal(\n \"url_citation\",\n )\n .describe(\n \"The type of the URL citation. Always `url_citation`.\",\n )\n .default(\n \"url_citation\",\n ),\n /**The URL of the web resource.*/\n url: z\n .string()\n .describe(\n \"The URL of the web resource.\",\n ),\n /**The index of the first character of the URL citation in the message.*/\n start_index:\n z\n .number()\n .int()\n .describe(\n \"The index of the first character of the URL citation in the message.\",\n ),\n /**The index of the last character of the URL citation in the message.*/\n end_index: z\n .number()\n .int()\n .describe(\n \"The index of the last character of the URL citation in the message.\",\n ),\n /**The title of the web resource.*/\n title: z\n .string()\n .describe(\n \"The title of the web resource.\",\n ),\n })\n .describe(\n \"A citation for a web resource used to generate a model response.\",\n ),\n z\n .object({\n /**The type of the container file citation. Always `container_file_citation`.*/\n type: z\n .literal(\n \"container_file_citation\",\n )\n .describe(\n \"The type of the container file citation. Always `container_file_citation`.\",\n )\n .default(\n \"container_file_citation\",\n ),\n /**The ID of the container file.*/\n container_id:\n z\n .string()\n .describe(\n \"The ID of the container file.\",\n ),\n /**The ID of the file.*/\n file_id: z\n .string()\n .describe(\n \"The ID of the file.\",\n ),\n /**The index of the first character of the container file citation in the message.*/\n start_index:\n z\n .number()\n .int()\n .describe(\n \"The index of the first character of the container file citation in the message.\",\n ),\n /**The index of the last character of the container file citation in the message.*/\n end_index: z\n .number()\n .int()\n .describe(\n \"The index of the last character of the container file citation in the message.\",\n ),\n /**The filename of the container file cited.*/\n filename: z\n .string()\n .describe(\n \"The filename of the container file cited.\",\n ),\n })\n .describe(\n \"A citation for a container file used to generate a model response.\",\n ),\n z\n .object({\n /**\n * The type of the file path. Always `file_path`.\n *\n */\n type: z\n .literal(\n \"file_path\",\n )\n .describe(\n \"The type of the file path. Always `file_path`.\\n\",\n ),\n /**\n * The ID of the file.\n *\n */\n file_id: z\n .string()\n .describe(\n \"The ID of the file.\\n\",\n ),\n /**\n * The index of the file in the list of files.\n *\n */\n index: z\n .number()\n .int()\n .describe(\n \"The index of the file in the list of files.\\n\",\n ),\n })\n .describe(\n \"A path to a file.\\n\",\n ),\n ]),\n )\n .describe(\n \"The annotations of the text output.\",\n ),\n logprobs: z\n .array(\n z\n .object({\n token: z.string(),\n logprob:\n z.number(),\n bytes: z.array(\n z\n .number()\n .int(),\n ),\n top_logprobs:\n z.array(\n z\n .object(\n {\n token: z.string(),\n logprob:\n z.number(),\n bytes: z.array(\n z\n .number()\n .int(),\n ),\n },\n )\n .describe(\n \"The top log probability of a token.\",\n ),\n ),\n })\n .describe(\n \"The log probability of a token.\",\n ),\n )\n .optional(),\n })\n .describe(\n \"A text output from the model.\",\n ),\n z\n .object({\n /**The type of the refusal. Always `refusal`.*/\n type: z\n .literal(\"refusal\")\n .describe(\n \"The type of the refusal. Always `refusal`.\",\n )\n .default(\"refusal\"),\n /**The refusal explanation from the model.*/\n refusal: z\n .string()\n .describe(\n \"The refusal explanation from the model.\",\n ),\n })\n .describe(\n \"A refusal from the model.\",\n ),\n ]),\n )\n .describe(\n \"The content of the output message.\\n\",\n ),\n /**\n * The status of the message input. One of `in_progress`, `completed`, or\n * `incomplete`. Populated when input items are returned via API.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of the message input. One of `in_progress`, `completed`, or\\n`incomplete`. Populated when input items are returned via API.\\n\",\n ),\n })\n .describe(\"An output message from the model.\\n\"),\n z\n .object({\n /**\n * The unique ID of the file search tool call.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the file search tool call.\\n\",\n ),\n /**\n * The type of the file search tool call. Always `file_search_call`.\n *\n */\n type: z\n .literal(\"file_search_call\")\n .describe(\n \"The type of the file search tool call. Always `file_search_call`.\\n\",\n ),\n /**\n * The status of the file search tool call. One of `in_progress`,\n * `searching`, `incomplete` or `failed`,\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"searching\",\n \"completed\",\n \"incomplete\",\n \"failed\",\n ])\n .describe(\n \"The status of the file search tool call. One of `in_progress`,\\n`searching`, `incomplete` or `failed`,\\n\",\n ),\n /**\n * The queries used to search for files.\n *\n */\n queries: z\n .array(z.string())\n .describe(\n \"The queries used to search for files.\\n\",\n ),\n results: z\n .union([\n z\n .array(\n z.object({\n /**\n * The unique ID of the file.\n *\n */\n file_id: z\n .string()\n .describe(\n \"The unique ID of the file.\\n\",\n )\n .optional(),\n /**\n * The text that was retrieved from the file.\n *\n */\n text: z\n .string()\n .describe(\n \"The text that was retrieved from the file.\\n\",\n )\n .optional(),\n /**\n * The name of the file.\n *\n */\n filename: z\n .string()\n .describe(\n \"The name of the file.\\n\",\n )\n .optional(),\n attributes: z\n .union([\n z\n .record(\n z\n .string()\n .max(64),\n z.union([\n z\n .string()\n .max(\n 512,\n ),\n z.number(),\n z.boolean(),\n ]),\n )\n .describe(\n \"Set of 16 key-value pairs that can be attached to an object. This can be\\nuseful for storing additional information about the object in a structured\\nformat, and querying for objects via API or the dashboard. Keys are strings\\nwith a maximum length of 64 characters. Values are strings with a maximum\\nlength of 512 characters, booleans, or numbers.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * The relevance score of the file - a value between 0 and 1.\n *\n */\n score: z\n .number()\n .describe(\n \"The relevance score of the file - a value between 0 and 1.\\n\",\n )\n .optional(),\n }),\n )\n .describe(\n \"The results of the file search tool call.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"The results of a file search tool call. See the\\n[file search guide](https://platform.openai.com/docs/guides/tools-file-search) for more information.\\n\",\n ),\n z\n .object({\n /**The type of the computer call. Always `computer_call`.*/\n type: z\n .literal(\"computer_call\")\n .describe(\n \"The type of the computer call. Always `computer_call`.\",\n )\n .default(\"computer_call\"),\n /**The unique ID of the computer call.*/\n id: z\n .string()\n .describe(\n \"The unique ID of the computer call.\",\n ),\n /**\n * An identifier used when responding to the tool call with output.\n *\n */\n call_id: z\n .string()\n .describe(\n \"An identifier used when responding to the tool call with output.\\n\",\n ),\n action: z.union([\n z\n .object({\n /**Specifies the event type. For a click action, this property is always `click`.*/\n type: z\n .literal(\"click\")\n .describe(\n \"Specifies the event type. For a click action, this property is always `click`.\",\n )\n .default(\"click\"),\n /**Indicates which mouse button was pressed during the click. One of `left`, `right`, `wheel`, `back`, or `forward`.*/\n button: z\n .enum([\n \"left\",\n \"right\",\n \"wheel\",\n \"back\",\n \"forward\",\n ])\n .describe(\n \"Indicates which mouse button was pressed during the click. One of `left`, `right`, `wheel`, `back`, or `forward`.\",\n ),\n /**The x-coordinate where the click occurred.*/\n x: z\n .number()\n .int()\n .describe(\n \"The x-coordinate where the click occurred.\",\n ),\n /**The y-coordinate where the click occurred.*/\n y: z\n .number()\n .int()\n .describe(\n \"The y-coordinate where the click occurred.\",\n ),\n })\n .describe(\"A click action.\"),\n z\n .object({\n /**Specifies the event type. For a double click action, this property is always set to `double_click`.*/\n type: z\n .literal(\"double_click\")\n .describe(\n \"Specifies the event type. For a double click action, this property is always set to `double_click`.\",\n )\n .default(\"double_click\"),\n /**The x-coordinate where the double click occurred.*/\n x: z\n .number()\n .int()\n .describe(\n \"The x-coordinate where the double click occurred.\",\n ),\n /**The y-coordinate where the double click occurred.*/\n y: z\n .number()\n .int()\n .describe(\n \"The y-coordinate where the double click occurred.\",\n ),\n })\n .describe(\"A double click action.\"),\n z\n .object({\n /**\n * Specifies the event type. For a drag action, this property is\n * always set to `drag`.\n *\n */\n type: z\n .literal(\"drag\")\n .describe(\n \"Specifies the event type. For a drag action, this property is \\nalways set to `drag`.\\n\",\n )\n .default(\"drag\"),\n /**\n * An array of coordinates representing the path of the drag action. Coordinates will appear as an array\n * of objects, eg\n * ```\n * [\n * { x: 100, y: 200 },\n * { x: 200, y: 300 }\n * ]\n * ```\n *\n */\n path: z\n .array(\n z\n .object({\n /**The x-coordinate.*/\n x: z\n .number()\n .int()\n .describe(\n \"The x-coordinate.\",\n ),\n /**The y-coordinate.*/\n y: z\n .number()\n .int()\n .describe(\n \"The y-coordinate.\",\n ),\n })\n .describe(\n \"An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.\",\n ),\n )\n .describe(\n \"An array of coordinates representing the path of the drag action. Coordinates will appear as an array\\nof objects, eg\\n```\\n[\\n { x: 100, y: 200 },\\n { x: 200, y: 300 }\\n]\\n```\\n\",\n ),\n })\n .describe(\"A drag action.\\n\"),\n z\n .object({\n /**Specifies the event type. For a keypress action, this property is always set to `keypress`.*/\n type: z\n .literal(\"keypress\")\n .describe(\n \"Specifies the event type. For a keypress action, this property is always set to `keypress`.\",\n )\n .default(\"keypress\"),\n /**The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.*/\n keys: z\n .array(\n z\n .string()\n .describe(\n \"One of the keys the model is requesting to be pressed.\",\n ),\n )\n .describe(\n \"The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.\",\n ),\n })\n .describe(\n \"A collection of keypresses the model would like to perform.\",\n ),\n z\n .object({\n /**\n * Specifies the event type. For a move action, this property is\n * always set to `move`.\n *\n */\n type: z\n .literal(\"move\")\n .describe(\n \"Specifies the event type. For a move action, this property is \\nalways set to `move`.\\n\",\n )\n .default(\"move\"),\n /**\n * The x-coordinate to move to.\n *\n */\n x: z\n .number()\n .int()\n .describe(\n \"The x-coordinate to move to.\\n\",\n ),\n /**\n * The y-coordinate to move to.\n *\n */\n y: z\n .number()\n .int()\n .describe(\n \"The y-coordinate to move to.\\n\",\n ),\n })\n .describe(\"A mouse move action.\\n\"),\n z\n .object({\n /**\n * Specifies the event type. For a screenshot action, this property is\n * always set to `screenshot`.\n *\n */\n type: z\n .literal(\"screenshot\")\n .describe(\n \"Specifies the event type. For a screenshot action, this property is \\nalways set to `screenshot`.\\n\",\n )\n .default(\"screenshot\"),\n })\n .describe(\"A screenshot action.\\n\"),\n z\n .object({\n /**\n * Specifies the event type. For a scroll action, this property is\n * always set to `scroll`.\n *\n */\n type: z\n .literal(\"scroll\")\n .describe(\n \"Specifies the event type. For a scroll action, this property is \\nalways set to `scroll`.\\n\",\n )\n .default(\"scroll\"),\n /**\n * The x-coordinate where the scroll occurred.\n *\n */\n x: z\n .number()\n .int()\n .describe(\n \"The x-coordinate where the scroll occurred.\\n\",\n ),\n /**\n * The y-coordinate where the scroll occurred.\n *\n */\n y: z\n .number()\n .int()\n .describe(\n \"The y-coordinate where the scroll occurred.\\n\",\n ),\n /**\n * The horizontal scroll distance.\n *\n */\n scroll_x: z\n .number()\n .int()\n .describe(\n \"The horizontal scroll distance.\\n\",\n ),\n /**\n * The vertical scroll distance.\n *\n */\n scroll_y: z\n .number()\n .int()\n .describe(\n \"The vertical scroll distance.\\n\",\n ),\n })\n .describe(\"A scroll action.\\n\"),\n z\n .object({\n /**\n * Specifies the event type. For a type action, this property is\n * always set to `type`.\n *\n */\n type: z\n .literal(\"type\")\n .describe(\n \"Specifies the event type. For a type action, this property is \\nalways set to `type`.\\n\",\n )\n .default(\"type\"),\n /**\n * The text to type.\n *\n */\n text: z\n .string()\n .describe(\"The text to type.\\n\"),\n })\n .describe(\"An action to type in text.\\n\"),\n z\n .object({\n /**\n * Specifies the event type. For a wait action, this property is\n * always set to `wait`.\n *\n */\n type: z\n .literal(\"wait\")\n .describe(\n \"Specifies the event type. For a wait action, this property is \\nalways set to `wait`.\\n\",\n )\n .default(\"wait\"),\n })\n .describe(\"A wait action.\\n\"),\n ]),\n /**\n * The pending safety checks for the computer call.\n *\n */\n pending_safety_checks: z\n .array(\n z\n .object({\n /**The ID of the pending safety check.*/\n id: z\n .string()\n .describe(\n \"The ID of the pending safety check.\",\n ),\n code: z\n .union([\n z\n .string()\n .describe(\n \"The type of the pending safety check.\",\n ),\n z.null(),\n ])\n .optional(),\n message: z\n .union([\n z\n .string()\n .describe(\n \"Details about the pending safety check.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"A pending safety check for the computer call.\",\n ),\n )\n .describe(\n \"The pending safety checks for the computer call.\\n\",\n ),\n /**\n * The status of the item. One of `in_progress`, `completed`, or\n * `incomplete`. Populated when items are returned via API.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of the item. One of `in_progress`, `completed`, or\\n`incomplete`. Populated when items are returned via API.\\n\",\n ),\n })\n .describe(\n \"A tool call to a computer use tool. See the\\n[computer use guide](https://platform.openai.com/docs/guides/tools-computer-use) for more information.\\n\",\n ),\n z\n .object({\n id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the computer tool call output.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The ID of the computer tool call that produced the output.*/\n call_id: z\n .string()\n .min(1)\n .max(64)\n .describe(\n \"The ID of the computer tool call that produced the output.\",\n ),\n /**The type of the computer tool call output. Always `computer_call_output`.*/\n type: z\n .literal(\"computer_call_output\")\n .describe(\n \"The type of the computer tool call output. Always `computer_call_output`.\",\n )\n .default(\"computer_call_output\"),\n /**\n * A computer screenshot image used with the computer use tool.\n *\n */\n output: z\n .object({\n /**\n * Specifies the event type. For a computer screenshot, this property is\n * always set to `computer_screenshot`.\n *\n */\n type: z\n .literal(\"computer_screenshot\")\n .describe(\n \"Specifies the event type. For a computer screenshot, this property is \\nalways set to `computer_screenshot`.\\n\",\n )\n .default(\"computer_screenshot\"),\n /**The URL of the screenshot image.*/\n image_url: z\n .string()\n .describe(\n \"The URL of the screenshot image.\",\n )\n .optional(),\n /**The identifier of an uploaded file that contains the screenshot.*/\n file_id: z\n .string()\n .describe(\n \"The identifier of an uploaded file that contains the screenshot.\",\n )\n .optional(),\n })\n .describe(\n \"A computer screenshot image used with the computer use tool.\\n\",\n ),\n acknowledged_safety_checks: z\n .union([\n z\n .array(\n z\n .object({\n /**The ID of the pending safety check.*/\n id: z\n .string()\n .describe(\n \"The ID of the pending safety check.\",\n ),\n code: z\n .union([\n z\n .string()\n .describe(\n \"The type of the pending safety check.\",\n ),\n z.null(),\n ])\n .optional(),\n message: z\n .union([\n z\n .string()\n .describe(\n \"Details about the pending safety check.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"A pending safety check for the computer call.\",\n ),\n )\n .describe(\n \"The safety checks reported by the API that have been acknowledged by the developer.\",\n ),\n z.null(),\n ])\n .optional(),\n status: z\n .union([\n z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\"The output of a computer tool call.\"),\n z\n .object({\n /**\n * The unique ID of the web search tool call.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the web search tool call.\\n\",\n ),\n /**\n * The type of the web search tool call. Always `web_search_call`.\n *\n */\n type: z\n .literal(\"web_search_call\")\n .describe(\n \"The type of the web search tool call. Always `web_search_call`.\\n\",\n ),\n /**\n * The status of the web search tool call.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"searching\",\n \"completed\",\n \"failed\",\n ])\n .describe(\n \"The status of the web search tool call.\\n\",\n ),\n /**\n * An object describing the specific action taken in this web search call.\n * Includes details on how the model used the web (search, open_page, find).\n *\n */\n action: z\n .union([\n z\n .object({\n /**\n * The action type.\n *\n */\n type: z\n .literal(\"search\")\n .describe(\"The action type.\\n\"),\n /**\n * The search query.\n *\n */\n query: z\n .string()\n .describe(\n \"The search query.\\n\",\n ),\n /**\n * The sources used in the search.\n *\n */\n sources: z\n .array(\n z\n .object({\n /**\n * The type of source. Always `url`.\n *\n */\n type: z\n .literal(\"url\")\n .describe(\n \"The type of source. Always `url`.\\n\",\n ),\n /**\n * The URL of the source.\n *\n */\n url: z\n .string()\n .describe(\n \"The URL of the source.\\n\",\n ),\n })\n .describe(\n \"A source used in the search.\\n\",\n ),\n )\n .describe(\n \"The sources used in the search.\\n\",\n )\n .optional(),\n })\n .describe(\n 'Action type \"search\" - Performs a web search query.\\n',\n ),\n z\n .object({\n /**\n * The action type.\n *\n */\n type: z\n .literal(\"open_page\")\n .describe(\"The action type.\\n\"),\n /**\n * The URL opened by the model.\n *\n */\n url: z\n .string()\n .url()\n .describe(\n \"The URL opened by the model.\\n\",\n ),\n })\n .describe(\n 'Action type \"open_page\" - Opens a specific URL from search results.\\n',\n ),\n z\n .object({\n /**\n * The action type.\n *\n */\n type: z\n .literal(\"find\")\n .describe(\"The action type.\\n\"),\n /**\n * The URL of the page searched for the pattern.\n *\n */\n url: z\n .string()\n .url()\n .describe(\n \"The URL of the page searched for the pattern.\\n\",\n ),\n /**\n * The pattern or text to search for within the page.\n *\n */\n pattern: z\n .string()\n .describe(\n \"The pattern or text to search for within the page.\\n\",\n ),\n })\n .describe(\n 'Action type \"find\": Searches for a pattern within a loaded page.\\n',\n ),\n ])\n .describe(\n \"An object describing the specific action taken in this web search call.\\nIncludes details on how the model used the web (search, open_page, find).\\n\",\n ),\n })\n .describe(\n \"The results of a web search tool call. See the\\n[web search guide](https://platform.openai.com/docs/guides/tools-web-search) for more information.\\n\",\n ),\n z\n .object({\n /**\n * The unique ID of the function tool call.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the function tool call.\\n\",\n )\n .optional(),\n /**\n * The type of the function tool call. Always `function_call`.\n *\n */\n type: z\n .literal(\"function_call\")\n .describe(\n \"The type of the function tool call. Always `function_call`.\\n\",\n ),\n /**\n * The unique ID of the function tool call generated by the model.\n *\n */\n call_id: z\n .string()\n .describe(\n \"The unique ID of the function tool call generated by the model.\\n\",\n ),\n /**\n * The name of the function to run.\n *\n */\n name: z\n .string()\n .describe(\"The name of the function to run.\\n\"),\n /**\n * A JSON string of the arguments to pass to the function.\n *\n */\n arguments: z\n .string()\n .describe(\n \"A JSON string of the arguments to pass to the function.\\n\",\n ),\n /**\n * The status of the item. One of `in_progress`, `completed`, or\n * `incomplete`. Populated when items are returned via API.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of the item. One of `in_progress`, `completed`, or\\n`incomplete`. Populated when items are returned via API.\\n\",\n )\n .optional(),\n })\n .describe(\n \"A tool call to run a function. See the \\n[function calling guide](https://platform.openai.com/docs/guides/function-calling) for more information.\\n\",\n ),\n z\n .object({\n id: z\n .union([\n z\n .string()\n .describe(\n \"The unique ID of the function tool call output. Populated when this item is returned via API.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The unique ID of the function tool call generated by the model.*/\n call_id: z\n .string()\n .min(1)\n .max(64)\n .describe(\n \"The unique ID of the function tool call generated by the model.\",\n ),\n /**The type of the function tool call output. Always `function_call_output`.*/\n type: z\n .literal(\"function_call_output\")\n .describe(\n \"The type of the function tool call output. Always `function_call_output`.\",\n )\n .default(\"function_call_output\"),\n /**Text, image, or file output of the function tool call.*/\n output: z\n .union([\n z\n .string()\n .max(10485760)\n .describe(\n \"A JSON string of the output of the function tool call.\",\n ),\n z.array(\n z.union([\n z\n .object({\n /**The type of the input item. Always `input_text`.*/\n type: z\n .literal(\"input_text\")\n .describe(\n \"The type of the input item. Always `input_text`.\",\n )\n .default(\"input_text\"),\n /**The text input to the model.*/\n text: z\n .string()\n .max(10485760)\n .describe(\n \"The text input to the model.\",\n ),\n })\n .describe(\n \"A text input to the model.\",\n ),\n z\n .object({\n /**The type of the input item. Always `input_image`.*/\n type: z\n .literal(\"input_image\")\n .describe(\n \"The type of the input item. Always `input_image`.\",\n )\n .default(\"input_image\"),\n image_url: z\n .union([\n z\n .string()\n .max(20971520)\n .describe(\n \"The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.\",\n ),\n z.null(),\n ])\n .optional(),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n detail: z\n .union([\n z\n .enum([\n \"low\",\n \"high\",\n \"auto\",\n ])\n .describe(\n \"The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision)\",\n ),\n z\n .object({\n /**The type of the input item. Always `input_file`.*/\n type: z\n .literal(\"input_file\")\n .describe(\n \"The type of the input item. Always `input_file`.\",\n )\n .default(\"input_file\"),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n filename: z\n .union([\n z\n .string()\n .describe(\n \"The name of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n file_data: z\n .union([\n z\n .string()\n .max(33554432)\n .describe(\n \"The base64-encoded data of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n file_url: z\n .union([\n z\n .string()\n .describe(\n \"The URL of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"A file input to the model.\",\n ),\n ]),\n ),\n ])\n .describe(\n \"Text, image, or file output of the function tool call.\",\n ),\n status: z\n .union([\n z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\"The output of a function tool call.\"),\n z\n .object({\n /**\n * The type of the object. Always `reasoning`.\n *\n */\n type: z\n .literal(\"reasoning\")\n .describe(\n \"The type of the object. Always `reasoning`.\\n\",\n ),\n /**\n * The unique identifier of the reasoning content.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique identifier of the reasoning content.\\n\",\n ),\n encrypted_content: z\n .union([\n z\n .string()\n .describe(\n \"The encrypted content of the reasoning item - populated when a response is\\ngenerated with `reasoning.encrypted_content` in the `include` parameter.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * Reasoning summary content.\n *\n */\n summary: z\n .array(\n z\n .object({\n /**The type of the object. Always `summary_text`.*/\n type: z\n .literal(\"summary_text\")\n .describe(\n \"The type of the object. Always `summary_text`.\",\n )\n .default(\"summary_text\"),\n /**A summary of the reasoning output from the model so far.*/\n text: z\n .string()\n .describe(\n \"A summary of the reasoning output from the model so far.\",\n ),\n })\n .describe(\n \"A summary text from the model.\",\n ),\n )\n .describe(\"Reasoning summary content.\\n\"),\n /**\n * Reasoning text content.\n *\n */\n content: z\n .array(\n z\n .object({\n /**The type of the reasoning text. Always `reasoning_text`.*/\n type: z\n .literal(\"reasoning_text\")\n .describe(\n \"The type of the reasoning text. Always `reasoning_text`.\",\n )\n .default(\"reasoning_text\"),\n /**The reasoning text from the model.*/\n text: z\n .string()\n .describe(\n \"The reasoning text from the model.\",\n ),\n })\n .describe(\n \"Reasoning text from the model.\",\n ),\n )\n .describe(\"Reasoning text content.\\n\")\n .optional(),\n /**\n * The status of the item. One of `in_progress`, `completed`, or\n * `incomplete`. Populated when items are returned via API.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of the item. One of `in_progress`, `completed`, or\\n`incomplete`. Populated when items are returned via API.\\n\",\n )\n .optional(),\n })\n .describe(\n \"A description of the chain of thought used by a reasoning model while generating\\na response. Be sure to include these items in your `input` to the Responses API\\nfor subsequent turns of a conversation if you are manually\\n[managing context](https://platform.openai.com/docs/guides/conversation-state).\\n\",\n ),\n z\n .object({\n id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the compaction item.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The type of the item. Always `compaction`.*/\n type: z\n .literal(\"compaction\")\n .describe(\n \"The type of the item. Always `compaction`.\",\n )\n .default(\"compaction\"),\n encrypted_content: z.string().max(10485760),\n })\n .describe(\n \"A compaction item generated by the [`v1/responses/compact` API](https://platform.openai.com/docs/api-reference/responses/compact).\",\n ),\n z\n .object({\n /**\n * The type of the image generation call. Always `image_generation_call`.\n *\n */\n type: z\n .literal(\"image_generation_call\")\n .describe(\n \"The type of the image generation call. Always `image_generation_call`.\\n\",\n ),\n /**\n * The unique ID of the image generation call.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the image generation call.\\n\",\n ),\n /**\n * The status of the image generation call.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"generating\",\n \"failed\",\n ])\n .describe(\n \"The status of the image generation call.\\n\",\n ),\n result: z.union([\n z\n .string()\n .describe(\n \"The generated image encoded in base64.\\n\",\n ),\n z.null(),\n ]),\n })\n .describe(\n \"An image generation request made by the model.\\n\",\n ),\n z\n .object({\n /**\n * The type of the code interpreter tool call. Always `code_interpreter_call`.\n *\n */\n type: z\n .literal(\"code_interpreter_call\")\n .describe(\n \"The type of the code interpreter tool call. Always `code_interpreter_call`.\\n\",\n )\n .default(\"code_interpreter_call\"),\n /**\n * The unique ID of the code interpreter tool call.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the code interpreter tool call.\\n\",\n ),\n /**\n * The status of the code interpreter tool call. Valid values are `in_progress`, `completed`, `incomplete`, `interpreting`, and `failed`.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n \"interpreting\",\n \"failed\",\n ])\n .describe(\n \"The status of the code interpreter tool call. Valid values are `in_progress`, `completed`, `incomplete`, `interpreting`, and `failed`.\\n\",\n ),\n /**\n * The ID of the container used to run the code.\n *\n */\n container_id: z\n .string()\n .describe(\n \"The ID of the container used to run the code.\\n\",\n ),\n code: z.union([\n z\n .string()\n .describe(\n \"The code to run, or null if not available.\\n\",\n ),\n z.null(),\n ]),\n outputs: z.union([\n z\n .array(\n z.union([\n z\n .object({\n /**The type of the output. Always `logs`.*/\n type: z\n .literal(\"logs\")\n .describe(\n \"The type of the output. Always `logs`.\",\n )\n .default(\"logs\"),\n /**The logs output from the code interpreter.*/\n logs: z\n .string()\n .describe(\n \"The logs output from the code interpreter.\",\n ),\n })\n .describe(\n \"The logs output from the code interpreter.\",\n ),\n z\n .object({\n /**The type of the output. Always `image`.*/\n type: z\n .literal(\"image\")\n .describe(\n \"The type of the output. Always `image`.\",\n )\n .default(\"image\"),\n /**The URL of the image output from the code interpreter.*/\n url: z\n .string()\n .describe(\n \"The URL of the image output from the code interpreter.\",\n ),\n })\n .describe(\n \"The image output from the code interpreter.\",\n ),\n ]),\n )\n .describe(\n \"The outputs generated by the code interpreter, such as logs or images.\\nCan be null if no outputs are available.\\n\",\n ),\n z.null(),\n ]),\n })\n .describe(\"A tool call to run code.\\n\"),\n z\n .object({\n /**\n * The type of the local shell call. Always `local_shell_call`.\n *\n */\n type: z\n .literal(\"local_shell_call\")\n .describe(\n \"The type of the local shell call. Always `local_shell_call`.\\n\",\n ),\n /**\n * The unique ID of the local shell call.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the local shell call.\\n\",\n ),\n /**\n * The unique ID of the local shell tool call generated by the model.\n *\n */\n call_id: z\n .string()\n .describe(\n \"The unique ID of the local shell tool call generated by the model.\\n\",\n ),\n /**Execute a shell command on the server.*/\n action: z\n .object({\n /**The type of the local shell action. Always `exec`.*/\n type: z\n .literal(\"exec\")\n .describe(\n \"The type of the local shell action. Always `exec`.\",\n )\n .default(\"exec\"),\n /**The command to run.*/\n command: z\n .array(z.string())\n .describe(\"The command to run.\"),\n timeout_ms: z\n .union([\n z\n .number()\n .int()\n .describe(\n \"Optional timeout in milliseconds for the command.\",\n ),\n z.null(),\n ])\n .optional(),\n working_directory: z\n .union([\n z\n .string()\n .describe(\n \"Optional working directory to run the command in.\",\n ),\n z.null(),\n ])\n .optional(),\n /**Environment variables to set for the command.*/\n env: z\n .record(z.string(), z.string())\n .describe(\n \"Environment variables to set for the command.\",\n ),\n user: z\n .union([\n z\n .string()\n .describe(\n \"Optional user to run the command as.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"Execute a shell command on the server.\",\n ),\n /**\n * The status of the local shell call.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of the local shell call.\\n\",\n ),\n })\n .describe(\n \"A tool call to run a command on the local shell.\\n\",\n ),\n z\n .object({\n /**\n * The type of the local shell tool call output. Always `local_shell_call_output`.\n *\n */\n type: z\n .literal(\"local_shell_call_output\")\n .describe(\n \"The type of the local shell tool call output. Always `local_shell_call_output`.\\n\",\n ),\n /**\n * The unique ID of the local shell tool call generated by the model.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the local shell tool call generated by the model.\\n\",\n ),\n /**\n * A JSON string of the output of the local shell tool call.\n *\n */\n output: z\n .string()\n .describe(\n \"A JSON string of the output of the local shell tool call.\\n\",\n ),\n status: z\n .union([\n z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of the item. One of `in_progress`, `completed`, or `incomplete`.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\"The output of a local shell tool call.\\n\"),\n z\n .object({\n id: z\n .union([\n z\n .string()\n .describe(\n \"The unique ID of the shell tool call. Populated when this item is returned via API.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The unique ID of the shell tool call generated by the model.*/\n call_id: z\n .string()\n .min(1)\n .max(64)\n .describe(\n \"The unique ID of the shell tool call generated by the model.\",\n ),\n /**The type of the item. Always `shell_call`.*/\n type: z\n .literal(\"shell_call\")\n .describe(\n \"The type of the item. Always `shell_call`.\",\n )\n .default(\"shell_call\"),\n /**The shell commands and limits that describe how to run the tool call.*/\n action: z\n .object({\n /**Ordered shell commands for the execution environment to run.*/\n commands: z\n .array(z.string())\n .describe(\n \"Ordered shell commands for the execution environment to run.\",\n ),\n timeout_ms: z\n .union([\n z\n .number()\n .int()\n .describe(\n \"Maximum wall-clock time in milliseconds to allow the shell commands to run.\",\n ),\n z.null(),\n ])\n .optional(),\n max_output_length: z\n .union([\n z\n .number()\n .int()\n .describe(\n \"Maximum number of UTF-8 characters to capture from combined stdout and stderr output.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"The shell commands and limits that describe how to run the tool call.\",\n ),\n status: z\n .union([\n z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"A tool representing a request to execute one or more shell commands.\",\n ),\n z\n .object({\n id: z\n .union([\n z\n .string()\n .describe(\n \"The unique ID of the shell tool call output. Populated when this item is returned via API.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The unique ID of the shell tool call generated by the model.*/\n call_id: z\n .string()\n .min(1)\n .max(64)\n .describe(\n \"The unique ID of the shell tool call generated by the model.\",\n ),\n /**The type of the item. Always `shell_call_output`.*/\n type: z\n .literal(\"shell_call_output\")\n .describe(\n \"The type of the item. Always `shell_call_output`.\",\n )\n .default(\"shell_call_output\"),\n /**Captured chunks of stdout and stderr output, along with their associated outcomes.*/\n output: z\n .array(\n z\n .object({\n /**Captured stdout output for the shell call.*/\n stdout: z\n .string()\n .max(10485760)\n .describe(\n \"Captured stdout output for the shell call.\",\n ),\n /**Captured stderr output for the shell call.*/\n stderr: z\n .string()\n .max(10485760)\n .describe(\n \"Captured stderr output for the shell call.\",\n ),\n /**The exit or timeout outcome associated with this shell call.*/\n outcome: z\n .union([\n z\n .object({\n /**The outcome type. Always `timeout`.*/\n type: z\n .literal(\n \"timeout\",\n )\n .describe(\n \"The outcome type. Always `timeout`.\",\n )\n .default(\n \"timeout\",\n ),\n })\n .describe(\n \"Indicates that the shell call exceeded its configured time limit.\",\n ),\n z\n .object({\n /**The outcome type. Always `exit`.*/\n type: z\n .literal(\"exit\")\n .describe(\n \"The outcome type. Always `exit`.\",\n )\n .default(\n \"exit\",\n ),\n /**The exit code returned by the shell process.*/\n exit_code: z\n .number()\n .int()\n .describe(\n \"The exit code returned by the shell process.\",\n ),\n })\n .describe(\n \"Indicates that the shell commands finished and returned an exit code.\",\n ),\n ])\n .describe(\n \"The exit or timeout outcome associated with this shell call.\",\n ),\n })\n .describe(\n \"Captured stdout and stderr for a portion of a shell tool call output.\",\n ),\n )\n .describe(\n \"Captured chunks of stdout and stderr output, along with their associated outcomes.\",\n ),\n max_output_length: z\n .union([\n z\n .number()\n .int()\n .describe(\n \"The maximum number of UTF-8 characters captured for this shell call's combined output.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"The streamed output items emitted by a shell tool call.\",\n ),\n z\n .object({\n /**The type of the item. Always `apply_patch_call`.*/\n type: z\n .literal(\"apply_patch_call\")\n .describe(\n \"The type of the item. Always `apply_patch_call`.\",\n )\n .default(\"apply_patch_call\"),\n id: z\n .union([\n z\n .string()\n .describe(\n \"The unique ID of the apply patch tool call. Populated when this item is returned via API.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The unique ID of the apply patch tool call generated by the model.*/\n call_id: z\n .string()\n .min(1)\n .max(64)\n .describe(\n \"The unique ID of the apply patch tool call generated by the model.\",\n ),\n /**The status of the apply patch tool call. One of `in_progress` or `completed`.*/\n status: z\n .enum([\"in_progress\", \"completed\"])\n .describe(\n \"The status of the apply patch tool call. One of `in_progress` or `completed`.\",\n ),\n /**The specific create, delete, or update instruction for the apply_patch tool call.*/\n operation: z\n .union([\n z\n .object({\n /**The operation type. Always `create_file`.*/\n type: z\n .literal(\"create_file\")\n .describe(\n \"The operation type. Always `create_file`.\",\n )\n .default(\"create_file\"),\n /**Path of the file to create relative to the workspace root.*/\n path: z\n .string()\n .min(1)\n .describe(\n \"Path of the file to create relative to the workspace root.\",\n ),\n /**Unified diff content to apply when creating the file.*/\n diff: z\n .string()\n .max(10485760)\n .describe(\n \"Unified diff content to apply when creating the file.\",\n ),\n })\n .describe(\n \"Instruction for creating a new file via the apply_patch tool.\",\n ),\n z\n .object({\n /**The operation type. Always `delete_file`.*/\n type: z\n .literal(\"delete_file\")\n .describe(\n \"The operation type. Always `delete_file`.\",\n )\n .default(\"delete_file\"),\n /**Path of the file to delete relative to the workspace root.*/\n path: z\n .string()\n .min(1)\n .describe(\n \"Path of the file to delete relative to the workspace root.\",\n ),\n })\n .describe(\n \"Instruction for deleting an existing file via the apply_patch tool.\",\n ),\n z\n .object({\n /**The operation type. Always `update_file`.*/\n type: z\n .literal(\"update_file\")\n .describe(\n \"The operation type. Always `update_file`.\",\n )\n .default(\"update_file\"),\n /**Path of the file to update relative to the workspace root.*/\n path: z\n .string()\n .min(1)\n .describe(\n \"Path of the file to update relative to the workspace root.\",\n ),\n /**Unified diff content to apply to the existing file.*/\n diff: z\n .string()\n .max(10485760)\n .describe(\n \"Unified diff content to apply to the existing file.\",\n ),\n })\n .describe(\n \"Instruction for updating an existing file via the apply_patch tool.\",\n ),\n ])\n .describe(\n \"The specific create, delete, or update instruction for the apply_patch tool call.\",\n ),\n })\n .describe(\n \"A tool call representing a request to create, delete, or update files using diff patches.\",\n ),\n z\n .object({\n /**The type of the item. Always `apply_patch_call_output`.*/\n type: z\n .literal(\"apply_patch_call_output\")\n .describe(\n \"The type of the item. Always `apply_patch_call_output`.\",\n )\n .default(\"apply_patch_call_output\"),\n id: z\n .union([\n z\n .string()\n .describe(\n \"The unique ID of the apply patch tool call output. Populated when this item is returned via API.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The unique ID of the apply patch tool call generated by the model.*/\n call_id: z\n .string()\n .min(1)\n .max(64)\n .describe(\n \"The unique ID of the apply patch tool call generated by the model.\",\n ),\n /**The status of the apply patch tool call output. One of `completed` or `failed`.*/\n status: z\n .enum([\"completed\", \"failed\"])\n .describe(\n \"The status of the apply patch tool call output. One of `completed` or `failed`.\",\n ),\n output: z\n .union([\n z\n .string()\n .max(10485760)\n .describe(\n \"Optional human-readable log text from the apply patch tool (e.g., patch results or errors).\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"The streamed output emitted by an apply patch tool call.\",\n ),\n z\n .object({\n /**\n * The type of the item. Always `mcp_list_tools`.\n *\n */\n type: z\n .literal(\"mcp_list_tools\")\n .describe(\n \"The type of the item. Always `mcp_list_tools`.\\n\",\n ),\n /**\n * The unique ID of the list.\n *\n */\n id: z\n .string()\n .describe(\"The unique ID of the list.\\n\"),\n /**\n * The label of the MCP server.\n *\n */\n server_label: z\n .string()\n .describe(\"The label of the MCP server.\\n\"),\n /**\n * The tools available on the server.\n *\n */\n tools: z\n .array(\n z\n .object({\n /**\n * The name of the tool.\n *\n */\n name: z\n .string()\n .describe(\n \"The name of the tool.\\n\",\n ),\n description: z\n .union([\n z\n .string()\n .describe(\n \"The description of the tool.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * The JSON schema describing the tool's input.\n *\n */\n input_schema: z\n .record(z.string(), z.unknown())\n .describe(\n \"The JSON schema describing the tool's input.\\n\",\n ),\n annotations: z\n .union([\n z\n .record(\n z.string(),\n z.unknown(),\n )\n .describe(\n \"Additional annotations about the tool.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"A tool available on an MCP server.\\n\",\n ),\n )\n .describe(\n \"The tools available on the server.\\n\",\n ),\n error: z\n .union([\n z\n .string()\n .describe(\n \"Error message if the server could not list tools.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"A list of tools available on an MCP server.\\n\",\n ),\n z\n .object({\n /**\n * The type of the item. Always `mcp_approval_request`.\n *\n */\n type: z\n .literal(\"mcp_approval_request\")\n .describe(\n \"The type of the item. Always `mcp_approval_request`.\\n\",\n ),\n /**\n * The unique ID of the approval request.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the approval request.\\n\",\n ),\n /**\n * The label of the MCP server making the request.\n *\n */\n server_label: z\n .string()\n .describe(\n \"The label of the MCP server making the request.\\n\",\n ),\n /**\n * The name of the tool to run.\n *\n */\n name: z\n .string()\n .describe(\"The name of the tool to run.\\n\"),\n /**\n * A JSON string of arguments for the tool.\n *\n */\n arguments: z\n .string()\n .describe(\n \"A JSON string of arguments for the tool.\\n\",\n ),\n })\n .describe(\n \"A request for human approval of a tool invocation.\\n\",\n ),\n z\n .object({\n /**\n * The type of the item. Always `mcp_approval_response`.\n *\n */\n type: z\n .literal(\"mcp_approval_response\")\n .describe(\n \"The type of the item. Always `mcp_approval_response`.\\n\",\n ),\n id: z\n .union([\n z\n .string()\n .describe(\n \"The unique ID of the approval response\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * The ID of the approval request being answered.\n *\n */\n approval_request_id: z\n .string()\n .describe(\n \"The ID of the approval request being answered.\\n\",\n ),\n /**\n * Whether the request was approved.\n *\n */\n approve: z\n .boolean()\n .describe(\n \"Whether the request was approved.\\n\",\n ),\n reason: z\n .union([\n z\n .string()\n .describe(\n \"Optional reason for the decision.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\"A response to an MCP approval request.\\n\"),\n z\n .object({\n /**\n * The type of the item. Always `mcp_call`.\n *\n */\n type: z\n .literal(\"mcp_call\")\n .describe(\n \"The type of the item. Always `mcp_call`.\\n\",\n ),\n /**\n * The unique ID of the tool call.\n *\n */\n id: z\n .string()\n .describe(\"The unique ID of the tool call.\\n\"),\n /**\n * The label of the MCP server running the tool.\n *\n */\n server_label: z\n .string()\n .describe(\n \"The label of the MCP server running the tool.\\n\",\n ),\n /**\n * The name of the tool that was run.\n *\n */\n name: z\n .string()\n .describe(\n \"The name of the tool that was run.\\n\",\n ),\n /**\n * A JSON string of the arguments passed to the tool.\n *\n */\n arguments: z\n .string()\n .describe(\n \"A JSON string of the arguments passed to the tool.\\n\",\n ),\n output: z\n .union([\n z\n .string()\n .describe(\n \"The output from the tool call.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n error: z\n .union([\n z\n .string()\n .describe(\n \"The error from the tool call, if any.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n \"calling\",\n \"failed\",\n ])\n .describe(\n \"The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.\\n\",\n )\n .optional(),\n approval_request_id: z\n .union([\n z\n .string()\n .describe(\n \"Unique identifier for the MCP tool call approval request.\\nInclude this value in a subsequent `mcp_approval_response` input to approve or reject the corresponding tool call.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"An invocation of a tool on an MCP server.\\n\",\n ),\n z\n .object({\n /**\n * The type of the custom tool call output. Always `custom_tool_call_output`.\n *\n */\n type: z\n .literal(\"custom_tool_call_output\")\n .describe(\n \"The type of the custom tool call output. Always `custom_tool_call_output`.\\n\",\n ),\n /**\n * The unique ID of the custom tool call output in the OpenAI platform.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the custom tool call output in the OpenAI platform.\\n\",\n )\n .optional(),\n /**\n * The call ID, used to map this custom tool call output to a custom tool call.\n *\n */\n call_id: z\n .string()\n .describe(\n \"The call ID, used to map this custom tool call output to a custom tool call.\\n\",\n ),\n /**\n * The output from the custom tool call generated by your code.\n * Can be a string or an list of output content.\n *\n */\n output: z\n .union([\n z\n .string()\n .describe(\n \"A string of the output of the custom tool call.\\n\",\n ),\n z\n .array(\n z.union([\n z\n .object({\n /**The type of the input item. Always `input_text`.*/\n type: z\n .literal(\n \"input_text\",\n )\n .describe(\n \"The type of the input item. Always `input_text`.\",\n )\n .default(\n \"input_text\",\n ),\n /**The text input to the model.*/\n text: z\n .string()\n .describe(\n \"The text input to the model.\",\n ),\n })\n .describe(\n \"A text input to the model.\",\n ),\n z\n .object({\n /**The type of the input item. Always `input_image`.*/\n type: z\n .literal(\n \"input_image\",\n )\n .describe(\n \"The type of the input item. Always `input_image`.\",\n )\n .default(\n \"input_image\",\n ),\n image_url: z\n .union([\n z\n .string()\n .describe(\n \"The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.\",\n ),\n z.null(),\n ])\n .optional(),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.*/\n detail: z\n .enum([\n \"low\",\n \"high\",\n \"auto\",\n ])\n .describe(\n \"The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\",\n ),\n })\n .describe(\n \"An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).\",\n ),\n z\n .object({\n /**The type of the input item. Always `input_file`.*/\n type: z\n .literal(\n \"input_file\",\n )\n .describe(\n \"The type of the input item. Always `input_file`.\",\n )\n .default(\n \"input_file\",\n ),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The name of the file to be sent to the model.*/\n filename: z\n .string()\n .describe(\n \"The name of the file to be sent to the model.\",\n )\n .optional(),\n /**The URL of the file to be sent to the model.*/\n file_url: z\n .string()\n .describe(\n \"The URL of the file to be sent to the model.\",\n )\n .optional(),\n /**\n * The content of the file to be sent to the model.\n *\n */\n file_data: z\n .string()\n .describe(\n \"The content of the file to be sent to the model.\\n\",\n )\n .optional(),\n })\n .describe(\n \"A file input to the model.\",\n ),\n ]),\n )\n .describe(\n \"Text, image, or file output of the custom tool call.\\n\",\n ),\n ])\n .describe(\n \"The output from the custom tool call generated by your code.\\nCan be a string or an list of output content.\\n\",\n ),\n })\n .describe(\n \"The output of a custom tool call from your code, being sent back to the model.\\n\",\n ),\n z\n .object({\n /**\n * The type of the custom tool call. Always `custom_tool_call`.\n *\n */\n type: z\n .literal(\"custom_tool_call\")\n .describe(\n \"The type of the custom tool call. Always `custom_tool_call`.\\n\",\n ),\n /**\n * The unique ID of the custom tool call in the OpenAI platform.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the custom tool call in the OpenAI platform.\\n\",\n )\n .optional(),\n /**\n * An identifier used to map this custom tool call to a tool call output.\n *\n */\n call_id: z\n .string()\n .describe(\n \"An identifier used to map this custom tool call to a tool call output.\\n\",\n ),\n /**\n * The name of the custom tool being called.\n *\n */\n name: z\n .string()\n .describe(\n \"The name of the custom tool being called.\\n\",\n ),\n /**\n * The input for the custom tool call generated by the model.\n *\n */\n input: z\n .string()\n .describe(\n \"The input for the custom tool call generated by the model.\\n\",\n ),\n })\n .describe(\n \"A call to a custom tool created by the model.\\n\",\n ),\n ])\n\n .describe(\n \"An item representing part of the context for the response to be\\ngenerated by the model. Can contain text, images, and audio inputs,\\nas well as previous assistant responses and tool call outputs.\\n\",\n ),\n z\n .object({\n type: z\n .union([\n z\n .literal(\"item_reference\")\n .describe(\n \"The type of item to reference. Always `item_reference`.\",\n )\n .default(\"item_reference\"),\n z.null(),\n ])\n .optional(),\n /**The ID of the item to reference.*/\n id: z.string().describe(\"The ID of the item to reference.\"),\n })\n .describe(\"An internal identifier for an item to reference.\"),\n ]),\n )\n .describe(\n \"A list of one or many input items to the model, containing\\ndifferent content types.\\n\",\n ),\n ])\n .describe(\n \"Text, image, or file inputs to the model, used to generate a response.\\n\\nLearn more:\\n- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)\\n- [Image inputs](https://platform.openai.com/docs/guides/images)\\n- [File inputs](https://platform.openai.com/docs/guides/pdf-files)\\n- [Conversation state](https://platform.openai.com/docs/guides/conversation-state)\\n- [Function calling](https://platform.openai.com/docs/guides/function-calling)\\n\",\n )\n .optional(),\n include: z\n .union([\n z\n .array(\n z\n .enum([\n \"file_search_call.results\",\n \"web_search_call.results\",\n \"web_search_call.action.sources\",\n \"message.input_image.image_url\",\n \"computer_call_output.output.image_url\",\n \"code_interpreter_call.outputs\",\n \"reasoning.encrypted_content\",\n \"message.output_text.logprobs\",\n ])\n .describe(\n \"Specify additional output data to include in the model response. Currently supported values are:\\n- `web_search_call.action.sources`: Include the sources of the web search tool call.\\n- `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items.\\n- `computer_call_output.output.image_url`: Include image urls from the computer call output.\\n- `file_search_call.results`: Include the search results of the file search tool call.\\n- `message.input_image.image_url`: Include image urls from the input message.\\n- `message.output_text.logprobs`: Include logprobs with assistant messages.\\n- `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the `store` parameter is set to `false`, or when an organization is enrolled in the zero data retention program).\",\n ),\n )\n .describe(\n \"Specify additional output data to include in the model response. Currently supported values are:\\n- `web_search_call.action.sources`: Include the sources of the web search tool call.\\n- `code_interpreter_call.outputs`: Includes the outputs of python code execution in code interpreter tool call items.\\n- `computer_call_output.output.image_url`: Include image urls from the computer call output.\\n- `file_search_call.results`: Include the search results of the file search tool call.\\n- `message.input_image.image_url`: Include image urls from the input message.\\n- `message.output_text.logprobs`: Include logprobs with assistant messages.\\n- `reasoning.encrypted_content`: Includes an encrypted version of reasoning tokens in reasoning item outputs. This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly (like when the `store` parameter is set to `false`, or when an organization is enrolled in the zero data retention program).\",\n ),\n z.null(),\n ])\n .optional(),\n parallel_tool_calls: z\n .union([\n z\n .boolean()\n .describe(\"Whether to allow the model to run tool calls in parallel.\\n\")\n .default(true),\n z.null(),\n ])\n .optional(),\n store: z\n .union([\n z\n .boolean()\n .describe(\n \"Whether to store the generated model response for later retrieval via\\nAPI.\\n\",\n )\n .default(true),\n z.null(),\n ])\n .optional(),\n instructions: z\n .union([\n z\n .string()\n .describe(\n \"A system (or developer) message inserted into the model's context.\\n\\nWhen using along with `previous_response_id`, the instructions from a previous\\nresponse will not be carried over to the next response. This makes it simple\\nto swap out system (or developer) messages in new responses.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n stream: z\n .union([\n z\n .boolean()\n .describe(\n \"If set to true, the model response data will be streamed to the client\\nas it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).\\nSee the [Streaming section below](https://platform.openai.com/docs/api-reference/responses-streaming)\\nfor more information.\\n\",\n )\n .default(false),\n z.null(),\n ])\n .optional(),\n stream_options: z\n .union([\n z\n .object({\n /**\n * When true, stream obfuscation will be enabled. Stream obfuscation adds\n * random characters to an `obfuscation` field on streaming delta events to\n * normalize payload sizes as a mitigation to certain side-channel attacks.\n * These obfuscation fields are included by default, but add a small amount\n * of overhead to the data stream. You can set `include_obfuscation` to\n * false to optimize for bandwidth if you trust the network links between\n * your application and the OpenAI API.\n *\n */\n include_obfuscation: z\n .boolean()\n .describe(\n \"When true, stream obfuscation will be enabled. Stream obfuscation adds\\nrandom characters to an `obfuscation` field on streaming delta events to\\nnormalize payload sizes as a mitigation to certain side-channel attacks.\\nThese obfuscation fields are included by default, but add a small amount\\nof overhead to the data stream. You can set `include_obfuscation` to\\nfalse to optimize for bandwidth if you trust the network links between\\nyour application and the OpenAI API.\\n\",\n )\n .optional(),\n })\n .describe(\n \"Options for streaming responses. Only set this when you set `stream: true`.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n conversation: z\n .union([\n z\n .union([\n z.string().describe(\"The unique ID of the conversation.\\n\"),\n z\n .object({\n /**The unique ID of the conversation.*/\n id: z.string().describe(\"The unique ID of the conversation.\"),\n })\n .describe(\"The conversation that this response belongs to.\"),\n ])\n .describe(\n \"The conversation that this response belongs to. Items from this conversation are prepended to `input_items` for this response request.\\nInput items and output items from this response are automatically added to this conversation after this response completes.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n }),\n ),\n);\n\nexport const OpenAIResponseSchema = z.intersection(\n z.object({\n metadata: z\n .union([\n z\n .record(z.string(), z.string())\n .describe(\n \"Set of 16 key-value pairs that can be attached to an object. This can be\\nuseful for storing additional information about the object in a structured\\nformat, and querying for objects via API or the dashboard.\\n\\nKeys are strings with a maximum length of 64 characters. Values are strings\\nwith a maximum length of 512 characters.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n top_logprobs: z\n .union([\n z\n .number()\n .int()\n .gte(0)\n .lte(20)\n .describe(\n \"An integer between 0 and 20 specifying the number of most likely tokens to\\nreturn at each token position, each with an associated log probability.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n temperature: z\n .union([\n z\n .number()\n .gte(0)\n .lte(2)\n .describe(\n \"What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.\\nWe generally recommend altering this or `top_p` but not both.\\n\",\n )\n .default(1),\n z.null(),\n ])\n .optional(),\n top_p: z\n .union([\n z\n .number()\n .gte(0)\n .lte(1)\n .describe(\n \"An alternative to sampling with temperature, called nucleus sampling,\\nwhere the model considers the results of the tokens with top_p probability\\nmass. So 0.1 means only the tokens comprising the top 10% probability mass\\nare considered.\\n\\nWe generally recommend altering this or `temperature` but not both.\\n\",\n )\n .default(1),\n z.null(),\n ])\n .optional(),\n /**\n * This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\n * A stable identifier for your end-users.\n * Used to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).\n *\n */\n user: z\n .string()\n .describe(\n \"This field is being replaced by `safety_identifier` and `prompt_cache_key`. Use `prompt_cache_key` instead to maintain caching optimizations.\\nA stable identifier for your end-users.\\nUsed to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).\\n\",\n )\n .optional(),\n /**\n * A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\n * The IDs should be a string that uniquely identifies each user. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).\n *\n */\n safety_identifier: z\n .string()\n .describe(\n \"A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies.\\nThe IDs should be a string that uniquely identifies each user. We recommend hashing their username or email address, in order to avoid sending us any identifying information. [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).\\n\",\n )\n .optional(),\n /**\n * Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](https://platform.openai.com/docs/guides/prompt-caching).\n *\n */\n prompt_cache_key: z\n .string()\n .describe(\n \"Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the `user` field. [Learn more](https://platform.openai.com/docs/guides/prompt-caching).\\n\",\n )\n .optional(),\n service_tier: z\n .union([\n z\n .enum([\"auto\", \"default\", \"flex\", \"scale\", \"priority\"])\n .describe(\n \"Specifies the processing type used for serving the request.\\n - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'.\\n - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model.\\n - If set to '[flex](https://platform.openai.com/docs/guides/flex-processing)' or '[priority](https://openai.com/api-priority-processing/)', then the request will be processed with the corresponding service tier.\\n - When not set, the default behavior is 'auto'.\\n\\n When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.\\n\",\n )\n .default(\"auto\"),\n z.null(),\n ])\n .optional(),\n prompt_cache_retention: z\n .union([\n z\n .enum([\"in_memory\", \"24h\"])\n .describe(\n \"The retention policy for the prompt cache. Set to `24h` to enable extended prompt caching, which keeps cached prefixes active for longer, up to a maximum of 24 hours. [Learn more](https://platform.openai.com/docs/guides/prompt-caching#prompt-cache-retention).\\n\",\n ),\n z.null(),\n ])\n .optional(),\n }),\n z.intersection(\n z.object({\n previous_response_id: z\n .union([\n z\n .string()\n .describe(\n \"The unique ID of the previous response to the model. Use this to\\ncreate multi-turn conversations. Learn more about\\n[conversation state](https://platform.openai.com/docs/guides/conversation-state). Cannot be used in conjunction with `conversation`.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\n * offers a wide range of models with different capabilities, performance\n * characteristics, and price points. Refer to the [model guide](https://platform.openai.com/docs/models)\n * to browse and compare available models.\n *\n */\n model: z\n .union([\n z.union([\n z.string(),\n z.enum([\n \"gpt-5.1\",\n \"gpt-5.1-2025-11-13\",\n \"gpt-5.1-codex\",\n \"gpt-5.1-mini\",\n \"gpt-5.1-chat-latest\",\n \"gpt-5\",\n \"gpt-5-mini\",\n \"gpt-5-nano\",\n \"gpt-5-2025-08-07\",\n \"gpt-5-mini-2025-08-07\",\n \"gpt-5-nano-2025-08-07\",\n \"gpt-5-chat-latest\",\n \"gpt-4.1\",\n \"gpt-4.1-mini\",\n \"gpt-4.1-nano\",\n \"gpt-4.1-2025-04-14\",\n \"gpt-4.1-mini-2025-04-14\",\n \"gpt-4.1-nano-2025-04-14\",\n \"o4-mini\",\n \"o4-mini-2025-04-16\",\n \"o3\",\n \"o3-2025-04-16\",\n \"o3-mini\",\n \"o3-mini-2025-01-31\",\n \"o1\",\n \"o1-2024-12-17\",\n \"o1-preview\",\n \"o1-preview-2024-09-12\",\n \"o1-mini\",\n \"o1-mini-2024-09-12\",\n \"gpt-4o\",\n \"gpt-4o-2024-11-20\",\n \"gpt-4o-2024-08-06\",\n \"gpt-4o-2024-05-13\",\n \"gpt-4o-audio-preview\",\n \"gpt-4o-audio-preview-2024-10-01\",\n \"gpt-4o-audio-preview-2024-12-17\",\n \"gpt-4o-audio-preview-2025-06-03\",\n \"gpt-4o-mini-audio-preview\",\n \"gpt-4o-mini-audio-preview-2024-12-17\",\n \"gpt-4o-search-preview\",\n \"gpt-4o-mini-search-preview\",\n \"gpt-4o-search-preview-2025-03-11\",\n \"gpt-4o-mini-search-preview-2025-03-11\",\n \"chatgpt-4o-latest\",\n \"codex-mini-latest\",\n \"gpt-4o-mini\",\n \"gpt-4o-mini-2024-07-18\",\n \"gpt-4-turbo\",\n \"gpt-4-turbo-2024-04-09\",\n \"gpt-4-0125-preview\",\n \"gpt-4-turbo-preview\",\n \"gpt-4-1106-preview\",\n \"gpt-4-vision-preview\",\n \"gpt-4\",\n \"gpt-4-0314\",\n \"gpt-4-0613\",\n \"gpt-4-32k\",\n \"gpt-4-32k-0314\",\n \"gpt-4-32k-0613\",\n \"gpt-3.5-turbo\",\n \"gpt-3.5-turbo-16k\",\n \"gpt-3.5-turbo-0301\",\n \"gpt-3.5-turbo-0613\",\n \"gpt-3.5-turbo-1106\",\n \"gpt-3.5-turbo-0125\",\n \"gpt-3.5-turbo-16k-0613\",\n ]),\n ]),\n z.enum([\n \"o1-pro\",\n \"o1-pro-2025-03-19\",\n \"o3-pro\",\n \"o3-pro-2025-06-10\",\n \"o3-deep-research\",\n \"o3-deep-research-2025-06-26\",\n \"o4-mini-deep-research\",\n \"o4-mini-deep-research-2025-06-26\",\n \"computer-use-preview\",\n \"computer-use-preview-2025-03-11\",\n \"gpt-5-codex\",\n \"gpt-5-pro\",\n \"gpt-5-pro-2025-10-06\",\n \"gpt-5.1-codex-max\",\n ]),\n ])\n .describe(\n \"Model ID used to generate the response, like `gpt-4o` or `o3`. OpenAI\\noffers a wide range of models with different capabilities, performance\\ncharacteristics, and price points. Refer to the [model guide](https://platform.openai.com/docs/models)\\nto browse and compare available models.\\n\",\n )\n .optional(),\n reasoning: z\n .union([\n z\n .object({\n effort: z\n .union([\n z\n .enum([\"none\", \"minimal\", \"low\", \"medium\", \"high\", \"xhigh\"])\n .describe(\n \"Constrains effort on reasoning for\\n[reasoning models](https://platform.openai.com/docs/guides/reasoning).\\nCurrently supported values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. Reducing\\nreasoning effort can result in faster responses and fewer tokens used\\non reasoning in a response.\\n\\n- `gpt-5.1` defaults to `none`, which does not perform reasoning. The supported reasoning values for `gpt-5.1` are `none`, `low`, `medium`, and `high`. Tool calls are supported for all reasoning values in gpt-5.1.\\n- All models before `gpt-5.1` default to `medium` reasoning effort, and do not support `none`.\\n- The `gpt-5-pro` model defaults to (and only supports) `high` reasoning effort.\\n- `xhigh` is currently only supported for `gpt-5.1-codex-max`.\\n\",\n )\n .default(\"medium\"),\n z.null(),\n ])\n .optional(),\n summary: z\n .union([\n z\n .enum([\"auto\", \"concise\", \"detailed\"])\n .describe(\n \"A summary of the reasoning performed by the model. This can be\\nuseful for debugging and understanding the model's reasoning process.\\nOne of `auto`, `concise`, or `detailed`.\\n\\n`concise` is only supported for `computer-use-preview` models.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n generate_summary: z\n .union([\n z\n .enum([\"auto\", \"concise\", \"detailed\"])\n .describe(\n \"**Deprecated:** use `summary` instead.\\n\\nA summary of the reasoning performed by the model. This can be\\nuseful for debugging and understanding the model's reasoning process.\\nOne of `auto`, `concise`, or `detailed`.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"**gpt-5 and o-series models only**\\n\\nConfiguration options for\\n[reasoning models](https://platform.openai.com/docs/guides/reasoning).\\n\",\n ),\n z.null(),\n ])\n .optional(),\n background: z\n .union([\n z\n .boolean()\n .describe(\n \"Whether to run the model response in the background.\\n[Learn more](https://platform.openai.com/docs/guides/background).\\n\",\n )\n .default(false),\n z.null(),\n ])\n .optional(),\n max_output_tokens: z\n .union([\n z\n .number()\n .int()\n .describe(\n \"An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](https://platform.openai.com/docs/guides/reasoning).\\n\",\n ),\n z.null(),\n ])\n .optional(),\n max_tool_calls: z\n .union([\n z\n .number()\n .int()\n .describe(\n \"The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * Configuration options for a text response from the model. Can be plain\n * text or structured JSON data. Learn more:\n * - [Text inputs and outputs](https://platform.openai.com/docs/guides/text)\n * - [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)\n *\n */\n text: z\n .object({\n /**\n * An object specifying the format that the model must output.\n *\n * Configuring `{ \"type\": \"json_schema\" }` enables Structured Outputs,\n * which ensures the model will match your supplied JSON schema. Learn more in the\n * [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).\n *\n * The default format is `{ \"type\": \"text\" }` with no additional options.\n *\n * **Not recommended for gpt-4o and newer models:**\n *\n * Setting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which\n * ensures the message the model generates is valid JSON. Using `json_schema`\n * is preferred for models that support it.\n *\n */\n format: z\n .union([\n z\n .object({\n /**The type of response format being defined. Always `text`.*/\n type: z\n .literal(\"text\")\n .describe(\n \"The type of response format being defined. Always `text`.\",\n ),\n })\n .describe(\n \"Default response format. Used to generate text responses.\\n\",\n ),\n z\n .object({\n /**The type of response format being defined. Always `json_schema`.*/\n type: z\n .literal(\"json_schema\")\n .describe(\n \"The type of response format being defined. Always `json_schema`.\",\n ),\n /**\n * A description of what the response format is for, used by the model to\n * determine how to respond in the format.\n *\n */\n description: z\n .string()\n .describe(\n \"A description of what the response format is for, used by the model to\\ndetermine how to respond in the format.\\n\",\n )\n .optional(),\n /**\n * The name of the response format. Must be a-z, A-Z, 0-9, or contain\n * underscores and dashes, with a maximum length of 64.\n *\n */\n name: z\n .string()\n .describe(\n \"The name of the response format. Must be a-z, A-Z, 0-9, or contain\\nunderscores and dashes, with a maximum length of 64.\\n\",\n ),\n /**\n * The schema for the response format, described as a JSON Schema object.\n * Learn how to build JSON schemas [here](https://json-schema.org/).\n *\n */\n schema: z\n .record(z.string(), z.unknown())\n .describe(\n \"The schema for the response format, described as a JSON Schema object.\\nLearn how to build JSON schemas [here](https://json-schema.org/).\\n\",\n ),\n strict: z\n .union([\n z\n .boolean()\n .describe(\n \"Whether to enable strict schema adherence when generating the output.\\nIf set to true, the model will always follow the exact schema defined\\nin the `schema` field. Only a subset of JSON Schema is supported when\\n`strict` is `true`. To learn more, read the [Structured Outputs\\nguide](https://platform.openai.com/docs/guides/structured-outputs).\\n\",\n )\n .default(false),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"JSON Schema response format. Used to generate structured JSON responses.\\nLearn more about [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).\\n\",\n ),\n z\n .object({\n /**The type of response format being defined. Always `json_object`.*/\n type: z\n .literal(\"json_object\")\n .describe(\n \"The type of response format being defined. Always `json_object`.\",\n ),\n })\n .describe(\n \"JSON object response format. An older method of generating JSON responses.\\nUsing `json_schema` is recommended for models that support it. Note that the\\nmodel will not generate JSON without a system or user message instructing it\\nto do so.\\n\",\n ),\n ])\n .describe(\n 'An object specifying the format that the model must output.\\n\\nConfiguring `{ \"type\": \"json_schema\" }` enables Structured Outputs, \\nwhich ensures the model will match your supplied JSON schema. Learn more in the \\n[Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs).\\n\\nThe default format is `{ \"type\": \"text\" }` with no additional options.\\n\\n**Not recommended for gpt-4o and newer models:**\\n\\nSetting to `{ \"type\": \"json_object\" }` enables the older JSON mode, which\\nensures the message the model generates is valid JSON. Using `json_schema`\\nis preferred for models that support it.\\n',\n )\n .optional(),\n verbosity: z\n .union([\n z\n .enum([\"low\", \"medium\", \"high\"])\n .describe(\n \"Constrains the verbosity of the model's response. Lower values will result in\\nmore concise responses, while higher values will result in more verbose responses.\\nCurrently supported values are `low`, `medium`, and `high`.\\n\",\n )\n .default(\"medium\"),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"Configuration options for a text response from the model. Can be plain\\ntext or structured JSON data. Learn more:\\n- [Text inputs and outputs](https://platform.openai.com/docs/guides/text)\\n- [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs)\\n\",\n )\n .optional(),\n /**\n * An array of tools the model may call while generating a response. You\n * can specify which tool to use by setting the `tool_choice` parameter.\n *\n * We support the following categories of tools:\n * - **Built-in tools**: Tools that are provided by OpenAI that extend the\n * model's capabilities, like [web search](https://platform.openai.com/docs/guides/tools-web-search)\n * or [file search](https://platform.openai.com/docs/guides/tools-file-search). Learn more about\n * [built-in tools](https://platform.openai.com/docs/guides/tools).\n * - **MCP Tools**: Integrations with third-party systems via custom MCP servers\n * or predefined connectors such as Google Drive and SharePoint. Learn more about\n * [MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp).\n * - **Function calls (custom tools)**: Functions that are defined by you,\n * enabling the model to call your own code with strongly typed arguments\n * and outputs. Learn more about\n * [function calling](https://platform.openai.com/docs/guides/function-calling). You can also use\n * custom tools to call your own code.\n *\n */\n tools: z\n .array(\n z\n .union([\n z\n .object({\n /**The type of the function tool. Always `function`.*/\n type: z\n .literal(\"function\")\n .describe(\n \"The type of the function tool. Always `function`.\",\n )\n .default(\"function\"),\n /**The name of the function to call.*/\n name: z.string().describe(\"The name of the function to call.\"),\n description: z\n .union([\n z\n .string()\n .describe(\n \"A description of the function. Used by the model to determine whether or not to call the function.\",\n ),\n z.null(),\n ])\n .optional(),\n parameters: z.union([\n z\n .record(z.string(), z.unknown())\n .describe(\n \"A JSON schema object describing the parameters of the function.\",\n ),\n z.null(),\n ]),\n strict: z.union([\n z\n .boolean()\n .describe(\n \"Whether to enforce strict parameter validation. Default `true`.\",\n ),\n z.null(),\n ]),\n })\n .describe(\n \"Defines a function in your own code the model can choose to call. Learn more about [function calling](https://platform.openai.com/docs/guides/function-calling).\",\n ),\n z\n .object({\n /**The type of the file search tool. Always `file_search`.*/\n type: z\n .literal(\"file_search\")\n .describe(\n \"The type of the file search tool. Always `file_search`.\",\n )\n .default(\"file_search\"),\n /**The IDs of the vector stores to search.*/\n vector_store_ids: z\n .array(z.string())\n .describe(\"The IDs of the vector stores to search.\"),\n /**The maximum number of results to return. This number should be between 1 and 50 inclusive.*/\n max_num_results: z\n .number()\n .int()\n .describe(\n \"The maximum number of results to return. This number should be between 1 and 50 inclusive.\",\n )\n .optional(),\n /**Ranking options for search.*/\n ranking_options: z\n .object({\n /**The ranker to use for the file search.*/\n ranker: z\n .enum([\"auto\", \"default-2024-11-15\"])\n .describe(\"The ranker to use for the file search.\")\n .optional(),\n /**The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.*/\n score_threshold: z\n .number()\n .describe(\n \"The score threshold for the file search, a number between 0 and 1. Numbers closer to 1 will attempt to return only the most relevant results, but may return fewer results.\",\n )\n .optional(),\n /**Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.*/\n hybrid_search: z\n .object({\n /**The weight of the embedding in the reciprocal ranking fusion.*/\n embedding_weight: z\n .number()\n .describe(\n \"The weight of the embedding in the reciprocal ranking fusion.\",\n ),\n /**The weight of the text in the reciprocal ranking fusion.*/\n text_weight: z\n .number()\n .describe(\n \"The weight of the text in the reciprocal ranking fusion.\",\n ),\n })\n .describe(\n \"Weights that control how reciprocal rank fusion balances semantic embedding matches versus sparse keyword matches when hybrid search is enabled.\",\n )\n .optional(),\n })\n .describe(\"Ranking options for search.\")\n .optional(),\n filters: z\n .union([\n z\n .union([\n z\n .object({\n /**\n * Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`.\n * - `eq`: equals\n * - `ne`: not equal\n * - `gt`: greater than\n * - `gte`: greater than or equal\n * - `lt`: less than\n * - `lte`: less than or equal\n * - `in`: in\n * - `nin`: not in\n *\n */\n type: z\n .enum([\n \"eq\",\n \"ne\",\n \"gt\",\n \"gte\",\n \"lt\",\n \"lte\",\n ])\n .describe(\n \"Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`.\\n- `eq`: equals\\n- `ne`: not equal\\n- `gt`: greater than\\n- `gte`: greater than or equal\\n- `lt`: less than\\n- `lte`: less than or equal\\n- `in`: in\\n- `nin`: not in\\n\",\n )\n .default(\"eq\"),\n /**The key to compare against the value.*/\n key: z\n .string()\n .describe(\n \"The key to compare against the value.\",\n ),\n /**The value to compare against the attribute key; supports string, number, or boolean types.*/\n value: z\n .union([\n z.string(),\n z.number(),\n z.boolean(),\n z.array(\n z.union([\n z.string(),\n z.number(),\n ]),\n ),\n ])\n .describe(\n \"The value to compare against the attribute key; supports string, number, or boolean types.\",\n ),\n })\n .strict()\n .describe(\n \"A filter used to compare a specified attribute key to a given value using a defined comparison operation.\\n\",\n ),\n z\n .object({\n /**Type of operation: `and` or `or`.*/\n type: z\n .enum([\"and\", \"or\"])\n .describe(\n \"Type of operation: `and` or `or`.\",\n ),\n /**Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.*/\n filters: z\n .array(\n z.union([\n z\n .object({\n /**\n * Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`.\n * - `eq`: equals\n * - `ne`: not equal\n * - `gt`: greater than\n * - `gte`: greater than or equal\n * - `lt`: less than\n * - `lte`: less than or equal\n * - `in`: in\n * - `nin`: not in\n *\n */\n type: z\n .enum([\n \"eq\",\n \"ne\",\n \"gt\",\n \"gte\",\n \"lt\",\n \"lte\",\n ])\n .describe(\n \"Specifies the comparison operator: `eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`.\\n- `eq`: equals\\n- `ne`: not equal\\n- `gt`: greater than\\n- `gte`: greater than or equal\\n- `lt`: less than\\n- `lte`: less than or equal\\n- `in`: in\\n- `nin`: not in\\n\",\n )\n .default(\"eq\"),\n /**The key to compare against the value.*/\n key: z\n .string()\n .describe(\n \"The key to compare against the value.\",\n ),\n /**The value to compare against the attribute key; supports string, number, or boolean types.*/\n value: z\n .union([\n z.string(),\n z.number(),\n z.boolean(),\n z.array(\n z.union(\n [\n z.string(),\n z.number(),\n ],\n ),\n ),\n ])\n .describe(\n \"The value to compare against the attribute key; supports string, number, or boolean types.\",\n ),\n })\n .strict()\n .describe(\n \"A filter used to compare a specified attribute key to a given value using a defined comparison operation.\\n\",\n ),\n z.any(),\n ]),\n )\n .describe(\n \"Array of filters to combine. Items can be `ComparisonFilter` or `CompoundFilter`.\",\n ),\n })\n .strict()\n .describe(\n \"Combine multiple filters using `and` or `or`.\",\n ),\n ])\n .describe(\"A filter to apply.\"),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"A tool that searches for relevant content from uploaded files. Learn more about the [file search tool](https://platform.openai.com/docs/guides/tools-file-search).\",\n ),\n z\n .object({\n /**The type of the computer use tool. Always `computer_use_preview`.*/\n type: z\n .literal(\"computer_use_preview\")\n .describe(\n \"The type of the computer use tool. Always `computer_use_preview`.\",\n )\n .default(\"computer_use_preview\"),\n /**The type of computer environment to control.*/\n environment: z\n .enum([\"windows\", \"mac\", \"linux\", \"ubuntu\", \"browser\"])\n .describe(\"The type of computer environment to control.\"),\n /**The width of the computer display.*/\n display_width: z\n .number()\n .int()\n .describe(\"The width of the computer display.\"),\n /**The height of the computer display.*/\n display_height: z\n .number()\n .int()\n .describe(\"The height of the computer display.\"),\n })\n .describe(\n \"A tool that controls a virtual computer. Learn more about the [computer tool](https://platform.openai.com/docs/guides/tools-computer-use).\",\n ),\n z\n .object({\n /**The type of the web search tool. One of `web_search` or `web_search_2025_08_26`.*/\n type: z\n .enum([\"web_search\", \"web_search_2025_08_26\"])\n .describe(\n \"The type of the web search tool. One of `web_search` or `web_search_2025_08_26`.\",\n )\n .default(\"web_search\"),\n filters: z\n .union([\n z\n .object({\n allowed_domains: z\n .union([\n z\n .array(\n z\n .string()\n .describe(\n \"Allowed domain for the search.\",\n ),\n )\n .describe(\n 'Allowed domains for the search. If not provided, all domains are allowed.\\nSubdomains of the provided domains are allowed as well.\\n\\nExample: `[\"pubmed.ncbi.nlm.nih.gov\"]`\\n',\n )\n .default([]),\n z.null(),\n ])\n .optional(),\n })\n .describe(\"Filters for the search.\\n\"),\n z.null(),\n ])\n .optional(),\n user_location: z\n .union([\n z\n .object({\n /**The type of location approximation. Always `approximate`.*/\n type: z\n .literal(\"approximate\")\n .describe(\n \"The type of location approximation. Always `approximate`.\",\n )\n .default(\"approximate\"),\n country: z\n .union([\n z\n .string()\n .describe(\n \"The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.\",\n ),\n z.null(),\n ])\n .optional(),\n region: z\n .union([\n z\n .string()\n .describe(\n \"Free text input for the region of the user, e.g. `California`.\",\n ),\n z.null(),\n ])\n .optional(),\n city: z\n .union([\n z\n .string()\n .describe(\n \"Free text input for the city of the user, e.g. `San Francisco`.\",\n ),\n z.null(),\n ])\n .optional(),\n timezone: z\n .union([\n z\n .string()\n .describe(\n \"The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"The approximate location of the user.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default.*/\n search_context_size: z\n .enum([\"low\", \"medium\", \"high\"])\n .describe(\n \"High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default.\",\n )\n .default(\"medium\"),\n })\n .describe(\n \"Search the Internet for sources related to the prompt. Learn more about the\\n[web search tool](https://platform.openai.com/docs/guides/tools-web-search).\\n\",\n ),\n z\n .object({\n /**The type of the MCP tool. Always `mcp`.*/\n type: z\n .literal(\"mcp\")\n .describe(\"The type of the MCP tool. Always `mcp`.\"),\n /**\n * A label for this MCP server, used to identify it in tool calls.\n *\n */\n server_label: z\n .string()\n .describe(\n \"A label for this MCP server, used to identify it in tool calls.\\n\",\n ),\n /**\n * The URL for the MCP server. One of `server_url` or `connector_id` must be\n * provided.\n *\n */\n server_url: z\n .string()\n .describe(\n \"The URL for the MCP server. One of `server_url` or `connector_id` must be\\nprovided.\\n\",\n )\n .optional(),\n /**\n * Identifier for service connectors, like those available in ChatGPT. One of\n * `server_url` or `connector_id` must be provided. Learn more about service\n * connectors [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).\n *\n * Currently supported `connector_id` values are:\n *\n * - Dropbox: `connector_dropbox`\n * - Gmail: `connector_gmail`\n * - Google Calendar: `connector_googlecalendar`\n * - Google Drive: `connector_googledrive`\n * - Microsoft Teams: `connector_microsoftteams`\n * - Outlook Calendar: `connector_outlookcalendar`\n * - Outlook Email: `connector_outlookemail`\n * - SharePoint: `connector_sharepoint`\n *\n */\n connector_id: z\n .enum([\n \"connector_dropbox\",\n \"connector_gmail\",\n \"connector_googlecalendar\",\n \"connector_googledrive\",\n \"connector_microsoftteams\",\n \"connector_outlookcalendar\",\n \"connector_outlookemail\",\n \"connector_sharepoint\",\n ])\n .describe(\n \"Identifier for service connectors, like those available in ChatGPT. One of\\n`server_url` or `connector_id` must be provided. Learn more about service\\nconnectors [here](https://platform.openai.com/docs/guides/tools-remote-mcp#connectors).\\n\\nCurrently supported `connector_id` values are:\\n\\n- Dropbox: `connector_dropbox`\\n- Gmail: `connector_gmail`\\n- Google Calendar: `connector_googlecalendar`\\n- Google Drive: `connector_googledrive`\\n- Microsoft Teams: `connector_microsoftteams`\\n- Outlook Calendar: `connector_outlookcalendar`\\n- Outlook Email: `connector_outlookemail`\\n- SharePoint: `connector_sharepoint`\\n\",\n )\n .optional(),\n /**\n * An OAuth access token that can be used with a remote MCP server, either\n * with a custom MCP server URL or a service connector. Your application\n * must handle the OAuth authorization flow and provide the token here.\n *\n */\n authorization: z\n .string()\n .describe(\n \"An OAuth access token that can be used with a remote MCP server, either\\nwith a custom MCP server URL or a service connector. Your application\\nmust handle the OAuth authorization flow and provide the token here.\\n\",\n )\n .optional(),\n /**\n * Optional description of the MCP server, used to provide more context.\n *\n */\n server_description: z\n .string()\n .describe(\n \"Optional description of the MCP server, used to provide more context.\\n\",\n )\n .optional(),\n headers: z\n .union([\n z\n .record(z.string(), z.string())\n .describe(\n \"Optional HTTP headers to send to the MCP server. Use for authentication\\nor other purposes.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n allowed_tools: z\n .union([\n z\n .union([\n z\n .array(z.string())\n .describe(\n \"A string array of allowed tool names\",\n ),\n z\n .object({\n /**List of allowed tool names.*/\n tool_names: z\n .array(z.string())\n .describe(\n \"List of allowed tool names.\",\n )\n .optional(),\n /**\n * Indicates whether or not a tool modifies data or is read-only. If an\n * MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),\n * it will match this filter.\n *\n */\n read_only: z\n .boolean()\n .describe(\n \"Indicates whether or not a tool modifies data or is read-only. If an\\nMCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),\\nit will match this filter.\\n\",\n )\n .optional(),\n })\n .strict()\n .describe(\n \"A filter object to specify which tools are allowed.\\n\",\n ),\n ])\n .describe(\n \"List of allowed tool names or a filter object.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n require_approval: z\n .union([\n z\n .union([\n z\n .object({\n /**\n * A filter object to specify which tools are allowed.\n *\n */\n always: z\n .object({\n /**List of allowed tool names.*/\n tool_names: z\n .array(z.string())\n .describe(\n \"List of allowed tool names.\",\n )\n .optional(),\n /**\n * Indicates whether or not a tool modifies data or is read-only. If an\n * MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),\n * it will match this filter.\n *\n */\n read_only: z\n .boolean()\n .describe(\n \"Indicates whether or not a tool modifies data or is read-only. If an\\nMCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),\\nit will match this filter.\\n\",\n )\n .optional(),\n })\n .strict()\n .describe(\n \"A filter object to specify which tools are allowed.\\n\",\n )\n .optional(),\n /**\n * A filter object to specify which tools are allowed.\n *\n */\n never: z\n .object({\n /**List of allowed tool names.*/\n tool_names: z\n .array(z.string())\n .describe(\n \"List of allowed tool names.\",\n )\n .optional(),\n /**\n * Indicates whether or not a tool modifies data or is read-only. If an\n * MCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),\n * it will match this filter.\n *\n */\n read_only: z\n .boolean()\n .describe(\n \"Indicates whether or not a tool modifies data or is read-only. If an\\nMCP server is [annotated with `readOnlyHint`](https://modelcontextprotocol.io/specification/2025-06-18/schema#toolannotations-readonlyhint),\\nit will match this filter.\\n\",\n )\n .optional(),\n })\n .strict()\n .describe(\n \"A filter object to specify which tools are allowed.\\n\",\n )\n .optional(),\n })\n .strict()\n .describe(\n \"Specify which of the MCP server's tools require approval. Can be\\n`always`, `never`, or a filter object associated with tools\\nthat require approval.\\n\",\n ),\n z\n .enum([\"always\", \"never\"])\n .describe(\n \"Specify a single approval policy for all tools. One of `always` or\\n`never`. When set to `always`, all tools will require approval. When\\nset to `never`, all tools will not require approval.\\n\",\n ),\n ])\n .describe(\n \"Specify which of the MCP server's tools require approval.\",\n )\n .default(\"always\"),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"Give the model access to additional tools via remote Model Context Protocol\\n(MCP) servers. [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).\\n\",\n ),\n z\n .object({\n /**\n * The type of the code interpreter tool. Always `code_interpreter`.\n *\n */\n type: z\n .literal(\"code_interpreter\")\n .describe(\n \"The type of the code interpreter tool. Always `code_interpreter`.\\n\",\n ),\n /**\n * The code interpreter container. Can be a container ID or an object that\n * specifies uploaded file IDs to make available to your code, along with an\n * optional `memory_limit` setting.\n *\n */\n container: z\n .union([\n z.string().describe(\"The container ID.\"),\n z\n .object({\n /**Always `auto`.*/\n type: z\n .literal(\"auto\")\n .describe(\"Always `auto`.\")\n .default(\"auto\"),\n /**An optional list of uploaded files to make available to your code.*/\n file_ids: z\n .array(z.string())\n .max(50)\n .describe(\n \"An optional list of uploaded files to make available to your code.\",\n )\n .optional(),\n memory_limit: z\n .union([\n z.enum([\"1g\", \"4g\", \"16g\", \"64g\"]),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"Configuration for a code interpreter container. Optionally specify the IDs of the files to run the code on.\",\n ),\n ])\n .describe(\n \"The code interpreter container. Can be a container ID or an object that\\nspecifies uploaded file IDs to make available to your code, along with an\\noptional `memory_limit` setting.\\n\",\n ),\n })\n .describe(\n \"A tool that runs Python code to help generate a response to a prompt.\\n\",\n ),\n z\n .object({\n /**\n * The type of the image generation tool. Always `image_generation`.\n *\n */\n type: z\n .literal(\"image_generation\")\n .describe(\n \"The type of the image generation tool. Always `image_generation`.\\n\",\n ),\n /**\n * The image generation model to use. Default: `gpt-image-1`.\n *\n */\n model: z\n .enum([\"gpt-image-1\", \"gpt-image-1-mini\"])\n .describe(\n \"The image generation model to use. Default: `gpt-image-1`.\\n\",\n )\n .default(\"gpt-image-1\"),\n /**\n * The quality of the generated image. One of `low`, `medium`, `high`,\n * or `auto`. Default: `auto`.\n *\n */\n quality: z\n .enum([\"low\", \"medium\", \"high\", \"auto\"])\n .describe(\n \"The quality of the generated image. One of `low`, `medium`, `high`,\\nor `auto`. Default: `auto`.\\n\",\n )\n .default(\"auto\"),\n /**\n * The size of the generated image. One of `1024x1024`, `1024x1536`,\n * `1536x1024`, or `auto`. Default: `auto`.\n *\n */\n size: z\n .enum([\"1024x1024\", \"1024x1536\", \"1536x1024\", \"auto\"])\n .describe(\n \"The size of the generated image. One of `1024x1024`, `1024x1536`,\\n`1536x1024`, or `auto`. Default: `auto`.\\n\",\n )\n .default(\"auto\"),\n /**\n * The output format of the generated image. One of `png`, `webp`, or\n * `jpeg`. Default: `png`.\n *\n */\n output_format: z\n .enum([\"png\", \"webp\", \"jpeg\"])\n .describe(\n \"The output format of the generated image. One of `png`, `webp`, or\\n`jpeg`. Default: `png`.\\n\",\n )\n .default(\"png\"),\n /**\n * Compression level for the output image. Default: 100.\n *\n */\n output_compression: z\n .number()\n .int()\n .gte(0)\n .lte(100)\n .describe(\n \"Compression level for the output image. Default: 100.\\n\",\n )\n .default(100),\n /**\n * Moderation level for the generated image. Default: `auto`.\n *\n */\n moderation: z\n .enum([\"auto\", \"low\"])\n .describe(\n \"Moderation level for the generated image. Default: `auto`.\\n\",\n )\n .default(\"auto\"),\n /**\n * Background type for the generated image. One of `transparent`,\n * `opaque`, or `auto`. Default: `auto`.\n *\n */\n background: z\n .enum([\"transparent\", \"opaque\", \"auto\"])\n .describe(\n \"Background type for the generated image. One of `transparent`,\\n`opaque`, or `auto`. Default: `auto`.\\n\",\n )\n .default(\"auto\"),\n input_fidelity: z\n .union([\n z\n .enum([\"high\", \"low\"])\n .describe(\n \"Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * Optional mask for inpainting. Contains `image_url`\n * (string, optional) and `file_id` (string, optional).\n *\n */\n input_image_mask: z\n .object({\n /**\n * Base64-encoded mask image.\n *\n */\n image_url: z\n .string()\n .describe(\"Base64-encoded mask image.\\n\")\n .optional(),\n /**\n * File ID for the mask image.\n *\n */\n file_id: z\n .string()\n .describe(\"File ID for the mask image.\\n\")\n .optional(),\n })\n .strict()\n .describe(\n \"Optional mask for inpainting. Contains `image_url`\\n(string, optional) and `file_id` (string, optional).\\n\",\n )\n .optional(),\n /**\n * Number of partial images to generate in streaming mode, from 0 (default value) to 3.\n *\n */\n partial_images: z\n .number()\n .int()\n .gte(0)\n .lte(3)\n .describe(\n \"Number of partial images to generate in streaming mode, from 0 (default value) to 3.\\n\",\n )\n .default(0),\n })\n .describe(\n \"A tool that generates images using a model like `gpt-image-1`.\\n\",\n ),\n z\n .object({\n /**The type of the local shell tool. Always `local_shell`.*/\n type: z\n .literal(\"local_shell\")\n .describe(\n \"The type of the local shell tool. Always `local_shell`.\",\n )\n .default(\"local_shell\"),\n })\n .describe(\n \"A tool that allows the model to execute shell commands in a local environment.\",\n ),\n z\n .object({\n /**The type of the shell tool. Always `shell`.*/\n type: z\n .literal(\"shell\")\n .describe(\"The type of the shell tool. Always `shell`.\")\n .default(\"shell\"),\n })\n .describe(\n \"A tool that allows the model to execute shell commands.\",\n ),\n z\n .object({\n /**The type of the custom tool. Always `custom`.*/\n type: z\n .literal(\"custom\")\n .describe(\"The type of the custom tool. Always `custom`.\")\n .default(\"custom\"),\n /**The name of the custom tool, used to identify it in tool calls.*/\n name: z\n .string()\n .describe(\n \"The name of the custom tool, used to identify it in tool calls.\",\n ),\n /**Optional description of the custom tool, used to provide more context.*/\n description: z\n .string()\n .describe(\n \"Optional description of the custom tool, used to provide more context.\",\n )\n .optional(),\n /**The input format for the custom tool. Default is unconstrained text.*/\n format: z\n .union([\n z\n .object({\n /**Unconstrained text format. Always `text`.*/\n type: z\n .literal(\"text\")\n .describe(\n \"Unconstrained text format. Always `text`.\",\n )\n .default(\"text\"),\n })\n .describe(\"Unconstrained free-form text.\"),\n z\n .object({\n /**Grammar format. Always `grammar`.*/\n type: z\n .literal(\"grammar\")\n .describe(\n \"Grammar format. Always `grammar`.\",\n )\n .default(\"grammar\"),\n /**The syntax of the grammar definition. One of `lark` or `regex`.*/\n syntax: z\n .enum([\"lark\", \"regex\"])\n .describe(\n \"The syntax of the grammar definition. One of `lark` or `regex`.\",\n ),\n /**The grammar definition.*/\n definition: z\n .string()\n .describe(\"The grammar definition.\"),\n })\n .describe(\"A grammar defined by the user.\"),\n ])\n .describe(\n \"The input format for the custom tool. Default is unconstrained text.\",\n )\n .optional(),\n })\n .describe(\n \"A custom tool that processes input using a specified format. Learn more about [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools)\",\n ),\n z\n .object({\n /**The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`.*/\n type: z\n .enum([\n \"web_search_preview\",\n \"web_search_preview_2025_03_11\",\n ])\n .describe(\n \"The type of the web search tool. One of `web_search_preview` or `web_search_preview_2025_03_11`.\",\n )\n .default(\"web_search_preview\"),\n user_location: z\n .union([\n z\n .object({\n /**The type of location approximation. Always `approximate`.*/\n type: z\n .literal(\"approximate\")\n .describe(\n \"The type of location approximation. Always `approximate`.\",\n )\n .default(\"approximate\"),\n country: z\n .union([\n z\n .string()\n .describe(\n \"The two-letter [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1) of the user, e.g. `US`.\",\n ),\n z.null(),\n ])\n .optional(),\n region: z\n .union([\n z\n .string()\n .describe(\n \"Free text input for the region of the user, e.g. `California`.\",\n ),\n z.null(),\n ])\n .optional(),\n city: z\n .union([\n z\n .string()\n .describe(\n \"Free text input for the city of the user, e.g. `San Francisco`.\",\n ),\n z.null(),\n ])\n .optional(),\n timezone: z\n .union([\n z\n .string()\n .describe(\n \"The [IANA timezone](https://timeapi.io/documentation/iana-timezones) of the user, e.g. `America/Los_Angeles`.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\"The user's location.\"),\n z.null(),\n ])\n .optional(),\n /**High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default.*/\n search_context_size: z\n .enum([\"low\", \"medium\", \"high\"])\n .describe(\n \"High level guidance for the amount of context window space to use for the search. One of `low`, `medium`, or `high`. `medium` is the default.\",\n )\n .optional(),\n })\n .describe(\n \"This tool searches the web for relevant results to use in a response. Learn more about the [web search tool](https://platform.openai.com/docs/guides/tools-web-search).\",\n ),\n z\n .object({\n /**The type of the tool. Always `apply_patch`.*/\n type: z\n .literal(\"apply_patch\")\n .describe(\"The type of the tool. Always `apply_patch`.\")\n .default(\"apply_patch\"),\n })\n .describe(\n \"Allows the assistant to create, delete, or update files using unified diffs.\",\n ),\n ])\n .describe(\"A tool that can be used to generate a response.\\n\"),\n )\n .describe(\n \"An array of tools the model may call while generating a response. You\\ncan specify which tool to use by setting the `tool_choice` parameter.\\n\\nWe support the following categories of tools:\\n- **Built-in tools**: Tools that are provided by OpenAI that extend the\\n model's capabilities, like [web search](https://platform.openai.com/docs/guides/tools-web-search)\\n or [file search](https://platform.openai.com/docs/guides/tools-file-search). Learn more about\\n [built-in tools](https://platform.openai.com/docs/guides/tools).\\n- **MCP Tools**: Integrations with third-party systems via custom MCP servers\\n or predefined connectors such as Google Drive and SharePoint. Learn more about\\n [MCP Tools](https://platform.openai.com/docs/guides/tools-connectors-mcp).\\n- **Function calls (custom tools)**: Functions that are defined by you,\\n enabling the model to call your own code with strongly typed arguments\\n and outputs. Learn more about\\n [function calling](https://platform.openai.com/docs/guides/function-calling). You can also use\\n custom tools to call your own code.\\n\",\n )\n .optional(),\n /**\n * How the model should select which tool (or tools) to use when generating\n * a response. See the `tools` parameter to see how to specify which tools\n * the model can call.\n *\n */\n tool_choice: z\n .union([\n z\n .enum([\"none\", \"auto\", \"required\"])\n .describe(\n \"Controls which (if any) tool is called by the model.\\n\\n`none` means the model will not call any tool and instead generates a message.\\n\\n`auto` means the model can pick between generating a message or calling one or\\nmore tools.\\n\\n`required` means the model must call one or more tools.\\n\",\n ),\n z\n .object({\n /**Allowed tool configuration type. Always `allowed_tools`.*/\n type: z\n .literal(\"allowed_tools\")\n .describe(\n \"Allowed tool configuration type. Always `allowed_tools`.\",\n ),\n /**\n * Constrains the tools available to the model to a pre-defined set.\n *\n * `auto` allows the model to pick from among the allowed tools and generate a\n * message.\n *\n * `required` requires the model to call one or more of the allowed tools.\n *\n */\n mode: z\n .enum([\"auto\", \"required\"])\n .describe(\n \"Constrains the tools available to the model to a pre-defined set.\\n\\n`auto` allows the model to pick from among the allowed tools and generate a\\nmessage.\\n\\n`required` requires the model to call one or more of the allowed tools.\\n\",\n ),\n /**\n * A list of tool definitions that the model should be allowed to call.\n *\n * For the Responses API, the list of tool definitions might look like:\n * ```json\n * [\n * { \"type\": \"function\", \"name\": \"get_weather\" },\n * { \"type\": \"mcp\", \"server_label\": \"deepwiki\" },\n * { \"type\": \"image_generation\" }\n * ]\n * ```\n *\n */\n tools: z\n .array(\n z\n .record(z.string(), z.unknown())\n .describe(\n \"A tool definition that the model should be allowed to call.\\n\",\n ),\n )\n .describe(\n 'A list of tool definitions that the model should be allowed to call.\\n\\nFor the Responses API, the list of tool definitions might look like:\\n```json\\n[\\n { \"type\": \"function\", \"name\": \"get_weather\" },\\n { \"type\": \"mcp\", \"server_label\": \"deepwiki\" },\\n { \"type\": \"image_generation\" }\\n]\\n```\\n',\n ),\n })\n .describe(\n \"Constrains the tools available to the model to a pre-defined set.\\n\",\n ),\n z\n .object({\n /**\n * The type of hosted tool the model should to use. Learn more about\n * [built-in tools](https://platform.openai.com/docs/guides/tools).\n *\n * Allowed values are:\n * - `file_search`\n * - `web_search_preview`\n * - `computer_use_preview`\n * - `code_interpreter`\n * - `image_generation`\n *\n */\n type: z\n .enum([\n \"file_search\",\n \"web_search_preview\",\n \"computer_use_preview\",\n \"web_search_preview_2025_03_11\",\n \"image_generation\",\n \"code_interpreter\",\n ])\n .describe(\n \"The type of hosted tool the model should to use. Learn more about\\n[built-in tools](https://platform.openai.com/docs/guides/tools).\\n\\nAllowed values are:\\n- `file_search`\\n- `web_search_preview`\\n- `computer_use_preview`\\n- `code_interpreter`\\n- `image_generation`\\n\",\n ),\n })\n .describe(\n \"Indicates that the model should use a built-in tool to generate a response.\\n[Learn more about built-in tools](https://platform.openai.com/docs/guides/tools).\\n\",\n ),\n z\n .object({\n /**For function calling, the type is always `function`.*/\n type: z\n .literal(\"function\")\n .describe(\"For function calling, the type is always `function`.\"),\n /**The name of the function to call.*/\n name: z.string().describe(\"The name of the function to call.\"),\n })\n .describe(\n \"Use this option to force the model to call a specific function.\\n\",\n ),\n z\n .object({\n /**For MCP tools, the type is always `mcp`.*/\n type: z\n .literal(\"mcp\")\n .describe(\"For MCP tools, the type is always `mcp`.\"),\n /**\n * The label of the MCP server to use.\n *\n */\n server_label: z\n .string()\n .describe(\"The label of the MCP server to use.\\n\"),\n name: z\n .union([\n z\n .string()\n .describe(\"The name of the tool to call on the server.\\n\"),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"Use this option to force the model to call a specific tool on a remote MCP server.\\n\",\n ),\n z\n .object({\n /**For custom tool calling, the type is always `custom`.*/\n type: z\n .literal(\"custom\")\n .describe(\"For custom tool calling, the type is always `custom`.\"),\n /**The name of the custom tool to call.*/\n name: z.string().describe(\"The name of the custom tool to call.\"),\n })\n .describe(\n \"Use this option to force the model to call a specific custom tool.\\n\",\n ),\n z\n .object({\n /**The tool to call. Always `apply_patch`.*/\n type: z\n .literal(\"apply_patch\")\n .describe(\"The tool to call. Always `apply_patch`.\")\n .default(\"apply_patch\"),\n })\n .describe(\n \"Forces the model to call the apply_patch tool when executing a tool call.\",\n ),\n z\n .object({\n /**The tool to call. Always `shell`.*/\n type: z\n .literal(\"shell\")\n .describe(\"The tool to call. Always `shell`.\")\n .default(\"shell\"),\n })\n .describe(\n \"Forces the model to call the shell tool when a tool call is required.\",\n ),\n ])\n .describe(\n \"How the model should select which tool (or tools) to use when generating\\na response. See the `tools` parameter to see how to specify which tools\\nthe model can call.\\n\",\n )\n .optional(),\n prompt: z\n .union([\n z\n .object({\n /**The unique identifier of the prompt template to use.*/\n id: z\n .string()\n .describe(\"The unique identifier of the prompt template to use.\"),\n version: z\n .union([\n z.string().describe(\"Optional version of the prompt template.\"),\n z.null(),\n ])\n .optional(),\n variables: z\n .union([\n z\n .record(\n z.string(),\n z.union([\n z.string(),\n z\n .object({\n /**The type of the input item. Always `input_text`.*/\n type: z\n .literal(\"input_text\")\n .describe(\n \"The type of the input item. Always `input_text`.\",\n )\n .default(\"input_text\"),\n /**The text input to the model.*/\n text: z\n .string()\n .describe(\n \"The text input to the model.\",\n ),\n })\n .describe(\"A text input to the model.\"),\n z\n .object({\n /**The type of the input item. Always `input_image`.*/\n type: z\n .literal(\"input_image\")\n .describe(\n \"The type of the input item. Always `input_image`.\",\n )\n .default(\"input_image\"),\n image_url: z\n .union([\n z\n .string()\n .describe(\n \"The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.\",\n ),\n z.null(),\n ])\n .optional(),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.*/\n detail: z\n .enum([\"low\", \"high\", \"auto\"])\n .describe(\n \"The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\",\n ),\n })\n .describe(\n \"An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).\",\n ),\n z\n .object({\n /**The type of the input item. Always `input_file`.*/\n type: z\n .literal(\"input_file\")\n .describe(\n \"The type of the input item. Always `input_file`.\",\n )\n .default(\"input_file\"),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The name of the file to be sent to the model.*/\n filename: z\n .string()\n .describe(\n \"The name of the file to be sent to the model.\",\n )\n .optional(),\n /**The URL of the file to be sent to the model.*/\n file_url: z\n .string()\n .describe(\n \"The URL of the file to be sent to the model.\",\n )\n .optional(),\n /**\n * The content of the file to be sent to the model.\n *\n */\n file_data: z\n .string()\n .describe(\n \"The content of the file to be sent to the model.\\n\",\n )\n .optional(),\n })\n .describe(\"A file input to the model.\"),\n ]),\n )\n .describe(\n \"Optional map of values to substitute in for variables in your\\nprompt. The substitution values can either be strings, or other\\nResponse input types like images or files.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"Reference to a prompt template and its variables.\\n[Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).\\n\",\n ),\n z.null(),\n ])\n .optional(),\n truncation: z\n .union([\n z\n .enum([\"auto\", \"disabled\"])\n .describe(\n \"The truncation strategy to use for the model response.\\n- `auto`: If the input to this Response exceeds\\n the model's context window size, the model will truncate the\\n response to fit the context window by dropping items from the beginning of the conversation.\\n- `disabled` (default): If the input size will exceed the context window\\n size for a model, the request will fail with a 400 error.\\n\",\n )\n .default(\"disabled\"),\n z.null(),\n ])\n .optional(),\n }),\n z.object({\n /**\n * Unique identifier for this Response.\n *\n */\n id: z.string().describe(\"Unique identifier for this Response.\\n\"),\n /**\n * The object type of this resource - always set to `response`.\n *\n */\n object: z\n .literal(\"response\")\n .describe(\"The object type of this resource - always set to `response`.\\n\"),\n /**\n * The status of the response generation. One of `completed`, `failed`,\n * `in_progress`, `cancelled`, `queued`, or `incomplete`.\n *\n */\n status: z\n .enum([\"completed\", \"failed\", \"in_progress\", \"cancelled\", \"queued\", \"incomplete\"])\n .describe(\n \"The status of the response generation. One of `completed`, `failed`,\\n`in_progress`, `cancelled`, `queued`, or `incomplete`.\\n\",\n )\n .optional(),\n /**\n * Unix timestamp (in seconds) of when this Response was created.\n *\n */\n created_at: z\n .number()\n .describe(\"Unix timestamp (in seconds) of when this Response was created.\\n\"),\n error: z.union([\n z\n .object({\n /**\n * The error code for the response.\n *\n */\n code: z\n .enum([\n \"server_error\",\n \"rate_limit_exceeded\",\n \"invalid_prompt\",\n \"vector_store_timeout\",\n \"invalid_image\",\n \"invalid_image_format\",\n \"invalid_base64_image\",\n \"invalid_image_url\",\n \"image_too_large\",\n \"image_too_small\",\n \"image_parse_error\",\n \"image_content_policy_violation\",\n \"invalid_image_mode\",\n \"image_file_too_large\",\n \"unsupported_image_media_type\",\n \"empty_image_file\",\n \"failed_to_download_image\",\n \"image_file_not_found\",\n ])\n .describe(\"The error code for the response.\\n\"),\n /**\n * A human-readable description of the error.\n *\n */\n message: z\n .string()\n .describe(\"A human-readable description of the error.\\n\"),\n })\n .describe(\n \"An error object returned when the model fails to generate a Response.\\n\",\n ),\n z.null(),\n ]),\n incomplete_details: z.union([\n z\n .object({\n /**The reason why the response is incomplete.*/\n reason: z\n .enum([\"max_output_tokens\", \"content_filter\"])\n .describe(\"The reason why the response is incomplete.\")\n .optional(),\n })\n .describe(\"Details about why the response is incomplete.\\n\"),\n z.null(),\n ]),\n /**\n * An array of content items generated by the model.\n *\n * - The length and order of items in the `output` array is dependent\n * on the model's response.\n * - Rather than accessing the first item in the `output` array and\n * assuming it's an `assistant` message with the content generated by\n * the model, you might consider using the `output_text` property where\n * supported in SDKs.\n *\n */\n output: z\n .array(\n z.union([\n z\n .object({\n /**\n * The unique ID of the output message.\n *\n */\n id: z.string().describe(\"The unique ID of the output message.\\n\"),\n /**\n * The type of the output message. Always `message`.\n *\n */\n type: z\n .literal(\"message\")\n .describe(\n \"The type of the output message. Always `message`.\\n\",\n ),\n /**\n * The role of the output message. Always `assistant`.\n *\n */\n role: z\n .literal(\"assistant\")\n .describe(\n \"The role of the output message. Always `assistant`.\\n\",\n ),\n /**\n * The content of the output message.\n *\n */\n content: z\n .array(\n z.union([\n z\n .object({\n /**The type of the output text. Always `output_text`.*/\n type: z\n .literal(\"output_text\")\n .describe(\n \"The type of the output text. Always `output_text`.\",\n )\n .default(\"output_text\"),\n /**The text output from the model.*/\n text: z\n .string()\n .describe(\n \"The text output from the model.\",\n ),\n /**The annotations of the text output.*/\n annotations: z\n .array(\n z.union([\n z\n .object({\n /**The type of the file citation. Always `file_citation`.*/\n type: z\n .literal(\n \"file_citation\",\n )\n .describe(\n \"The type of the file citation. Always `file_citation`.\",\n )\n .default(\n \"file_citation\",\n ),\n /**The ID of the file.*/\n file_id: z\n .string()\n .describe(\n \"The ID of the file.\",\n ),\n /**The index of the file in the list of files.*/\n index: z\n .number()\n .int()\n .describe(\n \"The index of the file in the list of files.\",\n ),\n /**The filename of the file cited.*/\n filename: z\n .string()\n .describe(\n \"The filename of the file cited.\",\n ),\n })\n .describe(\n \"A citation to a file.\",\n ),\n z\n .object({\n /**The type of the URL citation. Always `url_citation`.*/\n type: z\n .literal(\"url_citation\")\n .describe(\n \"The type of the URL citation. Always `url_citation`.\",\n )\n .default(\n \"url_citation\",\n ),\n /**The URL of the web resource.*/\n url: z\n .string()\n .describe(\n \"The URL of the web resource.\",\n ),\n /**The index of the first character of the URL citation in the message.*/\n start_index: z\n .number()\n .int()\n .describe(\n \"The index of the first character of the URL citation in the message.\",\n ),\n /**The index of the last character of the URL citation in the message.*/\n end_index: z\n .number()\n .int()\n .describe(\n \"The index of the last character of the URL citation in the message.\",\n ),\n /**The title of the web resource.*/\n title: z\n .string()\n .describe(\n \"The title of the web resource.\",\n ),\n })\n .describe(\n \"A citation for a web resource used to generate a model response.\",\n ),\n z\n .object({\n /**The type of the container file citation. Always `container_file_citation`.*/\n type: z\n .literal(\n \"container_file_citation\",\n )\n .describe(\n \"The type of the container file citation. Always `container_file_citation`.\",\n )\n .default(\n \"container_file_citation\",\n ),\n /**The ID of the container file.*/\n container_id: z\n .string()\n .describe(\n \"The ID of the container file.\",\n ),\n /**The ID of the file.*/\n file_id: z\n .string()\n .describe(\n \"The ID of the file.\",\n ),\n /**The index of the first character of the container file citation in the message.*/\n start_index: z\n .number()\n .int()\n .describe(\n \"The index of the first character of the container file citation in the message.\",\n ),\n /**The index of the last character of the container file citation in the message.*/\n end_index: z\n .number()\n .int()\n .describe(\n \"The index of the last character of the container file citation in the message.\",\n ),\n /**The filename of the container file cited.*/\n filename: z\n .string()\n .describe(\n \"The filename of the container file cited.\",\n ),\n })\n .describe(\n \"A citation for a container file used to generate a model response.\",\n ),\n z\n .object({\n /**\n * The type of the file path. Always `file_path`.\n *\n */\n type: z\n .literal(\"file_path\")\n .describe(\n \"The type of the file path. Always `file_path`.\\n\",\n ),\n /**\n * The ID of the file.\n *\n */\n file_id: z\n .string()\n .describe(\n \"The ID of the file.\\n\",\n ),\n /**\n * The index of the file in the list of files.\n *\n */\n index: z\n .number()\n .int()\n .describe(\n \"The index of the file in the list of files.\\n\",\n ),\n })\n .describe(\n \"A path to a file.\\n\",\n ),\n ]),\n )\n .describe(\n \"The annotations of the text output.\",\n ),\n logprobs: z\n .array(\n z\n .object({\n token: z.string(),\n logprob: z.number(),\n bytes: z.array(\n z.number().int(),\n ),\n top_logprobs: z.array(\n z\n .object({\n token: z.string(),\n logprob: z.number(),\n bytes: z.array(\n z\n .number()\n .int(),\n ),\n })\n .describe(\n \"The top log probability of a token.\",\n ),\n ),\n })\n .describe(\n \"The log probability of a token.\",\n ),\n )\n .optional(),\n })\n .describe(\"A text output from the model.\"),\n z\n .object({\n /**The type of the refusal. Always `refusal`.*/\n type: z\n .literal(\"refusal\")\n .describe(\n \"The type of the refusal. Always `refusal`.\",\n )\n .default(\"refusal\"),\n /**The refusal explanation from the model.*/\n refusal: z\n .string()\n .describe(\n \"The refusal explanation from the model.\",\n ),\n })\n .describe(\"A refusal from the model.\"),\n ]),\n )\n .describe(\"The content of the output message.\\n\"),\n /**\n * The status of the message input. One of `in_progress`, `completed`, or\n * `incomplete`. Populated when input items are returned via API.\n *\n */\n status: z\n .enum([\"in_progress\", \"completed\", \"incomplete\"])\n .describe(\n \"The status of the message input. One of `in_progress`, `completed`, or\\n`incomplete`. Populated when input items are returned via API.\\n\",\n ),\n })\n .describe(\"An output message from the model.\\n\"),\n z\n .object({\n /**\n * The unique ID of the file search tool call.\n *\n */\n id: z\n .string()\n .describe(\"The unique ID of the file search tool call.\\n\"),\n /**\n * The type of the file search tool call. Always `file_search_call`.\n *\n */\n type: z\n .literal(\"file_search_call\")\n .describe(\n \"The type of the file search tool call. Always `file_search_call`.\\n\",\n ),\n /**\n * The status of the file search tool call. One of `in_progress`,\n * `searching`, `incomplete` or `failed`,\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"searching\",\n \"completed\",\n \"incomplete\",\n \"failed\",\n ])\n .describe(\n \"The status of the file search tool call. One of `in_progress`,\\n`searching`, `incomplete` or `failed`,\\n\",\n ),\n /**\n * The queries used to search for files.\n *\n */\n queries: z\n .array(z.string())\n .describe(\"The queries used to search for files.\\n\"),\n results: z\n .union([\n z\n .array(\n z.object({\n /**\n * The unique ID of the file.\n *\n */\n file_id: z\n .string()\n .describe(\"The unique ID of the file.\\n\")\n .optional(),\n /**\n * The text that was retrieved from the file.\n *\n */\n text: z\n .string()\n .describe(\n \"The text that was retrieved from the file.\\n\",\n )\n .optional(),\n /**\n * The name of the file.\n *\n */\n filename: z\n .string()\n .describe(\"The name of the file.\\n\")\n .optional(),\n attributes: z\n .union([\n z\n .record(\n z.string(),\n z.union([\n z.string().max(512),\n z.number(),\n z.boolean(),\n ]),\n )\n .describe(\n \"Set of 16 key-value pairs that can be attached to an object. This can be\\nuseful for storing additional information about the object in a structured\\nformat, and querying for objects via API or the dashboard. Keys are strings\\nwith a maximum length of 64 characters. Values are strings with a maximum\\nlength of 512 characters, booleans, or numbers.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * The relevance score of the file - a value between 0 and 1.\n *\n */\n score: z\n .number()\n .describe(\n \"The relevance score of the file - a value between 0 and 1.\\n\",\n )\n .optional(),\n }),\n )\n .describe(\n \"The results of the file search tool call.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"The results of a file search tool call. See the\\n[file search guide](https://platform.openai.com/docs/guides/tools-file-search) for more information.\\n\",\n ),\n z\n .object({\n /**\n * The unique ID of the function tool call.\n *\n */\n id: z\n .string()\n .describe(\"The unique ID of the function tool call.\\n\")\n .optional(),\n /**\n * The type of the function tool call. Always `function_call`.\n *\n */\n type: z\n .literal(\"function_call\")\n .describe(\n \"The type of the function tool call. Always `function_call`.\\n\",\n ),\n /**\n * The unique ID of the function tool call generated by the model.\n *\n */\n call_id: z\n .string()\n .describe(\n \"The unique ID of the function tool call generated by the model.\\n\",\n ),\n /**\n * The name of the function to run.\n *\n */\n name: z.string().describe(\"The name of the function to run.\\n\"),\n /**\n * A JSON string of the arguments to pass to the function.\n *\n */\n arguments: z\n .string()\n .describe(\n \"A JSON string of the arguments to pass to the function.\\n\",\n ),\n /**\n * The status of the item. One of `in_progress`, `completed`, or\n * `incomplete`. Populated when items are returned via API.\n *\n */\n status: z\n .enum([\"in_progress\", \"completed\", \"incomplete\"])\n .describe(\n \"The status of the item. One of `in_progress`, `completed`, or\\n`incomplete`. Populated when items are returned via API.\\n\",\n )\n .optional(),\n })\n .describe(\n \"A tool call to run a function. See the \\n[function calling guide](https://platform.openai.com/docs/guides/function-calling) for more information.\\n\",\n ),\n z\n .object({\n /**\n * The unique ID of the web search tool call.\n *\n */\n id: z\n .string()\n .describe(\"The unique ID of the web search tool call.\\n\"),\n /**\n * The type of the web search tool call. Always `web_search_call`.\n *\n */\n type: z\n .literal(\"web_search_call\")\n .describe(\n \"The type of the web search tool call. Always `web_search_call`.\\n\",\n ),\n /**\n * The status of the web search tool call.\n *\n */\n status: z\n .enum([\"in_progress\", \"searching\", \"completed\", \"failed\"])\n .describe(\"The status of the web search tool call.\\n\"),\n /**\n * An object describing the specific action taken in this web search call.\n * Includes details on how the model used the web (search, open_page, find).\n *\n */\n action: z\n .record(z.string(), z.unknown())\n .and(\n z.union([\n z\n .object({\n /**\n * The action type.\n *\n */\n type: z\n .literal(\"search\")\n .describe(\"The action type.\\n\"),\n /**\n * The search query.\n *\n */\n query: z\n .string()\n .describe(\"The search query.\\n\"),\n /**\n * The sources used in the search.\n *\n */\n sources: z\n .array(\n z\n .object({\n /**\n * The type of source. Always `url`.\n *\n */\n type: z\n .literal(\"url\")\n .describe(\n \"The type of source. Always `url`.\\n\",\n ),\n /**\n * The URL of the source.\n *\n */\n url: z\n .string()\n .describe(\n \"The URL of the source.\\n\",\n ),\n })\n .describe(\n \"A source used in the search.\\n\",\n ),\n )\n .describe(\n \"The sources used in the search.\\n\",\n )\n .optional(),\n })\n .describe(\n 'Action type \"search\" - Performs a web search query.\\n',\n ),\n z\n .object({\n /**\n * The action type.\n *\n */\n type: z\n .literal(\"open_page\")\n .describe(\"The action type.\\n\"),\n /**\n * The URL opened by the model.\n *\n */\n url: z\n .string()\n .url()\n .describe(\"The URL opened by the model.\\n\"),\n })\n .describe(\n 'Action type \"open_page\" - Opens a specific URL from search results.\\n',\n ),\n z\n .object({\n /**\n * The action type.\n *\n */\n type: z\n .literal(\"find\")\n .describe(\"The action type.\\n\"),\n /**\n * The URL of the page searched for the pattern.\n *\n */\n url: z\n .string()\n .url()\n .describe(\n \"The URL of the page searched for the pattern.\\n\",\n ),\n /**\n * The pattern or text to search for within the page.\n *\n */\n pattern: z\n .string()\n .describe(\n \"The pattern or text to search for within the page.\\n\",\n ),\n })\n .describe(\n 'Action type \"find\": Searches for a pattern within a loaded page.\\n',\n ),\n ]),\n )\n .describe(\n \"An object describing the specific action taken in this web search call.\\nIncludes details on how the model used the web (search, open_page, find).\\n\",\n ),\n })\n .describe(\n \"The results of a web search tool call. See the\\n[web search guide](https://platform.openai.com/docs/guides/tools-web-search) for more information.\\n\",\n ),\n z\n .object({\n /**The type of the computer call. Always `computer_call`.*/\n type: z\n .literal(\"computer_call\")\n .describe(\n \"The type of the computer call. Always `computer_call`.\",\n )\n .default(\"computer_call\"),\n /**The unique ID of the computer call.*/\n id: z.string().describe(\"The unique ID of the computer call.\"),\n /**\n * An identifier used when responding to the tool call with output.\n *\n */\n call_id: z\n .string()\n .describe(\n \"An identifier used when responding to the tool call with output.\\n\",\n ),\n action: z.union([\n z\n .object({\n /**Specifies the event type. For a click action, this property is always `click`.*/\n type: z\n .literal(\"click\")\n .describe(\n \"Specifies the event type. For a click action, this property is always `click`.\",\n )\n .default(\"click\"),\n /**Indicates which mouse button was pressed during the click. One of `left`, `right`, `wheel`, `back`, or `forward`.*/\n button: z\n .enum([\"left\", \"right\", \"wheel\", \"back\", \"forward\"])\n .describe(\n \"Indicates which mouse button was pressed during the click. One of `left`, `right`, `wheel`, `back`, or `forward`.\",\n ),\n /**The x-coordinate where the click occurred.*/\n x: z\n .number()\n .int()\n .describe(\n \"The x-coordinate where the click occurred.\",\n ),\n /**The y-coordinate where the click occurred.*/\n y: z\n .number()\n .int()\n .describe(\n \"The y-coordinate where the click occurred.\",\n ),\n })\n .describe(\"A click action.\"),\n z\n .object({\n /**Specifies the event type. For a double click action, this property is always set to `double_click`.*/\n type: z\n .literal(\"double_click\")\n .describe(\n \"Specifies the event type. For a double click action, this property is always set to `double_click`.\",\n )\n .default(\"double_click\"),\n /**The x-coordinate where the double click occurred.*/\n x: z\n .number()\n .int()\n .describe(\n \"The x-coordinate where the double click occurred.\",\n ),\n /**The y-coordinate where the double click occurred.*/\n y: z\n .number()\n .int()\n .describe(\n \"The y-coordinate where the double click occurred.\",\n ),\n })\n .describe(\"A double click action.\"),\n z\n .object({\n /**\n * Specifies the event type. For a drag action, this property is\n * always set to `drag`.\n *\n */\n type: z\n .literal(\"drag\")\n .describe(\n \"Specifies the event type. For a drag action, this property is \\nalways set to `drag`.\\n\",\n )\n .default(\"drag\"),\n /**\n * An array of coordinates representing the path of the drag action. Coordinates will appear as an array\n * of objects, eg\n * ```\n * [\n * { x: 100, y: 200 },\n * { x: 200, y: 300 }\n * ]\n * ```\n *\n */\n path: z\n .array(\n z\n .object({\n /**The x-coordinate.*/\n x: z\n .number()\n .int()\n .describe(\"The x-coordinate.\"),\n /**The y-coordinate.*/\n y: z\n .number()\n .int()\n .describe(\"The y-coordinate.\"),\n })\n .describe(\n \"An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.\",\n ),\n )\n .describe(\n \"An array of coordinates representing the path of the drag action. Coordinates will appear as an array\\nof objects, eg\\n```\\n[\\n { x: 100, y: 200 },\\n { x: 200, y: 300 }\\n]\\n```\\n\",\n ),\n })\n .describe(\"A drag action.\\n\"),\n z\n .object({\n /**Specifies the event type. For a keypress action, this property is always set to `keypress`.*/\n type: z\n .literal(\"keypress\")\n .describe(\n \"Specifies the event type. For a keypress action, this property is always set to `keypress`.\",\n )\n .default(\"keypress\"),\n /**The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.*/\n keys: z\n .array(\n z\n .string()\n .describe(\n \"One of the keys the model is requesting to be pressed.\",\n ),\n )\n .describe(\n \"The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.\",\n ),\n })\n .describe(\n \"A collection of keypresses the model would like to perform.\",\n ),\n z\n .object({\n /**\n * Specifies the event type. For a move action, this property is\n * always set to `move`.\n *\n */\n type: z\n .literal(\"move\")\n .describe(\n \"Specifies the event type. For a move action, this property is \\nalways set to `move`.\\n\",\n )\n .default(\"move\"),\n /**\n * The x-coordinate to move to.\n *\n */\n x: z\n .number()\n .int()\n .describe(\"The x-coordinate to move to.\\n\"),\n /**\n * The y-coordinate to move to.\n *\n */\n y: z\n .number()\n .int()\n .describe(\"The y-coordinate to move to.\\n\"),\n })\n .describe(\"A mouse move action.\\n\"),\n z\n .object({\n /**\n * Specifies the event type. For a screenshot action, this property is\n * always set to `screenshot`.\n *\n */\n type: z\n .literal(\"screenshot\")\n .describe(\n \"Specifies the event type. For a screenshot action, this property is \\nalways set to `screenshot`.\\n\",\n )\n .default(\"screenshot\"),\n })\n .describe(\"A screenshot action.\\n\"),\n z\n .object({\n /**\n * Specifies the event type. For a scroll action, this property is\n * always set to `scroll`.\n *\n */\n type: z\n .literal(\"scroll\")\n .describe(\n \"Specifies the event type. For a scroll action, this property is \\nalways set to `scroll`.\\n\",\n )\n .default(\"scroll\"),\n /**\n * The x-coordinate where the scroll occurred.\n *\n */\n x: z\n .number()\n .int()\n .describe(\n \"The x-coordinate where the scroll occurred.\\n\",\n ),\n /**\n * The y-coordinate where the scroll occurred.\n *\n */\n y: z\n .number()\n .int()\n .describe(\n \"The y-coordinate where the scroll occurred.\\n\",\n ),\n /**\n * The horizontal scroll distance.\n *\n */\n scroll_x: z\n .number()\n .int()\n .describe(\"The horizontal scroll distance.\\n\"),\n /**\n * The vertical scroll distance.\n *\n */\n scroll_y: z\n .number()\n .int()\n .describe(\"The vertical scroll distance.\\n\"),\n })\n .describe(\"A scroll action.\\n\"),\n z\n .object({\n /**\n * Specifies the event type. For a type action, this property is\n * always set to `type`.\n *\n */\n type: z\n .literal(\"type\")\n .describe(\n \"Specifies the event type. For a type action, this property is \\nalways set to `type`.\\n\",\n )\n .default(\"type\"),\n /**\n * The text to type.\n *\n */\n text: z.string().describe(\"The text to type.\\n\"),\n })\n .describe(\"An action to type in text.\\n\"),\n z\n .object({\n /**\n * Specifies the event type. For a wait action, this property is\n * always set to `wait`.\n *\n */\n type: z\n .literal(\"wait\")\n .describe(\n \"Specifies the event type. For a wait action, this property is \\nalways set to `wait`.\\n\",\n )\n .default(\"wait\"),\n })\n .describe(\"A wait action.\\n\"),\n ]),\n /**\n * The pending safety checks for the computer call.\n *\n */\n pending_safety_checks: z\n .array(\n z\n .object({\n /**The ID of the pending safety check.*/\n id: z\n .string()\n .describe(\n \"The ID of the pending safety check.\",\n ),\n code: z\n .union([\n z\n .string()\n .describe(\n \"The type of the pending safety check.\",\n ),\n z.null(),\n ])\n .optional(),\n message: z\n .union([\n z\n .string()\n .describe(\n \"Details about the pending safety check.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"A pending safety check for the computer call.\",\n ),\n )\n .describe(\"The pending safety checks for the computer call.\\n\"),\n /**\n * The status of the item. One of `in_progress`, `completed`, or\n * `incomplete`. Populated when items are returned via API.\n *\n */\n status: z\n .enum([\"in_progress\", \"completed\", \"incomplete\"])\n .describe(\n \"The status of the item. One of `in_progress`, `completed`, or\\n`incomplete`. Populated when items are returned via API.\\n\",\n ),\n })\n .describe(\n \"A tool call to a computer use tool. See the\\n[computer use guide](https://platform.openai.com/docs/guides/tools-computer-use) for more information.\\n\",\n ),\n z\n .object({\n /**\n * The type of the object. Always `reasoning`.\n *\n */\n type: z\n .literal(\"reasoning\")\n .describe(\"The type of the object. Always `reasoning`.\\n\"),\n /**\n * The unique identifier of the reasoning content.\n *\n */\n id: z\n .string()\n .describe(\"The unique identifier of the reasoning content.\\n\"),\n encrypted_content: z\n .union([\n z\n .string()\n .describe(\n \"The encrypted content of the reasoning item - populated when a response is\\ngenerated with `reasoning.encrypted_content` in the `include` parameter.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * Reasoning summary content.\n *\n */\n summary: z\n .array(\n z\n .object({\n /**The type of the object. Always `summary_text`.*/\n type: z\n .literal(\"summary_text\")\n .describe(\n \"The type of the object. Always `summary_text`.\",\n )\n .default(\"summary_text\"),\n /**A summary of the reasoning output from the model so far.*/\n text: z\n .string()\n .describe(\n \"A summary of the reasoning output from the model so far.\",\n ),\n })\n .describe(\"A summary text from the model.\"),\n )\n .describe(\"Reasoning summary content.\\n\"),\n /**\n * Reasoning text content.\n *\n */\n content: z\n .array(\n z\n .object({\n /**The type of the reasoning text. Always `reasoning_text`.*/\n type: z\n .literal(\"reasoning_text\")\n .describe(\n \"The type of the reasoning text. Always `reasoning_text`.\",\n )\n .default(\"reasoning_text\"),\n /**The reasoning text from the model.*/\n text: z\n .string()\n .describe(\"The reasoning text from the model.\"),\n })\n .describe(\"Reasoning text from the model.\"),\n )\n .describe(\"Reasoning text content.\\n\")\n .optional(),\n /**\n * The status of the item. One of `in_progress`, `completed`, or\n * `incomplete`. Populated when items are returned via API.\n *\n */\n status: z\n .enum([\"in_progress\", \"completed\", \"incomplete\"])\n .describe(\n \"The status of the item. One of `in_progress`, `completed`, or\\n`incomplete`. Populated when items are returned via API.\\n\",\n )\n .optional(),\n })\n .describe(\n \"A description of the chain of thought used by a reasoning model while generating\\na response. Be sure to include these items in your `input` to the Responses API\\nfor subsequent turns of a conversation if you are manually\\n[managing context](https://platform.openai.com/docs/guides/conversation-state).\\n\",\n ),\n z\n .object({\n /**The type of the item. Always `compaction`.*/\n type: z\n .literal(\"compaction\")\n .describe(\"The type of the item. Always `compaction`.\")\n .default(\"compaction\"),\n /**The unique ID of the compaction item.*/\n id: z.string().describe(\"The unique ID of the compaction item.\"),\n encrypted_content: z.string(),\n created_by: z.string().optional(),\n })\n .describe(\n \"A compaction item generated by the [`v1/responses/compact` API](https://platform.openai.com/docs/api-reference/responses/compact).\",\n ),\n z\n .object({\n /**\n * The type of the image generation call. Always `image_generation_call`.\n *\n */\n type: z\n .literal(\"image_generation_call\")\n .describe(\n \"The type of the image generation call. Always `image_generation_call`.\\n\",\n ),\n /**\n * The unique ID of the image generation call.\n *\n */\n id: z\n .string()\n .describe(\"The unique ID of the image generation call.\\n\"),\n /**\n * The status of the image generation call.\n *\n */\n status: z\n .enum([\"in_progress\", \"completed\", \"generating\", \"failed\"])\n .describe(\"The status of the image generation call.\\n\"),\n result: z.union([\n z.string().describe(\"The generated image encoded in base64.\\n\"),\n z.null(),\n ]),\n })\n .describe(\"An image generation request made by the model.\\n\"),\n z\n .object({\n /**\n * The type of the code interpreter tool call. Always `code_interpreter_call`.\n *\n */\n type: z\n .literal(\"code_interpreter_call\")\n .describe(\n \"The type of the code interpreter tool call. Always `code_interpreter_call`.\\n\",\n )\n .default(\"code_interpreter_call\"),\n /**\n * The unique ID of the code interpreter tool call.\n *\n */\n id: z\n .string()\n .describe(\"The unique ID of the code interpreter tool call.\\n\"),\n /**\n * The status of the code interpreter tool call. Valid values are `in_progress`, `completed`, `incomplete`, `interpreting`, and `failed`.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n \"interpreting\",\n \"failed\",\n ])\n .describe(\n \"The status of the code interpreter tool call. Valid values are `in_progress`, `completed`, `incomplete`, `interpreting`, and `failed`.\\n\",\n ),\n /**\n * The ID of the container used to run the code.\n *\n */\n container_id: z\n .string()\n .describe(\"The ID of the container used to run the code.\\n\"),\n code: z.union([\n z\n .string()\n .describe(\"The code to run, or null if not available.\\n\"),\n z.null(),\n ]),\n outputs: z.union([\n z\n .array(\n z.union([\n z\n .object({\n /**The type of the output. Always `logs`.*/\n type: z\n .literal(\"logs\")\n .describe(\n \"The type of the output. Always `logs`.\",\n )\n .default(\"logs\"),\n /**The logs output from the code interpreter.*/\n logs: z\n .string()\n .describe(\n \"The logs output from the code interpreter.\",\n ),\n })\n .describe(\n \"The logs output from the code interpreter.\",\n ),\n z\n .object({\n /**The type of the output. Always `image`.*/\n type: z\n .literal(\"image\")\n .describe(\n \"The type of the output. Always `image`.\",\n )\n .default(\"image\"),\n /**The URL of the image output from the code interpreter.*/\n url: z\n .string()\n .describe(\n \"The URL of the image output from the code interpreter.\",\n ),\n })\n .describe(\n \"The image output from the code interpreter.\",\n ),\n ]),\n )\n .describe(\n \"The outputs generated by the code interpreter, such as logs or images.\\nCan be null if no outputs are available.\\n\",\n ),\n z.null(),\n ]),\n })\n .describe(\"A tool call to run code.\\n\"),\n z\n .object({\n /**\n * The type of the local shell call. Always `local_shell_call`.\n *\n */\n type: z\n .literal(\"local_shell_call\")\n .describe(\n \"The type of the local shell call. Always `local_shell_call`.\\n\",\n ),\n /**\n * The unique ID of the local shell call.\n *\n */\n id: z.string().describe(\"The unique ID of the local shell call.\\n\"),\n /**\n * The unique ID of the local shell tool call generated by the model.\n *\n */\n call_id: z\n .string()\n .describe(\n \"The unique ID of the local shell tool call generated by the model.\\n\",\n ),\n /**Execute a shell command on the server.*/\n action: z\n .object({\n /**The type of the local shell action. Always `exec`.*/\n type: z\n .literal(\"exec\")\n .describe(\n \"The type of the local shell action. Always `exec`.\",\n )\n .default(\"exec\"),\n /**The command to run.*/\n command: z\n .array(z.string())\n .describe(\"The command to run.\"),\n timeout_ms: z\n .union([\n z\n .number()\n .int()\n .describe(\n \"Optional timeout in milliseconds for the command.\",\n ),\n z.null(),\n ])\n .optional(),\n working_directory: z\n .union([\n z\n .string()\n .describe(\n \"Optional working directory to run the command in.\",\n ),\n z.null(),\n ])\n .optional(),\n /**Environment variables to set for the command.*/\n env: z\n .record(z.string(), z.string())\n .describe(\n \"Environment variables to set for the command.\",\n ),\n user: z\n .union([\n z\n .string()\n .describe(\n \"Optional user to run the command as.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\"Execute a shell command on the server.\"),\n /**\n * The status of the local shell call.\n *\n */\n status: z\n .enum([\"in_progress\", \"completed\", \"incomplete\"])\n .describe(\"The status of the local shell call.\\n\"),\n })\n .describe(\"A tool call to run a command on the local shell.\\n\"),\n z\n .object({\n /**The type of the item. Always `shell_call`.*/\n type: z\n .literal(\"shell_call\")\n .describe(\"The type of the item. Always `shell_call`.\")\n .default(\"shell_call\"),\n /**The unique ID of the shell tool call. Populated when this item is returned via API.*/\n id: z\n .string()\n .describe(\n \"The unique ID of the shell tool call. Populated when this item is returned via API.\",\n ),\n /**The unique ID of the shell tool call generated by the model.*/\n call_id: z\n .string()\n .describe(\n \"The unique ID of the shell tool call generated by the model.\",\n ),\n /**The shell commands and limits that describe how to run the tool call.*/\n action: z\n .object({\n commands: z.array(\n z.string().describe(\"A list of commands to run.\"),\n ),\n timeout_ms: z.union([\n z\n .number()\n .int()\n .describe(\n \"Optional timeout in milliseconds for the commands.\",\n ),\n z.null(),\n ]),\n max_output_length: z.union([\n z\n .number()\n .int()\n .describe(\n \"Optional maximum number of characters to return from each command.\",\n ),\n z.null(),\n ]),\n })\n .describe(\n \"The shell commands and limits that describe how to run the tool call.\",\n ),\n /**The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.*/\n status: z\n .enum([\"in_progress\", \"completed\", \"incomplete\"])\n .describe(\n \"The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.\",\n ),\n /**The ID of the entity that created this tool call.*/\n created_by: z\n .string()\n .describe(\"The ID of the entity that created this tool call.\")\n .optional(),\n })\n .describe(\n \"A tool call that executes one or more shell commands in a managed environment.\",\n ),\n z\n .object({\n /**The type of the shell call output. Always `shell_call_output`.*/\n type: z\n .literal(\"shell_call_output\")\n .describe(\n \"The type of the shell call output. Always `shell_call_output`.\",\n )\n .default(\"shell_call_output\"),\n /**The unique ID of the shell call output. Populated when this item is returned via API.*/\n id: z\n .string()\n .describe(\n \"The unique ID of the shell call output. Populated when this item is returned via API.\",\n ),\n /**The unique ID of the shell tool call generated by the model.*/\n call_id: z\n .string()\n .describe(\n \"The unique ID of the shell tool call generated by the model.\",\n ),\n /**An array of shell call output contents*/\n output: z\n .array(\n z\n .object({\n stdout: z.string(),\n stderr: z.string(),\n /**Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.*/\n outcome: z\n .union([\n z\n .object({\n /**The outcome type. Always `timeout`.*/\n type: z\n .literal(\"timeout\")\n .describe(\n \"The outcome type. Always `timeout`.\",\n )\n .default(\"timeout\"),\n })\n .describe(\n \"Indicates that the shell call exceeded its configured time limit.\",\n ),\n z\n .object({\n /**The outcome type. Always `exit`.*/\n type: z\n .literal(\"exit\")\n .describe(\n \"The outcome type. Always `exit`.\",\n )\n .default(\"exit\"),\n /**Exit code from the shell process.*/\n exit_code: z\n .number()\n .int()\n .describe(\n \"Exit code from the shell process.\",\n ),\n })\n .describe(\n \"Indicates that the shell commands finished and returned an exit code.\",\n ),\n ])\n .describe(\n \"Represents either an exit outcome (with an exit code) or a timeout outcome for a shell call output chunk.\",\n ),\n created_by: z.string().optional(),\n })\n .describe(\"The content of a shell call output.\"),\n )\n .describe(\"An array of shell call output contents\"),\n max_output_length: z.union([\n z\n .number()\n .int()\n .describe(\n \"The maximum length of the shell command output. This is generated by the model and should be passed back with the raw output.\",\n ),\n z.null(),\n ]),\n created_by: z.string().optional(),\n })\n .describe(\"The output of a shell tool call.\"),\n z\n .object({\n /**The type of the item. Always `apply_patch_call`.*/\n type: z\n .literal(\"apply_patch_call\")\n .describe(\"The type of the item. Always `apply_patch_call`.\")\n .default(\"apply_patch_call\"),\n /**The unique ID of the apply patch tool call. Populated when this item is returned via API.*/\n id: z\n .string()\n .describe(\n \"The unique ID of the apply patch tool call. Populated when this item is returned via API.\",\n ),\n /**The unique ID of the apply patch tool call generated by the model.*/\n call_id: z\n .string()\n .describe(\n \"The unique ID of the apply patch tool call generated by the model.\",\n ),\n /**The status of the apply patch tool call. One of `in_progress` or `completed`.*/\n status: z\n .enum([\"in_progress\", \"completed\"])\n .describe(\n \"The status of the apply patch tool call. One of `in_progress` or `completed`.\",\n ),\n /**One of the create_file, delete_file, or update_file operations applied via apply_patch.*/\n operation: z\n .union([\n z\n .object({\n /**Create a new file with the provided diff.*/\n type: z\n .literal(\"create_file\")\n .describe(\n \"Create a new file with the provided diff.\",\n )\n .default(\"create_file\"),\n /**Path of the file to create.*/\n path: z\n .string()\n .describe(\"Path of the file to create.\"),\n /**Diff to apply.*/\n diff: z.string().describe(\"Diff to apply.\"),\n })\n .describe(\n \"Instruction describing how to create a file via the apply_patch tool.\",\n ),\n z\n .object({\n /**Delete the specified file.*/\n type: z\n .literal(\"delete_file\")\n .describe(\"Delete the specified file.\")\n .default(\"delete_file\"),\n /**Path of the file to delete.*/\n path: z\n .string()\n .describe(\"Path of the file to delete.\"),\n })\n .describe(\n \"Instruction describing how to delete a file via the apply_patch tool.\",\n ),\n z\n .object({\n /**Update an existing file with the provided diff.*/\n type: z\n .literal(\"update_file\")\n .describe(\n \"Update an existing file with the provided diff.\",\n )\n .default(\"update_file\"),\n /**Path of the file to update.*/\n path: z\n .string()\n .describe(\"Path of the file to update.\"),\n /**Diff to apply.*/\n diff: z.string().describe(\"Diff to apply.\"),\n })\n .describe(\n \"Instruction describing how to update a file via the apply_patch tool.\",\n ),\n ])\n .describe(\n \"One of the create_file, delete_file, or update_file operations applied via apply_patch.\",\n ),\n /**The ID of the entity that created this tool call.*/\n created_by: z\n .string()\n .describe(\"The ID of the entity that created this tool call.\")\n .optional(),\n })\n .describe(\n \"A tool call that applies file diffs by creating, deleting, or updating files.\",\n ),\n z\n .object({\n /**The type of the item. Always `apply_patch_call_output`.*/\n type: z\n .literal(\"apply_patch_call_output\")\n .describe(\n \"The type of the item. Always `apply_patch_call_output`.\",\n )\n .default(\"apply_patch_call_output\"),\n /**The unique ID of the apply patch tool call output. Populated when this item is returned via API.*/\n id: z\n .string()\n .describe(\n \"The unique ID of the apply patch tool call output. Populated when this item is returned via API.\",\n ),\n /**The unique ID of the apply patch tool call generated by the model.*/\n call_id: z\n .string()\n .describe(\n \"The unique ID of the apply patch tool call generated by the model.\",\n ),\n /**The status of the apply patch tool call output. One of `completed` or `failed`.*/\n status: z\n .enum([\"completed\", \"failed\"])\n .describe(\n \"The status of the apply patch tool call output. One of `completed` or `failed`.\",\n ),\n output: z\n .union([\n z\n .string()\n .describe(\n \"Optional textual output returned by the apply patch tool.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The ID of the entity that created this tool call output.*/\n created_by: z\n .string()\n .describe(\n \"The ID of the entity that created this tool call output.\",\n )\n .optional(),\n })\n .describe(\"The output emitted by an apply patch tool call.\"),\n z\n .object({\n /**\n * The type of the item. Always `mcp_call`.\n *\n */\n type: z\n .literal(\"mcp_call\")\n .describe(\"The type of the item. Always `mcp_call`.\\n\"),\n /**\n * The unique ID of the tool call.\n *\n */\n id: z.string().describe(\"The unique ID of the tool call.\\n\"),\n /**\n * The label of the MCP server running the tool.\n *\n */\n server_label: z\n .string()\n .describe(\"The label of the MCP server running the tool.\\n\"),\n /**\n * The name of the tool that was run.\n *\n */\n name: z.string().describe(\"The name of the tool that was run.\\n\"),\n /**\n * A JSON string of the arguments passed to the tool.\n *\n */\n arguments: z\n .string()\n .describe(\n \"A JSON string of the arguments passed to the tool.\\n\",\n ),\n output: z\n .union([\n z.string().describe(\"The output from the tool call.\\n\"),\n z.null(),\n ])\n .optional(),\n error: z\n .union([\n z\n .string()\n .describe(\"The error from the tool call, if any.\\n\"),\n z.null(),\n ])\n .optional(),\n /**\n * The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n \"calling\",\n \"failed\",\n ])\n .describe(\n \"The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.\\n\",\n )\n .optional(),\n approval_request_id: z\n .union([\n z\n .string()\n .describe(\n \"Unique identifier for the MCP tool call approval request.\\nInclude this value in a subsequent `mcp_approval_response` input to approve or reject the corresponding tool call.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\"An invocation of a tool on an MCP server.\\n\"),\n z\n .object({\n /**\n * The type of the item. Always `mcp_list_tools`.\n *\n */\n type: z\n .literal(\"mcp_list_tools\")\n .describe(\"The type of the item. Always `mcp_list_tools`.\\n\"),\n /**\n * The unique ID of the list.\n *\n */\n id: z.string().describe(\"The unique ID of the list.\\n\"),\n /**\n * The label of the MCP server.\n *\n */\n server_label: z.string().describe(\"The label of the MCP server.\\n\"),\n /**\n * The tools available on the server.\n *\n */\n tools: z\n .array(\n z\n .object({\n /**\n * The name of the tool.\n *\n */\n name: z\n .string()\n .describe(\"The name of the tool.\\n\"),\n description: z\n .union([\n z\n .string()\n .describe(\n \"The description of the tool.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * The JSON schema describing the tool's input.\n *\n */\n input_schema: z\n .record(z.string(), z.unknown())\n .describe(\n \"The JSON schema describing the tool's input.\\n\",\n ),\n annotations: z\n .union([\n z\n .record(z.string(), z.unknown())\n .describe(\n \"Additional annotations about the tool.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\"A tool available on an MCP server.\\n\"),\n )\n .describe(\"The tools available on the server.\\n\"),\n error: z\n .union([\n z\n .string()\n .describe(\n \"Error message if the server could not list tools.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\"A list of tools available on an MCP server.\\n\"),\n z\n .object({\n /**\n * The type of the item. Always `mcp_approval_request`.\n *\n */\n type: z\n .literal(\"mcp_approval_request\")\n .describe(\n \"The type of the item. Always `mcp_approval_request`.\\n\",\n ),\n /**\n * The unique ID of the approval request.\n *\n */\n id: z.string().describe(\"The unique ID of the approval request.\\n\"),\n /**\n * The label of the MCP server making the request.\n *\n */\n server_label: z\n .string()\n .describe(\"The label of the MCP server making the request.\\n\"),\n /**\n * The name of the tool to run.\n *\n */\n name: z.string().describe(\"The name of the tool to run.\\n\"),\n /**\n * A JSON string of arguments for the tool.\n *\n */\n arguments: z\n .string()\n .describe(\"A JSON string of arguments for the tool.\\n\"),\n })\n .describe(\"A request for human approval of a tool invocation.\\n\"),\n z\n .object({\n /**\n * The type of the custom tool call. Always `custom_tool_call`.\n *\n */\n type: z\n .literal(\"custom_tool_call\")\n .describe(\n \"The type of the custom tool call. Always `custom_tool_call`.\\n\",\n ),\n /**\n * The unique ID of the custom tool call in the OpenAI platform.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the custom tool call in the OpenAI platform.\\n\",\n )\n .optional(),\n /**\n * An identifier used to map this custom tool call to a tool call output.\n *\n */\n call_id: z\n .string()\n .describe(\n \"An identifier used to map this custom tool call to a tool call output.\\n\",\n ),\n /**\n * The name of the custom tool being called.\n *\n */\n name: z\n .string()\n .describe(\"The name of the custom tool being called.\\n\"),\n /**\n * The input for the custom tool call generated by the model.\n *\n */\n input: z\n .string()\n .describe(\n \"The input for the custom tool call generated by the model.\\n\",\n ),\n })\n .describe(\"A call to a custom tool created by the model.\\n\"),\n ]),\n )\n .describe(\n \"An array of content items generated by the model.\\n\\n- The length and order of items in the `output` array is dependent\\n on the model's response.\\n- Rather than accessing the first item in the `output` array and\\n assuming it's an `assistant` message with the content generated by\\n the model, you might consider using the `output_text` property where\\n supported in SDKs.\\n\",\n ),\n instructions: z.union([\n z\n .union([\n z\n .string()\n .describe(\n \"A text input to the model, equivalent to a text input with the\\n`developer` role.\\n\",\n ),\n z\n .array(\n z.union([\n z\n .object({\n /**\n * The role of the message input. One of `user`, `assistant`, `system`, or\n * `developer`.\n *\n */\n role: z\n .enum([\"user\", \"assistant\", \"system\", \"developer\"])\n .describe(\n \"The role of the message input. One of `user`, `assistant`, `system`, or\\n`developer`.\\n\",\n ),\n /**\n * Text, image, or audio input to the model, used to generate a response.\n * Can also contain previous assistant responses.\n *\n */\n content: z\n .union([\n z\n .string()\n .describe(\"A text input to the model.\\n\"),\n z\n .array(\n z.union([\n z\n .object({\n /**The type of the input item. Always `input_text`.*/\n type: z\n .literal(\"input_text\")\n .describe(\n \"The type of the input item. Always `input_text`.\",\n )\n .default(\"input_text\"),\n /**The text input to the model.*/\n text: z\n .string()\n .describe(\n \"The text input to the model.\",\n ),\n })\n .describe(\n \"A text input to the model.\",\n ),\n z\n .object({\n /**The type of the input item. Always `input_image`.*/\n type: z\n .literal(\"input_image\")\n .describe(\n \"The type of the input item. Always `input_image`.\",\n )\n .default(\"input_image\"),\n image_url: z\n .union([\n z\n .string()\n .describe(\n \"The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.\",\n ),\n z.null(),\n ])\n .optional(),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.*/\n detail: z\n .enum([\n \"low\",\n \"high\",\n \"auto\",\n ])\n .describe(\n \"The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\",\n ),\n })\n .describe(\n \"An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).\",\n ),\n z\n .object({\n /**The type of the input item. Always `input_file`.*/\n type: z\n .literal(\"input_file\")\n .describe(\n \"The type of the input item. Always `input_file`.\",\n )\n .default(\"input_file\"),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The name of the file to be sent to the model.*/\n filename: z\n .string()\n .describe(\n \"The name of the file to be sent to the model.\",\n )\n .optional(),\n /**The URL of the file to be sent to the model.*/\n file_url: z\n .string()\n .describe(\n \"The URL of the file to be sent to the model.\",\n )\n .optional(),\n /**\n * The content of the file to be sent to the model.\n *\n */\n file_data: z\n .string()\n .describe(\n \"The content of the file to be sent to the model.\\n\",\n )\n .optional(),\n })\n .describe(\n \"A file input to the model.\",\n ),\n ]),\n )\n .describe(\n \"A list of one or many input items to the model, containing different content \\ntypes.\\n\",\n ),\n ])\n .describe(\n \"Text, image, or audio input to the model, used to generate a response.\\nCan also contain previous assistant responses.\\n\",\n ),\n /**\n * The type of the message input. Always `message`.\n *\n */\n type: z\n .literal(\"message\")\n .describe(\n \"The type of the message input. Always `message`.\\n\",\n )\n .optional(),\n })\n .describe(\n \"A message input to the model with a role indicating instruction following\\nhierarchy. Instructions given with the `developer` or `system` role take\\nprecedence over instructions given with the `user` role. Messages with the\\n`assistant` role are presumed to have been generated by the model in previous\\ninteractions.\\n\",\n ),\n z\n .record(z.string(), z.unknown())\n .and(\n z.union([\n z\n .object({\n /**\n * The type of the message input. Always set to `message`.\n *\n */\n type: z\n .literal(\"message\")\n .describe(\n \"The type of the message input. Always set to `message`.\\n\",\n )\n .optional(),\n /**\n * The role of the message input. One of `user`, `system`, or `developer`.\n *\n */\n role: z\n .enum([\"user\", \"system\", \"developer\"])\n .describe(\n \"The role of the message input. One of `user`, `system`, or `developer`.\\n\",\n ),\n /**\n * The status of item. One of `in_progress`, `completed`, or\n * `incomplete`. Populated when items are returned via API.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of item. One of `in_progress`, `completed`, or\\n`incomplete`. Populated when items are returned via API.\\n\",\n )\n .optional(),\n /**\n * A list of one or many input items to the model, containing different content\n * types.\n *\n */\n content: z\n .array(\n z.union([\n z\n .object({\n /**The type of the input item. Always `input_text`.*/\n type: z\n .literal(\n \"input_text\",\n )\n .describe(\n \"The type of the input item. Always `input_text`.\",\n )\n .default(\n \"input_text\",\n ),\n /**The text input to the model.*/\n text: z\n .string()\n .describe(\n \"The text input to the model.\",\n ),\n })\n .describe(\n \"A text input to the model.\",\n ),\n z\n .object({\n /**The type of the input item. Always `input_image`.*/\n type: z\n .literal(\n \"input_image\",\n )\n .describe(\n \"The type of the input item. Always `input_image`.\",\n )\n .default(\n \"input_image\",\n ),\n image_url: z\n .union([\n z\n .string()\n .describe(\n \"The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.\",\n ),\n z.null(),\n ])\n .optional(),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.*/\n detail: z\n .enum([\n \"low\",\n \"high\",\n \"auto\",\n ])\n .describe(\n \"The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\",\n ),\n })\n .describe(\n \"An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).\",\n ),\n z\n .object({\n /**The type of the input item. Always `input_file`.*/\n type: z\n .literal(\n \"input_file\",\n )\n .describe(\n \"The type of the input item. Always `input_file`.\",\n )\n .default(\n \"input_file\",\n ),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The name of the file to be sent to the model.*/\n filename: z\n .string()\n .describe(\n \"The name of the file to be sent to the model.\",\n )\n .optional(),\n /**The URL of the file to be sent to the model.*/\n file_url: z\n .string()\n .describe(\n \"The URL of the file to be sent to the model.\",\n )\n .optional(),\n /**\n * The content of the file to be sent to the model.\n *\n */\n file_data: z\n .string()\n .describe(\n \"The content of the file to be sent to the model.\\n\",\n )\n .optional(),\n })\n .describe(\n \"A file input to the model.\",\n ),\n ]),\n )\n .describe(\n \"A list of one or many input items to the model, containing different content \\ntypes.\\n\",\n ),\n })\n .describe(\n \"A message input to the model with a role indicating instruction following\\nhierarchy. Instructions given with the `developer` or `system` role take\\nprecedence over instructions given with the `user` role.\\n\",\n ),\n z\n .object({\n /**\n * The unique ID of the output message.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the output message.\\n\",\n ),\n /**\n * The type of the output message. Always `message`.\n *\n */\n type: z\n .literal(\"message\")\n .describe(\n \"The type of the output message. Always `message`.\\n\",\n ),\n /**\n * The role of the output message. Always `assistant`.\n *\n */\n role: z\n .literal(\"assistant\")\n .describe(\n \"The role of the output message. Always `assistant`.\\n\",\n ),\n /**\n * The content of the output message.\n *\n */\n content: z\n .array(\n z.union([\n z\n .object({\n /**The type of the output text. Always `output_text`.*/\n type: z\n .literal(\n \"output_text\",\n )\n .describe(\n \"The type of the output text. Always `output_text`.\",\n )\n .default(\n \"output_text\",\n ),\n /**The text output from the model.*/\n text: z\n .string()\n .describe(\n \"The text output from the model.\",\n ),\n /**The annotations of the text output.*/\n annotations: z\n .array(\n z.union([\n z\n .object(\n {\n /**The type of the file citation. Always `file_citation`.*/\n type: z\n .literal(\n \"file_citation\",\n )\n .describe(\n \"The type of the file citation. Always `file_citation`.\",\n )\n .default(\n \"file_citation\",\n ),\n /**The ID of the file.*/\n file_id:\n z\n .string()\n .describe(\n \"The ID of the file.\",\n ),\n /**The index of the file in the list of files.*/\n index: z\n .number()\n .int()\n .describe(\n \"The index of the file in the list of files.\",\n ),\n /**The filename of the file cited.*/\n filename:\n z\n .string()\n .describe(\n \"The filename of the file cited.\",\n ),\n },\n )\n .describe(\n \"A citation to a file.\",\n ),\n z\n .object(\n {\n /**The type of the URL citation. Always `url_citation`.*/\n type: z\n .literal(\n \"url_citation\",\n )\n .describe(\n \"The type of the URL citation. Always `url_citation`.\",\n )\n .default(\n \"url_citation\",\n ),\n /**The URL of the web resource.*/\n url: z\n .string()\n .describe(\n \"The URL of the web resource.\",\n ),\n /**The index of the first character of the URL citation in the message.*/\n start_index:\n z\n .number()\n .int()\n .describe(\n \"The index of the first character of the URL citation in the message.\",\n ),\n /**The index of the last character of the URL citation in the message.*/\n end_index:\n z\n .number()\n .int()\n .describe(\n \"The index of the last character of the URL citation in the message.\",\n ),\n /**The title of the web resource.*/\n title: z\n .string()\n .describe(\n \"The title of the web resource.\",\n ),\n },\n )\n .describe(\n \"A citation for a web resource used to generate a model response.\",\n ),\n z\n .object(\n {\n /**The type of the container file citation. Always `container_file_citation`.*/\n type: z\n .literal(\n \"container_file_citation\",\n )\n .describe(\n \"The type of the container file citation. Always `container_file_citation`.\",\n )\n .default(\n \"container_file_citation\",\n ),\n /**The ID of the container file.*/\n container_id:\n z\n .string()\n .describe(\n \"The ID of the container file.\",\n ),\n /**The ID of the file.*/\n file_id:\n z\n .string()\n .describe(\n \"The ID of the file.\",\n ),\n /**The index of the first character of the container file citation in the message.*/\n start_index:\n z\n .number()\n .int()\n .describe(\n \"The index of the first character of the container file citation in the message.\",\n ),\n /**The index of the last character of the container file citation in the message.*/\n end_index:\n z\n .number()\n .int()\n .describe(\n \"The index of the last character of the container file citation in the message.\",\n ),\n /**The filename of the container file cited.*/\n filename:\n z\n .string()\n .describe(\n \"The filename of the container file cited.\",\n ),\n },\n )\n .describe(\n \"A citation for a container file used to generate a model response.\",\n ),\n z\n .object(\n {\n /**\n * The type of the file path. Always `file_path`.\n *\n */\n type: z\n .literal(\n \"file_path\",\n )\n .describe(\n \"The type of the file path. Always `file_path`.\\n\",\n ),\n /**\n * The ID of the file.\n *\n */\n file_id:\n z\n .string()\n .describe(\n \"The ID of the file.\\n\",\n ),\n /**\n * The index of the file in the list of files.\n *\n */\n index: z\n .number()\n .int()\n .describe(\n \"The index of the file in the list of files.\\n\",\n ),\n },\n )\n .describe(\n \"A path to a file.\\n\",\n ),\n ]),\n )\n .describe(\n \"The annotations of the text output.\",\n ),\n logprobs: z\n .array(\n z\n .object({\n token: z.string(),\n logprob:\n z.number(),\n bytes: z.array(\n z\n .number()\n .int(),\n ),\n top_logprobs:\n z.array(\n z\n .object(\n {\n token: z.string(),\n logprob:\n z.number(),\n bytes: z.array(\n z\n .number()\n .int(),\n ),\n },\n )\n .describe(\n \"The top log probability of a token.\",\n ),\n ),\n })\n .describe(\n \"The log probability of a token.\",\n ),\n )\n .optional(),\n })\n .describe(\n \"A text output from the model.\",\n ),\n z\n .object({\n /**The type of the refusal. Always `refusal`.*/\n type: z\n .literal(\"refusal\")\n .describe(\n \"The type of the refusal. Always `refusal`.\",\n )\n .default(\"refusal\"),\n /**The refusal explanation from the model.*/\n refusal: z\n .string()\n .describe(\n \"The refusal explanation from the model.\",\n ),\n })\n .describe(\n \"A refusal from the model.\",\n ),\n ]),\n )\n .describe(\n \"The content of the output message.\\n\",\n ),\n /**\n * The status of the message input. One of `in_progress`, `completed`, or\n * `incomplete`. Populated when input items are returned via API.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of the message input. One of `in_progress`, `completed`, or\\n`incomplete`. Populated when input items are returned via API.\\n\",\n ),\n })\n .describe(\n \"An output message from the model.\\n\",\n ),\n z\n .object({\n /**\n * The unique ID of the file search tool call.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the file search tool call.\\n\",\n ),\n /**\n * The type of the file search tool call. Always `file_search_call`.\n *\n */\n type: z\n .literal(\"file_search_call\")\n .describe(\n \"The type of the file search tool call. Always `file_search_call`.\\n\",\n ),\n /**\n * The status of the file search tool call. One of `in_progress`,\n * `searching`, `incomplete` or `failed`,\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"searching\",\n \"completed\",\n \"incomplete\",\n \"failed\",\n ])\n .describe(\n \"The status of the file search tool call. One of `in_progress`,\\n`searching`, `incomplete` or `failed`,\\n\",\n ),\n /**\n * The queries used to search for files.\n *\n */\n queries: z\n .array(z.string())\n .describe(\n \"The queries used to search for files.\\n\",\n ),\n results: z\n .union([\n z\n .array(\n z.object({\n /**\n * The unique ID of the file.\n *\n */\n file_id: z\n .string()\n .describe(\n \"The unique ID of the file.\\n\",\n )\n .optional(),\n /**\n * The text that was retrieved from the file.\n *\n */\n text: z\n .string()\n .describe(\n \"The text that was retrieved from the file.\\n\",\n )\n .optional(),\n /**\n * The name of the file.\n *\n */\n filename: z\n .string()\n .describe(\n \"The name of the file.\\n\",\n )\n .optional(),\n attributes: z\n .union([\n z\n .record(\n z.string(),\n z.union(\n [\n z\n .string()\n .max(\n 512,\n ),\n z.number(),\n z.boolean(),\n ],\n ),\n )\n .describe(\n \"Set of 16 key-value pairs that can be attached to an object. This can be\\nuseful for storing additional information about the object in a structured\\nformat, and querying for objects via API or the dashboard. Keys are strings\\nwith a maximum length of 64 characters. Values are strings with a maximum\\nlength of 512 characters, booleans, or numbers.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * The relevance score of the file - a value between 0 and 1.\n *\n */\n score: z\n .number()\n .describe(\n \"The relevance score of the file - a value between 0 and 1.\\n\",\n )\n .optional(),\n }),\n )\n .describe(\n \"The results of the file search tool call.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"The results of a file search tool call. See the\\n[file search guide](https://platform.openai.com/docs/guides/tools-file-search) for more information.\\n\",\n ),\n z\n .object({\n /**The type of the computer call. Always `computer_call`.*/\n type: z\n .literal(\"computer_call\")\n .describe(\n \"The type of the computer call. Always `computer_call`.\",\n )\n .default(\"computer_call\"),\n /**The unique ID of the computer call.*/\n id: z\n .string()\n .describe(\n \"The unique ID of the computer call.\",\n ),\n /**\n * An identifier used when responding to the tool call with output.\n *\n */\n call_id: z\n .string()\n .describe(\n \"An identifier used when responding to the tool call with output.\\n\",\n ),\n action: z.union([\n z\n .object({\n /**Specifies the event type. For a click action, this property is always `click`.*/\n type: z\n .literal(\"click\")\n .describe(\n \"Specifies the event type. For a click action, this property is always `click`.\",\n )\n .default(\"click\"),\n /**Indicates which mouse button was pressed during the click. One of `left`, `right`, `wheel`, `back`, or `forward`.*/\n button: z\n .enum([\n \"left\",\n \"right\",\n \"wheel\",\n \"back\",\n \"forward\",\n ])\n .describe(\n \"Indicates which mouse button was pressed during the click. One of `left`, `right`, `wheel`, `back`, or `forward`.\",\n ),\n /**The x-coordinate where the click occurred.*/\n x: z\n .number()\n .int()\n .describe(\n \"The x-coordinate where the click occurred.\",\n ),\n /**The y-coordinate where the click occurred.*/\n y: z\n .number()\n .int()\n .describe(\n \"The y-coordinate where the click occurred.\",\n ),\n })\n .describe(\"A click action.\"),\n z\n .object({\n /**Specifies the event type. For a double click action, this property is always set to `double_click`.*/\n type: z\n .literal(\"double_click\")\n .describe(\n \"Specifies the event type. For a double click action, this property is always set to `double_click`.\",\n )\n .default(\"double_click\"),\n /**The x-coordinate where the double click occurred.*/\n x: z\n .number()\n .int()\n .describe(\n \"The x-coordinate where the double click occurred.\",\n ),\n /**The y-coordinate where the double click occurred.*/\n y: z\n .number()\n .int()\n .describe(\n \"The y-coordinate where the double click occurred.\",\n ),\n })\n .describe(\"A double click action.\"),\n z\n .object({\n /**\n * Specifies the event type. For a drag action, this property is\n * always set to `drag`.\n *\n */\n type: z\n .literal(\"drag\")\n .describe(\n \"Specifies the event type. For a drag action, this property is \\nalways set to `drag`.\\n\",\n )\n .default(\"drag\"),\n /**\n * An array of coordinates representing the path of the drag action. Coordinates will appear as an array\n * of objects, eg\n * ```\n * [\n * { x: 100, y: 200 },\n * { x: 200, y: 300 }\n * ]\n * ```\n *\n */\n path: z\n .array(\n z\n .object({\n /**The x-coordinate.*/\n x: z\n .number()\n .int()\n .describe(\n \"The x-coordinate.\",\n ),\n /**The y-coordinate.*/\n y: z\n .number()\n .int()\n .describe(\n \"The y-coordinate.\",\n ),\n })\n .describe(\n \"An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`.\",\n ),\n )\n .describe(\n \"An array of coordinates representing the path of the drag action. Coordinates will appear as an array\\nof objects, eg\\n```\\n[\\n { x: 100, y: 200 },\\n { x: 200, y: 300 }\\n]\\n```\\n\",\n ),\n })\n .describe(\"A drag action.\\n\"),\n z\n .object({\n /**Specifies the event type. For a keypress action, this property is always set to `keypress`.*/\n type: z\n .literal(\"keypress\")\n .describe(\n \"Specifies the event type. For a keypress action, this property is always set to `keypress`.\",\n )\n .default(\"keypress\"),\n /**The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.*/\n keys: z\n .array(\n z\n .string()\n .describe(\n \"One of the keys the model is requesting to be pressed.\",\n ),\n )\n .describe(\n \"The combination of keys the model is requesting to be pressed. This is an array of strings, each representing a key.\",\n ),\n })\n .describe(\n \"A collection of keypresses the model would like to perform.\",\n ),\n z\n .object({\n /**\n * Specifies the event type. For a move action, this property is\n * always set to `move`.\n *\n */\n type: z\n .literal(\"move\")\n .describe(\n \"Specifies the event type. For a move action, this property is \\nalways set to `move`.\\n\",\n )\n .default(\"move\"),\n /**\n * The x-coordinate to move to.\n *\n */\n x: z\n .number()\n .int()\n .describe(\n \"The x-coordinate to move to.\\n\",\n ),\n /**\n * The y-coordinate to move to.\n *\n */\n y: z\n .number()\n .int()\n .describe(\n \"The y-coordinate to move to.\\n\",\n ),\n })\n .describe(\"A mouse move action.\\n\"),\n z\n .object({\n /**\n * Specifies the event type. For a screenshot action, this property is\n * always set to `screenshot`.\n *\n */\n type: z\n .literal(\"screenshot\")\n .describe(\n \"Specifies the event type. For a screenshot action, this property is \\nalways set to `screenshot`.\\n\",\n )\n .default(\"screenshot\"),\n })\n .describe(\"A screenshot action.\\n\"),\n z\n .object({\n /**\n * Specifies the event type. For a scroll action, this property is\n * always set to `scroll`.\n *\n */\n type: z\n .literal(\"scroll\")\n .describe(\n \"Specifies the event type. For a scroll action, this property is \\nalways set to `scroll`.\\n\",\n )\n .default(\"scroll\"),\n /**\n * The x-coordinate where the scroll occurred.\n *\n */\n x: z\n .number()\n .int()\n .describe(\n \"The x-coordinate where the scroll occurred.\\n\",\n ),\n /**\n * The y-coordinate where the scroll occurred.\n *\n */\n y: z\n .number()\n .int()\n .describe(\n \"The y-coordinate where the scroll occurred.\\n\",\n ),\n /**\n * The horizontal scroll distance.\n *\n */\n scroll_x: z\n .number()\n .int()\n .describe(\n \"The horizontal scroll distance.\\n\",\n ),\n /**\n * The vertical scroll distance.\n *\n */\n scroll_y: z\n .number()\n .int()\n .describe(\n \"The vertical scroll distance.\\n\",\n ),\n })\n .describe(\"A scroll action.\\n\"),\n z\n .object({\n /**\n * Specifies the event type. For a type action, this property is\n * always set to `type`.\n *\n */\n type: z\n .literal(\"type\")\n .describe(\n \"Specifies the event type. For a type action, this property is \\nalways set to `type`.\\n\",\n )\n .default(\"type\"),\n /**\n * The text to type.\n *\n */\n text: z\n .string()\n .describe(\n \"The text to type.\\n\",\n ),\n })\n .describe(\n \"An action to type in text.\\n\",\n ),\n z\n .object({\n /**\n * Specifies the event type. For a wait action, this property is\n * always set to `wait`.\n *\n */\n type: z\n .literal(\"wait\")\n .describe(\n \"Specifies the event type. For a wait action, this property is \\nalways set to `wait`.\\n\",\n )\n .default(\"wait\"),\n })\n .describe(\"A wait action.\\n\"),\n ]),\n /**\n * The pending safety checks for the computer call.\n *\n */\n pending_safety_checks: z\n .array(\n z\n .object({\n /**The ID of the pending safety check.*/\n id: z\n .string()\n .describe(\n \"The ID of the pending safety check.\",\n ),\n code: z\n .union([\n z\n .string()\n .describe(\n \"The type of the pending safety check.\",\n ),\n z.null(),\n ])\n .optional(),\n message: z\n .union([\n z\n .string()\n .describe(\n \"Details about the pending safety check.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"A pending safety check for the computer call.\",\n ),\n )\n .describe(\n \"The pending safety checks for the computer call.\\n\",\n ),\n /**\n * The status of the item. One of `in_progress`, `completed`, or\n * `incomplete`. Populated when items are returned via API.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of the item. One of `in_progress`, `completed`, or\\n`incomplete`. Populated when items are returned via API.\\n\",\n ),\n })\n .describe(\n \"A tool call to a computer use tool. See the\\n[computer use guide](https://platform.openai.com/docs/guides/tools-computer-use) for more information.\\n\",\n ),\n z\n .object({\n id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the computer tool call output.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The ID of the computer tool call that produced the output.*/\n call_id: z\n .string()\n .min(1)\n .max(64)\n .describe(\n \"The ID of the computer tool call that produced the output.\",\n ),\n /**The type of the computer tool call output. Always `computer_call_output`.*/\n type: z\n .literal(\"computer_call_output\")\n .describe(\n \"The type of the computer tool call output. Always `computer_call_output`.\",\n )\n .default(\"computer_call_output\"),\n /**\n * A computer screenshot image used with the computer use tool.\n *\n */\n output: z\n .object({\n /**\n * Specifies the event type. For a computer screenshot, this property is\n * always set to `computer_screenshot`.\n *\n */\n type: z\n .literal(\"computer_screenshot\")\n .describe(\n \"Specifies the event type. For a computer screenshot, this property is \\nalways set to `computer_screenshot`.\\n\",\n )\n .default(\"computer_screenshot\"),\n /**The URL of the screenshot image.*/\n image_url: z\n .string()\n .describe(\n \"The URL of the screenshot image.\",\n )\n .optional(),\n /**The identifier of an uploaded file that contains the screenshot.*/\n file_id: z\n .string()\n .describe(\n \"The identifier of an uploaded file that contains the screenshot.\",\n )\n .optional(),\n })\n .describe(\n \"A computer screenshot image used with the computer use tool.\\n\",\n ),\n acknowledged_safety_checks: z\n .union([\n z\n .array(\n z\n .object({\n /**The ID of the pending safety check.*/\n id: z\n .string()\n .describe(\n \"The ID of the pending safety check.\",\n ),\n code: z\n .union([\n z\n .string()\n .describe(\n \"The type of the pending safety check.\",\n ),\n z.null(),\n ])\n .optional(),\n message: z\n .union([\n z\n .string()\n .describe(\n \"Details about the pending safety check.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"A pending safety check for the computer call.\",\n ),\n )\n .describe(\n \"The safety checks reported by the API that have been acknowledged by the developer.\",\n ),\n z.null(),\n ])\n .optional(),\n status: z\n .union([\n z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of the message input. One of `in_progress`, `completed`, or `incomplete`. Populated when input items are returned via API.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"The output of a computer tool call.\",\n ),\n z\n .object({\n /**\n * The unique ID of the web search tool call.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the web search tool call.\\n\",\n ),\n /**\n * The type of the web search tool call. Always `web_search_call`.\n *\n */\n type: z\n .literal(\"web_search_call\")\n .describe(\n \"The type of the web search tool call. Always `web_search_call`.\\n\",\n ),\n /**\n * The status of the web search tool call.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"searching\",\n \"completed\",\n \"failed\",\n ])\n .describe(\n \"The status of the web search tool call.\\n\",\n ),\n /**\n * An object describing the specific action taken in this web search call.\n * Includes details on how the model used the web (search, open_page, find).\n *\n */\n action: z\n .record(z.string(), z.unknown())\n .and(\n z.union([\n z\n .object({\n /**\n * The action type.\n *\n */\n type: z\n .literal(\"search\")\n .describe(\n \"The action type.\\n\",\n ),\n /**\n * The search query.\n *\n */\n query: z\n .string()\n .describe(\n \"The search query.\\n\",\n ),\n /**\n * The sources used in the search.\n *\n */\n sources: z\n .array(\n z\n .object({\n /**\n * The type of source. Always `url`.\n *\n */\n type: z\n .literal(\n \"url\",\n )\n .describe(\n \"The type of source. Always `url`.\\n\",\n ),\n /**\n * The URL of the source.\n *\n */\n url: z\n .string()\n .describe(\n \"The URL of the source.\\n\",\n ),\n })\n .describe(\n \"A source used in the search.\\n\",\n ),\n )\n .describe(\n \"The sources used in the search.\\n\",\n )\n .optional(),\n })\n .describe(\n 'Action type \"search\" - Performs a web search query.\\n',\n ),\n z\n .object({\n /**\n * The action type.\n *\n */\n type: z\n .literal(\n \"open_page\",\n )\n .describe(\n \"The action type.\\n\",\n ),\n /**\n * The URL opened by the model.\n *\n */\n url: z\n .string()\n .url()\n .describe(\n \"The URL opened by the model.\\n\",\n ),\n })\n .describe(\n 'Action type \"open_page\" - Opens a specific URL from search results.\\n',\n ),\n z\n .object({\n /**\n * The action type.\n *\n */\n type: z\n .literal(\"find\")\n .describe(\n \"The action type.\\n\",\n ),\n /**\n * The URL of the page searched for the pattern.\n *\n */\n url: z\n .string()\n .url()\n .describe(\n \"The URL of the page searched for the pattern.\\n\",\n ),\n /**\n * The pattern or text to search for within the page.\n *\n */\n pattern: z\n .string()\n .describe(\n \"The pattern or text to search for within the page.\\n\",\n ),\n })\n .describe(\n 'Action type \"find\": Searches for a pattern within a loaded page.\\n',\n ),\n ]),\n )\n .describe(\n \"An object describing the specific action taken in this web search call.\\nIncludes details on how the model used the web (search, open_page, find).\\n\",\n ),\n })\n .describe(\n \"The results of a web search tool call. See the\\n[web search guide](https://platform.openai.com/docs/guides/tools-web-search) for more information.\\n\",\n ),\n z\n .object({\n /**\n * The unique ID of the function tool call.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the function tool call.\\n\",\n )\n .optional(),\n /**\n * The type of the function tool call. Always `function_call`.\n *\n */\n type: z\n .literal(\"function_call\")\n .describe(\n \"The type of the function tool call. Always `function_call`.\\n\",\n ),\n /**\n * The unique ID of the function tool call generated by the model.\n *\n */\n call_id: z\n .string()\n .describe(\n \"The unique ID of the function tool call generated by the model.\\n\",\n ),\n /**\n * The name of the function to run.\n *\n */\n name: z\n .string()\n .describe(\n \"The name of the function to run.\\n\",\n ),\n /**\n * A JSON string of the arguments to pass to the function.\n *\n */\n arguments: z\n .string()\n .describe(\n \"A JSON string of the arguments to pass to the function.\\n\",\n ),\n /**\n * The status of the item. One of `in_progress`, `completed`, or\n * `incomplete`. Populated when items are returned via API.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of the item. One of `in_progress`, `completed`, or\\n`incomplete`. Populated when items are returned via API.\\n\",\n )\n .optional(),\n })\n .describe(\n \"A tool call to run a function. See the \\n[function calling guide](https://platform.openai.com/docs/guides/function-calling) for more information.\\n\",\n ),\n z\n .object({\n id: z\n .union([\n z\n .string()\n .describe(\n \"The unique ID of the function tool call output. Populated when this item is returned via API.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The unique ID of the function tool call generated by the model.*/\n call_id: z\n .string()\n .min(1)\n .max(64)\n .describe(\n \"The unique ID of the function tool call generated by the model.\",\n ),\n /**The type of the function tool call output. Always `function_call_output`.*/\n type: z\n .literal(\"function_call_output\")\n .describe(\n \"The type of the function tool call output. Always `function_call_output`.\",\n )\n .default(\"function_call_output\"),\n /**Text, image, or file output of the function tool call.*/\n output: z\n .union([\n z\n .string()\n .max(10485760)\n .describe(\n \"A JSON string of the output of the function tool call.\",\n ),\n z.array(\n z.union([\n z\n .object({\n /**The type of the input item. Always `input_text`.*/\n type: z\n .literal(\n \"input_text\",\n )\n .describe(\n \"The type of the input item. Always `input_text`.\",\n )\n .default(\n \"input_text\",\n ),\n /**The text input to the model.*/\n text: z\n .string()\n .max(10485760)\n .describe(\n \"The text input to the model.\",\n ),\n })\n .describe(\n \"A text input to the model.\",\n ),\n z\n .object({\n /**The type of the input item. Always `input_image`.*/\n type: z\n .literal(\n \"input_image\",\n )\n .describe(\n \"The type of the input item. Always `input_image`.\",\n )\n .default(\n \"input_image\",\n ),\n image_url: z\n .union([\n z\n .string()\n .max(\n 20971520,\n )\n .describe(\n \"The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.\",\n ),\n z.null(),\n ])\n .optional(),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n detail: z\n .union([\n z\n .enum([\n \"low\",\n \"high\",\n \"auto\",\n ])\n .describe(\n \"The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision)\",\n ),\n z\n .object({\n /**The type of the input item. Always `input_file`.*/\n type: z\n .literal(\n \"input_file\",\n )\n .describe(\n \"The type of the input item. Always `input_file`.\",\n )\n .default(\n \"input_file\",\n ),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n filename: z\n .union([\n z\n .string()\n .describe(\n \"The name of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n file_data: z\n .union([\n z\n .string()\n .max(\n 33554432,\n )\n .describe(\n \"The base64-encoded data of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n file_url: z\n .union([\n z\n .string()\n .describe(\n \"The URL of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"A file input to the model.\",\n ),\n ]),\n ),\n ])\n .describe(\n \"Text, image, or file output of the function tool call.\",\n ),\n status: z\n .union([\n z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of the item. One of `in_progress`, `completed`, or `incomplete`. Populated when items are returned via API.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"The output of a function tool call.\",\n ),\n z\n .object({\n /**\n * The type of the object. Always `reasoning`.\n *\n */\n type: z\n .literal(\"reasoning\")\n .describe(\n \"The type of the object. Always `reasoning`.\\n\",\n ),\n /**\n * The unique identifier of the reasoning content.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique identifier of the reasoning content.\\n\",\n ),\n encrypted_content: z\n .union([\n z\n .string()\n .describe(\n \"The encrypted content of the reasoning item - populated when a response is\\ngenerated with `reasoning.encrypted_content` in the `include` parameter.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * Reasoning summary content.\n *\n */\n summary: z\n .array(\n z\n .object({\n /**The type of the object. Always `summary_text`.*/\n type: z\n .literal(\"summary_text\")\n .describe(\n \"The type of the object. Always `summary_text`.\",\n )\n .default(\n \"summary_text\",\n ),\n /**A summary of the reasoning output from the model so far.*/\n text: z\n .string()\n .describe(\n \"A summary of the reasoning output from the model so far.\",\n ),\n })\n .describe(\n \"A summary text from the model.\",\n ),\n )\n .describe(\n \"Reasoning summary content.\\n\",\n ),\n /**\n * Reasoning text content.\n *\n */\n content: z\n .array(\n z\n .object({\n /**The type of the reasoning text. Always `reasoning_text`.*/\n type: z\n .literal(\n \"reasoning_text\",\n )\n .describe(\n \"The type of the reasoning text. Always `reasoning_text`.\",\n )\n .default(\n \"reasoning_text\",\n ),\n /**The reasoning text from the model.*/\n text: z\n .string()\n .describe(\n \"The reasoning text from the model.\",\n ),\n })\n .describe(\n \"Reasoning text from the model.\",\n ),\n )\n .describe(\"Reasoning text content.\\n\")\n .optional(),\n /**\n * The status of the item. One of `in_progress`, `completed`, or\n * `incomplete`. Populated when items are returned via API.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of the item. One of `in_progress`, `completed`, or\\n`incomplete`. Populated when items are returned via API.\\n\",\n )\n .optional(),\n })\n .describe(\n \"A description of the chain of thought used by a reasoning model while generating\\na response. Be sure to include these items in your `input` to the Responses API\\nfor subsequent turns of a conversation if you are manually\\n[managing context](https://platform.openai.com/docs/guides/conversation-state).\\n\",\n ),\n z\n .object({\n id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the compaction item.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The type of the item. Always `compaction`.*/\n type: z\n .literal(\"compaction\")\n .describe(\n \"The type of the item. Always `compaction`.\",\n )\n .default(\"compaction\"),\n encrypted_content: z.string().max(10485760),\n })\n .describe(\n \"A compaction item generated by the [`v1/responses/compact` API](https://platform.openai.com/docs/api-reference/responses/compact).\",\n ),\n z\n .object({\n /**\n * The type of the image generation call. Always `image_generation_call`.\n *\n */\n type: z\n .literal(\"image_generation_call\")\n .describe(\n \"The type of the image generation call. Always `image_generation_call`.\\n\",\n ),\n /**\n * The unique ID of the image generation call.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the image generation call.\\n\",\n ),\n /**\n * The status of the image generation call.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"generating\",\n \"failed\",\n ])\n .describe(\n \"The status of the image generation call.\\n\",\n ),\n result: z.union([\n z\n .string()\n .describe(\n \"The generated image encoded in base64.\\n\",\n ),\n z.null(),\n ]),\n })\n .describe(\n \"An image generation request made by the model.\\n\",\n ),\n z\n .object({\n /**\n * The type of the code interpreter tool call. Always `code_interpreter_call`.\n *\n */\n type: z\n .literal(\"code_interpreter_call\")\n .describe(\n \"The type of the code interpreter tool call. Always `code_interpreter_call`.\\n\",\n )\n .default(\"code_interpreter_call\"),\n /**\n * The unique ID of the code interpreter tool call.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the code interpreter tool call.\\n\",\n ),\n /**\n * The status of the code interpreter tool call. Valid values are `in_progress`, `completed`, `incomplete`, `interpreting`, and `failed`.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n \"interpreting\",\n \"failed\",\n ])\n .describe(\n \"The status of the code interpreter tool call. Valid values are `in_progress`, `completed`, `incomplete`, `interpreting`, and `failed`.\\n\",\n ),\n /**\n * The ID of the container used to run the code.\n *\n */\n container_id: z\n .string()\n .describe(\n \"The ID of the container used to run the code.\\n\",\n ),\n code: z.union([\n z\n .string()\n .describe(\n \"The code to run, or null if not available.\\n\",\n ),\n z.null(),\n ]),\n outputs: z.union([\n z\n .array(\n z.union([\n z\n .object({\n /**The type of the output. Always `logs`.*/\n type: z\n .literal(\"logs\")\n .describe(\n \"The type of the output. Always `logs`.\",\n )\n .default(\n \"logs\",\n ),\n /**The logs output from the code interpreter.*/\n logs: z\n .string()\n .describe(\n \"The logs output from the code interpreter.\",\n ),\n })\n .describe(\n \"The logs output from the code interpreter.\",\n ),\n z\n .object({\n /**The type of the output. Always `image`.*/\n type: z\n .literal(\n \"image\",\n )\n .describe(\n \"The type of the output. Always `image`.\",\n )\n .default(\n \"image\",\n ),\n /**The URL of the image output from the code interpreter.*/\n url: z\n .string()\n .describe(\n \"The URL of the image output from the code interpreter.\",\n ),\n })\n .describe(\n \"The image output from the code interpreter.\",\n ),\n ]),\n )\n .describe(\n \"The outputs generated by the code interpreter, such as logs or images.\\nCan be null if no outputs are available.\\n\",\n ),\n z.null(),\n ]),\n })\n .describe(\"A tool call to run code.\\n\"),\n z\n .object({\n /**\n * The type of the local shell call. Always `local_shell_call`.\n *\n */\n type: z\n .literal(\"local_shell_call\")\n .describe(\n \"The type of the local shell call. Always `local_shell_call`.\\n\",\n ),\n /**\n * The unique ID of the local shell call.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the local shell call.\\n\",\n ),\n /**\n * The unique ID of the local shell tool call generated by the model.\n *\n */\n call_id: z\n .string()\n .describe(\n \"The unique ID of the local shell tool call generated by the model.\\n\",\n ),\n /**Execute a shell command on the server.*/\n action: z\n .object({\n /**The type of the local shell action. Always `exec`.*/\n type: z\n .literal(\"exec\")\n .describe(\n \"The type of the local shell action. Always `exec`.\",\n )\n .default(\"exec\"),\n /**The command to run.*/\n command: z\n .array(z.string())\n .describe(\n \"The command to run.\",\n ),\n timeout_ms: z\n .union([\n z\n .number()\n .int()\n .describe(\n \"Optional timeout in milliseconds for the command.\",\n ),\n z.null(),\n ])\n .optional(),\n working_directory: z\n .union([\n z\n .string()\n .describe(\n \"Optional working directory to run the command in.\",\n ),\n z.null(),\n ])\n .optional(),\n /**Environment variables to set for the command.*/\n env: z\n .record(z.string(), z.string())\n .describe(\n \"Environment variables to set for the command.\",\n ),\n user: z\n .union([\n z\n .string()\n .describe(\n \"Optional user to run the command as.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"Execute a shell command on the server.\",\n ),\n /**\n * The status of the local shell call.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of the local shell call.\\n\",\n ),\n })\n .describe(\n \"A tool call to run a command on the local shell.\\n\",\n ),\n z\n .object({\n /**\n * The type of the local shell tool call output. Always `local_shell_call_output`.\n *\n */\n type: z\n .literal(\"local_shell_call_output\")\n .describe(\n \"The type of the local shell tool call output. Always `local_shell_call_output`.\\n\",\n ),\n /**\n * The unique ID of the local shell tool call generated by the model.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the local shell tool call generated by the model.\\n\",\n ),\n /**\n * A JSON string of the output of the local shell tool call.\n *\n */\n output: z\n .string()\n .describe(\n \"A JSON string of the output of the local shell tool call.\\n\",\n ),\n status: z\n .union([\n z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of the item. One of `in_progress`, `completed`, or `incomplete`.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"The output of a local shell tool call.\\n\",\n ),\n z\n .object({\n id: z\n .union([\n z\n .string()\n .describe(\n \"The unique ID of the shell tool call. Populated when this item is returned via API.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The unique ID of the shell tool call generated by the model.*/\n call_id: z\n .string()\n .min(1)\n .max(64)\n .describe(\n \"The unique ID of the shell tool call generated by the model.\",\n ),\n /**The type of the item. Always `shell_call`.*/\n type: z\n .literal(\"shell_call\")\n .describe(\n \"The type of the item. Always `shell_call`.\",\n )\n .default(\"shell_call\"),\n /**The shell commands and limits that describe how to run the tool call.*/\n action: z\n .object({\n /**Ordered shell commands for the execution environment to run.*/\n commands: z\n .array(z.string())\n .describe(\n \"Ordered shell commands for the execution environment to run.\",\n ),\n timeout_ms: z\n .union([\n z\n .number()\n .int()\n .describe(\n \"Maximum wall-clock time in milliseconds to allow the shell commands to run.\",\n ),\n z.null(),\n ])\n .optional(),\n max_output_length: z\n .union([\n z\n .number()\n .int()\n .describe(\n \"Maximum number of UTF-8 characters to capture from combined stdout and stderr output.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"The shell commands and limits that describe how to run the tool call.\",\n ),\n status: z\n .union([\n z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n ])\n .describe(\n \"The status of the shell call. One of `in_progress`, `completed`, or `incomplete`.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"A tool representing a request to execute one or more shell commands.\",\n ),\n z\n .object({\n id: z\n .union([\n z\n .string()\n .describe(\n \"The unique ID of the shell tool call output. Populated when this item is returned via API.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The unique ID of the shell tool call generated by the model.*/\n call_id: z\n .string()\n .min(1)\n .max(64)\n .describe(\n \"The unique ID of the shell tool call generated by the model.\",\n ),\n /**The type of the item. Always `shell_call_output`.*/\n type: z\n .literal(\"shell_call_output\")\n .describe(\n \"The type of the item. Always `shell_call_output`.\",\n )\n .default(\"shell_call_output\"),\n /**Captured chunks of stdout and stderr output, along with their associated outcomes.*/\n output: z\n .array(\n z\n .object({\n /**Captured stdout output for the shell call.*/\n stdout: z\n .string()\n .max(10485760)\n .describe(\n \"Captured stdout output for the shell call.\",\n ),\n /**Captured stderr output for the shell call.*/\n stderr: z\n .string()\n .max(10485760)\n .describe(\n \"Captured stderr output for the shell call.\",\n ),\n /**The exit or timeout outcome associated with this shell call.*/\n outcome: z\n .union([\n z\n .object({\n /**The outcome type. Always `timeout`.*/\n type: z\n .literal(\n \"timeout\",\n )\n .describe(\n \"The outcome type. Always `timeout`.\",\n )\n .default(\n \"timeout\",\n ),\n })\n .describe(\n \"Indicates that the shell call exceeded its configured time limit.\",\n ),\n z\n .object({\n /**The outcome type. Always `exit`.*/\n type: z\n .literal(\n \"exit\",\n )\n .describe(\n \"The outcome type. Always `exit`.\",\n )\n .default(\n \"exit\",\n ),\n /**The exit code returned by the shell process.*/\n exit_code: z\n .number()\n .int()\n .describe(\n \"The exit code returned by the shell process.\",\n ),\n })\n .describe(\n \"Indicates that the shell commands finished and returned an exit code.\",\n ),\n ])\n .describe(\n \"The exit or timeout outcome associated with this shell call.\",\n ),\n })\n .describe(\n \"Captured stdout and stderr for a portion of a shell tool call output.\",\n ),\n )\n .describe(\n \"Captured chunks of stdout and stderr output, along with their associated outcomes.\",\n ),\n max_output_length: z\n .union([\n z\n .number()\n .int()\n .describe(\n \"The maximum number of UTF-8 characters captured for this shell call's combined output.\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"The streamed output items emitted by a shell tool call.\",\n ),\n z\n .object({\n /**The type of the item. Always `apply_patch_call`.*/\n type: z\n .literal(\"apply_patch_call\")\n .describe(\n \"The type of the item. Always `apply_patch_call`.\",\n )\n .default(\"apply_patch_call\"),\n id: z\n .union([\n z\n .string()\n .describe(\n \"The unique ID of the apply patch tool call. Populated when this item is returned via API.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The unique ID of the apply patch tool call generated by the model.*/\n call_id: z\n .string()\n .min(1)\n .max(64)\n .describe(\n \"The unique ID of the apply patch tool call generated by the model.\",\n ),\n /**The status of the apply patch tool call. One of `in_progress` or `completed`.*/\n status: z\n .enum([\"in_progress\", \"completed\"])\n .describe(\n \"The status of the apply patch tool call. One of `in_progress` or `completed`.\",\n ),\n /**The specific create, delete, or update instruction for the apply_patch tool call.*/\n operation: z\n .union([\n z\n .object({\n /**The operation type. Always `create_file`.*/\n type: z\n .literal(\"create_file\")\n .describe(\n \"The operation type. Always `create_file`.\",\n )\n .default(\"create_file\"),\n /**Path of the file to create relative to the workspace root.*/\n path: z\n .string()\n .min(1)\n .describe(\n \"Path of the file to create relative to the workspace root.\",\n ),\n /**Unified diff content to apply when creating the file.*/\n diff: z\n .string()\n .max(10485760)\n .describe(\n \"Unified diff content to apply when creating the file.\",\n ),\n })\n .describe(\n \"Instruction for creating a new file via the apply_patch tool.\",\n ),\n z\n .object({\n /**The operation type. Always `delete_file`.*/\n type: z\n .literal(\"delete_file\")\n .describe(\n \"The operation type. Always `delete_file`.\",\n )\n .default(\"delete_file\"),\n /**Path of the file to delete relative to the workspace root.*/\n path: z\n .string()\n .min(1)\n .describe(\n \"Path of the file to delete relative to the workspace root.\",\n ),\n })\n .describe(\n \"Instruction for deleting an existing file via the apply_patch tool.\",\n ),\n z\n .object({\n /**The operation type. Always `update_file`.*/\n type: z\n .literal(\"update_file\")\n .describe(\n \"The operation type. Always `update_file`.\",\n )\n .default(\"update_file\"),\n /**Path of the file to update relative to the workspace root.*/\n path: z\n .string()\n .min(1)\n .describe(\n \"Path of the file to update relative to the workspace root.\",\n ),\n /**Unified diff content to apply to the existing file.*/\n diff: z\n .string()\n .max(10485760)\n .describe(\n \"Unified diff content to apply to the existing file.\",\n ),\n })\n .describe(\n \"Instruction for updating an existing file via the apply_patch tool.\",\n ),\n ])\n .describe(\n \"The specific create, delete, or update instruction for the apply_patch tool call.\",\n ),\n })\n .describe(\n \"A tool call representing a request to create, delete, or update files using diff patches.\",\n ),\n z\n .object({\n /**The type of the item. Always `apply_patch_call_output`.*/\n type: z\n .literal(\"apply_patch_call_output\")\n .describe(\n \"The type of the item. Always `apply_patch_call_output`.\",\n )\n .default(\"apply_patch_call_output\"),\n id: z\n .union([\n z\n .string()\n .describe(\n \"The unique ID of the apply patch tool call output. Populated when this item is returned via API.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The unique ID of the apply patch tool call generated by the model.*/\n call_id: z\n .string()\n .min(1)\n .max(64)\n .describe(\n \"The unique ID of the apply patch tool call generated by the model.\",\n ),\n /**The status of the apply patch tool call output. One of `completed` or `failed`.*/\n status: z\n .enum([\"completed\", \"failed\"])\n .describe(\n \"The status of the apply patch tool call output. One of `completed` or `failed`.\",\n ),\n output: z\n .union([\n z\n .string()\n .max(10485760)\n .describe(\n \"Optional human-readable log text from the apply patch tool (e.g., patch results or errors).\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"The streamed output emitted by an apply patch tool call.\",\n ),\n z\n .object({\n /**\n * The type of the item. Always `mcp_list_tools`.\n *\n */\n type: z\n .literal(\"mcp_list_tools\")\n .describe(\n \"The type of the item. Always `mcp_list_tools`.\\n\",\n ),\n /**\n * The unique ID of the list.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the list.\\n\",\n ),\n /**\n * The label of the MCP server.\n *\n */\n server_label: z\n .string()\n .describe(\n \"The label of the MCP server.\\n\",\n ),\n /**\n * The tools available on the server.\n *\n */\n tools: z\n .array(\n z\n .object({\n /**\n * The name of the tool.\n *\n */\n name: z\n .string()\n .describe(\n \"The name of the tool.\\n\",\n ),\n description: z\n .union([\n z\n .string()\n .describe(\n \"The description of the tool.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * The JSON schema describing the tool's input.\n *\n */\n input_schema: z\n .record(\n z.string(),\n z.unknown(),\n )\n .describe(\n \"The JSON schema describing the tool's input.\\n\",\n ),\n annotations: z\n .union([\n z\n .record(\n z.string(),\n z.unknown(),\n )\n .describe(\n \"Additional annotations about the tool.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"A tool available on an MCP server.\\n\",\n ),\n )\n .describe(\n \"The tools available on the server.\\n\",\n ),\n error: z\n .union([\n z\n .string()\n .describe(\n \"Error message if the server could not list tools.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"A list of tools available on an MCP server.\\n\",\n ),\n z\n .object({\n /**\n * The type of the item. Always `mcp_approval_request`.\n *\n */\n type: z\n .literal(\"mcp_approval_request\")\n .describe(\n \"The type of the item. Always `mcp_approval_request`.\\n\",\n ),\n /**\n * The unique ID of the approval request.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the approval request.\\n\",\n ),\n /**\n * The label of the MCP server making the request.\n *\n */\n server_label: z\n .string()\n .describe(\n \"The label of the MCP server making the request.\\n\",\n ),\n /**\n * The name of the tool to run.\n *\n */\n name: z\n .string()\n .describe(\n \"The name of the tool to run.\\n\",\n ),\n /**\n * A JSON string of arguments for the tool.\n *\n */\n arguments: z\n .string()\n .describe(\n \"A JSON string of arguments for the tool.\\n\",\n ),\n })\n .describe(\n \"A request for human approval of a tool invocation.\\n\",\n ),\n z\n .object({\n /**\n * The type of the item. Always `mcp_approval_response`.\n *\n */\n type: z\n .literal(\"mcp_approval_response\")\n .describe(\n \"The type of the item. Always `mcp_approval_response`.\\n\",\n ),\n id: z\n .union([\n z\n .string()\n .describe(\n \"The unique ID of the approval response\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * The ID of the approval request being answered.\n *\n */\n approval_request_id: z\n .string()\n .describe(\n \"The ID of the approval request being answered.\\n\",\n ),\n /**\n * Whether the request was approved.\n *\n */\n approve: z\n .boolean()\n .describe(\n \"Whether the request was approved.\\n\",\n ),\n reason: z\n .union([\n z\n .string()\n .describe(\n \"Optional reason for the decision.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"A response to an MCP approval request.\\n\",\n ),\n z\n .object({\n /**\n * The type of the item. Always `mcp_call`.\n *\n */\n type: z\n .literal(\"mcp_call\")\n .describe(\n \"The type of the item. Always `mcp_call`.\\n\",\n ),\n /**\n * The unique ID of the tool call.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the tool call.\\n\",\n ),\n /**\n * The label of the MCP server running the tool.\n *\n */\n server_label: z\n .string()\n .describe(\n \"The label of the MCP server running the tool.\\n\",\n ),\n /**\n * The name of the tool that was run.\n *\n */\n name: z\n .string()\n .describe(\n \"The name of the tool that was run.\\n\",\n ),\n /**\n * A JSON string of the arguments passed to the tool.\n *\n */\n arguments: z\n .string()\n .describe(\n \"A JSON string of the arguments passed to the tool.\\n\",\n ),\n output: z\n .union([\n z\n .string()\n .describe(\n \"The output from the tool call.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n error: z\n .union([\n z\n .string()\n .describe(\n \"The error from the tool call, if any.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.\n *\n */\n status: z\n .enum([\n \"in_progress\",\n \"completed\",\n \"incomplete\",\n \"calling\",\n \"failed\",\n ])\n .describe(\n \"The status of the tool call. One of `in_progress`, `completed`, `incomplete`, `calling`, or `failed`.\\n\",\n )\n .optional(),\n approval_request_id: z\n .union([\n z\n .string()\n .describe(\n \"Unique identifier for the MCP tool call approval request.\\nInclude this value in a subsequent `mcp_approval_response` input to approve or reject the corresponding tool call.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n })\n .describe(\n \"An invocation of a tool on an MCP server.\\n\",\n ),\n z\n .object({\n /**\n * The type of the custom tool call output. Always `custom_tool_call_output`.\n *\n */\n type: z\n .literal(\"custom_tool_call_output\")\n .describe(\n \"The type of the custom tool call output. Always `custom_tool_call_output`.\\n\",\n ),\n /**\n * The unique ID of the custom tool call output in the OpenAI platform.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the custom tool call output in the OpenAI platform.\\n\",\n )\n .optional(),\n /**\n * The call ID, used to map this custom tool call output to a custom tool call.\n *\n */\n call_id: z\n .string()\n .describe(\n \"The call ID, used to map this custom tool call output to a custom tool call.\\n\",\n ),\n /**\n * The output from the custom tool call generated by your code.\n * Can be a string or an list of output content.\n *\n */\n output: z\n .union([\n z\n .string()\n .describe(\n \"A string of the output of the custom tool call.\\n\",\n ),\n z\n .array(\n z.union([\n z\n .object({\n /**The type of the input item. Always `input_text`.*/\n type: z\n .literal(\n \"input_text\",\n )\n .describe(\n \"The type of the input item. Always `input_text`.\",\n )\n .default(\n \"input_text\",\n ),\n /**The text input to the model.*/\n text: z\n .string()\n .describe(\n \"The text input to the model.\",\n ),\n })\n .describe(\n \"A text input to the model.\",\n ),\n z\n .object({\n /**The type of the input item. Always `input_image`.*/\n type: z\n .literal(\n \"input_image\",\n )\n .describe(\n \"The type of the input item. Always `input_image`.\",\n )\n .default(\n \"input_image\",\n ),\n image_url: z\n .union([\n z\n .string()\n .describe(\n \"The URL of the image to be sent to the model. A fully qualified URL or base64 encoded image in a data URL.\",\n ),\n z.null(),\n ])\n .optional(),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.*/\n detail: z\n .enum([\n \"low\",\n \"high\",\n \"auto\",\n ])\n .describe(\n \"The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\",\n ),\n })\n .describe(\n \"An image input to the model. Learn about [image inputs](https://platform.openai.com/docs/guides/vision).\",\n ),\n z\n .object({\n /**The type of the input item. Always `input_file`.*/\n type: z\n .literal(\n \"input_file\",\n )\n .describe(\n \"The type of the input item. Always `input_file`.\",\n )\n .default(\n \"input_file\",\n ),\n file_id: z\n .union([\n z\n .string()\n .describe(\n \"The ID of the file to be sent to the model.\",\n ),\n z.null(),\n ])\n .optional(),\n /**The name of the file to be sent to the model.*/\n filename: z\n .string()\n .describe(\n \"The name of the file to be sent to the model.\",\n )\n .optional(),\n /**The URL of the file to be sent to the model.*/\n file_url: z\n .string()\n .describe(\n \"The URL of the file to be sent to the model.\",\n )\n .optional(),\n /**\n * The content of the file to be sent to the model.\n *\n */\n file_data: z\n .string()\n .describe(\n \"The content of the file to be sent to the model.\\n\",\n )\n .optional(),\n })\n .describe(\n \"A file input to the model.\",\n ),\n ]),\n )\n .describe(\n \"Text, image, or file output of the custom tool call.\\n\",\n ),\n ])\n .describe(\n \"The output from the custom tool call generated by your code.\\nCan be a string or an list of output content.\\n\",\n ),\n })\n .describe(\n \"The output of a custom tool call from your code, being sent back to the model.\\n\",\n ),\n z\n .object({\n /**\n * The type of the custom tool call. Always `custom_tool_call`.\n *\n */\n type: z\n .literal(\"custom_tool_call\")\n .describe(\n \"The type of the custom tool call. Always `custom_tool_call`.\\n\",\n ),\n /**\n * The unique ID of the custom tool call in the OpenAI platform.\n *\n */\n id: z\n .string()\n .describe(\n \"The unique ID of the custom tool call in the OpenAI platform.\\n\",\n )\n .optional(),\n /**\n * An identifier used to map this custom tool call to a tool call output.\n *\n */\n call_id: z\n .string()\n .describe(\n \"An identifier used to map this custom tool call to a tool call output.\\n\",\n ),\n /**\n * The name of the custom tool being called.\n *\n */\n name: z\n .string()\n .describe(\n \"The name of the custom tool being called.\\n\",\n ),\n /**\n * The input for the custom tool call generated by the model.\n *\n */\n input: z\n .string()\n .describe(\n \"The input for the custom tool call generated by the model.\\n\",\n ),\n })\n .describe(\n \"A call to a custom tool created by the model.\\n\",\n ),\n ]),\n )\n .describe(\n \"An item representing part of the context for the response to be\\ngenerated by the model. Can contain text, images, and audio inputs,\\nas well as previous assistant responses and tool call outputs.\\n\",\n ),\n z\n .object({\n type: z\n .union([\n z\n .literal(\"item_reference\")\n .describe(\n \"The type of item to reference. Always `item_reference`.\",\n )\n .default(\"item_reference\"),\n z.null(),\n ])\n .optional(),\n /**The ID of the item to reference.*/\n id: z\n .string()\n .describe(\"The ID of the item to reference.\"),\n })\n .describe(\n \"An internal identifier for an item to reference.\",\n ),\n ]),\n )\n .describe(\n \"A list of one or many input items to the model, containing\\ndifferent content types.\\n\",\n ),\n ])\n .describe(\n \"A system (or developer) message inserted into the model's context.\\n\\nWhen using along with `previous_response_id`, the instructions from a previous\\nresponse will not be carried over to the next response. This makes it simple\\nto swap out system (or developer) messages in new responses.\\n\",\n ),\n z.null(),\n ]),\n output_text: z\n .union([\n z\n .string()\n .describe(\n \"SDK-only convenience property that contains the aggregated text output\\nfrom all `output_text` items in the `output` array, if any are present.\\nSupported in the Python and JavaScript SDKs.\\n\",\n ),\n z.null(),\n ])\n .optional(),\n /**\n * Represents token usage details including input tokens, output tokens,\n * a breakdown of output tokens, and the total tokens used.\n *\n */\n usage: z\n .object({\n /**The number of input tokens.*/\n input_tokens: z.number().int().describe(\"The number of input tokens.\"),\n /**A detailed breakdown of the input tokens.*/\n input_tokens_details: z\n .object({\n /**\n * The number of tokens that were retrieved from the cache.\n * [More on prompt caching](https://platform.openai.com/docs/guides/prompt-caching).\n *\n */\n cached_tokens: z\n .number()\n .int()\n .describe(\n \"The number of tokens that were retrieved from the cache. \\n[More on prompt caching](https://platform.openai.com/docs/guides/prompt-caching).\\n\",\n ),\n })\n .describe(\"A detailed breakdown of the input tokens.\"),\n /**The number of output tokens.*/\n output_tokens: z.number().int().describe(\"The number of output tokens.\"),\n /**A detailed breakdown of the output tokens.*/\n output_tokens_details: z\n .object({\n /**The number of reasoning tokens.*/\n reasoning_tokens: z\n .number()\n .int()\n .describe(\"The number of reasoning tokens.\"),\n })\n .describe(\"A detailed breakdown of the output tokens.\"),\n /**The total number of tokens used.*/\n total_tokens: z.number().int().describe(\"The total number of tokens used.\"),\n })\n .describe(\n \"Represents token usage details including input tokens, output tokens,\\na breakdown of output tokens, and the total tokens used.\\n\",\n )\n .optional(),\n /**\n * Whether to allow the model to run tool calls in parallel.\n *\n */\n parallel_tool_calls: z\n .boolean()\n .describe(\"Whether to allow the model to run tool calls in parallel.\\n\")\n .default(true),\n conversation: z\n .union([\n z\n .object({\n /**The unique ID of the conversation.*/\n id: z.string().describe(\"The unique ID of the conversation.\"),\n })\n .describe(\n \"The conversation that this response belongs to. Input items and output items from this response are automatically added to this conversation.\",\n ),\n z.null(),\n ])\n .optional(),\n }),\n ),\n);\n\nexport const OpenAIResponseStreamEvent = z\n .object({\n type: z.enum([\n \"error\",\n \"response.audio.delta\",\n \"response.audio.done\",\n \"response.audio.transcript.delta\",\n \"response.audio.transcript.done\",\n \"response.code_interpreter_call.completed\",\n \"response.code_interpreter_call.in_progress\",\n \"response.code_interpreter_call.interpreting\",\n \"response.code_interpreter_call_code.delta\",\n \"response.code_interpreter_call_code.done\",\n \"response.completed\",\n \"response.computer_call.completed\",\n \"response.computer_call.failed\",\n \"response.computer_call.in_progress\",\n \"response.content_part.added\",\n \"response.content_part.done\",\n \"response.created\",\n \"response.custom_tool_call_input.delta\",\n \"response.custom_tool_call_input.done\",\n \"response.failed\",\n \"response.file_search_call.completed\",\n \"response.file_search_call.in_progress\",\n \"response.file_search_call.searching\",\n \"response.function_call_arguments.delta\",\n \"response.function_call_arguments.done\",\n \"response.image_generation_call.completed\",\n \"response.image_generation_call.generating\",\n \"response.image_generation_call.in_progress\",\n \"response.image_generation_call.partial_image\",\n \"response.in_progress\",\n \"response.incomplete\",\n \"response.mcp_call.completed\",\n \"response.mcp_call.failed\",\n \"response.mcp_call.in_progress\",\n \"response.mcp_call_arguments.delta\",\n \"response.mcp_call_arguments.done\",\n \"response.mcp_list_tools.completed\",\n \"response.mcp_list_tools.failed\",\n \"response.mcp_list_tools.in_progress\",\n \"response.output_item.added\",\n \"response.output_item.done\",\n \"response.output_text.annotation.added\",\n \"response.output_text.delta\",\n \"response.output_text.done\",\n \"response.queued\",\n \"response.reasoning_summary_part.added\",\n \"response.reasoning_summary_part.done\",\n \"response.reasoning_summary_text.delta\",\n \"response.reasoning_summary_text.done\",\n \"response.reasoning_text.delta\",\n \"response.reasoning_text.done\",\n \"response.refusal.delta\",\n \"response.refusal.done\",\n \"response.web_search_call.completed\",\n \"response.web_search_call.in_progress\",\n \"response.web_search_call.searching\",\n ]),\n })\n .catchall(z.any());\n","import { z } from \"zod\";\n\nexport const OpenAIVideoModels = z.enum([\"sora-2\", \"sora-2-pro\"]);\n\nexport type OpenAIVideoModels = z.infer<typeof OpenAIVideoModels>;\n\nexport const OpenAICreateVideoSchema = z.object({\n model: z\n .union([z.string(), OpenAIVideoModels])\n .describe(\n \"The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`.\",\n )\n .optional(),\n prompt: z\n .string()\n .min(1)\n .max(32000)\n .describe(\"Text prompt that describes the video to generate.\"),\n input_reference: z\n .string()\n .base64()\n .describe(\"Optional image reference that guides generation.\")\n .optional(),\n seconds: z\n .enum([\"4\", \"8\", \"12\"])\n .describe(\"Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds.\")\n .optional(),\n size: z\n .enum([\"720x1280\", \"1280x720\", \"1024x1792\", \"1792x1024\"])\n .describe(\n \"Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280.\",\n )\n .optional(),\n});\n\nexport const OpenAICreateVideo = z\n .object({\n id: z.string().describe(\"Unique identifier for the video job.\"),\n object: z\n .literal(\"video\")\n .describe(\"The object type, which is always `video`.\")\n .default(\"video\"),\n model: z\n .union([z.string(), OpenAIVideoModels])\n .describe(\"The video generation model that produced the job.\"),\n status: z\n .enum([\"queued\", \"in_progress\", \"completed\", \"failed\"])\n .describe(\"Current lifecycle status of the video job.\"),\n progress: z\n .number()\n .int()\n .describe(\"Approximate completion percentage for the generation task.\"),\n created_at: z\n .number()\n .int()\n .describe(\"Unix timestamp (seconds) for when the job was created.\"),\n completed_at: z.union([\n z\n .number()\n .int()\n .describe(\"Unix timestamp (seconds) for when the job completed, if finished.\"),\n z.null(),\n ]),\n expires_at: z.union([\n z\n .number()\n .int()\n .describe(\n \"Unix timestamp (seconds) for when the downloadable assets expire, if set.\",\n ),\n z.null(),\n ]),\n prompt: z.union([\n z.string().describe(\"The prompt that was used to generate the video.\"),\n z.null(),\n ]),\n size: z\n .enum([\"720x1280\", \"1280x720\", \"1024x1792\", \"1792x1024\"])\n .describe(\"The resolution of the generated video.\"),\n seconds: z.enum([\"4\", \"8\", \"12\"]).describe(\"Duration of the generated clip in seconds.\"),\n remixed_from_video_id: z.union([\n z.string().describe(\"Identifier of the source video if this video is a remix.\"),\n z.null(),\n ]),\n error: z.union([\n z\n .object({\n code: z.string(),\n message: z.string(),\n })\n .describe(\"Error payload that explains why generation failed, if applicable.\"),\n z.null(),\n ]),\n })\n .describe(\"Structured information describing a generated video job.\");\n\nexport type OpenAICreateVideoSchema = z.input<typeof OpenAICreateVideoSchema>;\nexport type OpenAICreateVideo = z.infer<typeof OpenAICreateVideo>;\n","import type { RunContext } from \"@better-agent/core\";\nimport { Events } from \"@better-agent/core/events\";\nimport type { Event } from \"@better-agent/core/events\";\nimport type {\n GenerativeModelOutputItem,\n GenerativeModelResponse,\n} from \"@better-agent/core/providers\";\nimport { BetterAgentError } from \"@better-agent/shared/errors\";\nimport { OpenAIAudioSpeechModels } from \"../audio-speech/schemas\";\nimport { OpenAIAudioTranscriptionModels } from \"../audio-transcription/schemas\";\nimport { OpenAIEmbeddingModels } from \"../embeddings/schemas\";\nimport { OpenAIImageModels } from \"../images/schemas\";\nimport type { OpenAIImageCaps } from \"../images/types\";\nimport { OpenAIResponseModels } from \"../responses/schemas\";\nimport type { OpenAIResponseCaps } from \"../responses/types\";\nimport type {\n OpenAIAudioSpeechCaps,\n OpenAIAudioTranscriptionCaps,\n OpenAIEmbeddingCaps,\n} from \"../types\";\nimport { OpenAIVideoModels } from \"../videos/schemas\";\nimport type { OpenAIVideoCaps } from \"../videos/types\";\n\nexport const isImageModel = (m: unknown): m is OpenAIImageModels =>\n OpenAIImageModels.options.includes(m as OpenAIImageModels);\n\nexport const isResponseModel = (m: unknown): m is OpenAIResponseModels =>\n OpenAIResponseModels.options.includes(m as OpenAIResponseModels);\n\nexport const isVideoModel = (m: unknown): m is OpenAIVideoModels =>\n OpenAIVideoModels.options.includes(m as OpenAIVideoModels);\n\nexport const isAudioSpeechModel = (m: unknown): m is OpenAIAudioSpeechModels =>\n OpenAIAudioSpeechModels.options.includes(m as OpenAIAudioSpeechModels);\n\nexport const isAudioTranscriptionModel = (m: unknown): m is OpenAIAudioTranscriptionModels =>\n OpenAIAudioTranscriptionModels.options.includes(m as OpenAIAudioTranscriptionModels);\n\nexport const isEmbeddingModel = (m: unknown): m is OpenAIEmbeddingModels =>\n OpenAIEmbeddingModels.options.includes(m as OpenAIEmbeddingModels);\n\nexport const OPENAI_RESPONSE_CAPS = {\n inputModalities: { text: true, image: true, file: true },\n inputShape: \"chat\",\n replayMode: \"multi_turn\",\n supportsInstruction: true,\n outputModalities: {\n text: {\n options: {},\n },\n },\n tools: true,\n structured_output: true,\n additionalSupportedRoles: [\"developer\"],\n} as const satisfies OpenAIResponseCaps;\n\nexport const OPENAI_IMAGE_CAPS = {\n inputModalities: { text: true, image: true },\n inputShape: \"prompt\",\n replayMode: \"single_turn_persistent\",\n supportsInstruction: false,\n outputModalities: {\n image: true,\n },\n additionalSupportedRoles: [\"developer\"],\n} as const satisfies OpenAIImageCaps;\n\nexport const OPENAI_VIDEO_CAPS = {\n inputModalities: { text: true, image: true },\n inputShape: \"prompt\",\n replayMode: \"single_turn_persistent\",\n supportsInstruction: false,\n outputModalities: {\n video: true,\n },\n additionalSupportedRoles: [\"developer\"],\n} as const satisfies OpenAIVideoCaps;\n\nexport const OPENAI_AUDIO_SPEECH_CAPS = {\n inputModalities: { text: true },\n inputShape: \"prompt\",\n replayMode: \"single_turn_persistent\",\n supportsInstruction: false,\n tools: false,\n outputModalities: {\n audio: true,\n },\n additionalSupportedRoles: [\"developer\"],\n} as const satisfies OpenAIAudioSpeechCaps;\n\nexport const OPENAI_AUDIO_TRANSCRIPTION_CAPS = {\n inputModalities: { audio: true },\n inputShape: \"prompt\",\n replayMode: \"single_turn_persistent\",\n supportsInstruction: false,\n outputModalities: {\n text: true,\n },\n additionalSupportedRoles: [\"developer\"],\n} as const satisfies OpenAIAudioTranscriptionCaps;\n\nexport const OPENAI_EMBEDDING_CAPS = {\n inputModalities: { text: true },\n inputShape: \"prompt\",\n replayMode: \"single_turn_persistent\",\n supportsInstruction: false,\n outputModalities: {\n embedding: true,\n },\n additionalSupportedRoles: [\"developer\"],\n} as const satisfies OpenAIEmbeddingCaps;\n\nexport const openaiUpstreamError = (\n message: string,\n meta: {\n status?: number;\n code?: string;\n raw?: unknown;\n model?: string;\n provider?: string;\n } = {},\n) => {\n const mappedCode =\n meta.code === \"ABORTED\"\n ? \"ABORTED\"\n : meta.code === \"VIDEO_POLL_TIMEOUT\"\n ? \"TIMEOUT\"\n : \"UPSTREAM_FAILED\";\n\n return BetterAgentError.fromCode(mappedCode, message, {\n ...(meta.status !== undefined ? { status: meta.status } : {}),\n context: {\n provider: \"openai\",\n ...(meta.model !== undefined ? { model: meta.model } : {}),\n ...(meta.code !== undefined &&\n meta.code !== \"ABORTED\" &&\n meta.code !== \"VIDEO_POLL_TIMEOUT\"\n ? { upstreamCode: meta.code }\n : {}),\n ...(meta.raw !== undefined ? { raw: meta.raw } : {}),\n },\n });\n};\n\nexport const createDeferred = <T>() => {\n let resolve!: (value: T | PromiseLike<T>) => void;\n let reject!: (reason?: unknown) => void;\n const promise = new Promise<T>((res, rej) => {\n resolve = res;\n reject = rej;\n });\n return { promise, resolve, reject };\n};\n\nexport const collectNonStreamOutputEvents = (\n response: GenerativeModelResponse,\n ctx: RunContext,\n): Event[] => {\n const events: Event[] = [];\n const pushEvent = (event: Record<string, unknown>) => {\n events.push({ ...event, timestamp: Date.now() } as Event);\n };\n const responseBody = response.response?.body as\n | {\n text?: unknown;\n language?: unknown;\n duration?: unknown;\n segments?: Array<{\n id?: unknown;\n start?: unknown;\n end?: unknown;\n text?: unknown;\n speaker?: unknown;\n }>;\n logprobs?: unknown[];\n }\n | undefined;\n const output = response.output;\n\n const transcriptTextFromOutput = output.find(\n (item): item is Extract<GenerativeModelOutputItem, { type: \"message\" }> =>\n item.type === \"message\" && typeof item.content === \"string\",\n )?.content;\n const transcriptText =\n typeof transcriptTextFromOutput === \"string\"\n ? transcriptTextFromOutput\n : typeof responseBody?.text === \"string\"\n ? responseBody.text\n : \"\";\n const isTranscriptionResponse =\n typeof transcriptText === \"string\" &&\n transcriptText.length > 0 &&\n (typeof responseBody?.language === \"string\" ||\n typeof responseBody?.duration === \"number\" ||\n Array.isArray(responseBody?.segments));\n\n if (isTranscriptionResponse) {\n const segments = Array.isArray(responseBody?.segments)\n ? responseBody.segments\n .map((segment) => {\n if (typeof segment?.id !== \"number\" && typeof segment?.id !== \"string\") {\n return null;\n }\n if (typeof segment?.start !== \"number\" || typeof segment?.end !== \"number\") {\n return null;\n }\n if (typeof segment?.text !== \"string\") return null;\n\n return {\n id: String(segment.id),\n start: segment.start,\n end: segment.end,\n text: segment.text,\n ...(typeof segment.speaker === \"string\"\n ? { speaker: segment.speaker }\n : {}),\n };\n })\n .filter((segment): segment is NonNullable<typeof segment> => segment !== null)\n : [];\n\n const messageId = ctx.generateMessageId();\n\n pushEvent({\n type: Events.TRANSCRIPT_MESSAGE_START,\n messageId,\n role: \"assistant\",\n });\n\n pushEvent({\n type: Events.TRANSCRIPT_MESSAGE_CONTENT,\n messageId,\n delta: transcriptText,\n ...(Array.isArray(responseBody?.logprobs) ? { logprobs: responseBody.logprobs } : {}),\n });\n\n for (const segment of segments) {\n pushEvent({\n type: Events.TRANSCRIPT_MESSAGE_SEGMENT,\n messageId,\n segment,\n });\n }\n\n pushEvent({\n type: Events.TRANSCRIPT_MESSAGE_END,\n messageId,\n });\n return events;\n }\n\n let lastAssistantMessageId: string | undefined;\n for (const item of output) {\n if (item.type === \"tool-call\" || item.type === \"provider-tool-result\") {\n pushEvent({\n type: Events.TOOL_CALL_START,\n parentMessageId: lastAssistantMessageId ?? `tool_call:${item.callId}`,\n toolCallId: item.callId,\n toolCallName: item.name,\n runId: ctx.runId,\n agentName: ctx.agentName,\n toolTarget: \"hosted\",\n });\n\n if (item.type === \"tool-call\" && typeof item.arguments === \"string\") {\n pushEvent({\n type: Events.TOOL_CALL_ARGS,\n parentMessageId: lastAssistantMessageId ?? `tool_call:${item.callId}`,\n toolCallId: item.callId,\n toolCallName: item.name,\n delta: item.arguments,\n runId: ctx.runId,\n agentName: ctx.agentName,\n toolTarget: \"hosted\",\n });\n }\n\n if (item.type === \"provider-tool-result\") {\n pushEvent({\n type: Events.TOOL_CALL_RESULT,\n parentMessageId: lastAssistantMessageId ?? `tool_call:${item.callId}`,\n toolCallId: item.callId,\n toolCallName: item.name,\n result: item.result,\n ...(item.isError ? { isError: item.isError } : {}),\n runId: ctx.runId,\n agentName: ctx.agentName,\n toolTarget: \"hosted\",\n });\n }\n\n pushEvent({\n type: Events.TOOL_CALL_END,\n parentMessageId: lastAssistantMessageId ?? `tool_call:${item.callId}`,\n toolCallId: item.callId,\n toolCallName: item.name,\n runId: ctx.runId,\n agentName: ctx.agentName,\n toolTarget: \"hosted\",\n });\n continue;\n }\n\n if (item.type !== \"message\") continue;\n\n const messageId = ctx.generateMessageId();\n\n const role = item.role;\n if (role === \"assistant\") {\n lastAssistantMessageId = messageId;\n }\n\n const content = item.content;\n if (typeof content === \"string\") {\n pushEvent({\n type: Events.TEXT_MESSAGE_START,\n messageId,\n role,\n });\n pushEvent({\n type: Events.TEXT_MESSAGE_CONTENT,\n messageId,\n delta: content,\n });\n pushEvent({\n type: Events.TEXT_MESSAGE_END,\n messageId,\n });\n continue;\n }\n\n for (const part of content) {\n if (part.type === \"text\") {\n pushEvent({\n type: Events.TEXT_MESSAGE_START,\n messageId,\n role,\n });\n pushEvent({\n type: Events.TEXT_MESSAGE_CONTENT,\n messageId,\n delta: part.text,\n });\n pushEvent({\n type: Events.TEXT_MESSAGE_END,\n messageId,\n });\n continue;\n }\n\n if (part.type === \"image\") {\n pushEvent({\n type: Events.IMAGE_MESSAGE_START,\n messageId,\n role,\n });\n pushEvent({\n type: Events.IMAGE_MESSAGE_CONTENT,\n messageId,\n delta:\n part.source.kind === \"url\"\n ? { kind: \"url\", url: part.source.url }\n : {\n kind: \"base64\",\n data: part.source.data,\n mimeType: part.source.mimeType,\n },\n });\n pushEvent({\n type: Events.IMAGE_MESSAGE_END,\n messageId,\n });\n continue;\n }\n\n if (part.type === \"video\") {\n pushEvent({\n type: Events.VIDEO_MESSAGE_START,\n messageId,\n role,\n });\n pushEvent({\n type: Events.VIDEO_MESSAGE_CONTENT,\n messageId,\n delta:\n part.source.kind === \"url\"\n ? { kind: \"url\", url: part.source.url }\n : {\n kind: \"base64\",\n data: part.source.data,\n mimeType: part.source.mimeType,\n },\n });\n pushEvent({\n type: Events.VIDEO_MESSAGE_END,\n messageId,\n });\n continue;\n }\n\n if (part.type === \"audio\" && part.source.kind === \"base64\") {\n pushEvent({\n type: Events.AUDIO_MESSAGE_START,\n messageId,\n role,\n });\n pushEvent({\n type: Events.AUDIO_MESSAGE_CONTENT,\n messageId,\n delta: {\n kind: \"base64\",\n data: part.source.data,\n mimeType: part.source.mimeType,\n },\n });\n pushEvent({\n type: Events.AUDIO_MESSAGE_END,\n messageId,\n });\n continue;\n }\n\n if (part.type === \"embedding\") {\n pushEvent({\n type: Events.EMBEDDING_MESSAGE_START,\n messageId,\n role,\n });\n pushEvent({\n type: Events.EMBEDDING_MESSAGE_CONTENT,\n messageId,\n delta: part.embedding,\n });\n pushEvent({\n type: Events.EMBEDDING_MESSAGE_END,\n messageId,\n });\n }\n }\n }\n return events;\n};\n","import { Events } from \"@better-agent/core/events\";\nimport type { Event } from \"@better-agent/core/events\";\nimport type {\n GenerativeModelCallOptions,\n GenerativeModelOutputItem,\n GenerativeModelResponse,\n GenerativeModelUsage,\n ModalitiesParam,\n} from \"@better-agent/core/providers\";\nimport { BetterAgentError } from \"@better-agent/shared/errors\";\nimport type { Result } from \"@better-agent/shared/neverthrow\";\nimport { err, ok } from \"@better-agent/shared/neverthrow\";\nimport { extractPassthroughOptions, omitNullish } from \"../../utils/object-utils\";\nimport type { OpenAITranscriptionStreamEvent } from \"../shared/schemas\";\nimport type {\n OpenAIAudioTranscriptionModels,\n OpenAICreateTranscriptionRequest,\n OpenAICreateTranscriptionResponse,\n} from \"./schemas\";\nimport type {\n OpenAIAudioTranscriptionCaps,\n OpenAIAudioTranscriptionEndpointOptions,\n} from \"./types\";\n\n/**\n * Keys explicitly handled by the OpenAI audio transcription mapper.\n */\nconst OPENAI_AUDIO_TRANSCRIPTION_KNOWN_KEYS: ReadonlySet<string> = new Set([\n // Framework-managed\n \"input\",\n \"tools\",\n \"toolChoice\",\n \"modalities\",\n \"structured_output\",\n // Explicitly mapped\n \"language\",\n \"prompt\",\n \"response_format\",\n \"temperature\",\n \"include\",\n \"timestamp_granularities\",\n \"stream\",\n \"chunking_strategy\",\n \"known_speaker_names\",\n \"known_speaker_references\",\n]);\n\nconst mapOpenAIUsage = (usage?: {\n input_tokens?: number;\n output_tokens?: number;\n total_tokens?: number;\n}): GenerativeModelUsage =>\n omitNullish({\n inputTokens: usage?.input_tokens,\n outputTokens: usage?.output_tokens,\n totalTokens: usage?.total_tokens,\n });\n\nexport function mapToOpenAIAudioTranscriptionRequest<\n M extends OpenAIAudioTranscriptionModels,\n TModalities extends ModalitiesParam<OpenAIAudioTranscriptionCaps> = undefined,\n>(args: {\n modelId: M;\n options: GenerativeModelCallOptions<\n OpenAIAudioTranscriptionCaps,\n OpenAIAudioTranscriptionEndpointOptions,\n TModalities\n >;\n}): Result<OpenAICreateTranscriptionRequest, BetterAgentError> {\n try {\n const o = args.options;\n\n const audioFile = \"file\" in o ? o.file : undefined;\n\n if (typeof audioFile !== \"string\" || !audioFile) {\n return err(\n BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n \"Audio transcription requires an audio file (base64 string or data URL)\",\n {\n context: {\n provider: \"openai\",\n model: args.modelId,\n },\n },\n ).at({\n at: \"openai.audio.transcription.map.fileMissing\",\n }),\n );\n }\n\n return ok({\n ...extractPassthroughOptions(\n o as Record<string, unknown>,\n OPENAI_AUDIO_TRANSCRIPTION_KNOWN_KEYS,\n ),\n file: audioFile as string,\n model: args.modelId,\n language: o.language,\n prompt: o.prompt,\n response_format: o.response_format,\n temperature: o.temperature,\n timestamp_granularities: o.timestamp_granularities,\n chunking_strategy: o.chunking_strategy,\n include: o.include,\n stream: o.stream,\n });\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"Failed to map OpenAI Audio Transcription request\",\n opts: { code: \"INTERNAL\", context: { provider: \"openai\", model: args.modelId } },\n }).at({\n at: \"openai.audio.transcription.mapToRequest\",\n }),\n );\n }\n}\n\nexport function mapFromOpenAIAudioTranscriptionResponse(\n raw: OpenAICreateTranscriptionResponse,\n): GenerativeModelResponse {\n const text = raw.text ?? \"\";\n\n const output: GenerativeModelOutputItem[] = [];\n if (text) {\n output.push({\n type: \"message\",\n role: \"assistant\",\n content: text,\n });\n }\n\n return {\n output,\n finishReason: \"stop\",\n usage: {},\n response: {\n body: raw,\n },\n };\n}\n\nexport function mapFromOpenAIAudioTranscriptionStreamEvent(\n event: OpenAITranscriptionStreamEvent,\n args: {\n messageId: string;\n text: string;\n logprobs?: unknown[];\n segments: Array<{\n id: string;\n start: number;\n end: number;\n text: string;\n speaker?: string;\n }>;\n },\n): Result<\n | {\n kind: \"event\";\n event: Event;\n }\n | {\n kind: \"final\";\n response: GenerativeModelResponse;\n }\n | null,\n BetterAgentError\n> {\n if (event.type === \"transcript.text.delta\") {\n return ok({\n kind: \"event\",\n event: {\n type: Events.TRANSCRIPT_MESSAGE_CONTENT,\n messageId: args.messageId,\n delta: event.delta ?? \"\",\n timestamp: Date.now(),\n ...omitNullish({\n logprobs: event.logprobs,\n segmentId: event.segment_id,\n }),\n },\n });\n }\n\n if (event.type === \"transcript.text.segment\") {\n return ok({\n kind: \"event\",\n event: {\n type: Events.TRANSCRIPT_MESSAGE_SEGMENT,\n messageId: args.messageId,\n segment: {\n id: event.id,\n start: event.start,\n end: event.end,\n text: event.text,\n ...omitNullish({ speaker: event.speaker }),\n },\n timestamp: Date.now(),\n },\n });\n }\n\n if (event.type === \"transcript.text.done\") {\n const response: GenerativeModelResponse = {\n output: args.text\n ? [\n {\n type: \"message\",\n role: \"assistant\",\n content: args.text,\n },\n ]\n : [],\n finishReason: \"stop\",\n usage: mapOpenAIUsage(event.usage),\n response: {\n body: {\n text: args.text,\n logprobs: args.logprobs,\n segments: args.segments,\n usage: event.usage,\n },\n },\n };\n\n return ok({\n kind: \"final\",\n response,\n });\n }\n\n return ok(null);\n}\n","import type { RunContext } from \"@better-agent/core\";\nimport { Events } from \"@better-agent/core/events\";\nimport type { Event } from \"@better-agent/core/events\";\nimport type {\n GenerativeModelCallOptions,\n GenerativeModelResponse,\n ModalitiesParam,\n} from \"@better-agent/core/providers\";\nimport { BetterAgentError } from \"@better-agent/shared/errors\";\nimport { type Result, err, ok } from \"@better-agent/shared/neverthrow\";\nimport type { createOpenAIClient } from \"../client\";\nimport {\n OPENAI_AUDIO_TRANSCRIPTION_CAPS,\n collectNonStreamOutputEvents,\n createDeferred,\n openaiUpstreamError,\n} from \"../shared/runtime\";\nimport type {\n OpenAIAudioTranscriptionGenerativeModel,\n OpenAIAudioTranscriptionModelId,\n} from \"../types\";\nimport {\n mapFromOpenAIAudioTranscriptionResponse,\n mapFromOpenAIAudioTranscriptionStreamEvent,\n mapToOpenAIAudioTranscriptionRequest,\n} from \"./mappers\";\nimport type { OpenAIAudioTranscriptionModels } from \"./schemas\";\nimport type {\n OpenAIAudioTranscriptionCaps,\n OpenAIAudioTranscriptionEndpointOptions,\n} from \"./types\";\n\nexport const createOpenAIAudioTranscriptionModel = <M extends OpenAIAudioTranscriptionModelId>(\n modelId: M,\n client: ReturnType<typeof createOpenAIClient>,\n): OpenAIAudioTranscriptionGenerativeModel<M> => {\n const doGenerate = (async <\n TModalities extends ModalitiesParam<OpenAIAudioTranscriptionCaps> = undefined,\n >(\n options: GenerativeModelCallOptions<\n OpenAIAudioTranscriptionCaps,\n OpenAIAudioTranscriptionEndpointOptions,\n TModalities\n >,\n ctx: RunContext,\n ) => {\n const requestBodyResult = mapToOpenAIAudioTranscriptionRequest({\n modelId: modelId as OpenAIAudioTranscriptionModels,\n options,\n });\n if (requestBodyResult.isErr()) {\n return err(\n requestBodyResult.error.at({\n at: \"openai.generate.mapRequest\",\n data: {\n modelId,\n endpoint: \"audio.transcriptions\",\n },\n }),\n );\n }\n\n const requestBody = requestBodyResult.value;\n\n const raw = await client.audio.transcriptions(requestBody, {\n signal: ctx.signal ?? null,\n });\n if (raw.isErr()) {\n return err(\n raw.error\n .at({ at: \"openai.generate.modelContext\", data: { model: String(modelId) } })\n .at({\n at: \"openai.generate.http\",\n data: {\n modelId,\n endpoint: \"audio.transcriptions\",\n path: \"/v1/audio/transcriptions\",\n },\n }),\n );\n }\n\n const response = mapFromOpenAIAudioTranscriptionResponse(raw.value);\n return ok({\n response: {\n ...response,\n request: {\n body: requestBody,\n },\n } satisfies GenerativeModelResponse,\n events: collectNonStreamOutputEvents(response, ctx),\n });\n }) as NonNullable<OpenAIAudioTranscriptionGenerativeModel<M>[\"doGenerate\"]>;\n\n const doGenerateStream = (async <\n const TModalities extends ModalitiesParam<OpenAIAudioTranscriptionCaps> = undefined,\n >(\n options: GenerativeModelCallOptions<\n OpenAIAudioTranscriptionCaps,\n OpenAIAudioTranscriptionEndpointOptions,\n TModalities\n >,\n ctx: RunContext,\n ) => {\n const requestBodyResult = mapToOpenAIAudioTranscriptionRequest({\n modelId: modelId as OpenAIAudioTranscriptionModels,\n options,\n });\n if (requestBodyResult.isErr()) {\n return err(\n requestBodyResult.error.at({\n at: \"openai.generateStream.mapRequest\",\n data: {\n modelId,\n endpoint: \"audio.transcriptions\",\n },\n }),\n );\n }\n\n const requestBody = {\n ...requestBodyResult.value,\n stream: true,\n };\n\n const streamResult = await client.audio.transcriptionsStream(requestBody, {\n signal: ctx.signal ?? null,\n });\n if (streamResult.isErr()) {\n return err(\n streamResult.error\n .at({ at: \"openai.generate.modelContext\", data: { model: String(modelId) } })\n .at({\n at: \"openai.generateStream.http\",\n data: {\n modelId,\n endpoint: \"audio.transcriptions\",\n path: \"/v1/audio/transcriptions\",\n },\n }),\n );\n }\n\n const {\n promise: final,\n resolve: resolveFinal,\n reject: rejectFinal,\n } = createDeferred<GenerativeModelResponse>();\n\n const events = (async function* (): AsyncGenerator<Result<Event, BetterAgentError>> {\n const messageId = ctx.generateMessageId();\n const textParts: string[] = [];\n const segments: Array<{\n id: string;\n start: number;\n end: number;\n text: string;\n speaker?: string;\n }> = [];\n let finalLogprobs: unknown[] | undefined;\n let started = false;\n let sawFinal = false;\n let finalResolved = false;\n\n try {\n for await (const raw of streamResult.value) {\n if (raw.isErr()) {\n const appErr = BetterAgentError.wrap({\n err: raw.error,\n message: \"OpenAI stream chunk error\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n },\n }).at({\n at: \"openai.generateStream.chunk\",\n });\n\n yield err(appErr);\n rejectFinal(appErr);\n return;\n }\n\n if (raw.value.type === \"transcript.text.delta\") {\n textParts.push(raw.value.delta ?? \"\");\n finalLogprobs = raw.value.logprobs ?? finalLogprobs;\n }\n\n if (raw.value.type === \"transcript.text.segment\") {\n segments.push({\n id: raw.value.id,\n start: raw.value.start,\n end: raw.value.end,\n text: raw.value.text,\n ...(raw.value.speaker !== undefined\n ? { speaker: raw.value.speaker }\n : {}),\n });\n }\n\n if (raw.value.type === \"transcript.text.done\") {\n finalLogprobs = raw.value.logprobs ?? finalLogprobs;\n }\n\n const text =\n raw.value.type === \"transcript.text.done\"\n ? (raw.value.text ?? textParts.join(\"\"))\n : \"\";\n\n const mapped = mapFromOpenAIAudioTranscriptionStreamEvent(raw.value, {\n messageId,\n text,\n ...(finalLogprobs !== undefined ? { logprobs: finalLogprobs } : {}),\n segments,\n });\n if (mapped.isErr()) {\n const appErr = mapped.error.at({\n at: \"openai.generateStream.mapEvent\",\n });\n\n yield err(appErr);\n rejectFinal(appErr);\n return;\n }\n\n const m = mapped.value;\n if (!m) continue;\n\n if (!started) {\n started = true;\n yield ok({\n type: Events.TRANSCRIPT_MESSAGE_START,\n messageId,\n role: \"assistant\",\n timestamp: Date.now(),\n });\n }\n\n if (m.kind === \"event\") {\n yield ok(m.event);\n continue;\n }\n\n sawFinal = true;\n resolveFinal({\n ...m.response,\n request: {\n body: requestBody,\n },\n });\n finalResolved = true;\n\n yield ok({\n type: Events.TRANSCRIPT_MESSAGE_END,\n messageId,\n timestamp: Date.now(),\n });\n return;\n }\n\n if (!sawFinal) {\n const missingFinal = openaiUpstreamError(\n \"Stream ended without transcript.text.done\",\n {\n provider: \"openai\",\n code: \"STREAM_MISSING_FINAL\",\n },\n ).at({\n at: \"openai.generateStream.missingFinal\",\n });\n\n yield err(missingFinal);\n rejectFinal(missingFinal);\n return;\n }\n } catch (e) {\n const appErr = BetterAgentError.wrap({\n err: e,\n message: \"OpenAI audio transcription streaming failed\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n context: { provider: \"openai\", model: String(modelId) },\n },\n }).at({\n at: \"openai.generateStream.generator\",\n });\n\n if (!finalResolved) {\n rejectFinal(appErr);\n }\n yield err(appErr);\n return;\n }\n })();\n\n return ok({\n events,\n final,\n });\n }) as NonNullable<OpenAIAudioTranscriptionGenerativeModel<M>[\"doGenerateStream\"]>;\n\n return {\n providerId: \"openai\",\n modelId,\n caps: OPENAI_AUDIO_TRANSCRIPTION_CAPS,\n doGenerate,\n doGenerateStream,\n } as OpenAIAudioTranscriptionGenerativeModel<M>;\n};\n","import type { OpenAIConfig } from \"../types\";\n\nconst getEnv = (name: string): string | undefined =>\n typeof process !== \"undefined\" ? process.env?.[name] : undefined;\n\nexport const buildOpenAIHeaders = (config: OpenAIConfig): Record<string, string> => {\n const headers: Record<string, string> = {\n ...(config.headers ?? {}),\n };\n\n const apiKey = config.apiKey ?? getEnv(\"OPENAI_API_KEY\");\n if (apiKey) headers.Authorization = `Bearer ${apiKey}`;\n if (config.organization) headers[\"OpenAI-Organization\"] = config.organization;\n if (config.project) headers[\"OpenAI-Project\"] = config.project;\n\n return headers;\n};\n","import { BetterAgentError } from \"@better-agent/shared/errors\";\n\nimport type { OpenAIError } from \"../types\";\n\nexport type OpenAIHttpError = {\n status: number;\n statusText: string;\n error?: OpenAIError[\"error\"];\n};\n\nexport const mapOpenAIHttpError = (\n httpError: OpenAIHttpError | undefined,\n ctx: {\n at: string;\n path: string;\n },\n): BetterAgentError => {\n if (!httpError) {\n return BetterAgentError.fromCode(\"UPSTREAM_FAILED\", \"OpenAI request failed\", {\n context: {\n provider: \"openai\",\n },\n }).at({\n at: ctx.at,\n data: {\n path: ctx.path,\n },\n });\n }\n\n const { status, statusText, error } = httpError;\n const message = error?.message ?? statusText ?? \"OpenAI request failed\";\n const code = String(error?.code ?? error?.type ?? status);\n\n return BetterAgentError.fromCode(\"UPSTREAM_FAILED\", message, {\n status,\n context: {\n provider: \"openai\",\n upstreamCode: code,\n raw: error,\n },\n }).at({\n at: ctx.at,\n data: {\n path: ctx.path,\n status,\n },\n });\n};\n","export const unwrapOpenAIStreamJson = (parsed: unknown): unknown => {\n if (!parsed || typeof parsed !== \"object\") return parsed;\n const obj = parsed;\n\n if (\"data\" in obj) return obj.data;\n if (\"value\" in obj) return obj.value;\n return obj;\n};\n","import { BetterAgentError } from \"@better-agent/shared/errors\";\nimport { type Result, err, ok } from \"@better-agent/shared/neverthrow\";\nimport { safeJsonParse } from \"@better-agent/shared/utils\";\nimport { baFetch } from \"../../utils/fetch\";\nimport type { OpenAICreateSpeechRequest } from \"../audio-speech/schemas\";\nimport type {\n OpenAICreateTranscriptionRequest,\n OpenAICreateTranscriptionResponse,\n} from \"../audio-transcription/schemas\";\nimport type {\n OpenAICreateEmbeddingRequest,\n OpenAICreateEmbeddingResponse,\n} from \"../embeddings/schemas\";\nimport type {\n OpenAICreateImage,\n OpenAICreateImageSchema,\n OpenAIEditImageSchema,\n} from \"../images/schemas\";\nimport type {\n OpenAICreateResponse,\n OpenAICreateResponseSchema,\n OpenAIResponseStreamEvent,\n} from \"../responses/schemas\";\nimport type {\n OpenAIDeleteFileResponse,\n OpenAIFileList,\n OpenAIFileObject,\n OpenAIImageStreamEvent,\n OpenAISpeechStreamEvent,\n OpenAITranscriptionStreamEvent,\n} from \"../shared/schemas\";\nimport type { OpenAIConfig, OpenAIError, OpenAIFileUploadRequest } from \"../types\";\nimport type { OpenAICreateVideo, OpenAICreateVideoSchema } from \"../videos/schemas\";\nimport { buildOpenAIHeaders } from \"./auth\";\nimport { mapOpenAIHttpError } from \"./errors\";\nimport { unwrapOpenAIStreamJson } from \"./stream\";\n\ntype RequestOptions = {\n signal?: AbortSignal | null;\n};\n\nexport const createOpenAIClient = (config: OpenAIConfig = {}) => {\n const baseUrl = (\n config.baseURL ??\n (typeof process !== \"undefined\" ? process.env?.OPENAI_BASE_URL : undefined) ??\n \"https://api.openai.com\"\n ).replace(/\\/+$/, \"\");\n const headers = buildOpenAIHeaders(config);\n\n const post = async <TOutput>(\n path: string,\n body: unknown,\n at: string,\n options?: RequestOptions,\n ): Promise<Result<TOutput, BetterAgentError>> => {\n try {\n const isMultipart = typeof FormData !== \"undefined\" && body instanceof FormData;\n const postHeaders = isMultipart\n ? headers\n : {\n ...headers,\n \"Content-Type\": \"application/json\",\n };\n const result = await baFetch<TOutput, OpenAIError>(`${baseUrl}${path}`, {\n method: \"POST\",\n body: isMultipart ? body : JSON.stringify(body),\n headers: postHeaders,\n signal: options?.signal ?? null,\n throw: false,\n });\n\n if (result.error) {\n return err(\n mapOpenAIHttpError(result.error, {\n at,\n path,\n }).at({\n at,\n data: {\n path,\n },\n }),\n );\n }\n\n if (!result.data) {\n return err(\n BetterAgentError.fromCode(\"UPSTREAM_FAILED\", \"OpenAI returned no data\", {\n context: {\n provider: \"openai\",\n },\n })\n .at({\n at,\n data: {\n path,\n },\n })\n .at({\n at: \"openai.http.post.noData\",\n data: {\n path,\n },\n }),\n );\n }\n\n return ok(result.data);\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"OpenAI request failed\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n context: {\n provider: \"openai\",\n },\n },\n })\n .at({\n at,\n data: {\n path,\n },\n })\n .at({\n at: \"openai.http.post.exception\",\n data: {\n path,\n },\n }),\n );\n }\n };\n\n const streamSSE = async <\n TEvent extends {\n type: string;\n },\n >(\n path: string,\n body: unknown,\n at: string,\n options?: RequestOptions,\n ): Promise<Result<AsyncGenerator<Result<TEvent, BetterAgentError>>, BetterAgentError>> => {\n let response: Response;\n const isMultipart = typeof FormData !== \"undefined\" && body instanceof FormData;\n const streamHeaders: Record<string, string> = {\n ...headers,\n Accept: \"text/event-stream\",\n };\n if (!isMultipart) {\n streamHeaders[\"Content-Type\"] = \"application/json\";\n }\n\n try {\n response = await fetch(`${baseUrl}${path}`, {\n method: \"POST\",\n headers: streamHeaders,\n body: isMultipart ? (body as FormData) : JSON.stringify(body),\n signal: options?.signal ?? null,\n });\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"OpenAI stream request failed\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n context: {\n provider: \"openai\",\n },\n },\n })\n .at({\n at,\n data: {\n path,\n },\n })\n .at({\n at: \"openai.http.stream.fetch\",\n data: {\n path,\n },\n }),\n );\n }\n\n if (!response.ok || !response.body) {\n let openaiError: OpenAIError | undefined;\n try {\n openaiError = (await response.json()) as OpenAIError;\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"OpenAI stream returned non-OK response\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n status: response.status,\n context: {\n provider: \"openai\",\n upstreamCode: String(response.status),\n },\n },\n })\n .at({\n at,\n data: {\n path,\n status: response.status,\n },\n })\n .at({\n at: \"openai.http.stream.notOk\",\n data: {\n path,\n },\n }),\n );\n }\n\n return err(\n mapOpenAIHttpError(\n {\n status: response.status,\n statusText: response.statusText,\n error: openaiError?.error,\n },\n {\n at: \"openai.http.stream.notOk\",\n path,\n },\n ).at({\n at,\n data: {\n path,\n },\n }),\n );\n }\n\n const streamBody = response.body;\n\n const stream = async function* (): AsyncGenerator<Result<TEvent, BetterAgentError>> {\n try {\n const reader = streamBody.getReader();\n const decoder = new TextDecoder(\"utf-8\");\n let buffer = \"\";\n while (true) {\n const { value, done } = await reader.read();\n if (done) {\n buffer += decoder.decode();\n buffer = buffer.replace(/\\r\\n/g, \"\\n\");\n break;\n }\n\n buffer += decoder.decode(value, {\n stream: true,\n });\n buffer = buffer.replace(/\\r\\n/g, \"\\n\");\n\n let separatorIndex = buffer.indexOf(\"\\n\\n\");\n while (separatorIndex !== -1) {\n const rawEvent = buffer.slice(0, separatorIndex);\n buffer = buffer.slice(separatorIndex + 2);\n\n const eventType = rawEvent\n .split(\"\\n\")\n .find((line) => line.startsWith(\"event:\"))\n ?.replace(/^event:\\s*/, \"\")\n .trim();\n\n const dataPayload = rawEvent\n .split(\"\\n\")\n .filter((line) => line.startsWith(\"data:\"))\n .map((line) => line.replace(/^data:\\s*/, \"\"))\n .join(\"\\n\")\n .trim();\n\n if (!dataPayload) {\n separatorIndex = buffer.indexOf(\"\\n\\n\");\n continue;\n }\n\n if (dataPayload === \"[DONE]\") {\n return;\n }\n\n const parsed = safeJsonParse(dataPayload);\n let payload = unwrapOpenAIStreamJson(parsed);\n if (\n payload &&\n typeof payload === \"object\" &&\n !(\"type\" in payload) &&\n eventType\n ) {\n payload = {\n type: eventType,\n ...payload,\n };\n } else if ((!payload || typeof payload !== \"object\") && eventType) {\n payload = {\n type: eventType,\n };\n }\n\n if (payload && typeof payload === \"object\" && \"type\" in payload) {\n yield ok(payload as TEvent);\n }\n\n separatorIndex = buffer.indexOf(\"\\n\\n\");\n }\n }\n\n if (buffer.trim().length > 0) {\n const eventType = buffer\n .split(\"\\n\")\n .find((line) => line.startsWith(\"event:\"))\n ?.replace(/^event:\\s*/, \"\")\n .trim();\n const dataPayload = buffer\n .split(\"\\n\")\n .filter((line) => line.startsWith(\"data:\"))\n .map((line) => line.replace(/^data:\\s*/, \"\"))\n .join(\"\\n\")\n .trim();\n\n if (dataPayload && dataPayload !== \"[DONE]\") {\n const parsed = safeJsonParse(dataPayload);\n let payload = unwrapOpenAIStreamJson(parsed);\n if (\n payload &&\n typeof payload === \"object\" &&\n !(\"type\" in payload) &&\n eventType\n ) {\n payload = {\n type: eventType,\n ...payload,\n };\n } else if ((!payload || typeof payload !== \"object\") && eventType) {\n payload = {\n type: eventType,\n };\n }\n\n if (payload && typeof payload === \"object\" && \"type\" in payload) {\n yield ok(payload as TEvent);\n }\n }\n }\n } catch (e) {\n yield err(\n BetterAgentError.wrap({\n err: e,\n message: \"OpenAI stream decode failed\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n context: {\n provider: \"openai\",\n },\n },\n })\n .at({\n at,\n data: {\n path,\n },\n })\n .at({\n at: \"openai.http.stream.decode\",\n data: {\n path,\n },\n }),\n );\n return;\n }\n };\n\n return ok(stream());\n };\n\n const streamBinary = async (\n path: string,\n body: unknown,\n at: string,\n options?: RequestOptions,\n ): Promise<Result<AsyncGenerator<Result<Uint8Array, BetterAgentError>>, BetterAgentError>> => {\n let response: Response;\n\n try {\n response = await fetch(`${baseUrl}${path}`, {\n method: \"POST\",\n headers: {\n ...headers,\n Accept: \"application/octet-stream\",\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(body),\n signal: options?.signal ?? null,\n });\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"OpenAI stream request failed\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n context: {\n provider: \"openai\",\n },\n },\n })\n .at({\n at,\n data: {\n path,\n },\n })\n .at({\n at: \"openai.http.stream.fetch\",\n data: {\n path,\n },\n }),\n );\n }\n\n if (!response.ok || !response.body) {\n let openaiError: OpenAIError | undefined;\n try {\n openaiError = (await response.json()) as OpenAIError;\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"OpenAI stream returned non-OK response\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n status: response.status,\n context: {\n provider: \"openai\",\n upstreamCode: String(response.status),\n },\n },\n })\n .at({\n at,\n data: {\n path,\n status: response.status,\n },\n })\n .at({\n at: \"openai.http.stream.notOk\",\n data: {\n path,\n },\n }),\n );\n }\n\n return err(\n mapOpenAIHttpError(\n {\n status: response.status,\n statusText: response.statusText,\n error: openaiError?.error,\n },\n {\n at: \"openai.http.stream.notOk\",\n path,\n },\n ).at({\n at,\n data: {\n path,\n },\n }),\n );\n }\n\n const streamBody = response.body;\n\n const stream = async function* (): AsyncGenerator<Result<Uint8Array, BetterAgentError>> {\n try {\n const reader = streamBody.getReader();\n\n while (true) {\n const { value, done } = await reader.read();\n if (done) return;\n if (value) yield ok(value);\n }\n } catch (e) {\n yield err(\n BetterAgentError.wrap({\n err: e,\n message: \"OpenAI stream decode failed\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n context: {\n provider: \"openai\",\n },\n },\n })\n .at({\n at,\n data: {\n path,\n },\n })\n .at({\n at: \"openai.http.stream.decode\",\n data: {\n path,\n },\n }),\n );\n return;\n }\n };\n\n return ok(stream());\n };\n\n const buildTranscriptionFormData = (\n body: OpenAICreateTranscriptionRequest,\n path: string,\n ): Result<FormData, BetterAgentError> => {\n const formData = new FormData();\n\n let audioBlob: Blob;\n if (body.file.startsWith(\"data:\")) {\n const matches = body.file.match(/^data:([^;]+);base64,(.+)$/);\n if (!matches || !matches[1] || !matches[2]) {\n return err(\n BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n \"Invalid data URL format for audio file\",\n {\n context: {\n provider: \"openai\",\n },\n },\n ).at({\n at: \"openai.audio.transcriptions.invalidDataUrl\",\n data: {\n path,\n },\n }),\n );\n }\n const mimeType = matches[1];\n const base64Data = matches[2];\n const binaryString = atob(base64Data);\n const bytes = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n audioBlob = new Blob([bytes], {\n type: mimeType,\n });\n } else {\n const binaryString = atob(body.file);\n const bytes = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n audioBlob = new Blob([bytes], {\n type: \"audio/mpeg\",\n });\n }\n\n formData.append(\"file\", audioBlob, \"audio.mp3\");\n\n formData.append(\"model\", body.model);\n\n if (body.language) formData.append(\"language\", body.language);\n if (body.prompt) formData.append(\"prompt\", body.prompt);\n if (body.response_format) formData.append(\"response_format\", body.response_format);\n if (body.temperature !== undefined)\n formData.append(\"temperature\", String(body.temperature));\n if (body.timestamp_granularities) {\n for (const tg of body.timestamp_granularities) {\n formData.append(\"timestamp_granularities[]\", tg);\n }\n }\n if (body.include) {\n for (const include of body.include) {\n formData.append(\"include[]\", include);\n }\n }\n if (body.stream !== undefined) {\n formData.append(\"stream\", String(body.stream));\n }\n if (body.chunking_strategy) {\n formData.append(\"chunking_strategy\", JSON.stringify(body.chunking_strategy));\n }\n\n return ok(formData);\n };\n\n const files = {\n upload: async (\n body: OpenAIFileUploadRequest,\n options?: RequestOptions,\n ): Promise<Result<OpenAIFileObject, BetterAgentError>> => {\n const path = \"/v1/files\";\n try {\n const formData = new FormData();\n const filename =\n body.filename ??\n (typeof File !== \"undefined\" && body.file instanceof File\n ? body.file.name\n : \"file\");\n const blob =\n body.file instanceof Blob\n ? body.file\n : new Blob([new Uint8Array(body.file)], {\n type: body.mimeType ?? \"application/octet-stream\",\n });\n\n formData.append(\"purpose\", body.purpose ?? \"assistants\");\n formData.append(\"file\", blob, filename);\n const response = await fetch(`${baseUrl}${path}`, {\n method: \"POST\",\n body: formData,\n headers,\n signal: options?.signal ?? null,\n });\n\n if (!response.ok) {\n let openaiError: OpenAIError | undefined;\n try {\n openaiError = (await response.json()) as OpenAIError;\n } catch (_e) {\n return err(\n BetterAgentError.fromCode(\n \"UPSTREAM_FAILED\",\n \"OpenAI file upload request failed\",\n {\n status: response.status,\n context: {\n provider: \"openai\",\n upstreamCode: String(response.status),\n },\n },\n ).at({\n at: \"openai.files.upload\",\n data: {\n path,\n },\n }),\n );\n }\n\n return err(\n mapOpenAIHttpError(\n {\n status: response.status,\n statusText: response.statusText,\n error: openaiError?.error,\n },\n { at: \"openai.files.upload\", path },\n ),\n );\n }\n\n return ok((await response.json()) as OpenAIFileObject);\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"Failed to prepare OpenAI file upload request\",\n opts: {\n code: \"INTERNAL\",\n context: {\n provider: \"openai\",\n },\n },\n }).at({\n at: \"openai.files.upload.prepare\",\n data: {\n path,\n },\n }),\n );\n }\n },\n list: async (\n options?: RequestOptions,\n ): Promise<Result<OpenAIFileList, BetterAgentError>> => {\n const path = \"/v1/files\";\n try {\n const response = await fetch(`${baseUrl}${path}`, {\n method: \"GET\",\n headers,\n signal: options?.signal ?? null,\n });\n\n if (!response.ok) {\n let openaiError: OpenAIError | undefined;\n try {\n openaiError = (await response.json()) as OpenAIError;\n } catch (_e) {\n return err(\n BetterAgentError.fromCode(\n \"UPSTREAM_FAILED\",\n \"OpenAI files list request failed\",\n {\n status: response.status,\n context: {\n provider: \"openai\",\n upstreamCode: String(response.status),\n },\n },\n ).at({\n at: \"openai.files.list\",\n data: {\n path,\n },\n }),\n );\n }\n\n return err(\n mapOpenAIHttpError(\n {\n status: response.status,\n statusText: response.statusText,\n error: openaiError?.error,\n },\n { at: \"openai.files.list\", path },\n ),\n );\n }\n\n return ok((await response.json()) as OpenAIFileList);\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"OpenAI files list request failed\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n context: {\n provider: \"openai\",\n },\n },\n }).at({\n at: \"openai.files.list\",\n data: {\n path,\n },\n }),\n );\n }\n },\n retrieve: async (\n fileId: string,\n options?: RequestOptions,\n ): Promise<Result<OpenAIFileObject, BetterAgentError>> => {\n const path = `/v1/files/${encodeURIComponent(fileId)}`;\n try {\n const response = await fetch(`${baseUrl}${path}`, {\n method: \"GET\",\n headers,\n signal: options?.signal ?? null,\n });\n\n if (!response.ok) {\n let openaiError: OpenAIError | undefined;\n try {\n openaiError = (await response.json()) as OpenAIError;\n } catch (_e) {\n return err(\n BetterAgentError.fromCode(\n \"UPSTREAM_FAILED\",\n \"OpenAI file retrieval request failed\",\n {\n status: response.status,\n context: {\n provider: \"openai\",\n upstreamCode: String(response.status),\n },\n },\n ).at({\n at: \"openai.files.retrieve\",\n data: {\n path,\n },\n }),\n );\n }\n\n return err(\n mapOpenAIHttpError(\n {\n status: response.status,\n statusText: response.statusText,\n error: openaiError?.error,\n },\n { at: \"openai.files.retrieve\", path },\n ),\n );\n }\n\n return ok((await response.json()) as OpenAIFileObject);\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"OpenAI file retrieval request failed\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n context: {\n provider: \"openai\",\n },\n },\n }).at({\n at: \"openai.files.retrieve\",\n data: {\n path,\n },\n }),\n );\n }\n },\n delete: async (\n fileId: string,\n options?: RequestOptions,\n ): Promise<Result<OpenAIDeleteFileResponse, BetterAgentError>> => {\n const path = `/v1/files/${encodeURIComponent(fileId)}`;\n try {\n const response = await fetch(`${baseUrl}${path}`, {\n method: \"DELETE\",\n headers,\n signal: options?.signal ?? null,\n });\n\n if (!response.ok) {\n let openaiError: OpenAIError | undefined;\n try {\n openaiError = (await response.json()) as OpenAIError;\n } catch (_e) {\n return err(\n BetterAgentError.fromCode(\n \"UPSTREAM_FAILED\",\n \"OpenAI file delete request failed\",\n {\n status: response.status,\n context: {\n provider: \"openai\",\n upstreamCode: String(response.status),\n },\n },\n ).at({\n at: \"openai.files.delete\",\n data: {\n path,\n },\n }),\n );\n }\n\n return err(\n mapOpenAIHttpError(\n {\n status: response.status,\n statusText: response.statusText,\n error: openaiError?.error,\n },\n { at: \"openai.files.delete\", path },\n ),\n );\n }\n\n return ok((await response.json()) as OpenAIDeleteFileResponse);\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"OpenAI file delete request failed\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n context: {\n provider: \"openai\",\n },\n },\n }).at({\n at: \"openai.files.delete\",\n data: {\n path,\n },\n }),\n );\n }\n },\n content: async (\n fileId: string,\n options?: RequestOptions,\n ): Promise<Result<{ data: ArrayBuffer; mimeType: string }, BetterAgentError>> => {\n const path = `/v1/files/${encodeURIComponent(fileId)}/content`;\n\n try {\n const response = await fetch(`${baseUrl}${path}`, {\n method: \"GET\",\n headers,\n signal: options?.signal ?? null,\n });\n\n if (!response.ok) {\n let openaiError: OpenAIError | undefined;\n try {\n openaiError = (await response.json()) as OpenAIError;\n } catch (_e) {\n return err(\n BetterAgentError.fromCode(\n \"UPSTREAM_FAILED\",\n \"OpenAI file content retrieval request failed\",\n {\n status: response.status,\n context: {\n provider: \"openai\",\n upstreamCode: String(response.status),\n },\n },\n ).at({\n at: \"openai.files.content\",\n data: {\n path,\n },\n }),\n );\n }\n\n return err(\n mapOpenAIHttpError(\n {\n status: response.status,\n statusText: response.statusText,\n error: openaiError?.error,\n },\n { at: \"openai.files.content\", path },\n ),\n );\n }\n\n const mimeType = response.headers.get(\"content-type\") ?? \"application/octet-stream\";\n const data = await response.arrayBuffer();\n return ok({ data, mimeType });\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"OpenAI file content retrieval request failed\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n context: {\n provider: \"openai\",\n },\n },\n }).at({\n at: \"openai.files.content\",\n data: {\n path,\n },\n }),\n );\n }\n },\n };\n\n const responses = {\n create: async (\n body: OpenAICreateResponseSchema,\n options?: RequestOptions,\n ): Promise<Result<OpenAICreateResponse, BetterAgentError>> => {\n const path = \"/v1/responses\";\n const r = await post<OpenAICreateResponse>(\n path,\n body,\n \"openai.http.responses.create\",\n options,\n );\n return r.mapErr((e) =>\n e.at({\n at: \"openai.responses.create\",\n data: {\n path,\n },\n }),\n );\n },\n\n stream: async (\n body: OpenAICreateResponseSchema,\n options?: RequestOptions,\n ): Promise<\n Result<\n AsyncGenerator<Result<OpenAIResponseStreamEvent, BetterAgentError>>,\n BetterAgentError\n >\n > => {\n const path = \"/v1/responses\";\n\n const requestBody = {\n ...body,\n stream: true,\n stream_options: body.stream_options,\n };\n\n const r = await streamSSE<OpenAIResponseStreamEvent>(\n path,\n requestBody,\n \"openai.http.responses.stream\",\n options,\n );\n\n return r.mapErr((e) =>\n e.at({\n at: \"openai.responses.stream\",\n data: {\n path,\n },\n }),\n );\n },\n };\n\n const images = {\n create: async (\n body: OpenAICreateImageSchema,\n options?: RequestOptions,\n ): Promise<Result<OpenAICreateImage, BetterAgentError>> => {\n const path = \"/v1/images/generations\";\n const r = await post<OpenAICreateImage>(\n path,\n body,\n \"openai.http.images.create\",\n options,\n );\n return r.mapErr((e) =>\n e.at({\n at: \"openai.images.create\",\n data: {\n path,\n },\n }),\n );\n },\n\n edit: async (\n body: OpenAIEditImageSchema,\n options?: RequestOptions,\n ): Promise<Result<OpenAICreateImage, BetterAgentError>> => {\n const path = \"/v1/images/edits\";\n const r = await post<OpenAICreateImage>(path, body, \"openai.http.images.edit\", options);\n return r.mapErr((e) =>\n e.at({\n at: \"openai.images.edit\",\n data: {\n path,\n },\n }),\n );\n },\n\n stream: async (\n body: OpenAICreateImageSchema,\n options?: RequestOptions,\n ): Promise<\n Result<\n AsyncGenerator<Result<OpenAIImageStreamEvent, BetterAgentError>>,\n BetterAgentError\n >\n > => {\n const path = \"/v1/images/generations\";\n\n const requestBody = {\n ...body,\n stream: true,\n };\n\n const r = await streamSSE<OpenAIImageStreamEvent>(\n path,\n requestBody,\n \"openai.http.images.stream\",\n options,\n );\n\n return r.mapErr((e) =>\n e.at({\n at: \"openai.images.stream\",\n data: {\n path,\n },\n }),\n );\n },\n\n streamEdit: async (\n body: OpenAIEditImageSchema,\n options?: RequestOptions,\n ): Promise<\n Result<\n AsyncGenerator<Result<OpenAIImageStreamEvent, BetterAgentError>>,\n BetterAgentError\n >\n > => {\n const path = \"/v1/images/edits\";\n\n const requestBody = {\n ...body,\n stream: true,\n };\n\n const r = await streamSSE<OpenAIImageStreamEvent>(\n path,\n requestBody,\n \"openai.http.images.streamEdit\",\n options,\n );\n\n return r.mapErr((e) =>\n e.at({\n at: \"openai.images.streamEdit\",\n data: {\n path,\n },\n }),\n );\n },\n };\n\n const videos = {\n create: async (\n body: OpenAICreateVideoSchema,\n options?: RequestOptions,\n ): Promise<Result<OpenAICreateVideo, BetterAgentError>> => {\n const path = \"/v1/videos\";\n const r = await post<OpenAICreateVideo>(\n path,\n body,\n \"openai.http.videos.create\",\n options,\n );\n return r.mapErr((e) =>\n e.at({\n at: \"openai.videos.create\",\n data: {\n path,\n },\n }),\n );\n },\n\n get: async (\n videoId: string,\n options?: RequestOptions,\n ): Promise<Result<OpenAICreateVideo, BetterAgentError>> => {\n const path = `/v1/videos/${encodeURIComponent(videoId)}`;\n\n try {\n const response = await fetch(`${baseUrl}${path}`, {\n method: \"GET\",\n headers,\n signal: options?.signal ?? null,\n });\n\n if (!response.ok) {\n let openaiError: OpenAIError | undefined;\n try {\n openaiError = (await response.json()) as OpenAIError;\n } catch (_e) {\n return err(\n BetterAgentError.fromCode(\n \"UPSTREAM_FAILED\",\n \"OpenAI video retrieval request failed\",\n {\n status: response.status,\n context: {\n provider: \"openai\",\n upstreamCode: String(response.status),\n },\n },\n ).at({\n at: \"openai.http.videos.get\",\n data: {\n path,\n },\n }),\n );\n }\n\n return err(\n mapOpenAIHttpError(\n {\n status: response.status,\n statusText: response.statusText,\n error: openaiError?.error,\n },\n {\n at: \"openai.http.videos.get\",\n path,\n },\n ),\n );\n }\n\n return ok((await response.json()) as OpenAICreateVideo);\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"OpenAI video retrieval request failed\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n context: {\n provider: \"openai\",\n },\n },\n }).at({\n at: \"openai.http.videos.get\",\n data: {\n path,\n },\n }),\n );\n }\n },\n\n content: async (\n videoId: string,\n options?: RequestOptions,\n ): Promise<Result<{ data: ArrayBuffer; mimeType: string }, BetterAgentError>> => {\n const path = `/v1/videos/${encodeURIComponent(videoId)}/content`;\n\n try {\n const response = await fetch(`${baseUrl}${path}`, {\n method: \"GET\",\n headers,\n signal: options?.signal ?? null,\n });\n\n if (!response.ok) {\n let openaiError: OpenAIError | undefined;\n try {\n openaiError = (await response.json()) as OpenAIError;\n } catch (_e) {\n return err(\n BetterAgentError.fromCode(\n \"UPSTREAM_FAILED\",\n \"OpenAI video content retrieval request failed\",\n {\n status: response.status,\n context: {\n provider: \"openai\",\n upstreamCode: String(response.status),\n },\n },\n ).at({\n at: \"openai.http.videos.content\",\n data: {\n path,\n },\n }),\n );\n }\n\n return err(\n mapOpenAIHttpError(\n {\n status: response.status,\n statusText: response.statusText,\n error: openaiError?.error,\n },\n {\n at: \"openai.http.videos.content\",\n path,\n },\n ),\n );\n }\n\n const contentType = response.headers.get(\"content-type\") ?? \"video/mp4\";\n const data = await response.arrayBuffer();\n\n return ok({\n data,\n mimeType: contentType,\n });\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"OpenAI video content retrieval request failed\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n context: {\n provider: \"openai\",\n },\n },\n }).at({\n at: \"openai.http.videos.content\",\n data: {\n path,\n },\n }),\n );\n }\n },\n };\n\n const audio = {\n speech: async (\n body: OpenAICreateSpeechRequest,\n options?: RequestOptions,\n ): Promise<Result<ArrayBuffer, BetterAgentError>> => {\n const path = \"/v1/audio/speech\";\n try {\n const response = await fetch(`${baseUrl}${path}`, {\n method: \"POST\",\n body: JSON.stringify(body),\n headers: {\n ...headers,\n \"Content-Type\": \"application/json\",\n },\n signal: options?.signal ?? null,\n });\n\n if (!response.ok) {\n let openaiError: OpenAIError | undefined;\n try {\n openaiError = (await response.json()) as OpenAIError;\n } catch (_e) {\n return err(\n BetterAgentError.fromCode(\n \"UPSTREAM_FAILED\",\n \"OpenAI audio speech request failed\",\n {\n status: response.status,\n context: {\n provider: \"openai\",\n upstreamCode: String(response.status),\n },\n },\n ).at({\n at: \"openai.http.audio.speech\",\n data: {\n path,\n },\n }),\n );\n }\n\n return err(\n mapOpenAIHttpError(\n {\n status: response.status,\n statusText: response.statusText,\n error: openaiError?.error,\n },\n {\n at: \"openai.http.audio.speech\",\n path,\n },\n ),\n );\n }\n\n const audioData = await response.arrayBuffer();\n return ok(audioData);\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"OpenAI audio speech request failed\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n context: {\n provider: \"openai\",\n },\n },\n }).at({\n at: \"openai.http.audio.speech\",\n data: {\n path,\n },\n }),\n );\n }\n },\n speechStream: async (\n body: OpenAICreateSpeechRequest,\n options?: RequestOptions,\n ): Promise<\n Result<\n AsyncGenerator<Result<OpenAISpeechStreamEvent, BetterAgentError>>,\n BetterAgentError\n >\n > => {\n const path = \"/v1/audio/speech\";\n const r = await streamSSE<OpenAISpeechStreamEvent>(\n path,\n body,\n \"openai.http.audio.speech.stream\",\n options,\n );\n return r.mapErr((e) =>\n e.at({\n at: \"openai.audio.speech.stream\",\n data: {\n path,\n },\n }),\n );\n },\n speechStreamAudio: async (\n body: OpenAICreateSpeechRequest,\n options?: RequestOptions,\n ): Promise<\n Result<AsyncGenerator<Result<Uint8Array, BetterAgentError>>, BetterAgentError>\n > => {\n const path = \"/v1/audio/speech\";\n const r = await streamBinary(path, body, \"openai.http.audio.speech.stream\", options);\n return r.mapErr((e) =>\n e.at({\n at: \"openai.audio.speech.stream\",\n data: {\n path,\n },\n }),\n );\n },\n\n transcriptions: async (\n body: OpenAICreateTranscriptionRequest,\n options?: RequestOptions,\n ): Promise<Result<OpenAICreateTranscriptionResponse, BetterAgentError>> => {\n const path = \"/v1/audio/transcriptions\";\n\n try {\n const formData = buildTranscriptionFormData(body, path);\n if (formData.isErr()) return err(formData.error);\n\n const r = await post<OpenAICreateTranscriptionResponse>(\n path,\n formData.value,\n \"openai.http.audio.transcriptions\",\n options,\n );\n\n return r.mapErr((e) =>\n e.at({\n at: \"openai.audio.transcriptions\",\n data: {\n path,\n },\n }),\n );\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"Failed to prepare audio transcription request\",\n opts: {\n code: \"INTERNAL\",\n context: {\n provider: \"openai\",\n },\n },\n }).at({\n at: \"openai.audio.transcriptions.prepare\",\n data: {\n path,\n },\n }),\n );\n }\n },\n transcriptionsStream: async (\n body: OpenAICreateTranscriptionRequest,\n options?: RequestOptions,\n ): Promise<\n Result<\n AsyncGenerator<Result<OpenAITranscriptionStreamEvent, BetterAgentError>>,\n BetterAgentError\n >\n > => {\n const path = \"/v1/audio/transcriptions\";\n try {\n const formData = buildTranscriptionFormData(body, path);\n if (formData.isErr()) return err(formData.error);\n const r = await streamSSE<OpenAITranscriptionStreamEvent>(\n path,\n formData.value,\n \"openai.http.audio.transcriptions.stream\",\n options,\n );\n return r.mapErr((e) =>\n e.at({\n at: \"openai.audio.transcriptions.stream\",\n data: {\n path,\n },\n }),\n );\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"Failed to prepare audio transcription stream request\",\n opts: {\n code: \"INTERNAL\",\n context: {\n provider: \"openai\",\n },\n },\n }).at({\n at: \"openai.audio.transcriptions.stream.prepare\",\n data: {\n path,\n },\n }),\n );\n }\n },\n };\n\n const embeddings = {\n create: async (\n body: OpenAICreateEmbeddingRequest,\n options?: RequestOptions,\n ): Promise<Result<OpenAICreateEmbeddingResponse, BetterAgentError>> => {\n const path = \"/v1/embeddings\";\n const r = await post<OpenAICreateEmbeddingResponse>(\n path,\n body,\n \"openai.http.embeddings.create\",\n options,\n );\n return r.mapErr((e) =>\n e.at({\n at: \"openai.embeddings.create\",\n data: {\n path,\n },\n }),\n );\n },\n };\n\n return {\n post,\n responses,\n images,\n videos,\n audio,\n embeddings,\n files,\n };\n};\n","import { Events } from \"@better-agent/core/events\";\nimport type { Event } from \"@better-agent/core/events\";\nimport type {\n GenerativeModelCallOptions,\n GenerativeModelOutputItem,\n GenerativeModelResponse,\n GenerativeModelUsage,\n ModalitiesParam,\n} from \"@better-agent/core/providers\";\nimport { BetterAgentError } from \"@better-agent/shared/errors\";\nimport type { Result } from \"@better-agent/shared/neverthrow\";\nimport { err, ok } from \"@better-agent/shared/neverthrow\";\nimport { extractPassthroughOptions, omitNullish } from \"../../utils/object-utils\";\nimport type { OpenAISpeechStreamEvent } from \"../shared/schemas\";\nimport type { OpenAICapsFor, OpenAIOptionsFor } from \"../types\";\nimport type { OpenAIAudioSpeechModels, OpenAICreateSpeechRequest } from \"./schemas\";\nimport type { OpenAIAudioSpeechEndpointOptions } from \"./types\";\n\n/**\n * Keys explicitly handled by the OpenAI audio speech mapper.\n */\nconst OPENAI_AUDIO_SPEECH_KNOWN_KEYS: ReadonlySet<string> = new Set([\n // Framework-managed\n \"input\",\n \"tools\",\n \"toolChoice\",\n \"modalities\",\n \"structured_output\",\n // Explicitly mapped\n \"instructions\",\n \"voice\",\n \"response_format\",\n \"speed\",\n \"stream_format\",\n]);\n\nconst mapOpenAIUsage = (usage?: {\n input_tokens?: number;\n output_tokens?: number;\n total_tokens?: number;\n}): GenerativeModelUsage =>\n omitNullish({\n inputTokens: usage?.input_tokens,\n outputTokens: usage?.output_tokens,\n totalTokens: usage?.total_tokens,\n });\n\nexport function mapToOpenAIAudioSpeechRequest<\n M extends OpenAIAudioSpeechModels,\n TModalities extends ModalitiesParam<OpenAICapsFor<M>> = undefined,\n>(args: {\n modelId: M;\n options: GenerativeModelCallOptions<OpenAICapsFor<M>, OpenAIOptionsFor<M>, TModalities>;\n}): Result<OpenAICreateSpeechRequest, BetterAgentError> {\n try {\n const o = args.options;\n const raw = o as unknown as OpenAIAudioSpeechEndpointOptions;\n\n const input =\n typeof o.input === \"string\"\n ? o.input\n : Array.isArray(o.input) &&\n o.input.length === 1 &&\n o.input[0]?.type === \"message\" &&\n typeof o.input[0].content === \"string\"\n ? o.input[0].content\n : undefined;\n\n if (typeof input !== \"string\" || !input) {\n return err(\n BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n \"Audio speech generation requires a text input\",\n { context: { provider: \"openai\", model: args.modelId } },\n ).at({\n at: \"openai.audio.speech.map.inputMissing\",\n }),\n );\n }\n\n const voice = o.voice ?? \"alloy\";\n\n return ok({\n ...extractPassthroughOptions(\n o as Record<string, unknown>,\n OPENAI_AUDIO_SPEECH_KNOWN_KEYS,\n ),\n model: args.modelId,\n input,\n voice,\n response_format: o.response_format,\n speed: o.speed,\n instructions: raw.instructions,\n stream_format: o.stream_format,\n });\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"Failed to map OpenAI Audio Speech request\",\n opts: { code: \"INTERNAL\", context: { provider: \"openai\", model: args.modelId } },\n }).at({\n at: \"openai.audio.speech.mapToRequest\",\n }),\n );\n }\n}\n\nexport function mapFromOpenAIAudioSpeechResponse(\n raw: ArrayBuffer,\n responseFormat?: string,\n): GenerativeModelResponse {\n const base64 = Buffer.from(raw).toString(\"base64\");\n\n const toOpenAIAudioMimeType = (format?: string): string => {\n switch (format) {\n case \"mp3\":\n return \"audio/mpeg\";\n case \"wav\":\n return \"audio/wav\";\n case \"flac\":\n return \"audio/flac\";\n case \"aac\":\n return \"audio/aac\";\n case \"opus\":\n return \"audio/opus\";\n case \"pcm\":\n return \"audio/pcm\";\n default:\n return \"audio/mpeg\";\n }\n };\n\n const mimeType = toOpenAIAudioMimeType(responseFormat);\n\n const output: GenerativeModelOutputItem[] = [\n {\n type: \"message\",\n role: \"assistant\",\n content: [\n {\n type: \"audio\",\n source: {\n kind: \"base64\",\n data: base64,\n mimeType,\n },\n },\n ],\n },\n ];\n\n return {\n output,\n finishReason: \"stop\",\n usage: {},\n response: {\n body: {\n audioData: raw,\n },\n },\n };\n}\n\nexport function mapFromOpenAIAudioSpeechStreamEvent(\n event: OpenAISpeechStreamEvent,\n args: {\n messageId: string;\n mimeType: string;\n audioBase64?: string;\n },\n): Result<\n | {\n kind: \"event\";\n event: Event;\n }\n | {\n kind: \"final\";\n response: GenerativeModelResponse;\n }\n | null,\n BetterAgentError\n> {\n if (event.type === \"speech.audio.delta\") {\n return ok({\n kind: \"event\",\n event: {\n type: Events.AUDIO_MESSAGE_CONTENT,\n messageId: args.messageId,\n delta: {\n kind: \"base64\",\n data: event.audio,\n mimeType: args.mimeType,\n },\n timestamp: Date.now(),\n },\n });\n }\n\n if (event.type === \"speech.audio.done\") {\n const audioBase64 = args.audioBase64 ?? \"\";\n const response: GenerativeModelResponse = {\n output: [\n {\n type: \"message\",\n role: \"assistant\",\n content: [\n {\n type: \"audio\",\n source: {\n kind: \"base64\",\n data: audioBase64,\n mimeType: args.mimeType,\n },\n },\n ],\n },\n ],\n finishReason: \"stop\",\n usage: mapOpenAIUsage(event.usage),\n response: {\n body: {\n audio: audioBase64,\n usage: event.usage,\n },\n },\n };\n\n return ok({\n kind: \"final\",\n response,\n });\n }\n\n return ok(null);\n}\n","import type { RunContext } from \"@better-agent/core\";\nimport { Events } from \"@better-agent/core/events\";\nimport type { Event } from \"@better-agent/core/events\";\nimport type {\n GenerativeModelCallOptions,\n GenerativeModelResponse,\n ModalitiesParam,\n} from \"@better-agent/core/providers\";\nimport { BetterAgentError } from \"@better-agent/shared/errors\";\nimport { type Result, err, ok } from \"@better-agent/shared/neverthrow\";\nimport type { createOpenAIClient } from \"../client\";\nimport {\n OPENAI_AUDIO_SPEECH_CAPS,\n collectNonStreamOutputEvents,\n createDeferred,\n openaiUpstreamError,\n} from \"../shared/runtime\";\nimport type { OpenAISpeechStreamEvent } from \"../shared/schemas\";\nimport type { OpenAICapsFor, OpenAIGenerativeModel, OpenAIOptionsFor } from \"../types\";\nimport {\n mapFromOpenAIAudioSpeechResponse,\n mapFromOpenAIAudioSpeechStreamEvent,\n mapToOpenAIAudioSpeechRequest,\n} from \"./mappers\";\nimport type { OpenAIAudioSpeechModels } from \"./schemas\";\n\nexport const createOpenAIAudioSpeechModel = <M extends OpenAIAudioSpeechModels>(\n modelId: M,\n client: ReturnType<typeof createOpenAIClient>,\n): OpenAIGenerativeModel<M> => {\n const supportsSse = modelId === \"gpt-4o-mini-tts\";\n\n const doGenerate: NonNullable<OpenAIGenerativeModel<M>[\"doGenerate\"]> = async <\n TModalities extends ModalitiesParam<OpenAICapsFor<M>> = undefined,\n >(\n options: GenerativeModelCallOptions<OpenAICapsFor<M>, OpenAIOptionsFor<M>, TModalities>,\n ctx: RunContext,\n ) => {\n const requestBodyResult = mapToOpenAIAudioSpeechRequest({ modelId, options });\n if (requestBodyResult.isErr()) {\n return err(\n requestBodyResult.error.at({\n at: \"openai.generate.mapRequest\",\n data: {\n modelId,\n endpoint: \"audio.speech\",\n },\n }),\n );\n }\n\n const requestBody = requestBodyResult.value;\n\n const raw = await client.audio.speech(requestBody, { signal: ctx.signal ?? null });\n if (raw.isErr()) {\n return err(\n raw.error\n .at({ at: \"openai.generate.modelContext\", data: { model: String(modelId) } })\n .at({\n at: \"openai.generate.http\",\n data: {\n modelId,\n endpoint: \"audio.speech\",\n path: \"/v1/audio/speech\",\n },\n }),\n );\n }\n\n const response = mapFromOpenAIAudioSpeechResponse(raw.value, requestBody.response_format);\n return ok({\n response: {\n ...response,\n request: {\n body: requestBody,\n },\n } satisfies GenerativeModelResponse,\n events: collectNonStreamOutputEvents(response, ctx),\n });\n };\n\n const doGenerateStream: NonNullable<OpenAIGenerativeModel<M>[\"doGenerateStream\"]> = async <\n const TModalities extends ModalitiesParam<OpenAICapsFor<M>>,\n >(\n options: GenerativeModelCallOptions<OpenAICapsFor<M>, OpenAIOptionsFor<M>, TModalities>,\n ctx: RunContext,\n ) => {\n const requestBodyResult = mapToOpenAIAudioSpeechRequest({ modelId, options });\n if (requestBodyResult.isErr()) {\n return err(\n requestBodyResult.error.at({\n at: \"openai.generateStream.mapRequest\",\n data: {\n modelId,\n endpoint: \"audio.speech\",\n },\n }),\n );\n }\n\n const requestBody = {\n ...requestBodyResult.value,\n stream: true,\n stream_format: supportsSse ? (\"sse\" as const) : (\"audio\" as const),\n };\n\n const streamResult = supportsSse\n ? await client.audio.speechStream(requestBody, { signal: ctx.signal ?? null })\n : await client.audio.speechStreamAudio(requestBody, { signal: ctx.signal ?? null });\n if (streamResult.isErr()) {\n return err(\n streamResult.error\n .at({ at: \"openai.generate.modelContext\", data: { model: String(modelId) } })\n .at({\n at: \"openai.generateStream.http\",\n data: {\n modelId,\n endpoint: \"audio.speech\",\n path: \"/v1/audio/speech\",\n },\n }),\n );\n }\n\n const {\n promise: final,\n resolve: resolveFinal,\n reject: rejectFinal,\n } = createDeferred<GenerativeModelResponse>();\n\n const events = (async function* (): AsyncGenerator<Result<Event, BetterAgentError>> {\n const messageId = ctx.generateMessageId();\n\n const toAudioMimeType = (format?: string) => {\n switch (format) {\n case \"mp3\":\n return \"audio/mpeg\";\n case \"wav\":\n return \"audio/wav\";\n case \"flac\":\n return \"audio/flac\";\n case \"aac\":\n return \"audio/aac\";\n case \"opus\":\n return \"audio/opus\";\n case \"pcm\":\n return \"audio/pcm\";\n default:\n return \"audio/mpeg\";\n }\n };\n\n const mimeType = toAudioMimeType(requestBody.response_format);\n const chunks: Array<ReturnType<typeof Buffer.from>> = [];\n let started = false;\n let sawFinal = false;\n let finalResolved = false;\n\n try {\n if (supportsSse) {\n const sseStream = streamResult.value as AsyncGenerator<\n Result<OpenAISpeechStreamEvent, BetterAgentError>\n >;\n for await (const raw of sseStream) {\n if (raw.isErr()) {\n const appErr = BetterAgentError.wrap({\n err: raw.error,\n message: \"OpenAI stream chunk error\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n },\n }).at({\n at: \"openai.generateStream.chunk\",\n });\n\n yield err(appErr);\n rejectFinal(appErr);\n return;\n }\n\n if (raw.value.type === \"speech.audio.delta\") {\n chunks.push(Buffer.from(raw.value.audio, \"base64\"));\n }\n\n const audioBase64 =\n raw.value.type === \"speech.audio.done\"\n ? chunks.length\n ? Buffer.concat(chunks).toString(\"base64\")\n : \"\"\n : undefined;\n\n const mapped = mapFromOpenAIAudioSpeechStreamEvent(raw.value, {\n messageId,\n mimeType,\n ...(audioBase64 !== undefined ? { audioBase64 } : {}),\n });\n if (mapped.isErr()) {\n const appErr = mapped.error.at({\n at: \"openai.generateStream.mapEvent\",\n });\n\n yield err(appErr);\n rejectFinal(appErr);\n return;\n }\n\n const m = mapped.value;\n if (!m) continue;\n\n if (!started) {\n started = true;\n yield ok({\n type: Events.AUDIO_MESSAGE_START,\n messageId,\n role: \"assistant\",\n timestamp: Date.now(),\n });\n }\n\n if (m.kind === \"event\") {\n yield ok(m.event);\n continue;\n }\n\n sawFinal = true;\n resolveFinal({\n ...m.response,\n request: {\n body: requestBody,\n },\n });\n finalResolved = true;\n\n yield ok({\n type: Events.AUDIO_MESSAGE_END,\n messageId,\n timestamp: Date.now(),\n });\n\n return;\n }\n\n if (!sawFinal) {\n const missingFinal = openaiUpstreamError(\n \"Stream ended without speech.audio.done\",\n {\n provider: \"openai\",\n code: \"STREAM_MISSING_FINAL\",\n },\n ).at({\n at: \"openai.generateStream.missingFinal\",\n });\n\n yield err(missingFinal);\n rejectFinal(missingFinal);\n return;\n }\n } else {\n const audioStream = streamResult.value as AsyncGenerator<\n Result<Uint8Array, BetterAgentError>\n >;\n for await (const raw of audioStream) {\n if (raw.isErr()) {\n const appErr = BetterAgentError.wrap({\n err: raw.error,\n message: \"OpenAI stream chunk error\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n },\n }).at({\n at: \"openai.generateStream.chunk\",\n });\n\n yield err(appErr);\n rejectFinal(appErr);\n return;\n }\n\n if (!started) {\n started = true;\n yield ok({\n type: Events.AUDIO_MESSAGE_START,\n messageId,\n role: \"assistant\",\n timestamp: Date.now(),\n });\n }\n\n const chunk = raw.value;\n const base64 = Buffer.from(chunk).toString(\"base64\");\n chunks.push(Buffer.from(chunk));\n yield ok({\n type: Events.AUDIO_MESSAGE_CONTENT,\n messageId,\n delta: {\n kind: \"base64\",\n data: base64,\n mimeType,\n },\n timestamp: Date.now(),\n });\n }\n\n const audioBuffer = chunks.length ? Buffer.concat(chunks) : Buffer.alloc(0);\n const base64 = audioBuffer.toString(\"base64\");\n resolveFinal({\n output: [\n {\n type: \"message\",\n role: \"assistant\",\n content: [\n {\n type: \"audio\",\n source: {\n kind: \"base64\",\n data: base64,\n mimeType,\n },\n },\n ],\n },\n ],\n finishReason: \"stop\",\n usage: {},\n request: {\n body: requestBody,\n },\n response: {\n body: {\n audio: base64,\n },\n },\n });\n finalResolved = true;\n sawFinal = true;\n\n yield ok({\n type: Events.AUDIO_MESSAGE_END,\n messageId,\n timestamp: Date.now(),\n });\n }\n } catch (e) {\n const appErr = BetterAgentError.wrap({\n err: e,\n message: \"OpenAI audio speech streaming failed\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n context: { provider: \"openai\", model: String(modelId) },\n },\n }).at({\n at: \"openai.generateStream.generator\",\n });\n\n if (!finalResolved) {\n rejectFinal(appErr);\n }\n yield err(appErr);\n return;\n }\n })();\n\n return ok({\n events,\n final,\n });\n };\n\n return {\n providerId: \"openai\",\n modelId,\n caps: OPENAI_AUDIO_SPEECH_CAPS as OpenAICapsFor<M>,\n doGenerate,\n doGenerateStream,\n };\n};\n","import type {\n GenerativeModelCallOptions,\n GenerativeModelOutputItem,\n GenerativeModelResponse,\n ModalitiesParam,\n} from \"@better-agent/core/providers\";\nimport { BetterAgentError } from \"@better-agent/shared/errors\";\nimport type { Result } from \"@better-agent/shared/neverthrow\";\nimport { err, ok } from \"@better-agent/shared/neverthrow\";\nimport { extractPassthroughOptions } from \"../../utils/object-utils\";\nimport type { OpenAICapsFor, OpenAIOptionsFor } from \"../types\";\nimport type {\n OpenAICreateEmbeddingRequest,\n OpenAICreateEmbeddingResponse,\n OpenAIEmbeddingModels,\n} from \"./schemas\";\n\n/**\n * Keys explicitly handled by the OpenAI embedding mapper.\n */\nconst OPENAI_EMBEDDING_KNOWN_KEYS: ReadonlySet<string> = new Set([\n // Framework-managed\n \"input\",\n \"tools\",\n \"toolChoice\",\n \"modalities\",\n \"structured_output\",\n // Explicitly mapped\n \"encoding_format\",\n \"dimensions\",\n \"user\",\n]);\n\nexport function mapToOpenAIEmbeddingRequest<\n M extends OpenAIEmbeddingModels,\n TModalities extends ModalitiesParam<OpenAICapsFor<M>> = undefined,\n>(args: {\n modelId: M;\n options: GenerativeModelCallOptions<OpenAICapsFor<M>, OpenAIOptionsFor<M>, TModalities>;\n}): Result<OpenAICreateEmbeddingRequest, BetterAgentError> {\n try {\n const o = args.options;\n\n const input =\n typeof o.input === \"string\"\n ? o.input\n : Array.isArray(o.input) &&\n o.input.length === 1 &&\n o.input[0]?.type === \"message\" &&\n typeof o.input[0].content === \"string\"\n ? o.input[0].content\n : undefined;\n\n if (typeof input !== \"string\" || !input) {\n return err(\n BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n \"Embedding generation requires a text input\",\n { context: { provider: \"openai\", model: args.modelId } },\n ).at({\n at: \"openai.embedding.map.inputMissing\",\n }),\n );\n }\n\n return ok({\n ...extractPassthroughOptions(o as Record<string, unknown>, OPENAI_EMBEDDING_KNOWN_KEYS),\n model: args.modelId,\n input,\n encoding_format: o.encoding_format,\n dimensions: o.dimensions,\n user: o.user,\n });\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"Failed to map OpenAI Embedding request\",\n opts: { code: \"INTERNAL\", context: { provider: \"openai\", model: args.modelId } },\n }).at({\n at: \"openai.embedding.mapToRequest\",\n }),\n );\n }\n}\n\nexport function mapFromOpenAIEmbeddingResponse(\n raw: OpenAICreateEmbeddingResponse,\n): GenerativeModelResponse {\n const output: GenerativeModelOutputItem[] = raw.data.map((item) => ({\n type: \"message\",\n role: \"assistant\",\n content: [\n {\n type: \"embedding\",\n embedding: item.embedding,\n },\n ],\n }));\n\n return {\n output,\n finishReason: \"stop\",\n usage: {\n inputTokens: raw.usage?.prompt_tokens,\n totalTokens: raw.usage?.total_tokens,\n },\n response: {\n body: raw,\n },\n };\n}\n","import type { RunContext } from \"@better-agent/core\";\nimport type {\n GenerativeModelCallOptions,\n GenerativeModelResponse,\n ModalitiesParam,\n} from \"@better-agent/core/providers\";\nimport { err, ok } from \"@better-agent/shared/neverthrow\";\nimport type { createOpenAIClient } from \"../client\";\nimport { OPENAI_EMBEDDING_CAPS, collectNonStreamOutputEvents } from \"../shared/runtime\";\nimport type { OpenAICapsFor, OpenAIGenerativeModel, OpenAIOptionsFor } from \"../types\";\nimport { mapFromOpenAIEmbeddingResponse, mapToOpenAIEmbeddingRequest } from \"./mappers\";\nimport type { OpenAIEmbeddingModels } from \"./schemas\";\n\nexport const createOpenAIEmbeddingModel = <M extends OpenAIEmbeddingModels>(\n modelId: M,\n client: ReturnType<typeof createOpenAIClient>,\n): OpenAIGenerativeModel<M> => {\n const doGenerate: NonNullable<OpenAIGenerativeModel<M>[\"doGenerate\"]> = async <\n TModalities extends ModalitiesParam<OpenAICapsFor<M>> = undefined,\n >(\n options: GenerativeModelCallOptions<OpenAICapsFor<M>, OpenAIOptionsFor<M>, TModalities>,\n ctx: RunContext,\n ) => {\n const requestBodyResult = mapToOpenAIEmbeddingRequest({\n modelId,\n options,\n });\n if (requestBodyResult.isErr()) {\n return err(\n requestBodyResult.error.at({\n at: \"openai.generate.mapRequest\",\n data: {\n modelId,\n endpoint: \"embeddings\",\n },\n }),\n );\n }\n\n const requestBody = requestBodyResult.value;\n\n const raw = await client.embeddings.create(requestBody, { signal: ctx.signal ?? null });\n if (raw.isErr()) {\n return err(\n raw.error\n .at({ at: \"openai.generate.modelContext\", data: { model: String(modelId) } })\n .at({\n at: \"openai.generate.http\",\n data: {\n modelId,\n endpoint: \"embeddings\",\n path: \"/v1/embeddings\",\n },\n }),\n );\n }\n\n const response = mapFromOpenAIEmbeddingResponse(raw.value);\n return ok({\n response: {\n ...response,\n request: {\n body: requestBody,\n },\n } satisfies GenerativeModelResponse,\n events: collectNonStreamOutputEvents(response, ctx),\n });\n };\n\n return {\n providerId: \"openai\",\n modelId,\n caps: OPENAI_EMBEDDING_CAPS as OpenAICapsFor<M>,\n doGenerate,\n };\n};\n","import { Events } from \"@better-agent/core/events\";\nimport type { Event } from \"@better-agent/core/events\";\nimport type {\n GenerativeModelCallOptions,\n GenerativeModelImageSource,\n GenerativeModelOutputItem,\n GenerativeModelResponse,\n GenerativeModelUsage,\n ModalitiesParam,\n} from \"@better-agent/core/providers\";\nimport { BetterAgentError } from \"@better-agent/shared/errors\";\nimport type { Result } from \"@better-agent/shared/neverthrow\";\nimport { err, ok } from \"@better-agent/shared/neverthrow\";\nimport { extractPassthroughOptions, omitNullish } from \"../../utils/object-utils\";\nimport type { OpenAIImageStreamEvent } from \"../shared/schemas\";\nimport type { OpenAICapsFor, OpenAIOptionsFor } from \"../types\";\nimport type {\n OpenAICreateImage,\n OpenAICreateImageSchema,\n OpenAIEditImageSchema,\n OpenAIImageModels,\n} from \"./schemas\";\n\n/**\n * Keys explicitly handled by the OpenAI images mapper.\n */\nconst OPENAI_IMAGE_KNOWN_KEYS: ReadonlySet<string> = new Set([\n // Framework-managed\n \"input\",\n \"tools\",\n \"toolChoice\",\n \"modalities\",\n \"structured_output\",\n // Explicitly mapped\n \"n\",\n \"quality\",\n \"response_format\",\n \"output_format\",\n \"output_compression\",\n \"stream\",\n \"partial_images\",\n \"size\",\n \"moderation\",\n \"background\",\n \"style\",\n \"input_fidelity\",\n \"user\",\n]);\n\nconst mapOpenAIUsage = (usage?: {\n input_tokens?: number;\n output_tokens?: number;\n total_tokens?: number;\n}): GenerativeModelUsage =>\n omitNullish({\n inputTokens: usage?.input_tokens,\n outputTokens: usage?.output_tokens,\n totalTokens: usage?.total_tokens,\n });\n\ntype OpenAIImagesRequestPayload =\n | { mode: \"generate\"; body: OpenAICreateImageSchema }\n | { mode: \"edit\"; body: OpenAIEditImageSchema };\n\nconst toImageDataUrl = (source: GenerativeModelImageSource): string =>\n source.kind === \"url\" ? source.url : `data:${source.mimeType};base64,${source.data}`;\n\nconst parseOpenAIImagePromptInput = <\n M extends OpenAIImageModels,\n TModalities extends ModalitiesParam<OpenAICapsFor<M>> = undefined,\n>(args: {\n modelId: M;\n options: GenerativeModelCallOptions<OpenAICapsFor<M>, OpenAIOptionsFor<M>, TModalities>;\n}) => {\n const input = args.options.input;\n\n if (Array.isArray(input) && input.length > 1) {\n throw BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n \"Image generation supports a single input item\",\n { context: { provider: \"openai\", model: args.modelId } },\n ).at({\n at: \"openai.images.map.inputLimit\",\n });\n }\n\n const first = Array.isArray(input) ? input[0] : input;\n if (typeof first === \"string\")\n return { prompt: first, images: [] as GenerativeModelImageSource[] };\n\n if (!first || typeof first !== \"object\" || !(\"type\" in first) || first.type !== \"message\") {\n throw BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n \"Image generation requires a prompt string or a single message input\",\n { context: { provider: \"openai\", model: args.modelId } },\n ).at({\n at: \"openai.images.map.inputShape\",\n });\n }\n\n if (typeof first.content === \"string\") {\n return { prompt: first.content, images: [] as GenerativeModelImageSource[] };\n }\n\n const promptParts: string[] = [];\n const images: GenerativeModelImageSource[] = [];\n\n for (const part of first.content) {\n if (part.type === \"text\") {\n promptParts.push(part.text);\n continue;\n }\n\n if (part.type === \"image\") {\n images.push(part.source);\n continue;\n }\n\n throw BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n \"Image generation only supports text and image input parts\",\n { context: { provider: \"openai\", model: args.modelId, partType: part.type } },\n ).at({\n at: \"openai.images.map.partType\",\n });\n }\n\n return { prompt: promptParts.join(\"\\n\"), images };\n};\n\nexport function mapFromOpenAIImagesStreamEvent(\n event: OpenAIImageStreamEvent,\n messageId: string,\n): Result<\n | {\n kind: \"event\";\n event: Event;\n }\n | {\n kind: \"final\";\n response: GenerativeModelResponse;\n }\n | null,\n BetterAgentError\n> {\n if (event.type === \"image_generation.partial_image\") {\n return ok({\n kind: \"event\",\n event: {\n type: Events.IMAGE_MESSAGE_CONTENT,\n messageId,\n delta: {\n kind: \"base64\",\n data: event.b64_json,\n mimeType: `image/${event.output_format ?? \"png\"}`,\n },\n timestamp: Date.now(),\n },\n });\n }\n\n if (event.type === \"image_generation.completed\") {\n const response: GenerativeModelResponse = {\n output: [\n {\n type: \"message\",\n role: \"assistant\",\n content: [\n {\n type: \"image\",\n source: {\n kind: \"base64\",\n data: event.b64_json,\n mimeType: `image/${event.output_format ?? \"png\"}`,\n },\n },\n ],\n },\n ],\n finishReason: \"stop\",\n usage: mapOpenAIUsage(event.usage),\n response: {\n body: event,\n },\n };\n\n return ok({\n kind: \"final\",\n response,\n });\n }\n\n return ok(null);\n}\n\nexport function mapToOpenAIImagesRequest<\n M extends OpenAIImageModels,\n TModalities extends ModalitiesParam<OpenAICapsFor<M>> = undefined,\n>(args: {\n modelId: M;\n options: GenerativeModelCallOptions<OpenAICapsFor<M>, OpenAIOptionsFor<M>, TModalities>;\n}): Result<OpenAIImagesRequestPayload, BetterAgentError> {\n try {\n const o = args.options;\n\n if (o.stream && args.modelId !== \"gpt-image-1\") {\n return err(\n BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n \"Image streaming is only supported for gpt-image-1\",\n { context: { provider: \"openai\", model: args.modelId } },\n ).at({\n at: \"openai.images.map.streamUnsupported\",\n }),\n );\n }\n\n const parsed = parseOpenAIImagePromptInput(args);\n const prompt = parsed.prompt;\n\n if (typeof prompt !== \"string\" || !prompt) {\n return err(\n BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n \"Image generation requires a text prompt\",\n { context: { provider: \"openai\", model: args.modelId } },\n ).at({\n at: \"openai.images.map.promptMissing\",\n }),\n );\n }\n\n if (parsed.images.length === 0) {\n return ok({\n mode: \"generate\",\n body: {\n ...extractPassthroughOptions(\n o as Record<string, unknown>,\n OPENAI_IMAGE_KNOWN_KEYS,\n ),\n model: args.modelId,\n prompt,\n n: o.n,\n quality: o.quality,\n response_format: o.response_format,\n output_format: o.output_format,\n output_compression: o.output_compression,\n stream: o.stream,\n partial_images: o.partial_images,\n size: o.size,\n moderation: o.moderation,\n background: o.background,\n style: o.style,\n user: o.user,\n },\n });\n }\n\n if (args.modelId === \"dall-e-3\") {\n return err(\n BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n \"OpenAI image edits are not supported for dall-e-3\",\n { context: { provider: \"openai\", model: args.modelId } },\n ).at({\n at: \"openai.images.map.editUnsupported\",\n }),\n );\n }\n\n return ok({\n mode: \"edit\",\n body: {\n ...extractPassthroughOptions(o as Record<string, unknown>, OPENAI_IMAGE_KNOWN_KEYS),\n model: args.modelId,\n prompt,\n images: parsed.images.map((image) => ({\n image_url: toImageDataUrl(image),\n })),\n n: o.n,\n quality: o.quality,\n response_format: o.response_format,\n output_format: o.output_format,\n output_compression: o.output_compression,\n stream: o.stream,\n partial_images: o.partial_images,\n size: o.size,\n moderation: o.moderation,\n background: o.background,\n user: o.user,\n input_fidelity: o.input_fidelity,\n },\n });\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"Failed to map OpenAI Images request\",\n opts: { code: \"INTERNAL\", context: { provider: \"openai\", model: args.modelId } },\n }).at({\n at: \"openai.images.mapToRequest\",\n }),\n );\n }\n}\n\nexport function mapFromOpenAIImagesResponse(raw: OpenAICreateImage): GenerativeModelResponse {\n const data = raw.data ?? [];\n const mimeType: `image/${\"png\" | \"webp\" | \"jpeg\"}` = `image/${raw.output_format ?? \"png\"}`;\n\n const images: GenerativeModelImageSource[] = data.flatMap((d): GenerativeModelImageSource[] =>\n d.url\n ? [\n {\n kind: \"url\",\n url: d.url,\n },\n ]\n : d.b64_json\n ? [\n {\n kind: \"base64\",\n data: d.b64_json,\n mimeType,\n },\n ]\n : [],\n );\n\n const output: GenerativeModelOutputItem[] = [];\n if (images.length) {\n output.push({\n type: \"message\",\n role: \"assistant\",\n content: images.map((source) => ({\n type: \"image\",\n source,\n })),\n });\n }\n\n return {\n output,\n finishReason: \"stop\",\n usage: raw.usage\n ? {\n inputTokens: raw.usage.input_tokens,\n outputTokens: raw.usage.output_tokens,\n totalTokens: raw.usage.total_tokens,\n }\n : {},\n response: {\n body: raw,\n },\n };\n}\n","import type { RunContext } from \"@better-agent/core\";\nimport { Events } from \"@better-agent/core/events\";\nimport type { Event } from \"@better-agent/core/events\";\nimport type {\n GenerativeModelCallOptions,\n GenerativeModelResponse,\n ModalitiesParam,\n} from \"@better-agent/core/providers\";\nimport { BetterAgentError } from \"@better-agent/shared/errors\";\nimport { type Result, err, ok } from \"@better-agent/shared/neverthrow\";\nimport type { createOpenAIClient } from \"../client\";\nimport {\n OPENAI_IMAGE_CAPS,\n collectNonStreamOutputEvents,\n createDeferred,\n openaiUpstreamError,\n} from \"../shared/runtime\";\nimport type { OpenAICapsFor, OpenAIGenerativeModel, OpenAIOptionsFor } from \"../types\";\nimport {\n mapFromOpenAIImagesResponse,\n mapFromOpenAIImagesStreamEvent,\n mapToOpenAIImagesRequest,\n} from \"./mappers\";\nimport type { OpenAIImageModels } from \"./schemas\";\n\nexport const createOpenAIImagesModel = <M extends OpenAIImageModels>(\n modelId: M,\n client: ReturnType<typeof createOpenAIClient>,\n): OpenAIGenerativeModel<M> => {\n const doGenerate: NonNullable<OpenAIGenerativeModel<M>[\"doGenerate\"]> = async <\n TModalities extends ModalitiesParam<OpenAICapsFor<M>> = undefined,\n >(\n options: GenerativeModelCallOptions<OpenAICapsFor<M>, OpenAIOptionsFor<M>, TModalities>,\n ctx: RunContext,\n ) => {\n const requestBodyResult = mapToOpenAIImagesRequest({ modelId, options });\n if (requestBodyResult.isErr()) {\n return err(\n requestBodyResult.error.at({\n at: \"openai.generate.mapRequest\",\n data: { modelId, endpoint: \"images\" },\n }),\n );\n }\n\n const request = requestBodyResult.value;\n const raw =\n request.mode === \"edit\"\n ? await client.images.edit(request.body, { signal: ctx.signal ?? null })\n : await client.images.create(request.body, { signal: ctx.signal ?? null });\n if (raw.isErr()) {\n return err(\n raw.error\n .at({ at: \"openai.generate.modelContext\", data: { model: String(modelId) } })\n .at({\n at: \"openai.generate.http\",\n data: {\n modelId,\n endpoint: \"images\",\n path:\n request.mode === \"edit\"\n ? \"/v1/images/edits\"\n : \"/v1/images/generations\",\n },\n }),\n );\n }\n\n const response = mapFromOpenAIImagesResponse(raw.value);\n return ok({\n response: {\n ...response,\n request: { body: request.body },\n } satisfies GenerativeModelResponse,\n events: collectNonStreamOutputEvents(response, ctx),\n });\n };\n\n const doGenerateStream: NonNullable<OpenAIGenerativeModel<M>[\"doGenerateStream\"]> = async <\n const TModalities extends ModalitiesParam<OpenAICapsFor<M>> = undefined,\n >(\n options: GenerativeModelCallOptions<OpenAICapsFor<M>, OpenAIOptionsFor<M>, TModalities>,\n ctx: RunContext,\n ) => {\n const requestBodyResult = mapToOpenAIImagesRequest({ modelId, options });\n if (requestBodyResult.isErr()) {\n return err(\n requestBodyResult.error.at({\n at: \"openai.generateStream.mapRequest\",\n data: { modelId, endpoint: \"images\" },\n }),\n );\n }\n\n const request = requestBodyResult.value;\n const streamResult =\n request.mode === \"edit\"\n ? await client.images.streamEdit(request.body, { signal: ctx.signal ?? null })\n : await client.images.stream(request.body, { signal: ctx.signal ?? null });\n if (streamResult.isErr()) {\n return err(\n streamResult.error\n .at({ at: \"openai.generate.modelContext\", data: { model: String(modelId) } })\n .at({\n at: \"openai.generateStream.http\",\n data: {\n modelId,\n endpoint: \"images\",\n path:\n request.mode === \"edit\"\n ? \"/v1/images/edits\"\n : \"/v1/images/generations\",\n },\n }),\n );\n }\n\n const {\n promise: final,\n resolve: resolveFinal,\n reject: rejectFinal,\n } = createDeferred<GenerativeModelResponse>();\n\n const events = (async function* (): AsyncGenerator<Result<Event, BetterAgentError>> {\n const messageId = ctx.generateMessageId();\n let started = false;\n let sawFinal = false;\n\n try {\n for await (const raw of streamResult.value) {\n if (raw.isErr()) {\n const appErr = BetterAgentError.wrap({\n err: raw.error,\n message: \"OpenAI stream chunk error\",\n opts: { code: \"UPSTREAM_FAILED\" },\n }).at({ at: \"openai.generateStream.chunk\" });\n yield err(appErr);\n rejectFinal(appErr);\n return;\n }\n\n const mapped = mapFromOpenAIImagesStreamEvent(raw.value, messageId);\n if (mapped.isErr()) {\n const appErr = mapped.error.at({ at: \"openai.generateStream.mapEvent\" });\n yield err(appErr);\n rejectFinal(appErr);\n return;\n }\n\n const m = mapped.value;\n if (!m) continue;\n\n if (!started) {\n started = true;\n yield ok({\n type: Events.IMAGE_MESSAGE_START,\n messageId,\n role: \"assistant\",\n timestamp: Date.now(),\n });\n }\n\n if (m.kind === \"event\") {\n yield ok(m.event);\n continue;\n }\n\n sawFinal = true;\n resolveFinal({ ...m.response, request: { body: request.body } });\n yield ok({\n type: Events.IMAGE_MESSAGE_END,\n messageId,\n timestamp: Date.now(),\n });\n return;\n }\n\n if (!sawFinal) {\n const missingFinal = openaiUpstreamError(\n \"Stream ended without image_generation.completed\",\n { provider: \"openai\", code: \"STREAM_MISSING_FINAL\" },\n ).at({ at: \"openai.generateStream.missingFinal\" });\n yield err(missingFinal);\n rejectFinal(missingFinal);\n return;\n }\n } catch (e) {\n const appErr = BetterAgentError.wrap({\n err: e,\n message: \"OpenAI image streaming failed\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n context: { provider: \"openai\", model: String(modelId) },\n },\n }).at({ at: \"openai.generateStream.generator\" });\n yield err(appErr);\n rejectFinal(appErr);\n return;\n }\n })();\n\n return ok({ events, final });\n };\n\n return {\n providerId: \"openai\",\n modelId,\n caps: OPENAI_IMAGE_CAPS as OpenAICapsFor<M>,\n doGenerate,\n doGenerateStream,\n };\n};\n","import type { HostedToolDefinition } from \"@better-agent/core\";\nimport type { OpenAICreateResponseSchema } from \"../responses/schemas\";\n\ntype OpenAINativeToolByType<TType extends string> = TType extends \"tool_search\"\n ? {\n type: \"tool_search\";\n execution?: \"server\" | \"client\";\n description?: string;\n parameters?: Record<string, unknown>;\n }\n : NonNullable<OpenAICreateResponseSchema[\"tools\"]>[number] extends infer TTool\n ? TTool extends { type: infer ToolType extends string }\n ? TType extends ToolType\n ? TTool\n : never\n : never\n : never;\n\nexport type OpenAINativeToolConfig<TType extends string> = Omit<\n OpenAINativeToolByType<TType>,\n \"type\"\n>;\n\nexport type OpenAINativeToolType =\n | \"web_search\"\n | \"web_search_preview\"\n | \"file_search\"\n | \"code_interpreter\"\n | \"image_generation\"\n | \"computer_use_preview\"\n | \"mcp\"\n | \"shell\"\n | \"local_shell\"\n | \"apply_patch\"\n | \"tool_search\"\n | \"custom\";\n\nexport type OpenAINativeToolDefinition<TType extends OpenAINativeToolType = OpenAINativeToolType> =\n HostedToolDefinition<\"openai\", TType, OpenAINativeToolConfig<TType>>;\n\nexport type OpenAINativeToolBuilders = ReturnType<typeof createOpenAINativeToolBuilders>;\ntype AnyOpenAINativeToolDefinition = {\n [K in OpenAINativeToolType]: OpenAINativeToolDefinition<K>;\n}[OpenAINativeToolType];\n\nexport function createOpenAINativeToolBuilders() {\n return {\n webSearch: (config: OpenAINativeToolConfig<\"web_search\">) =>\n createNativeTool(\"web_search\", config),\n webSearchPreview: (config: OpenAINativeToolConfig<\"web_search_preview\">) =>\n createNativeTool(\"web_search_preview\", config),\n fileSearch: (config: OpenAINativeToolConfig<\"file_search\">) =>\n createNativeTool(\"file_search\", config),\n codeInterpreter: (config: OpenAINativeToolConfig<\"code_interpreter\">) =>\n createNativeTool(\"code_interpreter\", config),\n imageGeneration: (config: OpenAINativeToolConfig<\"image_generation\">) =>\n createNativeTool(\"image_generation\", config),\n computerUsePreview: (config: OpenAINativeToolConfig<\"computer_use_preview\">) =>\n createNativeTool(\"computer_use_preview\", config),\n mcp: (config: OpenAINativeToolConfig<\"mcp\">) => createNativeTool(\"mcp\", config),\n shell: (config = {}) => createNativeTool(\"shell\", config),\n localShell: (config = {}) => createNativeTool(\"local_shell\", config),\n applyPatch: (config = {}) => createNativeTool(\"apply_patch\", config),\n toolSearch: (config: OpenAINativeToolConfig<\"tool_search\"> = {}) =>\n createNativeTool(\"tool_search\", config),\n custom: (config: OpenAINativeToolConfig<\"custom\">) => createNativeTool(\"custom\", config),\n };\n}\n\nfunction createNativeTool<TType extends OpenAINativeToolType>(\n type: TType,\n config: OpenAINativeToolConfig<TType>,\n): OpenAINativeToolDefinition<TType> {\n return {\n kind: \"hosted\",\n provider: \"openai\",\n type,\n config,\n };\n}\n\nexport function isOpenAINativeToolDefinition(tool: unknown): tool is AnyOpenAINativeToolDefinition {\n if (!tool || typeof tool !== \"object\") return false;\n const t = tool as Record<string, unknown>;\n return t.kind === \"hosted\" && t.provider === \"openai\" && typeof t.type === \"string\";\n}\n\n/**\n * Converts a hosted OpenAI tool definition to Responses API `tools[]` payload shape.\n */\nexport function mapOpenAINativeToolToRequest(\n tool: AnyOpenAINativeToolDefinition,\n): NonNullable<OpenAICreateResponseSchema[\"tools\"]>[number] {\n switch (tool.type) {\n case \"web_search\":\n return { type: \"web_search\", ...tool.config };\n case \"web_search_preview\":\n return { type: \"web_search_preview\", ...tool.config };\n case \"file_search\":\n return { type: \"file_search\", ...tool.config };\n case \"code_interpreter\":\n return { type: \"code_interpreter\", ...tool.config };\n case \"image_generation\":\n return { type: \"image_generation\", ...tool.config };\n case \"computer_use_preview\":\n return { type: \"computer_use_preview\", ...tool.config };\n case \"mcp\":\n return { type: \"mcp\", ...tool.config };\n case \"shell\":\n return { type: \"shell\", ...tool.config };\n case \"local_shell\":\n return { type: \"local_shell\", ...tool.config };\n case \"apply_patch\":\n return { type: \"apply_patch\", ...tool.config };\n case \"tool_search\":\n return { type: \"tool_search\", ...tool.config } as unknown as NonNullable<\n OpenAICreateResponseSchema[\"tools\"]\n >[number];\n case \"custom\":\n return { type: \"custom\", ...tool.config };\n }\n}\n","import { TOOL_JSON_SCHEMA, isCallableToolDefinition } from \"@better-agent/core\";\nimport { Events } from \"@better-agent/core/events\";\nimport type { Event } from \"@better-agent/core/events\";\nimport type {\n Capabilities,\n GenerativeModelCallOptions,\n GenerativeModelFinishReason,\n GenerativeModelInputItem,\n GenerativeModelInputMessagePart,\n GenerativeModelOutputItem,\n GenerativeModelOutputMessage,\n GenerativeModelProviderToolResult,\n GenerativeModelResponse,\n GenerativeModelUsage,\n ModalitiesParam,\n} from \"@better-agent/core/providers\";\nimport { BetterAgentError } from \"@better-agent/shared/errors\";\nimport type { Result } from \"@better-agent/shared/neverthrow\";\nimport { err, ok } from \"@better-agent/shared/neverthrow\";\nimport { extractPassthroughOptions, omitNullish } from \"../../utils/object-utils\";\nimport { isOpenAINativeToolDefinition, mapOpenAINativeToolToRequest } from \"../tools\";\nimport type { OpenAICapsFor, OpenAIOptionsFor } from \"../types\";\nimport type {\n OpenAICreateResponse,\n OpenAICreateResponseSchema,\n OpenAIFunctionItem,\n OpenAIInputItem,\n OpenAIResponseModels,\n OpenAIResponseStreamEvent,\n} from \"./schemas\";\nimport type { OpenAIResponseCaps, OpenAIResponseEndpointOptions } from \"./types\";\n\n/**\n * Keys explicitly handled by the OpenAI responses mapper.\n */\nconst OPENAI_RESPONSE_KNOWN_KEYS: ReadonlySet<string> = new Set([\n // Framework-managed (set by the runtime, not the user)\n \"input\",\n \"tools\",\n \"toolChoice\",\n \"modalities\",\n \"structured_output\",\n // Explicitly mapped to the request body\n \"conversation\",\n \"include\",\n \"instructions\",\n \"logprobs\",\n \"max_output_tokens\",\n \"max_tool_calls\",\n \"maxToolCalls\",\n \"metadata\",\n \"parallel_tool_calls\",\n \"previous_response_id\",\n \"prompt_cache_key\",\n \"prompt_cache_retention\",\n \"reasoning\",\n \"reasoningEffort\",\n \"reasoningSummary\",\n \"safety_identifier\",\n \"service_tier\",\n \"store\",\n \"temperature\",\n \"text\",\n \"textVerbosity\",\n \"top_logprobs\",\n \"top_p\",\n \"truncation\",\n]);\n\nconst IMAGE_EXTENSIONS = new Set([\n \".png\",\n \".jpg\",\n \".jpeg\",\n \".gif\",\n \".webp\",\n \".bmp\",\n \".svg\",\n \".avif\",\n \".heic\",\n \".heif\",\n]);\n\nconst hasExtension = (value: string | undefined, extensions: Set<string>): boolean => {\n if (!value) return false;\n const lower = value.toLowerCase();\n for (const ext of extensions) {\n if (lower.endsWith(ext)) return true;\n }\n return false;\n};\n\nconst isImageMimeType = (mimeType: string | undefined): boolean =>\n typeof mimeType === \"string\" && mimeType.toLowerCase().startsWith(\"image/\");\n\nconst isPdfMimeType = (mimeType: string | undefined): boolean =>\n typeof mimeType === \"string\" && mimeType.toLowerCase() === \"application/pdf\";\n\nconst getFileSourceMimeType = (source: {\n mimeType?: string;\n filename?: string;\n url?: string;\n}) =>\n source.mimeType ?? (source.url?.toLowerCase().endsWith(\".pdf\") ? \"application/pdf\" : undefined);\n\nconst isFileLikeImage = (source: {\n mimeType?: string;\n filename?: string;\n url?: string;\n}) =>\n isImageMimeType(source.mimeType) ||\n hasExtension(source.filename, IMAGE_EXTENSIONS) ||\n hasExtension(source.url, IMAGE_EXTENSIONS);\n\nconst isFileLikePdf = (source: {\n mimeType?: string;\n filename?: string;\n url?: string;\n}) =>\n isPdfMimeType(getFileSourceMimeType(source)) ||\n hasExtension(source.filename, new Set([\".pdf\"])) ||\n hasExtension(source.url, new Set([\".pdf\"]));\n\nconst toImageOutputMessage = (\n source:\n | {\n kind: \"url\";\n url: string;\n }\n | {\n kind: \"base64\";\n data: string;\n mimeType: string;\n },\n): GenerativeModelOutputMessage => ({\n type: \"message\",\n role: \"assistant\",\n content: [\n {\n type: \"image\",\n source,\n },\n ],\n});\n\nconst extractNativeToolOutputMessages = (\n item: Record<string, unknown> & { type: string },\n): GenerativeModelOutputMessage[] => {\n if (item.type === \"image_generation_call\" && typeof item.result === \"string\") {\n return [\n toImageOutputMessage({\n kind: \"base64\",\n data: item.result,\n mimeType: \"image/png\",\n }),\n ];\n }\n\n return [];\n};\n\nexport function mapToOpenAIResponsesRequest<\n M extends OpenAIResponseModels,\n TModalities extends ModalitiesParam<OpenAICapsFor<M>> = undefined,\n>(args: {\n modelId: M;\n options: GenerativeModelCallOptions<OpenAICapsFor<M>, OpenAIOptionsFor<M>, TModalities>;\n}): Result<OpenAICreateResponseSchema, BetterAgentError> {\n try {\n const o = args.options;\n const raw = o as unknown as OpenAIResponseEndpointOptions;\n type InputItem = GenerativeModelInputItem<OpenAIResponseCaps>;\n type MessagePart = GenerativeModelInputMessagePart<OpenAIResponseCaps>;\n const inputItems =\n typeof o.input === \"string\" ? undefined : (o.input as readonly InputItem[]);\n\n const input: OpenAICreateResponseSchema[\"input\"] =\n typeof o.input === \"string\"\n ? [\n {\n role: \"user\",\n content: [\n {\n type: \"input_text\",\n text: o.input,\n },\n ],\n },\n ]\n : (inputItems ?? []).flatMap<OpenAIInputItem>((item) => {\n if (typeof item === \"string\")\n return [\n {\n role: \"user\",\n content: [\n {\n type: \"input_text\",\n text: item,\n },\n ],\n },\n ];\n\n if (item.type === \"message\") {\n const role =\n typeof item.role === \"string\" &&\n (item.role === \"system\" ||\n item.role === \"user\" ||\n item.role === \"assistant\" ||\n item.role === \"developer\")\n ? (item.role as \"system\" | \"user\" | \"assistant\" | \"developer\")\n : \"user\";\n\n const isAssistant = role === \"assistant\";\n if (isAssistant) {\n const content =\n typeof item.content === \"string\"\n ? [\n {\n type: \"output_text\" as const,\n text: item.content,\n },\n ]\n : item.content.flatMap((part: MessagePart) =>\n part.type === \"text\"\n ? [\n {\n type: \"output_text\" as const,\n text: part.text,\n },\n ]\n : [],\n );\n\n return [{ role, content } as OpenAIInputItem];\n }\n\n const content: Array<Record<string, unknown>> =\n typeof item.content === \"string\"\n ? [\n {\n type: \"input_text\" as const,\n text: item.content,\n },\n ]\n : [];\n\n if (Array.isArray(item.content)) {\n for (const part of item.content as MessagePart[]) {\n if (part.type === \"text\") {\n content.push({\n type: \"input_text\" as const,\n text: part.text,\n });\n continue;\n }\n\n if (part.type === \"file\") {\n const source = part.source;\n const filename = source.filename;\n\n if (source.kind === \"provider-file\") {\n const providerSource = source as {\n kind: \"provider-file\";\n ref: { provider: string; id: string };\n filename?: string;\n };\n if (source.ref.provider !== \"openai\") {\n throw BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n \"OpenAI file inputs require a provider-file reference for provider=openai\",\n {\n context: {\n provider: \"openai\",\n model: args.modelId,\n sourceProvider: source.ref.provider,\n },\n },\n ).at({\n at: \"openai.responses.map.input.fileProvider\",\n });\n }\n\n if (isFileLikeImage(providerSource)) {\n content.push({\n type: \"input_image\" as const,\n detail: \"auto\" as const,\n file_id: providerSource.ref.id,\n ...(filename != null ? { filename } : {}),\n });\n continue;\n }\n\n content.push({\n type: \"input_file\" as const,\n file_id: providerSource.ref.id,\n ...(filename != null ? { filename } : {}),\n });\n continue;\n }\n\n if (source.kind === \"url\") {\n const urlSource = source as {\n kind: \"url\";\n url: string;\n filename?: string;\n mimeType?: string;\n };\n if (isFileLikePdf(urlSource)) {\n content.push({\n type: \"input_file\" as const,\n file_url: urlSource.url,\n ...(filename != null ? { filename } : {}),\n });\n continue;\n }\n\n content.push({\n type: \"input_image\" as const,\n detail: \"auto\" as const,\n image_url: urlSource.url,\n });\n continue;\n }\n\n const base64Source = source as {\n kind: \"base64\";\n data: string;\n mimeType: string;\n filename?: string;\n };\n const dataUrl = `data:${base64Source.mimeType};base64,${base64Source.data}`;\n if (isFileLikePdf(base64Source)) {\n content.push({\n type: \"input_file\" as const,\n file_data: dataUrl,\n ...(filename != null ? { filename } : {}),\n });\n continue;\n }\n\n content.push({\n type: \"input_image\" as const,\n detail: \"auto\" as const,\n image_url: dataUrl,\n });\n continue;\n }\n\n if (part.type !== \"image\") {\n throw BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n `Unsupported message part for OpenAI Responses: ${part.type}`,\n {\n context: {\n provider: \"openai\",\n model: args.modelId,\n partType: part.type,\n },\n },\n ).at({\n at: \"openai.responses.map.input.unsupportedPart\",\n });\n }\n\n const source = part.source;\n const imageUrl =\n source.kind === \"url\"\n ? source.url\n : `data:${source.mimeType};base64,${source.data}`;\n content.push({\n type: \"input_image\" as const,\n detail: \"auto\" as const,\n image_url: imageUrl,\n });\n }\n }\n\n return [{ role, content: content as never } as OpenAIInputItem];\n }\n\n const callArguments =\n \"arguments\" in item && typeof item.arguments === \"string\"\n ? item.arguments\n : \"{}\";\n\n const call: OpenAIFunctionItem = {\n type: \"function_call\",\n call_id: item.callId,\n name: item.name,\n arguments: callArguments,\n };\n\n if (item.result == null) return [call];\n\n const out: OpenAIFunctionItem = {\n type: \"function_call_output\",\n call_id: item.callId,\n output:\n typeof item.result === \"string\"\n ? item.result\n : JSON.stringify(item.result),\n status: item.isError === true ? \"incomplete\" : \"completed\",\n };\n\n return [call, out];\n });\n\n let text: OpenAICreateResponseSchema[\"text\"] | undefined;\n if (\"structured_output\" in o && o.structured_output) {\n const out = o.structured_output;\n const { name, strict = true } = out;\n if ((out.schema as { type?: unknown }).type !== \"object\") {\n return err(\n BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n \"Structured output schema must be an object\",\n { context: { provider: \"openai\", model: args.modelId } },\n ).at({\n at: \"openai.responses.map.structuredOutput\",\n }),\n );\n }\n\n text = {\n format: {\n type: \"json_schema\" as const,\n name,\n strict,\n schema: out.schema,\n },\n };\n }\n\n type OpenAITool = NonNullable<OpenAICreateResponseSchema[\"tools\"]>[number];\n const openAiTools: OpenAITool[] = [];\n\n const tools = (\"tools\" in o ? o.tools : []) ?? [];\n\n if (tools.length) {\n for (const tool of tools) {\n if (isOpenAINativeToolDefinition(tool)) {\n openAiTools.push(mapOpenAINativeToolToRequest(tool));\n continue;\n }\n\n const callableTool = tool as\n | ({ [TOOL_JSON_SCHEMA]?: unknown } & Record<string, unknown>)\n | undefined;\n if (!callableTool || !isCallableToolDefinition(callableTool as never)) continue;\n\n const parameters = callableTool[TOOL_JSON_SCHEMA];\n\n if (\n (\n parameters as {\n type?: unknown;\n }\n ).type !== \"object\"\n ) {\n return err(\n BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n \"Tool parameters schema must be an object\",\n { context: { provider: \"openai\", model: args.modelId } },\n ).at({\n at: \"openai.responses.map.tools\",\n }),\n );\n }\n\n openAiTools.push({\n type: \"function\",\n name: String(callableTool.name ?? \"\"),\n description:\n typeof callableTool.description === \"string\"\n ? callableTool.description\n : null,\n parameters: parameters as Record<string, unknown>,\n strict: typeof callableTool.strict === \"boolean\" ? callableTool.strict : null,\n });\n }\n }\n\n let openAiToolChoice: OpenAICreateResponse[\"tool_choice\"] | undefined;\n if (\n \"tools\" in o &&\n o.tools &&\n \"toolChoice\" in o &&\n o.toolChoice &&\n o.toolChoice.type !== \"auto\"\n ) {\n const tc = o.toolChoice;\n\n if (tc.type === \"none\") {\n openAiToolChoice = \"none\";\n } else if (tc.type === \"required\") {\n openAiToolChoice = \"required\";\n } else if (tc.type === \"tool\") {\n if (!openAiTools.length) {\n return err(\n BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n \"toolChoice=tool requires tools[] to be provided\",\n {\n context: {\n provider: \"openai\",\n model: args.modelId,\n },\n },\n ).at({\n at: \"openai.responses.map.toolChoice\",\n }),\n );\n }\n\n const exists = openAiTools.some(\n (t) => t.type === \"function\" && \"name\" in t && t.name === tc.name,\n );\n\n if (!exists) {\n return err(\n BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n `Requested tool not found: ${tc.name}`,\n { context: { provider: \"openai\", model: args.modelId } },\n ).at({\n at: \"openai.responses.map.toolChoice\",\n }),\n );\n }\n\n openAiToolChoice = {\n type: \"function\",\n name: tc.name,\n };\n }\n }\n\n if (raw.text && typeof raw.text === \"object\") {\n text = { ...text, ...(raw.text as Record<string, unknown>) } as typeof text;\n }\n if (raw.textVerbosity != null) {\n text = { ...(text ?? {}), verbosity: raw.textVerbosity } as typeof text;\n }\n\n const request: Record<string, unknown> = {\n ...extractPassthroughOptions(o as Record<string, unknown>, OPENAI_RESPONSE_KNOWN_KEYS),\n model: args.modelId,\n input,\n ...omitNullish({\n text,\n tools: openAiTools.length ? openAiTools : undefined,\n tool_choice: openAiToolChoice,\n conversation: o.conversation,\n include: o.include,\n instructions: raw.instructions,\n metadata: o.metadata,\n parallel_tool_calls: o.parallel_tool_calls,\n previous_response_id: o.previous_response_id,\n prompt_cache_key: o.prompt_cache_key,\n prompt_cache_retention: o.prompt_cache_retention,\n reasoning: o.reasoning,\n safety_identifier: o.safety_identifier,\n service_tier: o.service_tier,\n store: o.store,\n truncation: o.truncation,\n }),\n ...(o.reasoningEffort != null || o.reasoningSummary != null\n ? {\n reasoning: {\n ...(o.reasoning && typeof o.reasoning === \"object\" ? o.reasoning : {}),\n ...omitNullish({\n effort: o.reasoningEffort,\n summary: o.reasoningSummary,\n }),\n },\n }\n : {}),\n };\n\n const responseOpts = o as {\n modalities?: readonly string[];\n max_output_tokens?: number;\n max_tool_calls?: number;\n temperature?: number;\n top_logprobs?: number;\n top_p?: number;\n };\n\n const requestedLogprobs =\n typeof o.logprobs === \"number\" ? o.logprobs : o.logprobs === true ? 20 : undefined;\n\n if (o.logprobs != null) {\n request.include = Array.isArray(request.include)\n ? Array.from(new Set([...request.include, \"message.output_text.logprobs\"]))\n : [\"message.output_text.logprobs\"];\n if (requestedLogprobs != null) {\n request.top_logprobs = requestedLogprobs;\n }\n }\n\n const maxToolCalls = o.max_tool_calls ?? o.maxToolCalls;\n if (maxToolCalls != null) {\n request.max_tool_calls = maxToolCalls;\n }\n\n if (responseOpts.modalities === undefined || responseOpts.modalities.includes(\"text\")) {\n if (responseOpts.max_output_tokens != null) {\n request.max_output_tokens = responseOpts.max_output_tokens;\n }\n if (responseOpts.max_tool_calls != null) {\n request.max_tool_calls = responseOpts.max_tool_calls;\n }\n if (responseOpts.temperature != null) request.temperature = responseOpts.temperature;\n if (responseOpts.top_logprobs != null) request.top_logprobs = responseOpts.top_logprobs;\n if (responseOpts.top_p != null) request.top_p = responseOpts.top_p;\n }\n\n return ok(request as OpenAICreateResponseSchema);\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"Failed to map OpenAI Responses request\",\n opts: { code: \"INTERNAL\", context: { provider: \"openai\", model: args.modelId } },\n }).at({\n at: \"openai.responses.mapToRequest\",\n }),\n );\n }\n}\n\nexport function mapFromOpenAIResponsesResponse(\n response: OpenAICreateResponse,\n): GenerativeModelResponse {\n const outputItems: Array<GenerativeModelOutputItem> = [];\n\n for (const item of response.output ?? []) {\n if (item.type === \"message\") {\n const parts =\n item.content\n ?.filter((part) => part.type === \"output_text\")\n .map((part) => ({\n type: \"text\" as const,\n text: part.text,\n })) ?? [];\n\n if (parts.length > 0) {\n outputItems.push({\n type: \"message\",\n role: item.role as GenerativeModelOutputMessage[\"role\"],\n content: parts,\n });\n }\n continue;\n }\n\n if (item.type === \"function_call\") {\n outputItems.push({\n type: \"tool-call\",\n name: item.name,\n arguments: item.arguments,\n callId: item.call_id,\n });\n continue;\n }\n\n const itemType = String(item.type);\n if (itemType === \"tool_search_output\") {\n const toolSearchItem = item as unknown as {\n type: \"tool_search_output\";\n call_id?: string;\n id: string;\n };\n outputItems.push({\n type: \"provider-tool-result\",\n name: \"tool_search\",\n callId: toolSearchItem.call_id ?? toolSearchItem.id,\n result: toolSearchItem,\n });\n continue;\n }\n\n if (typeof item.type === \"string\" && item.type.endsWith(\"_call\")) {\n if (!(typeof item.id === \"string\" && item.id.length > 0)) continue;\n const nativeToolName = item.type.slice(0, -\"_call\".length);\n const nativeToolResult: GenerativeModelProviderToolResult = {\n type: \"provider-tool-result\",\n name: nativeToolName,\n callId: item.id,\n result: item,\n };\n\n outputItems.push(nativeToolResult);\n outputItems.push(\n ...extractNativeToolOutputMessages(\n item as Record<string, unknown> & { type: string },\n ),\n );\n continue;\n }\n\n if (typeof item.type === \"string\" && item.type.endsWith(\"_call_output\")) {\n if (!(\"call_id\" in item)) continue;\n const callId = item.call_id;\n if (!(typeof callId === \"string\" && callId.length > 0)) continue;\n const nativeToolName = item.type.slice(0, -\"_call_output\".length);\n const nativeToolResult: GenerativeModelProviderToolResult = {\n type: \"provider-tool-result\",\n name: nativeToolName,\n callId,\n result: item,\n };\n\n outputItems.push(nativeToolResult);\n }\n }\n\n const inputTokens = response.usage?.input_tokens;\n const outputTokens = response.usage?.output_tokens;\n const totalTokens =\n typeof inputTokens === \"number\" && typeof outputTokens === \"number\"\n ? inputTokens + outputTokens\n : undefined;\n\n const usage: GenerativeModelUsage = omitNullish({\n inputTokens,\n outputTokens,\n totalTokens,\n reasoningTokens: response.usage?.output_tokens_details?.reasoning_tokens,\n cachedInputTokens: response.usage?.input_tokens_details?.cached_tokens,\n });\n\n const hasToolCalls = outputItems.some(\n (item) => item.type === \"tool-call\" && \"arguments\" in item,\n );\n\n let finishReason: GenerativeModelFinishReason;\n\n const incompleteReason = response.incomplete_details?.reason;\n if (incompleteReason === \"max_output_tokens\") {\n finishReason = \"length\";\n } else if (incompleteReason === \"content_filter\") {\n finishReason = \"content-filter\";\n } else if (incompleteReason) {\n finishReason = \"other\";\n } else if (hasToolCalls) {\n finishReason = \"tool-calls\";\n } else {\n finishReason = \"stop\";\n }\n\n return {\n output: outputItems,\n finishReason,\n usage,\n response: {\n body: response,\n },\n };\n}\n\nexport function mapFromOpenAIResponsesStreamEvent<TModelCaps extends Capabilities>(\n event: OpenAIResponseStreamEvent,\n messageId: string,\n): Result<\n | {\n kind: \"event\";\n event: Event;\n }\n | {\n kind: \"final\";\n response: GenerativeModelResponse<TModelCaps>;\n }\n | null,\n BetterAgentError\n> {\n if (event.type === \"response.reasoning_summary_part.added\") {\n return ok({\n kind: \"event\",\n event: {\n type: Events.REASONING_MESSAGE_START,\n messageId,\n role: \"assistant\",\n visibility: \"summary\",\n provider: \"openai\",\n timestamp: Date.now(),\n },\n });\n }\n\n if (event.type === \"response.reasoning_summary_text.delta\") {\n return ok({\n kind: \"event\",\n event: {\n type: Events.REASONING_MESSAGE_CONTENT,\n messageId,\n visibility: \"summary\",\n delta: (event as { delta?: string }).delta ?? \"\",\n provider: \"openai\",\n timestamp: Date.now(),\n },\n });\n }\n\n if (\n event.type === \"response.reasoning_summary_part.done\" ||\n event.type === \"response.reasoning_summary_text.done\"\n ) {\n return ok({\n kind: \"event\",\n event: {\n type: Events.REASONING_MESSAGE_END,\n messageId,\n visibility: \"summary\",\n provider: \"openai\",\n timestamp: Date.now(),\n },\n });\n }\n\n if (event.type === \"response.reasoning_text.delta\") {\n return ok({\n kind: \"event\",\n event: {\n type: Events.REASONING_MESSAGE_CONTENT,\n messageId,\n visibility: \"full\",\n delta: (event as { delta?: string }).delta ?? \"\",\n provider: \"openai\",\n timestamp: Date.now(),\n },\n });\n }\n\n if (event.type === \"response.reasoning_text.done\") {\n return ok({\n kind: \"event\",\n event: {\n type: Events.REASONING_MESSAGE_END,\n messageId,\n visibility: \"full\",\n provider: \"openai\",\n timestamp: Date.now(),\n },\n });\n }\n\n if (event.type === \"response.output_item.added\") {\n if (event?.item?.type === \"message\") {\n return ok({\n kind: \"event\",\n event: {\n type: Events.TEXT_MESSAGE_START,\n messageId,\n role: \"assistant\",\n timestamp: Date.now(),\n },\n });\n }\n if (event?.item?.type === \"function_call\") {\n const toolCallId =\n typeof event.item.call_id === \"string\" && event.item.call_id.length > 0\n ? event.item.call_id\n : event.item.id;\n return ok({\n kind: \"event\",\n event: {\n type: Events.TOOL_CALL_START,\n toolCallId,\n toolCallName: event?.item?.name ?? \"\",\n parentMessageId: messageId,\n runId: \"\",\n agentName: \"\",\n toolTarget: \"hosted\",\n timestamp: Date.now(),\n } as Event,\n });\n }\n\n if (\n event.item.type.endsWith(\"_call\") &&\n event.item.type !== \"function_call\" &&\n typeof event.item.id === \"string\" &&\n event.item.id.length > 0\n ) {\n const nativeToolName = event.item.type.slice(0, -\"_call\".length);\n return ok({\n kind: \"event\",\n event: {\n type: Events.TOOL_CALL_START,\n toolCallId: event.item.id,\n toolCallName: nativeToolName,\n parentMessageId: messageId,\n runId: \"\",\n agentName: \"\",\n toolTarget: \"hosted\",\n timestamp: Date.now(),\n } as Event,\n });\n }\n }\n\n if (event.type === \"response.output_text.delta\") {\n return ok({\n kind: \"event\",\n event: {\n type: Events.TEXT_MESSAGE_CONTENT,\n messageId,\n delta: event.delta ?? \"\",\n timestamp: Date.now(),\n },\n });\n }\n\n if (event.type === \"response.output_text.done\") {\n return ok({\n kind: \"event\",\n event: {\n type: Events.TEXT_MESSAGE_END,\n messageId,\n timestamp: Date.now(),\n },\n });\n }\n\n if (event.type === \"response.function_call_arguments.delta\") {\n const toolCallId =\n typeof event.call_id === \"string\" && event.call_id.length > 0\n ? event.call_id\n : event.item_id;\n return ok({\n kind: \"event\",\n event: {\n type: Events.TOOL_CALL_ARGS,\n parentMessageId: messageId,\n toolCallId,\n toolCallName: \"unknown\",\n delta: event.delta ?? \"\",\n runId: \"\",\n agentName: \"\",\n toolTarget: \"hosted\",\n timestamp: Date.now(),\n } as Event,\n });\n }\n\n if (event.type === \"response.function_call_arguments.done\") {\n const toolCallId =\n typeof event.call_id === \"string\" && event.call_id.length > 0\n ? event.call_id\n : event.item_id;\n return ok({\n kind: \"event\",\n event: {\n type: Events.TOOL_CALL_END,\n parentMessageId: messageId,\n toolCallId,\n toolCallName: \"unknown\",\n runId: \"\",\n agentName: \"\",\n toolTarget: \"hosted\",\n timestamp: Date.now(),\n } as Event,\n });\n }\n\n if (event.type === \"response.code_interpreter_call_code.delta\") {\n return ok({\n kind: \"event\",\n event: {\n type: Events.TOOL_CALL_ARGS,\n parentMessageId: messageId,\n toolCallId: event.item_id,\n toolCallName: \"code_interpreter\",\n delta: event.delta ?? \"\",\n runId: \"\",\n agentName: \"\",\n toolTarget: \"hosted\",\n timestamp: Date.now(),\n } as Event,\n });\n }\n\n if (event.type === \"response.mcp_call_arguments.delta\") {\n return ok({\n kind: \"event\",\n event: {\n type: Events.TOOL_CALL_ARGS,\n parentMessageId: messageId,\n toolCallId: event.item_id,\n toolCallName: \"mcp\",\n delta: event.delta ?? \"\",\n runId: \"\",\n agentName: \"\",\n toolTarget: \"hosted\",\n timestamp: Date.now(),\n } as Event,\n });\n }\n\n if (event.type === \"response.custom_tool_call_input.delta\") {\n return ok({\n kind: \"event\",\n event: {\n type: Events.TOOL_CALL_ARGS,\n parentMessageId: messageId,\n toolCallId: event.item_id,\n toolCallName: \"custom_tool\",\n delta: event.delta ?? \"\",\n runId: \"\",\n agentName: \"\",\n toolTarget: \"hosted\",\n timestamp: Date.now(),\n } as Event,\n });\n }\n\n if (\n event.type === \"response.code_interpreter_call_code.done\" ||\n event.type === \"response.mcp_call_arguments.done\" ||\n event.type === \"response.custom_tool_call_input.done\"\n ) {\n return ok({\n kind: \"event\",\n event: {\n type: Events.TOOL_CALL_END,\n parentMessageId: messageId,\n toolCallId: event.item_id,\n toolCallName:\n event.type === \"response.code_interpreter_call_code.done\"\n ? \"code_interpreter\"\n : event.type === \"response.mcp_call_arguments.done\"\n ? \"mcp\"\n : \"custom_tool\",\n runId: \"\",\n agentName: \"\",\n toolTarget: \"hosted\",\n timestamp: Date.now(),\n } as Event,\n });\n }\n\n if (\n event.type === \"response.web_search_call.in_progress\" ||\n event.type === \"response.web_search_call.searching\" ||\n event.type === \"response.web_search_call.completed\" ||\n event.type === \"response.file_search_call.in_progress\" ||\n event.type === \"response.file_search_call.searching\" ||\n event.type === \"response.file_search_call.completed\" ||\n event.type === \"response.code_interpreter_call.in_progress\" ||\n event.type === \"response.code_interpreter_call.interpreting\" ||\n event.type === \"response.code_interpreter_call.completed\" ||\n event.type === \"response.image_generation_call.in_progress\" ||\n event.type === \"response.image_generation_call.generating\" ||\n event.type === \"response.image_generation_call.completed\" ||\n event.type === \"response.computer_call.in_progress\" ||\n event.type === \"response.computer_call.completed\" ||\n event.type === \"response.computer_call.failed\" ||\n event.type === \"response.mcp_call.in_progress\" ||\n event.type === \"response.mcp_call.completed\" ||\n event.type === \"response.mcp_call.failed\" ||\n event.type === \"response.mcp_list_tools.in_progress\" ||\n event.type === \"response.mcp_list_tools.completed\" ||\n event.type === \"response.mcp_list_tools.failed\"\n ) {\n const fullType = event.type.slice(\"response.\".length);\n const dotIndex = fullType.lastIndexOf(\".\");\n const toolSegment = dotIndex >= 0 ? fullType.slice(0, dotIndex) : fullType;\n const status = dotIndex >= 0 ? fullType.slice(dotIndex + 1) : \"unknown\";\n const tool = toolSegment.endsWith(\"_call\")\n ? toolSegment.slice(0, -\"_call\".length)\n : toolSegment;\n\n return ok({\n kind: \"event\",\n event: {\n type: Events.DATA_PART,\n id: event.item_id,\n data: {\n endpoint: \"responses\",\n tool,\n status,\n raw: event,\n },\n timestamp: Date.now(),\n } as Event,\n });\n }\n\n if (event.type === \"response.image_generation_call.partial_image\") {\n const partialEvent = event as {\n item_id?: unknown;\n partial_image_b64?: unknown;\n b64_json?: unknown;\n output_format?: unknown;\n };\n const data =\n typeof partialEvent.partial_image_b64 === \"string\"\n ? partialEvent.partial_image_b64\n : typeof partialEvent.b64_json === \"string\"\n ? partialEvent.b64_json\n : null;\n if (!data) return ok(null);\n\n return ok({\n kind: \"event\",\n event: {\n type: Events.IMAGE_MESSAGE_CONTENT,\n messageId:\n typeof partialEvent.item_id === \"string\" && partialEvent.item_id.length > 0\n ? partialEvent.item_id\n : messageId,\n delta: {\n kind: \"base64\",\n data,\n mimeType:\n typeof partialEvent.output_format === \"string\"\n ? `image/${partialEvent.output_format}`\n : \"image/png\",\n },\n timestamp: Date.now(),\n },\n });\n }\n\n if (event.type === \"response.output_item.done\") {\n const doneItem = event.item as unknown as { type: string; call_id?: string; id?: string };\n if (doneItem.type === \"tool_search_output\") {\n const callId =\n typeof doneItem.call_id === \"string\" && doneItem.call_id.length > 0\n ? doneItem.call_id\n : doneItem.id;\n if (!(typeof callId === \"string\" && callId.length > 0)) {\n return ok(null);\n }\n\n return ok({\n kind: \"event\",\n event: {\n type: Events.TOOL_CALL_RESULT,\n parentMessageId: messageId,\n toolCallId: callId,\n toolCallName: \"tool_search\",\n result: doneItem,\n runId: \"\",\n agentName: \"\",\n toolTarget: \"hosted\",\n timestamp: Date.now(),\n } as Event,\n });\n }\n\n if (\n event.item.type.endsWith(\"_call\") &&\n event.item.type !== \"function_call\" &&\n typeof event.item.id === \"string\" &&\n event.item.id.length > 0\n ) {\n return ok({\n kind: \"event\",\n event: {\n type: Events.TOOL_CALL_RESULT,\n parentMessageId: messageId,\n toolCallId: event.item.id,\n toolCallName: event.item.type.slice(0, -\"_call\".length),\n result: event.item,\n runId: \"\",\n agentName: \"\",\n toolTarget: \"hosted\",\n timestamp: Date.now(),\n } as Event,\n });\n }\n\n if (\n event.item.type.endsWith(\"_call_output\") &&\n \"call_id\" in event.item &&\n typeof event.item.call_id === \"string\" &&\n event.item.call_id.length > 0\n ) {\n return ok({\n kind: \"event\",\n event: {\n type: Events.TOOL_CALL_RESULT,\n parentMessageId: messageId,\n toolCallId: event.item.call_id,\n toolCallName: event.item.type.slice(0, -\"_call_output\".length),\n result: event.item,\n runId: \"\",\n agentName: \"\",\n toolTarget: \"hosted\",\n timestamp: Date.now(),\n } as Event,\n });\n }\n }\n\n if (event.type === \"response.completed\") {\n return ok({\n kind: \"final\",\n response: mapFromOpenAIResponsesResponse(event.response),\n });\n }\n\n if (event.type === \"error\") {\n const errorRecord =\n typeof event.error === \"object\" && event.error !== null\n ? (event.error as Record<string, unknown>)\n : undefined;\n const upstreamCode =\n typeof errorRecord?.code === \"string\"\n ? errorRecord.code\n : typeof errorRecord?.type === \"string\"\n ? errorRecord.type\n : \"STREAM_ERROR\";\n const userMessage =\n upstreamCode === \"context_length_exceeded\"\n ? \"This conversation exceeds the model context window. Start a new thread or remove large generated content.\"\n : typeof event.message === \"string\" && event.message.length > 0\n ? event.message\n : typeof errorRecord?.message === \"string\" && errorRecord.message.length > 0\n ? errorRecord.message\n : \"OpenAI streaming error\";\n\n return err(\n BetterAgentError.fromCode(\n upstreamCode === \"context_length_exceeded\"\n ? \"CONTEXT_LENGTH_EXCEEDED\"\n : \"UPSTREAM_FAILED\",\n userMessage,\n {\n context: {\n provider: \"openai\",\n upstreamCode,\n raw: event,\n },\n },\n ).at({\n at: \"openai.responses.stream.event\",\n }),\n );\n }\n\n return ok(null);\n}\n","import type { RunContext } from \"@better-agent/core\";\nimport { Events } from \"@better-agent/core/events\";\nimport type { Event } from \"@better-agent/core/events\";\nimport type {\n GenerativeModelCallOptions,\n GenerativeModelResponse,\n ModalitiesParam,\n} from \"@better-agent/core/providers\";\nimport { BetterAgentError } from \"@better-agent/shared/errors\";\nimport { type Result, err, ok } from \"@better-agent/shared/neverthrow\";\nimport type { createOpenAIClient } from \"../client\";\nimport {\n OPENAI_RESPONSE_CAPS,\n collectNonStreamOutputEvents,\n createDeferred,\n openaiUpstreamError,\n} from \"../shared/runtime\";\nimport type { OpenAICapsFor, OpenAIGenerativeModel, OpenAIOptionsFor } from \"../types\";\nimport {\n mapFromOpenAIResponsesResponse,\n mapFromOpenAIResponsesStreamEvent,\n mapToOpenAIResponsesRequest,\n} from \"./mappers\";\nimport type { OpenAIResponseModels, OpenAIResponseStreamEvent } from \"./schemas\";\n\nexport const createOpenAIResponsesModel = <M extends OpenAIResponseModels>(\n modelId: M,\n client: ReturnType<typeof createOpenAIClient>,\n): OpenAIGenerativeModel<M> => {\n const doGenerate: NonNullable<OpenAIGenerativeModel<M>[\"doGenerate\"]> = async <\n const TModalities extends ModalitiesParam<OpenAICapsFor<M>>,\n >(\n options: GenerativeModelCallOptions<OpenAICapsFor<M>, OpenAIOptionsFor<M>, TModalities>,\n ctx: RunContext,\n ) => {\n const requestBodyResult = mapToOpenAIResponsesRequest({ modelId, options });\n if (requestBodyResult.isErr()) {\n return err(\n requestBodyResult.error.at({\n at: \"openai.generate.mapRequest\",\n data: { modelId, endpoint: \"responses\" },\n }),\n );\n }\n\n const requestBody = requestBodyResult.value;\n const raw = await client.responses.create(requestBody, { signal: ctx.signal ?? null });\n if (raw.isErr()) {\n return err(\n raw.error\n .at({ at: \"openai.generate.modelContext\", data: { model: String(modelId) } })\n .at({\n at: \"openai.generate.http\",\n data: { modelId, endpoint: \"responses\", path: \"/v1/responses\" },\n }),\n );\n }\n\n const response = mapFromOpenAIResponsesResponse(raw.value);\n return ok({\n response: {\n ...response,\n request: { body: requestBody },\n } satisfies GenerativeModelResponse,\n events: collectNonStreamOutputEvents(response, ctx),\n });\n };\n\n const doGenerateStream: NonNullable<OpenAIGenerativeModel<M>[\"doGenerateStream\"]> = async <\n const TModalities extends ModalitiesParam<OpenAICapsFor<M>>,\n >(\n options: GenerativeModelCallOptions<OpenAICapsFor<M>, OpenAIOptionsFor<M>, TModalities>,\n ctx: RunContext,\n ) => {\n const requestBodyResult = mapToOpenAIResponsesRequest({ modelId, options });\n if (requestBodyResult.isErr()) {\n return err(\n requestBodyResult.error.at({\n at: \"openai.generateStream.mapRequest\",\n data: { modelId, endpoint: \"responses\" },\n }),\n );\n }\n\n const requestBody = requestBodyResult.value;\n const streamResult = await client.responses.stream(requestBody, {\n signal: ctx.signal ?? null,\n });\n if (streamResult.isErr()) {\n return err(\n streamResult.error\n .at({ at: \"openai.generate.modelContext\", data: { model: String(modelId) } })\n .at({\n at: \"openai.generateStream.http\",\n data: { modelId, endpoint: \"responses\", path: \"/v1/responses\" },\n }),\n );\n }\n\n const {\n promise: final,\n resolve: resolveFinal,\n reject: rejectFinal,\n } = createDeferred<GenerativeModelResponse>();\n\n const events = (async function* (): AsyncGenerator<Result<Event, BetterAgentError>> {\n const messageId = ctx.generateMessageId();\n const functionCallIdByItemId = new Map<string, string>();\n let sawFinal = false;\n let sawTextEnd = false;\n let finalResolved = false;\n const endedToolCalls = new Set<string>();\n const resultToolCalls = new Set<string>();\n const startedImageMessages = new Set<string>();\n const endedImageMessages = new Set<string>();\n const startedReasoningMessages = new Set<string>();\n const endedReasoningMessages = new Set<string>();\n\n try {\n for await (const raw of streamResult.value) {\n if (raw.isErr()) {\n const appErr = BetterAgentError.wrap({\n err: raw.error,\n message: \"OpenAI stream chunk error\",\n opts: { code: \"UPSTREAM_FAILED\" },\n }).at({ at: \"openai.generateStream.chunk\" });\n yield err(appErr);\n rejectFinal(appErr);\n return;\n }\n\n let openAiEvent = raw.value as OpenAIResponseStreamEvent;\n if (\n openAiEvent.type === \"response.output_item.added\" &&\n openAiEvent.item?.type === \"function_call\" &&\n typeof openAiEvent.item.id === \"string\" &&\n openAiEvent.item.id.length > 0 &&\n typeof openAiEvent.item.call_id === \"string\" &&\n openAiEvent.item.call_id.length > 0\n ) {\n functionCallIdByItemId.set(openAiEvent.item.id, openAiEvent.item.call_id);\n } else if (\n (openAiEvent.type === \"response.function_call_arguments.delta\" ||\n openAiEvent.type === \"response.function_call_arguments.done\") &&\n typeof openAiEvent.item_id === \"string\" &&\n openAiEvent.item_id.length > 0 &&\n (typeof openAiEvent.call_id !== \"string\" ||\n openAiEvent.call_id.length === 0)\n ) {\n const mappedCallId = functionCallIdByItemId.get(openAiEvent.item_id);\n if (mappedCallId) openAiEvent = { ...openAiEvent, call_id: mappedCallId };\n }\n\n const mapped = mapFromOpenAIResponsesStreamEvent(openAiEvent, messageId);\n if (mapped.isErr()) {\n const appErr = mapped.error.at({ at: \"openai.generateStream.mapEvent\" });\n yield err(appErr);\n rejectFinal(appErr);\n return;\n }\n\n const m = mapped.value;\n if (!m) continue;\n\n if (m.kind === \"final\") {\n sawFinal = true;\n for (const outputItem of m.response.output) {\n if (\n outputItem.type !== \"provider-tool-result\" ||\n resultToolCalls.has(outputItem.callId)\n ) {\n continue;\n }\n\n yield ok({\n type: Events.TOOL_CALL_RESULT,\n parentMessageId: messageId,\n toolCallId: outputItem.callId,\n toolCallName: outputItem.name,\n result: outputItem.result,\n runId: ctx.runId,\n agentName: ctx.agentName,\n toolTarget: \"hosted\",\n timestamp: Date.now(),\n });\n resultToolCalls.add(outputItem.callId);\n\n if (\n startedImageMessages.has(outputItem.callId) &&\n !endedImageMessages.has(outputItem.callId)\n ) {\n yield ok({\n type: Events.IMAGE_MESSAGE_END,\n messageId: outputItem.callId,\n timestamp: Date.now(),\n });\n endedImageMessages.add(outputItem.callId);\n }\n\n if (endedToolCalls.has(outputItem.callId)) continue;\n yield ok({\n type: Events.TOOL_CALL_END,\n parentMessageId: messageId,\n toolCallId: outputItem.callId,\n toolCallName: outputItem.name,\n runId: ctx.runId,\n agentName: ctx.agentName,\n toolTarget: \"hosted\",\n timestamp: Date.now(),\n });\n endedToolCalls.add(outputItem.callId);\n }\n\n resolveFinal({ ...m.response, request: { body: requestBody } });\n finalResolved = true;\n if (sawTextEnd) return;\n continue;\n }\n\n const ev = m.event;\n const reasoningKey =\n ev.type === Events.REASONING_MESSAGE_START ||\n ev.type === Events.REASONING_MESSAGE_CONTENT ||\n ev.type === Events.REASONING_MESSAGE_END\n ? `${ev.visibility}:${ev.messageId}`\n : null;\n\n if (ev.type === Events.TEXT_MESSAGE_END) sawTextEnd = true;\n\n if (\n ev.type === Events.IMAGE_MESSAGE_CONTENT &&\n !startedImageMessages.has(ev.messageId)\n ) {\n yield ok({\n type: Events.IMAGE_MESSAGE_START,\n messageId: ev.messageId,\n role: \"assistant\",\n timestamp: Date.now(),\n });\n startedImageMessages.add(ev.messageId);\n }\n\n if (ev.type === Events.TOOL_CALL_END) endedToolCalls.add(ev.toolCallId);\n if (ev.type === Events.TOOL_CALL_RESULT) resultToolCalls.add(ev.toolCallId);\n if (ev.type === Events.REASONING_MESSAGE_START && reasoningKey) {\n startedReasoningMessages.add(reasoningKey);\n }\n\n if (\n (ev.type === Events.REASONING_MESSAGE_CONTENT ||\n ev.type === Events.REASONING_MESSAGE_END) &&\n reasoningKey &&\n !startedReasoningMessages.has(reasoningKey)\n ) {\n yield ok({\n type: Events.REASONING_MESSAGE_START,\n messageId: ev.messageId,\n role: \"assistant\",\n visibility: ev.visibility,\n timestamp: Date.now(),\n });\n startedReasoningMessages.add(reasoningKey);\n }\n\n if (\n ev.type === Events.REASONING_MESSAGE_END &&\n reasoningKey &&\n endedReasoningMessages.has(reasoningKey)\n ) {\n continue;\n }\n\n yield ok(ev);\n\n if (\n ev.type === Events.TOOL_CALL_RESULT &&\n startedImageMessages.has(ev.toolCallId) &&\n !endedImageMessages.has(ev.toolCallId)\n ) {\n yield ok({\n type: Events.IMAGE_MESSAGE_END,\n messageId: ev.toolCallId,\n timestamp: Date.now(),\n });\n endedImageMessages.add(ev.toolCallId);\n }\n\n if (ev.type === Events.TOOL_CALL_RESULT && !endedToolCalls.has(ev.toolCallId)) {\n yield ok({\n type: Events.TOOL_CALL_END,\n parentMessageId: messageId,\n toolCallId: ev.toolCallId,\n toolCallName: ev.toolCallName,\n runId: ctx.runId,\n agentName: ctx.agentName,\n toolTarget: \"hosted\",\n timestamp: Date.now(),\n });\n endedToolCalls.add(ev.toolCallId);\n }\n\n if (ev.type === Events.REASONING_MESSAGE_END && reasoningKey) {\n endedReasoningMessages.add(reasoningKey);\n }\n\n if (finalResolved && sawTextEnd) return;\n }\n\n if (!sawFinal) {\n const missingFinal = openaiUpstreamError(\n \"Stream ended without response.completed\",\n { provider: \"openai\", code: \"STREAM_MISSING_FINAL\" },\n ).at({ at: \"openai.generateStream.missingFinal\" });\n yield err(missingFinal);\n rejectFinal(missingFinal);\n return;\n }\n } catch (e) {\n const appErr = BetterAgentError.wrap({\n err: e,\n message: \"OpenAI streaming failed\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n context: { provider: \"openai\", model: String(modelId) },\n },\n }).at({ at: \"openai.generateStream.generator\" });\n yield err(appErr);\n rejectFinal(appErr);\n return;\n }\n })();\n\n return ok({ events, final });\n };\n\n return {\n providerId: \"openai\",\n modelId,\n caps: OPENAI_RESPONSE_CAPS as OpenAICapsFor<M>,\n doGenerate,\n doGenerateStream,\n };\n};\n","import type {\n GenerativeModelCallOptions,\n GenerativeModelOutputItem,\n GenerativeModelResponse,\n ModalitiesParam,\n} from \"@better-agent/core/providers\";\nimport { BetterAgentError } from \"@better-agent/shared/errors\";\nimport type { Result } from \"@better-agent/shared/neverthrow\";\nimport { err, ok } from \"@better-agent/shared/neverthrow\";\nimport { extractPassthroughOptions } from \"../../utils/object-utils\";\nimport type { OpenAICapsFor, OpenAIOptionsFor } from \"../types\";\nimport type { OpenAICreateVideo, OpenAICreateVideoSchema, OpenAIVideoModels } from \"./schemas\";\n\n/**\n * Keys explicitly handled by the OpenAI videos mapper.\n */\nconst OPENAI_VIDEO_KNOWN_KEYS: ReadonlySet<string> = new Set([\n // Framework-managed\n \"input\",\n \"tools\",\n \"toolChoice\",\n \"modalities\",\n \"structured_output\",\n // Explicitly mapped\n \"input_reference\",\n \"seconds\",\n \"size\",\n \"pollIntervalMs\",\n \"pollTimeoutMs\",\n]);\n\nexport function mapToOpenAIVideosRequest<\n M extends OpenAIVideoModels,\n TModalities extends ModalitiesParam<OpenAICapsFor<M>> = undefined,\n>(args: {\n modelId: M;\n options: GenerativeModelCallOptions<OpenAICapsFor<M>, OpenAIOptionsFor<M>, TModalities>;\n}): Result<OpenAICreateVideoSchema, BetterAgentError> {\n try {\n const o = args.options;\n\n let prompt: string | undefined;\n let inputReference: string | undefined = o.input_reference;\n\n if (typeof o.input === \"string\") {\n prompt = o.input;\n } else {\n if (o.input.length !== 1) {\n return err(\n BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n \"Video generation supports a single input item\",\n { context: { provider: \"openai\", model: args.modelId } },\n ).at({\n at: \"openai.videos.map.inputLimit\",\n }),\n );\n }\n\n const item = o.input[0];\n if (!item) {\n return err(\n BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n \"Video generation requires one input item\",\n { context: { provider: \"openai\", model: args.modelId } },\n ).at({\n at: \"openai.videos.map.inputMissing\",\n }),\n );\n }\n\n if (typeof item === \"string\") {\n prompt = item;\n } else if (item.type === \"message\") {\n if (typeof item.content === \"string\") {\n prompt = item.content;\n } else {\n const parts = item.content;\n type MessagePart = (typeof parts)[number];\n\n const text = parts\n .flatMap((part: MessagePart) =>\n part.type === \"text\" && \"text\" in part ? [part.text] : [],\n )\n .join(\"\\n\")\n .trim();\n\n if (text.length > 0) {\n prompt = text;\n }\n\n if (!inputReference) {\n const imagePart = parts.find(\n (part: MessagePart) => part.type === \"image\" && \"source\" in part,\n );\n\n if (imagePart) {\n if (imagePart.source.kind === \"url\") {\n return err(\n BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n \"OpenAI video input_reference requires base64 image data\",\n {\n context: {\n provider: \"openai\",\n model: args.modelId,\n },\n },\n ).at({\n at: \"openai.videos.map.inputReferenceUrlUnsupported\",\n }),\n );\n }\n\n inputReference = imagePart.source.data;\n }\n }\n }\n } else {\n return err(\n BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n \"Video generation only accepts message or text prompt input\",\n {\n context: {\n provider: \"openai\",\n model: args.modelId,\n },\n },\n ).at({\n at: \"openai.videos.map.invalidInputItem\",\n }),\n );\n }\n }\n\n if (typeof prompt !== \"string\" || prompt.trim().length === 0) {\n return err(\n BetterAgentError.fromCode(\n \"VALIDATION_FAILED\",\n \"Video generation requires a text prompt\",\n { context: { provider: \"openai\", model: args.modelId } },\n ).at({\n at: \"openai.videos.map.promptMissing\",\n }),\n );\n }\n\n return ok({\n ...extractPassthroughOptions(o as Record<string, unknown>, OPENAI_VIDEO_KNOWN_KEYS),\n model: args.modelId,\n prompt,\n input_reference: inputReference,\n seconds: o.seconds,\n size: o.size,\n });\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"Failed to map OpenAI Videos request\",\n opts: { code: \"INTERNAL\", context: { provider: \"openai\", model: args.modelId } },\n }).at({\n at: \"openai.videos.mapToRequest\",\n }),\n );\n }\n}\n\nexport function mapFromOpenAIVideosResponse(args: {\n raw: OpenAICreateVideo;\n video?: {\n data: string;\n mimeType: string;\n };\n}): GenerativeModelResponse {\n const output: GenerativeModelOutputItem[] =\n args.video &&\n args.raw.status === \"completed\" &&\n typeof args.video.data === \"string\" &&\n args.video.data.length > 0\n ? [\n {\n type: \"message\",\n role: \"assistant\",\n content: [\n {\n type: \"video\",\n source: {\n kind: \"base64\",\n data: args.video.data,\n mimeType: args.video.mimeType,\n },\n },\n ],\n },\n ]\n : [];\n\n return {\n output,\n finishReason: args.raw.status === \"failed\" ? \"other\" : \"stop\",\n usage: {},\n response: {\n body: args.raw,\n },\n };\n}\n","import type { RunContext } from \"@better-agent/core\";\nimport { Events } from \"@better-agent/core/events\";\nimport type { Event } from \"@better-agent/core/events\";\nimport type {\n GenerativeModelCallOptions,\n GenerativeModelOutputItem,\n GenerativeModelResponse,\n ModalitiesParam,\n} from \"@better-agent/core/providers\";\nimport { BetterAgentError } from \"@better-agent/shared/errors\";\nimport { type Result, err, ok } from \"@better-agent/shared/neverthrow\";\nimport type { createOpenAIClient } from \"../client\";\nimport {\n OPENAI_VIDEO_CAPS,\n collectNonStreamOutputEvents,\n createDeferred,\n openaiUpstreamError,\n} from \"../shared/runtime\";\nimport type { OpenAICapsFor, OpenAIGenerativeModel, OpenAIOptionsFor } from \"../types\";\nimport { mapFromOpenAIVideosResponse, mapToOpenAIVideosRequest } from \"./mappers\";\nimport type { OpenAIVideoModels } from \"./schemas\";\n\nexport const createOpenAIVideoModel = <M extends OpenAIVideoModels>(\n modelId: M,\n client: ReturnType<typeof createOpenAIClient>,\n): OpenAIGenerativeModel<M> => {\n const resolveVideoId = (value: unknown): string | undefined => {\n if (!value || typeof value !== \"object\") return undefined;\n const obj = value as Record<string, unknown>;\n const candidate = obj.id;\n return typeof candidate === \"string\" && candidate.length > 0 ? candidate : undefined;\n };\n\n const doGenerate: NonNullable<OpenAIGenerativeModel<M>[\"doGenerate\"]> = async <\n TModalities extends ModalitiesParam<OpenAICapsFor<M>> = undefined,\n >(\n options: GenerativeModelCallOptions<OpenAICapsFor<M>, OpenAIOptionsFor<M>, TModalities>,\n ctx: RunContext,\n ) => {\n const requestBodyResult = mapToOpenAIVideosRequest({ modelId, options });\n if (requestBodyResult.isErr()) {\n return err(\n requestBodyResult.error.at({\n at: \"openai.generate.mapRequest\",\n data: { modelId, endpoint: \"videos\" },\n }),\n );\n }\n\n const requestBody = requestBodyResult.value;\n const pollIntervalMs = Math.max(250, options.pollIntervalMs ?? 2000);\n const pollTimeoutMs = Math.max(5000, options.pollTimeoutMs ?? 10 * 60 * 1000);\n const startedAt = Date.now();\n\n const sleep = async (ms: number): Promise<void> => {\n await new Promise<void>((resolve, reject) => {\n const timer = setTimeout(() => {\n ctx.signal?.removeEventListener(\"abort\", onAbort);\n resolve();\n }, ms);\n\n const onAbort = () => {\n clearTimeout(timer);\n ctx.signal?.removeEventListener(\"abort\", onAbort);\n reject(\n openaiUpstreamError(\"OpenAI video generation aborted\", {\n provider: \"openai\",\n model: String(modelId),\n code: \"ABORTED\",\n }).at({ at: \"openai.videos.poll.sleep.aborted\" }),\n );\n };\n\n if (ctx.signal) {\n if (ctx.signal.aborted) {\n onAbort();\n return;\n }\n ctx.signal.addEventListener(\"abort\", onAbort, { once: true });\n }\n });\n };\n\n const created = await client.videos.create(requestBody, { signal: ctx.signal ?? null });\n if (created.isErr()) {\n return err(\n created.error\n .at({ at: \"openai.generate.modelContext\", data: { model: String(modelId) } })\n .at({\n at: \"openai.generate.http\",\n data: { modelId, endpoint: \"videos\", path: \"/v1/videos\" },\n }),\n );\n }\n\n let latest = created.value;\n const initialVideoId = resolveVideoId(latest);\n if (!initialVideoId) {\n return err(\n openaiUpstreamError(\"OpenAI video response missing id\", {\n provider: \"openai\",\n model: String(modelId),\n code: \"VIDEO_ID_MISSING\",\n raw: latest,\n }).at({ at: \"openai.videos.create.missingId\" }),\n );\n }\n let videoId = initialVideoId;\n\n while (latest.status === \"queued\" || latest.status === \"in_progress\") {\n if (ctx.signal?.aborted) {\n return err(\n openaiUpstreamError(\"OpenAI video generation aborted\", {\n provider: \"openai\",\n model: String(modelId),\n code: \"ABORTED\",\n }).at({ at: \"openai.videos.poll.aborted\", data: { videoId } }),\n );\n }\n\n if (Date.now() - startedAt > pollTimeoutMs) {\n return err(\n openaiUpstreamError(\"OpenAI video generation timed out\", {\n provider: \"openai\",\n model: String(modelId),\n code: \"VIDEO_POLL_TIMEOUT\",\n }).at({\n at: \"openai.videos.poll.timeout\",\n data: { videoId, timeoutMs: pollTimeoutMs, lastStatus: latest.status },\n }),\n );\n }\n\n try {\n await sleep(pollIntervalMs);\n } catch (e) {\n return err(\n BetterAgentError.wrap({\n err: e,\n message: \"OpenAI video generation aborted\",\n opts: {\n code: \"ABORTED\",\n context: { provider: \"openai\", model: String(modelId) },\n },\n }).at({ at: \"openai.videos.poll.sleep\", data: { videoId } }),\n );\n }\n\n const status = await client.videos.get(videoId, { signal: ctx.signal ?? null });\n if (status.isErr()) {\n return err(\n status.error\n .at({\n at: \"openai.generate.modelContext\",\n data: { model: String(modelId) },\n })\n .at({\n at: \"openai.generate.http\",\n data: { modelId, endpoint: \"videos\", path: `/v1/videos/${videoId}` },\n }),\n );\n }\n latest = status.value;\n videoId = resolveVideoId(latest) ?? videoId;\n }\n\n if (latest.status === \"failed\") {\n return err(\n openaiUpstreamError(latest.error?.message ?? \"OpenAI video generation failed\", {\n provider: \"openai\",\n model: String(modelId),\n code: latest.error?.code ?? \"VIDEO_GENERATION_FAILED\",\n raw: latest,\n }).at({ at: \"openai.videos.poll.failed\", data: { videoId } }),\n );\n }\n\n const videoData = await client.videos.content(videoId, { signal: ctx.signal ?? null });\n if (videoData.isErr()) {\n return err(\n videoData.error\n .at({ at: \"openai.generate.modelContext\", data: { model: String(modelId) } })\n .at({\n at: \"openai.generate.http\",\n data: {\n modelId,\n endpoint: \"videos\",\n path: `/v1/videos/${videoId}/content`,\n },\n }),\n );\n }\n\n const response = mapFromOpenAIVideosResponse({\n raw: latest,\n video: {\n data: Buffer.from(videoData.value.data).toString(\"base64\"),\n mimeType: videoData.value.mimeType,\n },\n });\n return ok({\n response: {\n ...response,\n request: { body: requestBody },\n } satisfies GenerativeModelResponse,\n events: collectNonStreamOutputEvents(response, ctx),\n });\n };\n\n const doGenerateStream: NonNullable<OpenAIGenerativeModel<M>[\"doGenerateStream\"]> = async <\n const TModalities extends ModalitiesParam<OpenAICapsFor<M>>,\n >(\n options: GenerativeModelCallOptions<OpenAICapsFor<M>, OpenAIOptionsFor<M>, TModalities>,\n ctx: RunContext,\n ) => {\n const requestBodyResult = mapToOpenAIVideosRequest({ modelId, options });\n if (requestBodyResult.isErr()) {\n return err(\n requestBodyResult.error.at({\n at: \"openai.generateStream.mapRequest\",\n data: { modelId, endpoint: \"videos\" },\n }),\n );\n }\n\n const requestBody = requestBodyResult.value;\n const pollIntervalMs = Math.max(250, options.pollIntervalMs ?? 2000);\n const pollTimeoutMs = Math.max(5000, options.pollTimeoutMs ?? 10 * 60 * 1000);\n\n const sleep = async (ms: number): Promise<void> => {\n await new Promise<void>((resolve, reject) => {\n const timer = setTimeout(() => {\n ctx.signal?.removeEventListener(\"abort\", onAbort);\n resolve();\n }, ms);\n\n const onAbort = () => {\n clearTimeout(timer);\n ctx.signal?.removeEventListener(\"abort\", onAbort);\n reject(\n openaiUpstreamError(\"OpenAI video generation aborted\", {\n provider: \"openai\",\n model: String(modelId),\n code: \"ABORTED\",\n }).at({ at: \"openai.videos.poll.sleep.aborted\" }),\n );\n };\n\n if (ctx.signal) {\n if (ctx.signal.aborted) {\n onAbort();\n return;\n }\n ctx.signal.addEventListener(\"abort\", onAbort, { once: true });\n }\n });\n };\n\n const {\n promise: final,\n resolve: resolveFinal,\n reject: rejectFinal,\n } = createDeferred<GenerativeModelResponse>();\n\n const events = (async function* (): AsyncGenerator<Result<Event, BetterAgentError>> {\n const startedAt = Date.now();\n const messageId = ctx.generateMessageId();\n let finalResolved = false;\n let started = false;\n\n try {\n const created = await client.videos.create(requestBody, {\n signal: ctx.signal ?? null,\n });\n if (created.isErr()) {\n const appErr = created.error\n .at({\n at: \"openai.generate.modelContext\",\n data: { model: String(modelId) },\n })\n .at({\n at: \"openai.generateStream.http\",\n data: { modelId, endpoint: \"videos\", path: \"/v1/videos\" },\n });\n yield err(appErr);\n rejectFinal(appErr);\n return;\n }\n\n let latest = created.value;\n const initialVideoId = resolveVideoId(latest);\n if (!initialVideoId) {\n const appErr = openaiUpstreamError(\"OpenAI video response missing id\", {\n provider: \"openai\",\n model: String(modelId),\n code: \"VIDEO_ID_MISSING\",\n raw: latest,\n }).at({ at: \"openai.videos.create.missingId\" });\n yield err(appErr);\n rejectFinal(appErr);\n return;\n }\n let videoId = initialVideoId;\n\n yield ok({\n type: Events.DATA_PART,\n id: videoId,\n data: {\n endpoint: \"videos\",\n status: latest.status,\n raw: latest,\n },\n timestamp: Date.now(),\n });\n\n while (latest.status === \"queued\" || latest.status === \"in_progress\") {\n if (ctx.signal?.aborted) {\n const appErr = openaiUpstreamError(\"OpenAI video generation aborted\", {\n provider: \"openai\",\n model: String(modelId),\n code: \"ABORTED\",\n }).at({ at: \"openai.videos.poll.aborted\", data: { videoId } });\n yield err(appErr);\n rejectFinal(appErr);\n return;\n }\n\n if (Date.now() - startedAt > pollTimeoutMs) {\n const appErr = openaiUpstreamError(\"OpenAI video generation timed out\", {\n provider: \"openai\",\n model: String(modelId),\n code: \"VIDEO_POLL_TIMEOUT\",\n }).at({\n at: \"openai.videos.poll.timeout\",\n data: { videoId, timeoutMs: pollTimeoutMs, lastStatus: latest.status },\n });\n yield err(appErr);\n rejectFinal(appErr);\n return;\n }\n\n try {\n await sleep(pollIntervalMs);\n } catch (e) {\n const appErr = BetterAgentError.wrap({\n err: e,\n message: \"OpenAI video generation aborted\",\n opts: {\n code: \"ABORTED\",\n context: { provider: \"openai\", model: String(modelId) },\n },\n }).at({ at: \"openai.videos.poll.sleep\", data: { videoId } });\n yield err(appErr);\n rejectFinal(appErr);\n return;\n }\n\n const status = await client.videos.get(videoId, { signal: ctx.signal ?? null });\n if (status.isErr()) {\n const appErr = status.error\n .at({\n at: \"openai.generate.modelContext\",\n data: { model: String(modelId) },\n })\n .at({\n at: \"openai.generateStream.http\",\n data: {\n modelId,\n endpoint: \"videos\",\n path: `/v1/videos/${videoId}`,\n },\n });\n yield err(appErr);\n rejectFinal(appErr);\n return;\n }\n\n latest = status.value;\n videoId = resolveVideoId(latest) ?? videoId;\n\n yield ok({\n type: Events.DATA_PART,\n id: videoId,\n data: {\n endpoint: \"videos\",\n status: latest.status,\n raw: latest,\n },\n timestamp: Date.now(),\n });\n }\n\n if (latest.status === \"failed\") {\n const appErr = openaiUpstreamError(\n latest.error?.message ?? \"OpenAI video generation failed\",\n {\n provider: \"openai\",\n model: String(modelId),\n code: latest.error?.code ?? \"VIDEO_GENERATION_FAILED\",\n raw: latest,\n },\n ).at({ at: \"openai.videos.poll.failed\", data: { videoId } });\n yield err(appErr);\n rejectFinal(appErr);\n return;\n }\n\n const videoData = await client.videos.content(videoId, {\n signal: ctx.signal ?? null,\n });\n if (videoData.isErr()) {\n const appErr = videoData.error\n .at({\n at: \"openai.generate.modelContext\",\n data: { model: String(modelId) },\n })\n .at({\n at: \"openai.generateStream.http\",\n data: {\n modelId,\n endpoint: \"videos\",\n path: `/v1/videos/${videoId}/content`,\n },\n });\n yield err(appErr);\n rejectFinal(appErr);\n return;\n }\n\n const response = mapFromOpenAIVideosResponse({\n raw: latest,\n video: {\n data: Buffer.from(videoData.value.data).toString(\"base64\"),\n mimeType: videoData.value.mimeType,\n },\n });\n\n const message = response.output.find(\n (item): item is Extract<GenerativeModelOutputItem, { type: \"message\" }> =>\n item.type === \"message\",\n );\n const videoPart =\n message && Array.isArray(message.content)\n ? message.content.find((part) => part.type === \"video\")\n : undefined;\n\n if (videoPart && videoPart.type === \"video\") {\n if (!started) {\n started = true;\n yield ok({\n type: Events.VIDEO_MESSAGE_START,\n messageId,\n role: \"assistant\",\n timestamp: Date.now(),\n });\n }\n\n yield ok({\n type: Events.VIDEO_MESSAGE_CONTENT,\n messageId,\n delta:\n videoPart.source.kind === \"url\"\n ? { kind: \"url\", url: videoPart.source.url }\n : {\n kind: \"base64\",\n data: videoPart.source.data,\n mimeType: videoPart.source.mimeType,\n },\n timestamp: Date.now(),\n });\n\n yield ok({\n type: Events.VIDEO_MESSAGE_END,\n messageId,\n timestamp: Date.now(),\n });\n }\n\n resolveFinal({ ...response, request: { body: requestBody } });\n finalResolved = true;\n return;\n } catch (e) {\n const appErr = BetterAgentError.wrap({\n err: e,\n message: \"OpenAI video streaming failed\",\n opts: {\n code: \"UPSTREAM_FAILED\",\n context: { provider: \"openai\", model: String(modelId) },\n },\n }).at({ at: \"openai.generateStream.generator\" });\n\n if (!finalResolved) rejectFinal(appErr);\n yield err(appErr);\n return;\n }\n })();\n\n return ok({ events, final });\n };\n\n return {\n providerId: \"openai\",\n modelId,\n caps: OPENAI_VIDEO_CAPS as OpenAICapsFor<M>,\n doGenerate,\n doGenerateStream,\n };\n};\n","import { createOpenAIAudioSpeechModel } from \"../audio-speech/model\";\nimport type { OpenAIAudioSpeechModels } from \"../audio-speech/schemas\";\nimport { createOpenAIAudioTranscriptionModel } from \"../audio-transcription/model\";\nimport type { OpenAIAudioTranscriptionModels } from \"../audio-transcription/schemas\";\nimport type { createOpenAIClient } from \"../client/create-client\";\nimport { createOpenAIEmbeddingModel } from \"../embeddings/model\";\nimport type { OpenAIEmbeddingModels } from \"../embeddings/schemas\";\nimport { createOpenAIImagesModel } from \"../images/model\";\nimport type { OpenAIImageModels } from \"../images/schemas\";\nimport { createOpenAIResponsesModel } from \"../responses/model\";\nimport type { OpenAIResponseModels } from \"../responses/schemas\";\nimport {\n isAudioSpeechModel,\n isAudioTranscriptionModel,\n isEmbeddingModel,\n isImageModel,\n isResponseModel,\n isVideoModel,\n} from \"../shared/runtime\";\nimport type {\n OpenAIAudioSpeechGenerativeModel,\n OpenAIAudioSpeechModelId,\n OpenAIEmbeddingGenerativeModel,\n OpenAIEmbeddingModelId,\n OpenAIGenerativeModel,\n OpenAIImageGenerativeModel,\n OpenAIImageModelId,\n OpenAIModelId,\n OpenAIResponseGenerativeModel,\n OpenAIResponseModelId,\n OpenAIRouteHint,\n OpenAIVideoGenerativeModel,\n OpenAIVideoModelId,\n} from \"../types\";\nimport { createOpenAIVideoModel } from \"../videos/model\";\nimport type { OpenAIVideoModels } from \"../videos/schemas\";\n\nexport function createOpenAIGenerativeModel<M extends OpenAIResponseModelId>(\n modelId: M,\n client: ReturnType<typeof createOpenAIClient>,\n routeHint: \"responses\",\n): OpenAIResponseGenerativeModel<M>;\nexport function createOpenAIGenerativeModel<M extends OpenAIImageModelId>(\n modelId: M,\n client: ReturnType<typeof createOpenAIClient>,\n routeHint: \"images\",\n): OpenAIImageGenerativeModel<M>;\nexport function createOpenAIGenerativeModel<M extends OpenAIVideoModelId>(\n modelId: M,\n client: ReturnType<typeof createOpenAIClient>,\n routeHint: \"videos\",\n): OpenAIVideoGenerativeModel<M>;\nexport function createOpenAIGenerativeModel<M extends OpenAIAudioSpeechModelId>(\n modelId: M,\n client: ReturnType<typeof createOpenAIClient>,\n routeHint: \"audio.speech\",\n): OpenAIAudioSpeechGenerativeModel<M>;\nexport function createOpenAIGenerativeModel<M extends OpenAIEmbeddingModelId>(\n modelId: M,\n client: ReturnType<typeof createOpenAIClient>,\n routeHint: \"embeddings\",\n): OpenAIEmbeddingGenerativeModel<M>;\nexport function createOpenAIGenerativeModel<M extends OpenAIModelId>(\n modelId: M,\n client: ReturnType<typeof createOpenAIClient>,\n): OpenAIGenerativeModel<M>;\nexport function createOpenAIGenerativeModel(\n modelId: OpenAIModelId,\n client: ReturnType<typeof createOpenAIClient>,\n routeHint?: OpenAIRouteHint,\n): unknown {\n if (routeHint === \"responses\") {\n return createOpenAIResponsesModel(modelId as OpenAIResponseModels, client);\n }\n\n if (routeHint === \"images\") {\n return createOpenAIImagesModel(modelId as OpenAIImageModels, client);\n }\n\n if (routeHint === \"videos\") {\n return createOpenAIVideoModel(modelId as OpenAIVideoModels, client);\n }\n\n if (routeHint === \"audio.speech\") {\n return createOpenAIAudioSpeechModel(modelId as OpenAIAudioSpeechModels, client);\n }\n\n if (routeHint === \"audio.transcription\") {\n return createOpenAIAudioTranscriptionModel(\n modelId as OpenAIAudioTranscriptionModels,\n client,\n );\n }\n\n if (routeHint === \"embeddings\") {\n return createOpenAIEmbeddingModel(modelId as OpenAIEmbeddingModels, client);\n }\n\n if (isResponseModel(modelId)) {\n return createOpenAIResponsesModel(modelId, client);\n }\n\n if (isImageModel(modelId)) {\n return createOpenAIImagesModel(modelId, client);\n }\n\n if (isVideoModel(modelId)) {\n return createOpenAIVideoModel(modelId, client);\n }\n\n if (isAudioSpeechModel(modelId)) {\n return createOpenAIAudioSpeechModel(modelId, client);\n }\n\n if (isAudioTranscriptionModel(modelId)) {\n return createOpenAIAudioTranscriptionModel(modelId, client);\n }\n\n if (isEmbeddingModel(modelId)) {\n return createOpenAIEmbeddingModel(modelId, client);\n }\n\n return createOpenAIResponsesModel(modelId as OpenAIResponseModels, client);\n}\n","import { createOpenAIAudioTranscriptionModel } from \"./audio-transcription/model\";\nimport { createOpenAIClient as createOpenAIHttpClient } from \"./client\";\nimport { createOpenAIGenerativeModel } from \"./models\";\nimport { createOpenAINativeToolBuilders } from \"./tools\";\nimport type {\n OpenAIAudioSpeechModelId,\n OpenAIAudioTranscriptionModelId,\n OpenAIConfig,\n OpenAIEmbeddingModelId,\n OpenAIImageModelId,\n OpenAIModelId,\n OpenAIProvider,\n OpenAIResponseModelId,\n OpenAIVideoModelId,\n} from \"./types\";\n\nexport const createOpenAI = (config: OpenAIConfig): OpenAIProvider => {\n const httpClient = createOpenAIHttpClient(config);\n const tools = createOpenAINativeToolBuilders();\n\n const provider: OpenAIProvider = {\n id: \"openai\",\n tools,\n files: httpClient.files,\n\n model(modelId: OpenAIModelId) {\n return createOpenAIGenerativeModel(modelId, httpClient);\n },\n\n text(modelId: OpenAIResponseModelId) {\n return createOpenAIGenerativeModel(modelId, httpClient, \"responses\");\n },\n\n image(modelId: OpenAIImageModelId) {\n return createOpenAIGenerativeModel(modelId, httpClient, \"images\");\n },\n\n video(modelId: OpenAIVideoModelId) {\n return createOpenAIGenerativeModel(modelId, httpClient, \"videos\");\n },\n\n audio(modelId: OpenAIAudioSpeechModelId) {\n return createOpenAIGenerativeModel(modelId, httpClient, \"audio.speech\");\n },\n\n transcription(modelId: OpenAIAudioTranscriptionModelId) {\n return createOpenAIAudioTranscriptionModel(modelId, httpClient);\n },\n\n embedding(modelId: OpenAIEmbeddingModelId) {\n return createOpenAIGenerativeModel(modelId, httpClient, \"embeddings\");\n },\n };\n\n return provider;\n};\n"],"mappings":";;;;;;;;;AAEA,MAAa,0BAA0B,EAAE,KAAK;CAAC;CAAmB;CAAS;CAAW,CAAC;AAIvF,MAAa,sBAAsB,EAAE,OAAO;CACxC,OAAO,EACF,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK;EAAC;EAAS;EAAY;EAAkB,CAAC,CAAC,CAAC,CACrE,SACG,8HACH;CACL,OAAO,EACF,QAAQ,CACR,IAAI,KAAK,CACT,SAAS,yEAAyE;CACvF,cAAc,EACT,QAAQ,CACR,IAAI,KAAK,CACT,SACG,oHACH,CACA,UAAU;CACf,OAAO,EACF,MAAM,CACH,EAAE,QAAQ,EACV,EAAE,KAAK;EACH;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACH,CAAC,CACL,CAAC,CACD,SACG,iTACH;CACL,iBAAiB,EACZ,KAAK;EAAC;EAAO;EAAQ;EAAO;EAAQ;EAAO;EAAM,CAAC,CAClD,SACG,gGACH,CACA,QAAQ,MAAM;CACnB,OAAO,EACF,QAAQ,CACR,IAAI,IAAK,CACT,IAAI,EAAE,CACN,SACG,+FACH,CACA,QAAQ,EAAE;CACf,eAAe,EACV,KAAK,CAAC,OAAO,QAAQ,CAAC,CACtB,SACG,gIACH,CACA,QAAQ,QAAQ;CACrB,QAAQ,EACH,MAAM,CAAC,EAAE,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC,CAC9B,SACG,uHACH,CACA,UAAU;CAClB,CAAC;;;;ACnEF,MAAa,iCAAiC,EAAE,KAAK;CACjD;CACA;CACA;CACA;CACH,CAAC;AAIF,MAAa,6BAA6B,EAAE,OAAO;CAC/C,MAAM,EACD,QAAQ,CACR,QAAQ,CACR,SACG,sIACH;CACL,OAAO,EACF,MAAM,CACH,EAAE,QAAQ,EACV,EAAE,KAAK;EACH;EACA;EACA;EAC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ACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACH,CAAC;AAEF,MAAa,6BAA6B,EAAE,aACxC,EAAE,aACE,EAAE,OAAO;CACL,UAAU,EACL,MAAM,CACH,EACK,OAAO,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAC9B,SACG,8UACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;CACf,cAAc,EACT,MAAM,CACH,EACK,QAAQ,CACR,KAAK,CACL,IAAI,EAAE,CACN,IAAI,GAAG,CACP,SACG,wJACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;CACf,aAAa,EACR,MAAM,CACH,EACK,QAAQ,CACR,IAAI,EAAE,CACN,IAAI,EAAE,CACN,SACG,wPACH,CACA,QAAQ,EAAE,EACf,EAAE,MAAM,CACX,CAAC,CACD,UAAU;CACf,OAAO,EACF,MAAM,CACH,EACK,QAAQ,CACR,IAAI,EAAE,CACN,IAAI,EAAE,CACN,SACG,0TACH,CACA,QAAQ,EAAE,EACf,EAAE,MAAM,CACX,CAAC,CACD,UAAU;CAOf,MAAM,EACD,QAAQ,CACR,SACG,6YACH,CACA,UAAU;CAMf,mBAAmB,EACd,QAAQ,CACR,SACG,qYACH,CACA,UAAU;CAKf,kBAAkB,EACb,QAAQ,CACR,SACG,8LACH,CACA,UAAU;CACf,cAAc,EACT,MAAM,CACH,EACK,KAAK;EAAC;EAAQ;EAAW;E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,EACJ,MACG,EAAE,MAAM,CACJ,EACK,OAAO;KAEJ,MAAM,EACD,QAAQ,cAAc,CACtB,SACG,qDACH,CACA,QAAQ,cAAc;KAE3B,MAAM,EACD,QAAQ,CACR,SACG,kCACH;KAEL,aAAa,EACR,MACG,EAAE,MAAM;MACJ,EACK,OAAO;OAEJ,MAAM,EACD,QACG,gBACH,CACA,SACG,yDACH,CACA,QACG,gBACH;OAEL,SAAS,EACJ,QAAQ,CACR,SACG,sBACH;OAEL,OAAO,EACF,QAAQ,CACR,KAAK,CACL,SACG,8CACH;OAEL,UAAU,EACL,QAAQ,CACR,SACG,kCACH;OACR,CAAC,CACD,SACG,wBACH;MACL,EACK,OAAO;OAEJ,MAAM,EACD,QACG,eACH,CACA,SACG,uDACH,CACA,QACG,eACH;OAEL,KAAK,EACA,QAAQ,CACR,SACG,+BACH;OAEL,aACI,EACK,QAAQ,CACR,KAAK,CACL,SACG,uEACH;OAET,WAAW,EACN,QAAQ,CACR,KAAK,CACL,SACG,sEACH;OAEL,OAAO,EACF,QAAQ,CACR,SACG,iCACH;OACR,CAAC,CACD,SACG,mEACH;MACL,EACK,OAAO;OAEJ,MAAM,EACD,QACG,0BACH,CACA,SACG,6EACH,CACA,QACG,0BACH;OAEL,cACI,EACK,QAAQ,CACR,SACG,gCACH;OAET,SAAS,EACJ,QAAQ,CACR,SACG,sBACH;OAEL,aACI,EACK,QAAQ,CACR,KAAK,CACL,SACG,kFACH;OAET,WAAW,EACN,QAAQ,CACR,KAAK,CACL,SACG,iFACH;OAEL,UAAU,EACL,QAAQ,CACR,SACG,4CACH;OACR,CAAC,CACD,SACG,qEACH;MACL,EACK,OAAO;OAKJ,MAAM,EACD,QACG,YACH,CACA,SACG,mDACH;OAKL,SAAS,EACJ,QAAQ,CACR,SACG,wBACH;OAKL,OAAO,EACF,QAAQ,CACR,KAAK,CACL,SACG,gDACH;OACR,CAAC,CACD,SACG,sBACH;MACR,CAAC,CACL,CACA,SACG,sCACH;KACL,UAAU,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C,CACD,UAAU;KACf,SAAS,EACJ,MAAM,CACH,EACK,QAAQ,CACR,SACG,0CACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;KAClB,CAAC,CACD,SACG,gDACH,CACR,CACA,SACG,qDACH;IAML,QAAQ,EACH,KAAK;KACF;KACA;KACA;KACH,CAAC,CACD,SACG,4HACH;IACR,CAAC,CACD,SACG,wJACH;GACL,EACK,OAAO;IACJ,IAAI,EACC,MAAM,CACH,EACK,QAAQ,CACR,SACG,2CACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IAEf,SAAS,EACJ,QAAQ,CACR,IAAI,EAAE,CACN,IAAI,GAAG,CACP,SACG,6DACH;IAEL,MAAM,EACD,QAAQ,uBAAuB,CAC/B,SACG,4EACH,CACA,QAAQ,uBAAuB;IAKpC,QAAQ,EACH,OAAO;KAMJ,MAAM,EACD,QAAQ,sBAAsB,CAC9B,SACG,iHACH,CACA,QAAQ,sBAAsB;KAEnC,WAAW,EACN,QAAQ,CACR,SACG,mCACH,CACA,UAAU;KAEf,SAAS,EACJ,QAAQ,CACR,SACG,mEACH,CACA,UAAU;KAClB,CAAC,CACD,SACG,iEACH;IACL,4BAA4B,EACvB,MAAM,CACH,EACK,MACG,EACK,OAAO;KAEJ,IAAI,EACC,QAAQ,CACR,SACG,sCACH;KACL,MAAM,EACD,MAAM,CACH,EACK,QAAQ,CACR,SACG,wCACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;KACf,SAAS,EACJ,MAAM,CACH,EACK,QAAQ,CACR,SACG,0CACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;KAClB,CAAC,CACD,SACG,gDACH,CACR,CACA,SACG,sFACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IACf,QAAQ,EACH,MAAM,CACH,EACK,KAAK;KACF;KACA;KACA;KACH,CAAC,CACD,SACG,wIACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IAClB,CAAC,CACD,SAA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,CAAC,CACD,UAAU;MACf,WAAW,EACN,MAAM,CACH,EACK,QAAQ,CACR,IAAI,SAAS,CACb,SACG,+DACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;MACf,UAAU,EACL,MAAM,CACH,EACK,QAAQ,CACR,SACG,+CACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;MAClB,CAAC,CACD,SACG,6BACH;KACR,CAAC,CACL,CACJ,CAAC,CACD,SACG,yDACH;IACL,QAAQ,EACH,MAAM,CACH,EACK,KAAK;KACF;KACA;KACA;KACH,CAAC,CACD,SACG,yHACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IAClB,CAAC,CACD,SAAS,sCAAsC;GACpD,EACK,OAAO;IAKJ,MAAM,EACD,QAAQ,YAAY,CACpB,SACG,gDACH;IAKL,IAAI,EACC,QAAQ,CACR,SACG,oDACH;IACL,mBAAmB,EACd,MAAM,CACH,EACK,QAAQ,CACR,SACG,yJACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IAKf,SAAS,EACJ,MACG,EACK,OAAO;KAEJ,MAAM,EACD,QAAQ,eAAe,CACvB,SACG,iDACH,CACA,QAAQ,eAAe;KAE5B,MAAM,EACD,QAAQ,CACR,SACG,2DACH;KACR,CAAC,CACD,SACG,iCACH,CACR,CACA,SAAS,+BAA+B;IAK7C,SAAS,EACJ,MACG,EACK,OAAO;KAEJ,MAAM,EACD,QAAQ,iBAAiB,CACzB,SACG,2DACH,CACA,QAAQ,iBAAiB;KAE9B,MAAM,EACD,QAAQ,CACR,SACG,qCACH;KACR,CAAC,CACD,SACG,iCACH,CACR,CACA,SAAS,4BAA4B,CACrC,UAAU;IAMf,QAAQ,EACH,KAAK;KACF;KACA;KACA;KACH,CAAC,CACD,SACG,4HACH,CACA,UAAU;IAClB,CAAC,CACD,SACG,mTACH;GACL,EACK,OAAO;IACJ,IAAI,EACC,MAAM,CACH,EACK,QAAQ,CACR,SACG,iCACH,EACL,EAAE,MAAM,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KL,IAAI,EACC,QAAQ,CACR,SACG,yEACH,CACA,UAAU;IAKf,SAAS,EACJ,QAAQ,CACR,SACG,iFACH;IAML,QAAQ,EACH,MAAM,CACH,EACK,QAAQ,CACR,SACG,oDACH,EACL,EACK,MACG,EAAE,MAAM;KACJ,EACK,OAAO;MAEJ,MAAM,EACD,QACG,aACH,CACA,SACG,mDACH,CACA,QACG,aACH;MAEL,MAAM,EACD,QAAQ,CACR,SACG,+BACH;MACR,CAAC,CACD,SACG,6BACH;KACL,EACK,OAAO;MAEJ,MAAM,EACD,QACG,cACH,CACA,SACG,oDACH,CACA,QACG,cACH;MACL,WAAW,EACN,MAAM,CACH,EACK,QAAQ,CACR,SACG,6GACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;MACf,SAAS,EACJ,MAAM,CACH,EACK,QAAQ,CACR,SACG,8CACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;MAEf,QAAQ,EACH,KAAK;OACF;OACA;OACA;OACH,CAAC,CACD,SACG,8GACH;MACR,CAAC,CACD,SACG,2GACH;KACL,EACK,OAAO;MAEJ,MAAM,EACD,QACG,aACH,CACA,SACG,mDACH,CACA,QACG,aACH;MACL,SAAS,EACJ,MAAM,CACH,EACK,QAAQ,CACR,SACG,8CACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;MAEf,UAAU,EACL,QAAQ,CACR,SACG,gDACH,CACA,UAAU;MAEf,UAAU,EACL,QAAQ,CACR,SACG,+CACH,CACA,UAAU;MAKf,WAAW,EACN,QAAQ,CACR,SACG,qDACH,CACA,UAAU;MAClB,CAAC,CACD,SACG,6BACH;KACR,CAAC,CACL,CACA,SACG,yDACH,CACR,CAAC,CACD,SACG,gHACH;IACR,CAAC,CACD,SACG,mFACH;GACL,EACK,OAAO;IAKJ,MAAM,EACD,QAAQ,mBAAmB,CAC3B,SACG,iEACH;IAKL,IAAI,EACC,QAAQ,CACR,SACG,kEACH,CACA,UAAU;IAKf,SAAS,EACJ,QAAQ,CACR,SACG,2EACH;IAKL,MAAM,EACD,QAAQ,CACR,SACG,8CACH;IAKL,OAAO,EACF,QAAQ,CACR,SACG,+DACH;IACR,CAAC,CACD,SACG,kDACH;GACR,CAAC,CAED,SACG,yMACH;EACL,EACK,OAAO;GACJ,MAAM,EACD,MAAM,CACH,EACK,QAAQ,iBAAiB,CACzB,SACG,0DACH,CACA,QAAQ,iBAAiB,EAC9B,EAAE,MAAM,CACX,CAAC,CACD,UAAU;GAEf,IAAI,EAAE,QAAQ,CAAC,SAAS,mCAAmC;GAC9D,CAAC,CACD,SAAS,mDAAmD;EACpE,CAAC,CACL,CACA,SACG,yFACH,CACR,CAAC,CACD,SACG,+cACH,CACA,UAAU;CACf,SAAS,EACJ,MAAM,CACH,EACK,MACG,EACK,KAAK;EACF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACH,CAAC,CACD,SACG,29BACH,CACR,CACA,SACG,29BACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;CACf,qBAAqB,EAChB,MAAM,CACH,EACK,SAAS,CACT,SAAS,8DAA8D,CACvE,QAAQ,KAAK,EAClB,EAAE,MAAM,CACX,CAAC,CACD,UAAU;CACf,OAAO,EACF,MAAM,CACH,EACK,SAAS,CACT,SACG,gFACH,CACA,QAAQ,KAAK,EAClB,EAAE,MAAM,CACX,CAAC,CACD,UAAU;CACf,cAAc,EACT,MAAM,CACH,EACK,QAAQ,CACR,SACG,qSACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;CACf,QAAQ,EACH,MAAM,CACH,EACK,SAAS,CACT,SACG,2WACH,CACA,QAAQ,MAAM,EACnB,EAAE,MAAM,CACX,CAAC,CACD,UAAU;CACf,gBAAgB,EACX,MAAM,CACH,EACK,OAAO,EAWJ,qBAAqB,EAChB,SAAS,CACT,SACG,6dACH,CACA,UAAU,EAClB,CAAC,CACD,SACG,gFACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;CACf,cAAc,EACT,MAAM,C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ACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;CAClB,CAAC,EACF,EAAE,aACE,EAAE,OAAO;CACL,sBAAsB,EACjB,MAAM,CACH,EACK,QAAQ,CACR,SACG,8PACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;CAQf,OAAO,EACF,MAAM,CACH,EAAE,MAAM,CACJ,EAAE,QAAQ,EACV,EAAE,KAAK;EACH;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACH,CAAC,CACL,CAAC,EACF,EAAE,KAAK;EACH;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACH,CAAC,CACL,CAAC,CACD,SACG,mSACH,CACA,UAAU;CACf,WAAW,EACN,MAAM,CACH,EACK,OAAO;EACJ,QAAQ,EACH,MAAM,CACH,EACK,KAAK;GAAC;GAAQ;GAAW;GAAO;GAAU;GAAQ;GAAQ,CAAC,CAC3D,SACG,gwBACH,CACA,QAAQ,SAAS,EACtB,EAAE,MAAM,CACX,CAAC,CACD,UAAU;EACf,SAAS,EACJ,MAAM,CACH,EACK,KAAK;GAAC;GAAQ;GAAW;GAAW,CAAC,CACrC,SACG,sPACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;EACf,kBAAkB,EACb,MAAM,CACH,EACK,KAAK;GAAC;GAAQ;GAAW;GAAW,CAAC,CACrC,SACG,8NACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;EAClB,CAAC,CACD,SACG,4IACH,EACL,EAAE,MAAM,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IACL,EACK,OAAO;KAEJ,MAAM,EACD,QAAQ,aAAa,CACrB,SACG,mDACH,CACA,QAAQ,aAAa;KAC1B,SAAS,EACJ,MAAM,CACH,EACK,QAAQ,CACR,SACG,8CACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;KAEf,UAAU,EACL,QAAQ,CACR,SACG,gDACH,CACA,UAAU;KAEf,UAAU,EACL,QAAQ,CACR,SACG,+CACH,CACA,UAAU;KAKf,WAAW,EACN,QAAQ,CACR,SACG,qDACH,CACA,UAAU;KAClB,CAAC,CACD,SACG,6BACH;IACR,CAAC,CACL,CACA,SACG,0FACH,CACR,CAAC,CACD,SACG,2HACH;GAKL,MAAM,EACD,QAAQ,UAAU,CAClB,SACG,qDACH,CACA,UAAU;GAClB,CAAC,CACD,SACG,kUACH;EACL,EACK,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,CAC/B,IACG,EAAE,MAAM;GACJ,EACK,OAAO;IAKJ,MAAM,EACD,QAAQ,UAAU,CAClB,SACG,4DACH,CACA,UAAU;IAKf,MAAM,EACD,KAAK;KAAC;KAAQ;KAAU;KAAY,CAAC,CACrC,SACG,4EACH;IAML,QAAQ,EACH,KAAK;KACF;KACA;KACA;KACH,CAAC,CACD,SACG,wHACH,CACA,UAAU;IAMf,SAAS,EACJ,MACG,EAAE,MAAM;KACJ,EACK,OAAO;MAEJ,MAAM,EACD,QACG,aACH,CACA,SACG,mDACH,CACA,QACG,aACH;MAEL,MAAM,EACD,QAAQ,CACR,SACG,+BACH;MACR,CAAC,CACD,SACG,6BACH;KACL,EACK,OAAO;MAEJ,MAAM,EACD,QACG,cACH,CACA,SACG,oDACH,CACA,QACG,cACH;MACL,WAAW,EACN,MAAM,CACH,EACK,QAAQ,CACR,SACG,6GACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;MACf,SAAS,EACJ,MAAM,CACH,EACK,QAAQ,CACR,SACG,8CACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;MAEf,QAAQ,EACH,KAAK;OACF;OACA;OACA;OACH,CAAC,CACD,SACG,8GACH;MACR,CAAC,CACD,SACG,2GACH;KACL,EACK,OAAO;MAEJ,MAAM,EACD,QACG,aACH,CACA,SACG,mDACH,CACA,QACG,aACH;MACL,SAAS,EACJ,MAAM,CACH,EACK,QAAQ,CACR,SACG,8CACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;MAEf,UAAU,EACL,QAAQ,CACR,SACG,gDACH,CACA,UAAU;MAEf,UAAU,EACL,QAAQ,CACR,SACG,+CACH,CACA,UAAU;MAKf,WAAW,EACN,QAAQ,CACR,SACG,qDACH,CACA,UAAU;MAClB,CAAC,CACD,SACG,6BACH;KACR,CAAC,CACL,CACA,SACG,0FACH;IACR,CAAC,CACD,SACG,kNACH;GACL,EACK,OAAO;IAKJ,IAAI,EACC,QAAQ,CACR,SACG,yCACH;IAKL,MAAM,EACD,QAAQ,UAAU,CAClB,SACG,sDACH;IAKL,MAAM,EACD,QAAQ,YAAY,CACpB,SACG,wDACH;IAKL,SAAS,EACJ,MACG,EAAE,MAAM,CACJ,EACK,OAAO;KAEJ,MAAM,EACD,QACG,cACH,CACA,SACG,qDACH,CACA,QACG,cACH;KAEL,MAAM,EACD,QAAQ,CACR,SACG,kCACH;KAEL,aAAa,EACR,MACG,EAAE,MAAM;MACJ,EACK,OACG;OAEI,MAAM,EACD,QACG,gBACH,CACA,SACG,yDACH,CACA,QACG,gBACH;OAEL,SACI,EACK,QAAQ,CACR,SACG,sBACH;OAET,OAAO,EACF,QAAQ,CACR,KAAK,CACL,SACG,8CACH;OAEL,UACI,EACK,QAAQ,CACR,SACG,kCACH;OACZ,CACJ,CACA,SACG,wBACH;MACL,EACK,OACG;OAEI,MAAM,EACD,QACG,eACH,CACA,SACG,uDACH,CACA,QACG,eACH;OAEL,KAAK,EACA,QAAQ,CACR,SACG,+BACH;OAEL,aACI,EACK,QAAQ,CACR,KAAK,CACL,SACG,uEACH;OAET,WACI,EACK,QAAQ,CACR,KAAK,CACL,SACG,sEACH;OAET,OAAO,EACF,QAAQ,CACR,SACG,iCACH;OACR,CACJ,CACA,SACG,mEACH;MACL,EACK,OACG;OAEI,MAAM,EACD,QACG,0BACH,CACA,SACG,6EACH,CACA,QACG,0BACH;OAEL,cACI,EACK,QAAQ,CACR,SACG,gCACH;OAET,SACI,EACK,QAAQ,CACR,SACG,sBACH;OAET,aACI,EACK,QAAQ,CACR,KAAK,CACL,SACG,kFACH;OAET,WACI,EACK,QAAQ,CACR,KAAK,CACL,SACG,iFACH;OAET,UACI,EACK,QAAQ,CACR,SACG,4CACH;OACZ,CACJ,CACA,SACG,qEACH;MACL,EACK,OACG;OAKI,MAAM,EACD,QACG,YACH,CACA,SACG,mDACH;OAKL,SACI,EACK,QAAQ,CACR,SACG,wBACH;OAKT,OAAO,EACF,QAAQ,CACR,KAAK,CACL,SACG,gDACH;OACR,CACJ,CACA,SACG,sBACH;MACR,CAAC,CACL,CACA,SACG,sCACH;KACL,UAAU,EACL,MACG,EACK,OAAO;MACJ,OAAO,EAAE,QAAQ;MACjB,SACI,EAAE,QAAQ;MACd,OAAO,EAAE,MACL,EACK,QAAQ,CACR,KAAK,CACb;MACD,cACI,EAAE,MACE,EACK,OACG;OACI,OAAO,EAAE,QAAQ;OACjB,SACI,EAAE,QAAQ;OACd,OAAO,EAAE,MACL,EACK,QAAQ,CACR,KAAK,CACb;OACJ,CACJ,CACA,SACG,sCACH,CACR;MACR,CAAC,CACD,SACG,kCACH,CACR,CACA,UAAU;KAClB,CAAC,CACD,SACG,gCACH,EACL,EACK,OAAO;KAEJ,MAAM,EACD,QAAQ,UAAU,CAClB,SACG,6CACH,CACA,QAAQ,UAAU;KAEvB,SAAS,EACJ,QAAQ,CACR,SACG,0CACH;KACR,CAAC,CACD,SACG,4BACH,CACR,CAAC,CACL,CACA,SACG,uCACH;IAML,QAAQ,EACH,KAAK;KACF;KACA;KACA;KACH,CAAC,CACD,SACG,2IACH;IACR,CAAC,C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ACA,UAAU;KAEf,SAAS,EACJ,QAAQ,CACR,SACG,mEACH,CACA,UAAU;KAClB,CAAC,CACD,SACG,iEACH;IACL,4BAA4B,EACvB,MAAM,CACH,EACK,MACG,EACK,OAAO;KAEJ,IAAI,EACC,QAAQ,CACR,SACG,sCACH;KACL,MAAM,EACD,MAAM,CACH,EACK,QAAQ,CACR,SACG,wCACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;KACf,SAAS,EACJ,MAAM,CACH,EACK,QAAQ,CACR,SACG,0CACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;KAClB,CAAC,CACD,SACG,gDACH,CACR,CACA,SACG,sFACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IACf,QAAQ,EACH,MAAM,CACH,EACK,KAAK;KACF;KACA;KACA;KACH,CAAC,CACD,SACG,wIACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IAClB,CAAC,CACD,SACG,sCACH;GACL,EACK,OAAO;IAKJ,IAAI,EACC,QAAQ,CACR,SACG,+CACH;IAKL,MAAM,EACD,QAAQ,kBAAkB,CAC1B,SACG,oEACH;IAKL,QAAQ,EACH,KAAK;KACF;KACA;KACA;KACA;KACH,CAAC,CACD,SACG,4CACH;IAML,QAAQ,EACH,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,CAC/B,IACG,EAAE,MAAM;KACJ,EACK,OAAO;MAKJ,MAAM,EACD,QAAQ,SAAS,CACjB,SACG,qBACH;MAKL,OAAO,EACF,QAAQ,CACR,SACG,sBACH;MAKL,SAAS,EACJ,MACG,EACK,OAAO;OAKJ,MAAM,EACD,QACG,MACH,CACA,SACG,sCACH;OAKL,KAAK,EACA,QAAQ,CACR,SACG,2BACH;OACR,CAAC,CACD,SACG,iCACH,CACR,CACA,SACG,oCACH,CACA,UAAU;MAClB,CAAC,CACD,SACG,0DACH;KACL,EACK,OAAO;MAKJ,MAAM,EACD,QACG,YACH,CACA,SACG,qBACH;MAKL,KAAK,EACA,QAAQ,CACR,KAAK,CACL,SACG,iCACH;MACR,CAAC,CACD,SACG,0EACH;KACL,EACK,OAAO;MAKJ,MAAM,EACD,QAAQ,OAAO,CACf,SACG,qBACH;MAKL,KAAK,EACA,QAAQ,CACR,KAAK,CACL,SACG,kDACH;MAKL,SAAS,EACJ,QAAQ,CACR,SACG,uDACH;MACR,CAAC,CACD,SACG,uEACH;KACR,CAAC,CACL,CACA,SACG,uJACH;IACR,CAAC,CACD,SACG,uJACH;GACL,EACK,OAAO;IAKJ,IAAI,EACC,QAAQ,CACR,SACG,6CACH,CACA,UAAU;IAKf,MAAM,EACD,QAAQ,gBAAgB,CACxB,SACG,gEACH;IAKL,SAAS,EACJ,QAAQ,CACR,SACG,oEACH;IAKL,MAAM,EACD,QAAQ,CACR,SACG,qCACH;IAKL,WAAW,EACN,QAAQ,CACR,SACG,4DACH;IAML,QAAQ,EACH,KAAK;KACF;KACA;KACA;KACH,CAAC,CACD,SACG,4HACH,CACA,UAAU;IAClB,CAAC,CACD,SACG,sJACH;GACL,EACK,OAAO;IACJ,IAAI,EACC,MAAM,CACH,EACK,QAAQ,CACR,SACG,gGACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IAEf,SAAS,EACJ,QAAQ,CACR,IAAI,EAAE,CACN,IAAI,GAAG,CACP,SACG,kEACH;IAEL,MAAM,EACD,QAAQ,uBAAuB,CAC/B,SACG,4EACH,CACA,QAAQ,uBAAuB;IAEpC,QAAQ,EACH,MAAM,CACH,EACK,QAAQ,CACR,IAAI,SAAS,CACb,SACG,yDACH,EACL,EAAE,MACE,EAAE,MAAM;KACJ,EACK,OAAO;MAEJ,MAAM,EACD,QACG,aACH,CACA,SACG,mDACH,CACA,QACG,aACH;MAEL,MAAM,EACD,QAAQ,CACR,IAAI,SAAS,CACb,SACG,+BACH;MACR,CAAC,CACD,SACG,6BACH;KACL,EACK,OAAO;MAEJ,MAAM,EACD,QACG,cACH,CACA,SACG,oDACH,CACA,QACG,cACH;MACL,WAAW,EACN,MAAM,CACH,EACK,QAAQ,CACR,IACG,SACH,CACA,SACG,6GACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;MACf,SAAS,EACJ,MAAM,CACH,EACK,QAAQ,CACR,SACG,8CACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;MACf,QAAQ,EACH,MAAM,CACH,EACK,KAAK;OACF;OACA;OACA;OACH,CAAC,CACD,SACG,8GACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;MAClB,CAAC,CACD,SACG,0GACH;KACL,EACK,OAAO;MAEJ,MAAM,EACD,QACG,aACH,CACA,SACG,mDACH,CACA,QACG,aACH;MACL,SAAS,EACJ,MAAM,CACH,EACK,QAAQ,CACR,SACG,8CACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;MACf,UAAU,EACL,MAAM,CACH,EACK,QAAQ,CACR,SACG,gDACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;MACf,WAAW,EACN,MAAM,CACH,EACK,QAAQ,CACR,IACG,SACH,CACA,SACG,+DACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;MACf,UAAU,EACL,MAAM,CACH,EACK,QAAQ,CACR,SACG,+CACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;MAClB,CAAC,CACD,SACG,6BACH;KACR,CAAC,CACL,CACJ,CAAC,CACD,SACG,yDACH;IACL,QAAQ,EACH,MAAM,CACH,EACK,KAAK;KACF;KACA;KACA;KACH,CAAC,CACD,SACG,yHACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IAClB,CAAC,CACD,SACG,sCACH;GACL,EACK,OAAO;IAKJ,MAAM,EACD,QAAQ,YAAY,CACpB,SACG,gDACH;IAKL,IAAI,EACC,QAAQ,CACR,SACG,oDACH;IACL,mBAAmB,EACd,MAAM,CACH,EACK,QAAQ,CACR,SACG,yJACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IAKf,SAAS,EACJ,MACG,EACK,OAAO;KAEJ,MAAM,EACD,QAAQ,eAAe,CACvB,SACG,iDACH,CACA,QACG,eACH;KAEL,MAAM,EACD,QAAQ,CACR,SACG,2DACH;KACR,CAAC,CACD,SACG,iCACH,CACR,CACA,SACG,+BACH;IAKL,SAAS,EACJ,MACG,EACK,OAAO;KAEJ,MAAM,EACD,QACG,iBACH,CACA,SACG,2DACH,CACA,QACG,iBACH;KAEL,MAAM,EACD,QAAQ,CACR,SACG,qCACH;KACR,CAAC,CACD,SACG,iCACH,CACR,CACA,SAAS,4BAA4B,CACrC,UAAU;IAMf,QAAQ,EACH,KAAK;KACF;KACA;KACA;KACH,CAAC,CACD,SACG,4HACH,CACA,UAAU;IAClB,CAAC,CACD,SACG,mTACH;GACL,EACK,OAAO;IACJ,IAAI,EACC,MAAM,CACH,EACK,QAAQ,CACR,SACG,iCACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IAEf,MAAM,EACD,QAAQ,aAAa,CACrB,SACG,6CACH,CACA,QAAQ,aAAa;IAC1B,mBAAmB,EAAE,QAAQ,CAAC,IAAI,SAAS;IAC9C,CAAC,CACD,SACG,qIACH;GACL,EACK,OAAO;IAKJ,MAAM,EACD,QAAQ,wBAAwB,CAChC,SACG,2EACH;IAKL,IAAI,EACC,QAAQ,CACR,SACG,gDACH;IAKL,QAAQ,EACH,KAAK;KACF;KACA;KACA;KACA;KACH,CAAC,CACD,SACG,6CACH;IACL,QAAQ,EAAE,MAAM,CACZ,EACK,QAAQ,CACR,SACG,2CACH,EACL,EAAE,MAAM,CACX,CAAC;IACL,CAAC,CACD,SACG,mDACH;GACL,EACK,OAAO;IAKJ,MAAM,EACD,QAAQ,wBAAwB,CAChC,SACG,gFACH,CACA,QAAQ,wBAAwB;IAKrC,IAAI,EACC,QAAQ,CACR,SACG,qDACH;IAKL,QAAQ,EACH,KAAK;KACF;KACA;KACA;KACA;KACA;KACH,CAAC,CACD,SACG,2IACH;IAKL,cAAc,EACT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L,QAAQ,EACH,KAAK;KACF;KACA;KACA;KACH,CAAC,CACD,SACG,wCACH;IACR,CAAC,CACD,SACG,qDACH;GACL,EACK,OAAO;IAKJ,MAAM,EACD,QAAQ,0BAA0B,CAClC,SACG,oFACH;IAKL,IAAI,EACC,QAAQ,CACR,SACG,uEACH;IAKL,QAAQ,EACH,QAAQ,CACR,SACG,8DACH;IACL,QAAQ,EACH,MAAM,CACH,EACK,KAAK;KACF;KACA;KACA;KACH,CAAC,CACD,SACG,gFACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IAClB,CAAC,CACD,SACG,2CACH;GACL,EACK,OAAO;IACJ,IAAI,EACC,MAAM,CACH,EACK,QAAQ,CACR,SACG,sFACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IAEf,SAAS,EACJ,QAAQ,CACR,IAAI,EAAE,CACN,IAAI,GAAG,CACP,SACG,+DACH;IAEL,MAAM,EACD,QAAQ,aAAa,CACrB,SACG,6CACH,CACA,QAAQ,aAAa;IAE1B,QAAQ,EACH,OAAO;KAEJ,UAAU,EACL,MAAM,EAAE,QAAQ,CAAC,CACjB,SACG,+DACH;KACL,YAAY,EACP,MAAM,CACH,EACK,QAAQ,CACR,KAAK,CACL,SACG,8EACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;KACf,mBAAmB,EACd,MAAM,CACH,EACK,QAAQ,CACR,KAAK,CACL,SACG,wFACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;KAClB,CAAC,CACD,SACG,wEACH;IACL,QAAQ,EACH,MAAM,CACH,EACK,KAAK;KACF;KACA;KACA;KACH,CAAC,CACD,SACG,oFACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IAClB,CAAC,CACD,SACG,uEACH;GACL,EACK,OAAO;IACJ,IAAI,EACC,MAAM,CACH,EACK,QAAQ,CACR,SACG,6FACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IAEf,SAAS,EACJ,QAAQ,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H,EACK,QAAQ,CACR,SACG,iCACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;KAKf,cAAc,EACT,OACG,EAAE,QAAQ,EACV,EAAE,SAAS,CACd,CACA,SACG,iDACH;KACL,aAAa,EACR,MAAM,CACH,EACK,OACG,EAAE,QAAQ,EACV,EAAE,SAAS,CACd,CACA,SACG,2CACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;KAClB,CAAC,CACD,SACG,uCACH,CACR,CACA,SACG,uCACH;IACL,OAAO,EACF,MAAM,CACH,EACK,QAAQ,CACR,SACG,sDACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IAClB,CAAC,CACD,SACG,gDACH;GACL,EACK,OAAO;IAKJ,MAAM,EACD,QAAQ,uBAAuB,CAC/B,SACG,yDACH;IAKL,IAAI,EACC,QAAQ,CACR,SACG,2CACH;IAKL,cAAc,EACT,QAAQ,CACR,SACG,oDACH;IAKL,MAAM,EACD,QAAQ,CACR,SACG,iCACH;IAKL,WAAW,EACN,QAAQ,CACR,SACG,6CACH;IACR,CAAC,CACD,SACG,uDACH;GACL,EACK,OAAO;IAKJ,MAAM,EACD,QAAQ,wBAAwB,CAChC,SACG,0DACH;IACL,IAAI,EACC,MAAM,CACH,EACK,QAAQ,CACR,SACG,2CACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IAKf,qBAAqB,EAChB,QAAQ,CACR,SACG,mDACH;IAKL,SAAS,EACJ,SAAS,CACT,SACG,sCACH;IACL,QAAQ,EACH,MAAM,CACH,EACK,QAAQ,CACR,SACG,sCACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IAClB,CAAC,CACD,SACG,2CACH;GACL,EACK,OAAO;IAKJ,MAAM,EACD,QAAQ,WAAW,CACnB,SACG,6CACH;IAKL,IAAI,EACC,QAAQ,CACR,SACG,oCACH;IAKL,cAAc,EACT,QAAQ,CACR,SACG,kDACH;IAKL,MAAM,EACD,QAAQ,CACR,SACG,uCACH;IAKL,WAAW,EACN,QAAQ,CACR,SACG,uDACH;IACL,QAAQ,EACH,MAAM,CACH,EACK,QAAQ,CACR,SACG,mCACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IACf,OAAO,EACF,MAAM,CACH,EACK,QAAQ,CACR,SACG,0CACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IAKf,QAAQ,EACH,KAAK;KACF;KACA;KACA;KACA;KACA;KACH,CAAC,CACD,SACG,0GACH,CACA,UAAU;IACf,qBAAqB,EAChB,MAAM,CACH,EACK,QAAQ,CACR,SACG,kLACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;IAClB,CAAC,CACD,SACG,8CACH;GACL,EACK,OAAO;IAKJ,MAAM,EACD,QAAQ,0BAA0B,CAClC,SACG,+EACH;IAKL,IAAI,EACC,QAAQ,CACR,SACG,yEACH,CACA,UAAU;IAKf,SAAS,EACJ,QAAQ,CACR,SACG,iFACH;IAML,QAAQ,EACH,MAAM,CACH,EACK,QAAQ,CACR,SACG,oDACH,EACL,EACK,MACG,EAAE,MAAM;KACJ,EACK,OAAO;MAEJ,MAAM,EACD,QACG,aACH,CACA,SACG,mDACH,CACA,QACG,aACH;MAEL,MAAM,EACD,QAAQ,CACR,SACG,+BACH;MACR,CAAC,CACD,SACG,6BACH;KACL,EACK,OAAO;MAEJ,MAAM,EACD,QACG,cACH,CACA,SACG,oDACH,CACA,QACG,cACH;MACL,WAAW,EACN,MAAM,CACH,EACK,QAAQ,CACR,SACG,6GACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;MACf,SAAS,EACJ,MAAM,CACH,EACK,QAAQ,CACR,SACG,8CACH,EACL,EAAE,MAAM,CACX,CAAC,CACD,UAAU;MAEf,QAAQ,EACH,KAAK;OACF;OACA;OACA;OACH,CAAC,CACD,SACG,8GACH;MACR,CAAC,CACD,SACG,2GACH;KACL,EACK,OAAO;MAEJ,MAAM,EACD,QACG,aACH,CACA,SACG,mDACH,CACA,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