Skip to content

Commit 37cd030

Browse files
feat(api): api update
1 parent 18b3c20 commit 37cd030

3 files changed

Lines changed: 30 additions & 2 deletions

File tree

‎.stats.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 27
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api/moderation-api-2a9024f55f158ede9f9d4811ab4035e470afc920d0f15513da6603d011b2bef7.yml
3-
openapi_spec_hash: cc3275c46438bd043ac96e669e27276f
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/moderation-api/moderation-api-cbf656f40e43acf60d9596f78204f031dc8c7205626df8f05ce8e88bcf49b597.yml
3+
openapi_spec_hash: 23be5a56248a1a575b34833eb7e7fe49
44
config_hash: 9d144cc6c49d3fd53e5b4472c1e22165

‎src/moderation_api/types/content_submit_params.py‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"PolicySelfHarm",
4343
"PolicySpam",
4444
"PolicyLowQualityContent",
45+
"PolicyFaceDetection",
4546
"PolicySelfPromotion",
4647
"PolicyPolitical",
4748
"PolicyReligion",
@@ -365,6 +366,26 @@ class PolicyLowQualityContent(TypedDict, total=False):
365366
threshold: float
366367

367368

369+
class PolicyFaceDetection(TypedDict, total=False):
370+
id: Required[Literal["face_detection"]]
371+
372+
flag: Required[bool]
373+
374+
comparator: Literal["at_least", "fewer_than"]
375+
"""
376+
Flag images that contain "at least" or "fewer than" the configured number of
377+
faces. Defaults to at_least.
378+
"""
379+
380+
count: int
381+
"""Number of faces the comparator applies to.
382+
383+
Defaults to 1, so the default rule flags any image containing a face.
384+
"""
385+
386+
threshold: float
387+
388+
368389
class PolicySelfPromotion(TypedDict, total=False):
369390
id: Required[Literal["self_promotion"]]
370391

@@ -489,6 +510,7 @@ class PolicyGuideline(TypedDict, total=False):
489510
PolicySelfHarm,
490511
PolicySpam,
491512
PolicyLowQualityContent,
513+
PolicyFaceDetection,
492514
PolicySelfPromotion,
493515
PolicyPolitical,
494516
PolicyReligion,

‎src/moderation_api/types/content_submit_response.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,12 @@ class PolicyClassifierOutput(BaseModel):
242242

243243
type: Literal["classifier"]
244244

245+
data: Optional[Dict[str, object]] = None
246+
"""Optional structured data produced by the policy.
247+
248+
For face detection: { count, faces: [{ confidence, gender, age }] }.
249+
"""
250+
245251
flagged_fields: Optional[List[str]] = None
246252
"""The keys of the flagged fields if submitting an object."""
247253

0 commit comments

Comments
 (0)