mirror of
https://github.com/openai/codex.git
synced 2026-11-25 23:30:49 +00:00
Carry prompt wellbeing results through answer moderation (#63886)
## What changed Add optional `promptWellbeingResults` to answer moderation metadata. Each result contains the scored input item's ID, labels, and numeric scores. Preserve the results on live agent messages and when rebuilding thread history, and expose them in the app-server v2 schemas and Python SDK models. Ignore malformed wellbeing results when reading stored moderation so the moderation decision and its display instruction can still be applied. ## Testing Cover serialization round trips with and without a display instruction, and verify that older moderation records without wellbeing results deserialize. GitOrigin-RevId: b3ed41fb529e33638eb5486bf2a22ff8b926f82a
This commit is contained in:
@@ -305,6 +305,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -3808,6 +3817,33 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"RateLimitReachedType": {
|
||||
"enum": [
|
||||
"rate_limit_reached",
|
||||
|
||||
+36
@@ -7720,6 +7720,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/v2/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -19730,6 +19739,33 @@
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ProviderSettings": {
|
||||
"oneOf": [
|
||||
{
|
||||
|
||||
+36
@@ -710,6 +710,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -15590,6 +15599,33 @@
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ProviderSettings": {
|
||||
"oneOf": [
|
||||
{
|
||||
|
||||
@@ -121,6 +121,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -991,6 +1000,33 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ReasoningEffort": {
|
||||
"description": "A non-empty reasoning effort value advertised by the model.",
|
||||
"minLength": 1,
|
||||
|
||||
@@ -121,6 +121,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -991,6 +1000,33 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ReasoningEffort": {
|
||||
"description": "A non-empty reasoning effort value advertised by the model.",
|
||||
"minLength": 1,
|
||||
|
||||
@@ -121,6 +121,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -1207,6 +1216,33 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ReasoningEffort": {
|
||||
"description": "A non-empty reasoning effort value advertised by the model.",
|
||||
"minLength": 1,
|
||||
|
||||
@@ -141,6 +141,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -1343,6 +1352,33 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ReasoningEffort": {
|
||||
"description": "A non-empty reasoning effort value advertised by the model.",
|
||||
"minLength": 1,
|
||||
|
||||
@@ -121,6 +121,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -991,6 +1000,33 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ReasoningEffort": {
|
||||
"description": "A non-empty reasoning effort value advertised by the model.",
|
||||
"minLength": 1,
|
||||
|
||||
@@ -121,6 +121,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -1233,6 +1242,33 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ReasoningEffort": {
|
||||
"description": "A non-empty reasoning effort value advertised by the model.",
|
||||
"minLength": 1,
|
||||
|
||||
+36
@@ -121,6 +121,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -1233,6 +1242,33 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ReasoningEffort": {
|
||||
"description": "A non-empty reasoning effort value advertised by the model.",
|
||||
"minLength": 1,
|
||||
|
||||
@@ -121,6 +121,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -1233,6 +1242,33 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ReasoningEffort": {
|
||||
"description": "A non-empty reasoning effort value advertised by the model.",
|
||||
"minLength": 1,
|
||||
|
||||
@@ -141,6 +141,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -1367,6 +1376,33 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ReasoningEffort": {
|
||||
"description": "A non-empty reasoning effort value advertised by the model.",
|
||||
"minLength": 1,
|
||||
|
||||
@@ -121,6 +121,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -1233,6 +1242,33 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ReasoningEffort": {
|
||||
"description": "A non-empty reasoning effort value advertised by the model.",
|
||||
"minLength": 1,
|
||||
|
||||
+36
@@ -121,6 +121,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -1233,6 +1242,33 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ReasoningEffort": {
|
||||
"description": "A non-empty reasoning effort value advertised by the model.",
|
||||
"minLength": 1,
|
||||
|
||||
@@ -141,6 +141,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -1343,6 +1352,33 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ReasoningEffort": {
|
||||
"description": "A non-empty reasoning effort value advertised by the model.",
|
||||
"minLength": 1,
|
||||
|
||||
@@ -121,6 +121,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -1233,6 +1242,33 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ReasoningEffort": {
|
||||
"description": "A non-empty reasoning effort value advertised by the model.",
|
||||
"minLength": 1,
|
||||
|
||||
@@ -121,6 +121,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -1207,6 +1216,33 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ReasoningEffort": {
|
||||
"description": "A non-empty reasoning effort value advertised by the model.",
|
||||
"minLength": 1,
|
||||
|
||||
@@ -121,6 +121,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -1233,6 +1242,33 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ReasoningEffort": {
|
||||
"description": "A non-empty reasoning effort value advertised by the model.",
|
||||
"minLength": 1,
|
||||
|
||||
@@ -121,6 +121,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -1207,6 +1216,33 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ReasoningEffort": {
|
||||
"description": "A non-empty reasoning effort value advertised by the model.",
|
||||
"minLength": 1,
|
||||
|
||||
@@ -121,6 +121,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -1207,6 +1216,33 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ReasoningEffort": {
|
||||
"description": "A non-empty reasoning effort value advertised by the model.",
|
||||
"minLength": 1,
|
||||
|
||||
@@ -121,6 +121,15 @@
|
||||
},
|
||||
"moderated": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"promptWellbeingResults": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/PromptWellbeingResult"
|
||||
},
|
||||
"type": [
|
||||
"array",
|
||||
"null"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -1207,6 +1216,33 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"PromptWellbeingResult": {
|
||||
"description": "Wellbeing results for a single scored input item.",
|
||||
"properties": {
|
||||
"inputItemId": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"scores": {
|
||||
"additionalProperties": {
|
||||
"format": "double",
|
||||
"type": "number"
|
||||
},
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"inputItemId",
|
||||
"labels",
|
||||
"scores"
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ReasoningEffort": {
|
||||
"description": "A non-empty reasoning effort value advertised by the model.",
|
||||
"minLength": 1,
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+2
-1
@@ -2,5 +2,6 @@
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { AgentMessageDisplay } from "./AgentMessageDisplay";
|
||||
import type { PromptWellbeingResult } from "./PromptWellbeingResult";
|
||||
|
||||
export type AgentMessageModeration = { moderated: boolean, display: AgentMessageDisplay | null, };
|
||||
export type AgentMessageModeration = { promptWellbeingResults: Array<PromptWellbeingResult> | null, moderated: boolean, display: AgentMessageDisplay | null, };
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
/**
|
||||
* Wellbeing results for a single scored input item.
|
||||
*/
|
||||
export type PromptWellbeingResult = { inputItemId: string, scores: Record<string, number>, labels: Array<string>, };
|
||||
@@ -453,6 +453,7 @@ export type { ProjectChangeType } from "./ProjectChangeType";
|
||||
export type { ProjectChangedNotification } from "./ProjectChangedNotification";
|
||||
export type { ProjectRoot } from "./ProjectRoot";
|
||||
export type { ProjectSortKey } from "./ProjectSortKey";
|
||||
export type { PromptWellbeingResult } from "./PromptWellbeingResult";
|
||||
export type { ProviderSettings } from "./ProviderSettings";
|
||||
export type { ProviderSettingsPatch } from "./ProviderSettingsPatch";
|
||||
export type { QueuedSubmission } from "./QueuedSubmission";
|
||||
|
||||
@@ -666,6 +666,7 @@ impl ThreadHistoryBuilder {
|
||||
.moderation
|
||||
.as_ref()
|
||||
.map(|decision| AgentMessageModeration {
|
||||
prompt_wellbeing_results: decision.prompt_wellbeing_results.clone(),
|
||||
moderated: decision.moderated,
|
||||
display: decision.display.clone(),
|
||||
}),
|
||||
|
||||
@@ -38,6 +38,7 @@ use codex_protocol::items::DynamicToolCallStatus as CoreDynamicToolCallStatus;
|
||||
pub use codex_protocol::items::McpAppDisplayMode;
|
||||
pub use codex_protocol::items::McpAppUi;
|
||||
use codex_protocol::items::McpToolCallStatus as CoreMcpToolCallStatus;
|
||||
pub use codex_protocol::items::PromptWellbeingResult;
|
||||
use codex_protocol::items::TurnItem as CoreTurnItem;
|
||||
use codex_protocol::memory_citation::MemoryCitation as CoreMemoryCitation;
|
||||
use codex_protocol::memory_citation::MemoryCitationEntry as CoreMemoryCitationEntry;
|
||||
@@ -156,6 +157,7 @@ pub enum CommandAction {
|
||||
#[ts(export_to = "v2/")]
|
||||
#[serde(from = "CoreAgentMessageModeration")]
|
||||
pub struct AgentMessageModeration {
|
||||
pub prompt_wellbeing_results: Option<Vec<PromptWellbeingResult>>,
|
||||
pub moderated: bool,
|
||||
pub display: Option<AgentMessageDisplay>,
|
||||
}
|
||||
@@ -163,6 +165,7 @@ pub struct AgentMessageModeration {
|
||||
impl From<CoreAgentMessageModeration> for AgentMessageModeration {
|
||||
fn from(value: CoreAgentMessageModeration) -> Self {
|
||||
Self {
|
||||
prompt_wellbeing_results: value.prompt_wellbeing_results,
|
||||
moderated: value.moderated,
|
||||
display: value.display,
|
||||
}
|
||||
|
||||
@@ -3276,7 +3276,7 @@ fn answer_moderation_preserves_the_display_instruction() {
|
||||
json!({"version":1, "mode":"block", "reason":{"kind":"protection","protectionType":"omnimod"}}),
|
||||
json!({"version":1, "mode":"block", "reason":{"kind":"cyber","trustedAccess":false}}),
|
||||
] {
|
||||
let stored = json!({"moderated": !display.is_null(), "display": display});
|
||||
let mut stored = json!({"moderated": !display.is_null(), "display": display});
|
||||
let mut with_extra_fields = stored.clone();
|
||||
if let Some(object) = with_extra_fields["display"].as_object_mut() {
|
||||
object.insert("additionalV1Field".into(), json!(true));
|
||||
@@ -3285,6 +3285,7 @@ fn answer_moderation_preserves_the_display_instruction() {
|
||||
with_extra_fields,
|
||||
)
|
||||
.unwrap();
|
||||
stored["promptWellbeingResults"] = JsonValue::Null;
|
||||
assert_eq!(
|
||||
serde_json::to_value(AgentMessageModeration::from(core)).unwrap(),
|
||||
stored
|
||||
@@ -3292,6 +3293,25 @@ fn answer_moderation_preserves_the_display_instruction() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn prompt_wellbeing_results_round_trip_with_or_without_display() {
|
||||
for display in [
|
||||
json!({"version": 1, "mode": "show", "trustedContacts": "check"}),
|
||||
JsonValue::Null,
|
||||
] {
|
||||
let stored = json!({
|
||||
"moderated": true,
|
||||
"display": display,
|
||||
"promptWellbeingResults": [{"inputItemId":"msg_input_1","labels":[],"scores":{"U-S4":0.1}}]
|
||||
});
|
||||
let core: codex_protocol::items::AgentMessageModeration =
|
||||
serde_json::from_value(stored.clone()).unwrap();
|
||||
let decision: AgentMessageModeration =
|
||||
serde_json::from_value(serde_json::to_value(core).unwrap()).unwrap();
|
||||
assert_eq!(serde_json::to_value(decision).unwrap(), stored);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn core_turn_item_into_thread_item_converts_supported_variants() {
|
||||
let user_item = TurnItem::UserMessage(UserMessageItem {
|
||||
@@ -3420,6 +3440,7 @@ fn core_turn_item_into_thread_item_converts_supported_variants() {
|
||||
|
||||
let agent_item_with_phase = TurnItem::AgentMessage(AgentMessageItem {
|
||||
moderation: Some(codex_protocol::items::AgentMessageModeration {
|
||||
prompt_wellbeing_results: None,
|
||||
moderated: true,
|
||||
display: None,
|
||||
}),
|
||||
@@ -3445,6 +3466,7 @@ fn core_turn_item_into_thread_item_converts_supported_variants() {
|
||||
ThreadItemPayload::from(agent_item_with_phase),
|
||||
ThreadItemPayload::AgentMessage {
|
||||
moderation: Some(AgentMessageModeration {
|
||||
prompt_wellbeing_results: None,
|
||||
moderated: true,
|
||||
display: None
|
||||
}),
|
||||
|
||||
@@ -341,6 +341,7 @@ pub(crate) fn apply_answer_moderation(
|
||||
&& answer.id == decision.item_id
|
||||
{
|
||||
answer.moderation = Some(codex_protocol::items::AgentMessageModeration {
|
||||
prompt_wellbeing_results: decision.prompt_wellbeing_results.clone(),
|
||||
moderated: decision.moderated,
|
||||
display: decision.display.clone(),
|
||||
});
|
||||
|
||||
@@ -6,6 +6,7 @@ pub use display::AnswerAnnotation;
|
||||
pub use display::AnswerReplacement;
|
||||
pub use display::BlockReason;
|
||||
pub use display::HelplineSubject;
|
||||
pub use display::PromptWellbeingResult;
|
||||
pub use display::TrustedContacts;
|
||||
|
||||
use crate::AgentPath;
|
||||
@@ -163,6 +164,13 @@ pub struct AsyncUserInputQuestion {
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Deserialize, Serialize, TS, JsonSchema)]
|
||||
#[serde(from = "display::StoredModeration")]
|
||||
pub struct AgentMessageModeration {
|
||||
#[serde(
|
||||
rename = "promptWellbeingResults",
|
||||
default,
|
||||
skip_serializing_if = "Option::is_none"
|
||||
)]
|
||||
#[ts(optional)]
|
||||
pub prompt_wellbeing_results: Option<Vec<PromptWellbeingResult>>,
|
||||
pub moderated: bool,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
#[ts(optional)]
|
||||
|
||||
@@ -123,25 +123,41 @@ pub enum BlockReason {
|
||||
},
|
||||
}
|
||||
|
||||
/// Wellbeing results for a single scored input item.
|
||||
#[derive(derive_more::Debug, Clone, PartialEq, Eq, Deserialize, Serialize, TS, JsonSchema)]
|
||||
#[debug("PromptWellbeingResult([redacted])")]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct PromptWellbeingResult {
|
||||
pub input_item_id: String,
|
||||
#[ts(type = "Record<string, number>")]
|
||||
#[schemars(with = "std::collections::BTreeMap<String, f64>")]
|
||||
pub scores: std::collections::BTreeMap<String, serde_json::Number>,
|
||||
pub labels: Vec<String>,
|
||||
}
|
||||
|
||||
/// An unreadable instruction leaves the answer restricted.
|
||||
#[derive(Deserialize)]
|
||||
pub(super) struct StoredModeration {
|
||||
moderated: bool,
|
||||
display: Option<Value>,
|
||||
#[serde(rename = "promptWellbeingResults")]
|
||||
prompt_wellbeing_results: Option<Value>,
|
||||
}
|
||||
|
||||
impl From<StoredModeration> for AgentMessageModeration {
|
||||
fn from(stored: StoredModeration) -> Self {
|
||||
let Some(value) = stored.display else {
|
||||
return Self {
|
||||
moderated: stored.moderated,
|
||||
display: None,
|
||||
};
|
||||
};
|
||||
let display = serde_json::from_value(value).ok();
|
||||
let has_display = stored.display.is_some();
|
||||
let display = stored
|
||||
.display
|
||||
.and_then(|value| serde_json::from_value(value).ok());
|
||||
Self {
|
||||
moderated: stored.moderated || display.is_none(),
|
||||
moderated: stored.moderated || (has_display && display.is_none()),
|
||||
display,
|
||||
// An invalid optional result must never discard a block or clear a check.
|
||||
prompt_wellbeing_results: stored
|
||||
.prompt_wellbeing_results
|
||||
.and_then(|value| serde_json::from_value(value).ok()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,6 +145,7 @@ impl AgentMessageItem {
|
||||
texts.collect(),
|
||||
Some(crate::protocol::TargetedAnswerModeration {
|
||||
item_id: self.id.clone(),
|
||||
prompt_wellbeing_results: decision.prompt_wellbeing_results.clone(),
|
||||
moderated: decision.moderated,
|
||||
display: decision.display.clone(),
|
||||
}),
|
||||
|
||||
@@ -2417,6 +2417,13 @@ pub struct ModelVerificationEvent {
|
||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, TS)]
|
||||
#[serde(from = "StoredTargetedModeration")]
|
||||
pub struct TargetedAnswerModeration {
|
||||
#[serde(
|
||||
rename = "promptWellbeingResults",
|
||||
default,
|
||||
skip_serializing_if = "Option::is_none"
|
||||
)]
|
||||
#[ts(optional)]
|
||||
pub prompt_wellbeing_results: Option<Vec<crate::items::PromptWellbeingResult>>,
|
||||
pub item_id: String,
|
||||
pub moderated: bool,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
@@ -2435,6 +2442,7 @@ impl From<StoredTargetedModeration> for TargetedAnswerModeration {
|
||||
fn from(value: StoredTargetedModeration) -> Self {
|
||||
Self {
|
||||
item_id: value.item_id,
|
||||
prompt_wellbeing_results: value.decision.prompt_wellbeing_results,
|
||||
moderated: value.decision.moderated,
|
||||
display: value.decision.display,
|
||||
}
|
||||
|
||||
@@ -160,6 +160,7 @@ pub(super) fn completed_item(
|
||||
TurnItem::AgentMessage(AgentMessageItem {
|
||||
moderation: event.moderation.as_ref().map(|decision| {
|
||||
codex_protocol::items::AgentMessageModeration {
|
||||
prompt_wellbeing_results: decision.prompt_wellbeing_results.clone(),
|
||||
moderated: decision.moderated,
|
||||
display: decision.display.clone(),
|
||||
}
|
||||
|
||||
@@ -3947,6 +3947,15 @@ class ProjectSortKey(Enum):
|
||||
recency_at = "recencyAt"
|
||||
|
||||
|
||||
class PromptWellbeingResult(BaseModel):
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
)
|
||||
input_item_id: Annotated[str, Field(alias="inputItemId")]
|
||||
labels: list[str]
|
||||
scores: dict[str, float]
|
||||
|
||||
|
||||
class OpenaiProviderSettings(BaseModel):
|
||||
model_config = ConfigDict(
|
||||
populate_by_name=True,
|
||||
@@ -11909,6 +11918,9 @@ class AgentMessageModeration(BaseModel):
|
||||
)
|
||||
display: AgentMessageDisplay | None = None
|
||||
moderated: bool
|
||||
prompt_wellbeing_results: Annotated[
|
||||
list[PromptWellbeingResult] | None, Field(alias="promptWellbeingResults")
|
||||
] = None
|
||||
|
||||
|
||||
class AppInfo(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user