mirror of
https://github.com/openai/codex.git
synced 2026-03-05 21:45:28 +03:00
Took over the work that @aaronl-openai started here: https://github.com/openai/codex/pull/10397 Now that app-server clients are able to set up custom tools (called `dynamic_tools` in app-server), we should expose a way for clients to pass in not just text, but also image outputs. This is something the Responses API already supports for function call outputs, where you can pass in either a string or an array of content outputs (text, image, file): https://platform.openai.com/docs/api-reference/responses/create#responses_create-input-input_item_list-item-function_tool_call_output-output-array-input_image So let's just plumb it through in Codex (with the caveat that we only support text and image for now). This is implemented end-to-end across app-server v2 protocol types and core tool handling. ## Breaking API change NOTE: This introduces a breaking change with dynamic tools, but I think it's ok since this concept was only recently introduced (https://github.com/openai/codex/pull/9539) and it's better to get the API contract correct. I don't think there are any real consumers of this yet (not even the Codex App). Old shape: `{ "output": "dynamic-ok", "success": true }` New shape: ``` { "contentItems": [ { "type": "inputText", "text": "dynamic-ok" }, { "type": "inputImage", "imageUrl": "data:image/png;base64,AAA" } ] "success": true } ```
66 lines
1.5 KiB
JSON
66 lines
1.5 KiB
JSON
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"definitions": {
|
|
"DynamicToolCallOutputContentItem": {
|
|
"oneOf": [
|
|
{
|
|
"properties": {
|
|
"text": {
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"enum": [
|
|
"inputText"
|
|
],
|
|
"title": "InputTextDynamicToolCallOutputContentItemType",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"text",
|
|
"type"
|
|
],
|
|
"title": "InputTextDynamicToolCallOutputContentItem",
|
|
"type": "object"
|
|
},
|
|
{
|
|
"properties": {
|
|
"imageUrl": {
|
|
"type": "string"
|
|
},
|
|
"type": {
|
|
"enum": [
|
|
"inputImage"
|
|
],
|
|
"title": "InputImageDynamicToolCallOutputContentItemType",
|
|
"type": "string"
|
|
}
|
|
},
|
|
"required": [
|
|
"imageUrl",
|
|
"type"
|
|
],
|
|
"title": "InputImageDynamicToolCallOutputContentItem",
|
|
"type": "object"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"properties": {
|
|
"contentItems": {
|
|
"items": {
|
|
"$ref": "#/definitions/DynamicToolCallOutputContentItem"
|
|
},
|
|
"type": "array"
|
|
},
|
|
"success": {
|
|
"type": "boolean"
|
|
}
|
|
},
|
|
"required": [
|
|
"contentItems",
|
|
"success"
|
|
],
|
|
"title": "DynamicToolCallResponse",
|
|
"type": "object"
|
|
} |