Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

Preserve `ImageUserInput` in the Python SDK (#45796)

Krish Chainani63c09ed2127c
diff --git a/sdk/python/scripts/update_sdk_artifacts.py b/sdk/python/scripts/update_sdk_artifacts.py
index 61d98e29e4..4c36b595f0 100755
--- a/sdk/python/scripts/update_sdk_artifacts.py
+++ b/sdk/python/scripts/update_sdk_artifacts.py
@@ -587,6 +587,7 @@ def _preserve_inline_image_class_names(out_path: Path) -> None:
"""Keep the public class names used before ImageReference was introduced."""
source = out_path.read_text()
stable_names = {
+ "UrlUserInput": "ImageUserInput",
"ImageUrlContentItem": "InputImageContentItem",
"ImageUrlFunctionCallOutputContentItem": "InputImageFunctionCallOutputContentItem",
}
diff --git a/sdk/python/src/openai_codex/generated/v2_all.py b/sdk/python/src/openai_codex/generated/v2_all.py
index 0a76ae8fc4..8f500002c2 100644
--- a/sdk/python/src/openai_codex/generated/v2_all.py
+++ b/sdk/python/src/openai_codex/generated/v2_all.py
@@ -6240,7 +6240,7 @@ class TextUserInput(BaseModel):
type: Annotated[Literal["text"], Field(title="TextUserInputType")]
-class UrlUserInput(BaseModel):
+class ImageUserInput(BaseModel):
model_config = ConfigDict(
populate_by_name=True,
)
@@ -6304,7 +6304,7 @@ class MentionUserInput(BaseModel):
class UserInput(
RootModel[
TextUserInput
- | UrlUserInput
+ | ImageUserInput
| FileIdUserInput
| LocalImageUserInput
| AudioUserInput
@@ -6318,7 +6318,7 @@ class UserInput(
)
root: (
TextUserInput
- | UrlUserInput
+ | ImageUserInput
| FileIdUserInput
| LocalImageUserInput
| AudioUserInput
diff --git a/sdk/python/tests/test_artifact_workflow_and_binaries.py b/sdk/python/tests/test_artifact_workflow_and_binaries.py
index 7fae0b7a57..1d2e23170b 100644
--- a/sdk/python/tests/test_artifact_workflow_and_binaries.py
+++ b/sdk/python/tests/test_artifact_workflow_and_binaries.py
@@ -539,10 +539,12 @@ def test_generated_chatgpt_account_email_is_required_nullable() -> None:
def test_generated_inline_image_class_names_remain_stable() -> None:
"""Keep the existing Python class names when image references expand."""
from openai_codex.generated.v2_all import (
+ ImageUserInput,
InputImageContentItem,
InputImageFunctionCallOutputContentItem,
)
+ assert ImageUserInput.__name__ == "ImageUserInput"
assert InputImageContentItem.__name__ == "InputImageContentItem"
assert (
InputImageFunctionCallOutputContentItem.__name__