Skip to content

Commit 0dcc693

Browse files
author
stlc-bot
committed
feat(api): enable ZDR on remaining AI endpoints via OpenAI (#1099)
Stainless-Generated-From: cdbd5ca
1 parent 53fa41c commit 0dcc693

25 files changed

Lines changed: 345 additions & 56 deletions

‎src/context/dev/resources/ai.py‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import overload
5+
from typing_extensions import Literal, overload
66

77
import httpx
88

@@ -51,6 +51,7 @@ def extract_product(
5151
max_age_ms: int | Omit = omit,
5252
tags: SequenceNotStr[str] | Omit = omit,
5353
timeout_opts: ai_extract_product_params.TimeoutOpts | Omit = omit,
54+
zdr: Literal["enabled", "disabled"] | Omit = omit,
5455
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5556
# The extra values given here take precedence over values defined on the client or passed to this method.
5657
extra_headers: Headers | None = None,
@@ -75,6 +76,12 @@ def extract_product(
7576
timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
7677
timeoutOpts object.
7778
79+
zdr: Set to enabled to bypass shared caches and omit request and response content
80+
from retained usage logs. Asset uploads are skipped, so hosted image URLs are
81+
omitted. Requires zero data retention to be enabled for your organization
82+
(contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED.
83+
Successful ZDR responses include X-Context-ZDR: true.
84+
7885
extra_headers: Send extra headers
7986
8087
extra_query: Add additional query parameters to the request
@@ -91,6 +98,7 @@ def extract_product(
9198
"max_age_ms": max_age_ms,
9299
"tags": tags,
93100
"timeout_opts": timeout_opts,
101+
"zdr": zdr,
94102
},
95103
ai_extract_product_params.AIExtractProductParams,
96104
),
@@ -261,6 +269,7 @@ async def extract_product(
261269
max_age_ms: int | Omit = omit,
262270
tags: SequenceNotStr[str] | Omit = omit,
263271
timeout_opts: ai_extract_product_params.TimeoutOpts | Omit = omit,
272+
zdr: Literal["enabled", "disabled"] | Omit = omit,
264273
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
265274
# The extra values given here take precedence over values defined on the client or passed to this method.
266275
extra_headers: Headers | None = None,
@@ -285,6 +294,12 @@ async def extract_product(
285294
timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
286295
timeoutOpts object.
287296
297+
zdr: Set to enabled to bypass shared caches and omit request and response content
298+
from retained usage logs. Asset uploads are skipped, so hosted image URLs are
299+
omitted. Requires zero data retention to be enabled for your organization
300+
(contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED.
301+
Successful ZDR responses include X-Context-ZDR: true.
302+
288303
extra_headers: Send extra headers
289304
290305
extra_query: Add additional query parameters to the request
@@ -301,6 +316,7 @@ async def extract_product(
301316
"max_age_ms": max_age_ms,
302317
"tags": tags,
303318
"timeout_opts": timeout_opts,
319+
"zdr": zdr,
304320
},
305321
ai_extract_product_params.AIExtractProductParams,
306322
),

‎src/context/dev/resources/industry.py‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def retrieve_naics(
5252
min_results: int | Omit = omit,
5353
tags: SequenceNotStr[str] | Omit = omit,
5454
timeout_opts: industry_retrieve_naics_params.TimeoutOpts | Omit = omit,
55+
zdr: Literal["enabled", "disabled"] | Omit = omit,
5556
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5657
# The extra values given here take precedence over values defined on the client or passed to this method.
5758
extra_headers: Headers | None = None,
@@ -79,6 +80,12 @@ def retrieve_naics(
7980
timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
8081
timeoutOpts object.
8182
83+
zdr: Set to enabled to bypass shared caches and omit request and response content
84+
from retained usage logs. Asset uploads are skipped, so hosted image URLs are
85+
omitted. Requires zero data retention to be enabled for your organization
86+
(contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED.
87+
Successful ZDR responses include X-Context-ZDR: true.
88+
8289
extra_headers: Send extra headers
8390
8491
extra_query: Add additional query parameters to the request
@@ -101,6 +108,7 @@ def retrieve_naics(
101108
"min_results": min_results,
102109
"tags": tags,
103110
"timeout_opts": timeout_opts,
111+
"zdr": zdr,
104112
},
105113
industry_retrieve_naics_params.IndustryRetrieveNaicsParams,
106114
),
@@ -117,6 +125,7 @@ def retrieve_sic(
117125
tags: SequenceNotStr[str] | Omit = omit,
118126
timeout_opts: industry_retrieve_sic_params.TimeoutOpts | Omit = omit,
119127
type: Literal["original_sic", "latest_sec"] | Omit = omit,
128+
zdr: Literal["enabled", "disabled"] | Omit = omit,
120129
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
121130
# The extra values given here take precedence over values defined on the client or passed to this method.
122131
extra_headers: Headers | None = None,
@@ -149,6 +158,12 @@ def retrieve_sic(
149158
Industrial Classification system; `latest_sec` uses the current SIC list as
150159
published by the SEC. Defaults to `original_sic`.
151160
161+
zdr: Set to enabled to bypass shared caches and omit request and response content
162+
from retained usage logs. Asset uploads are skipped, so hosted image URLs are
163+
omitted. Requires zero data retention to be enabled for your organization
164+
(contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED.
165+
Successful ZDR responses include X-Context-ZDR: true.
166+
152167
extra_headers: Send extra headers
153168
154169
extra_query: Add additional query parameters to the request
@@ -172,6 +187,7 @@ def retrieve_sic(
172187
"tags": tags,
173188
"timeout_opts": timeout_opts,
174189
"type": type,
190+
"zdr": zdr,
175191
},
176192
industry_retrieve_sic_params.IndustryRetrieveSicParams,
177193
),
@@ -208,6 +224,7 @@ async def retrieve_naics(
208224
min_results: int | Omit = omit,
209225
tags: SequenceNotStr[str] | Omit = omit,
210226
timeout_opts: industry_retrieve_naics_params.TimeoutOpts | Omit = omit,
227+
zdr: Literal["enabled", "disabled"] | Omit = omit,
211228
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
212229
# The extra values given here take precedence over values defined on the client or passed to this method.
213230
extra_headers: Headers | None = None,
@@ -235,6 +252,12 @@ async def retrieve_naics(
235252
timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
236253
timeoutOpts object.
237254
255+
zdr: Set to enabled to bypass shared caches and omit request and response content
256+
from retained usage logs. Asset uploads are skipped, so hosted image URLs are
257+
omitted. Requires zero data retention to be enabled for your organization
258+
(contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED.
259+
Successful ZDR responses include X-Context-ZDR: true.
260+
238261
extra_headers: Send extra headers
239262
240263
extra_query: Add additional query parameters to the request
@@ -257,6 +280,7 @@ async def retrieve_naics(
257280
"min_results": min_results,
258281
"tags": tags,
259282
"timeout_opts": timeout_opts,
283+
"zdr": zdr,
260284
},
261285
industry_retrieve_naics_params.IndustryRetrieveNaicsParams,
262286
),
@@ -273,6 +297,7 @@ async def retrieve_sic(
273297
tags: SequenceNotStr[str] | Omit = omit,
274298
timeout_opts: industry_retrieve_sic_params.TimeoutOpts | Omit = omit,
275299
type: Literal["original_sic", "latest_sec"] | Omit = omit,
300+
zdr: Literal["enabled", "disabled"] | Omit = omit,
276301
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
277302
# The extra values given here take precedence over values defined on the client or passed to this method.
278303
extra_headers: Headers | None = None,
@@ -305,6 +330,12 @@ async def retrieve_sic(
305330
Industrial Classification system; `latest_sec` uses the current SIC list as
306331
published by the SEC. Defaults to `original_sic`.
307332
333+
zdr: Set to enabled to bypass shared caches and omit request and response content
334+
from retained usage logs. Asset uploads are skipped, so hosted image URLs are
335+
omitted. Requires zero data retention to be enabled for your organization
336+
(contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED.
337+
Successful ZDR responses include X-Context-ZDR: true.
338+
308339
extra_headers: Send extra headers
309340
310341
extra_query: Add additional query parameters to the request
@@ -328,6 +359,7 @@ async def retrieve_sic(
328359
"tags": tags,
329360
"timeout_opts": timeout_opts,
330361
"type": type,
362+
"zdr": zdr,
331363
},
332364
industry_retrieve_sic_params.IndustryRetrieveSicParams,
333365
),

‎src/context/dev/resources/parse.py‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,10 @@ def handle(
180180
use_main_content_only: Extract only the main content from HTML-like inputs
181181
182182
zdr: Set to enabled to bypass shared caches and omit request and response content
183-
from retained usage logs. Requires zero data retention to be enabled for your
184-
organization (contact support@context.dev), otherwise the request fails with
185-
ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.
183+
from retained usage logs. Asset uploads are skipped, so hosted image URLs are
184+
omitted. Requires zero data retention to be enabled for your organization
185+
(contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED.
186+
Successful ZDR responses include X-Context-ZDR: true.
186187
187188
extra_headers: Send extra headers
188189
@@ -364,9 +365,10 @@ async def handle(
364365
use_main_content_only: Extract only the main content from HTML-like inputs
365366
366367
zdr: Set to enabled to bypass shared caches and omit request and response content
367-
from retained usage logs. Requires zero data retention to be enabled for your
368-
organization (contact support@context.dev), otherwise the request fails with
369-
ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true.
368+
from retained usage logs. Asset uploads are skipped, so hosted image URLs are
369+
omitted. Requires zero data retention to be enabled for your organization
370+
(contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED.
371+
Successful ZDR responses include X-Context-ZDR: true.
370372
371373
extra_headers: Send extra headers
372374

‎src/context/dev/resources/people.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
from typing import Iterable
6+
from typing_extensions import Literal
67

78
import httpx
89

@@ -54,6 +55,7 @@ def enrich(
5455
social_urls: SequenceNotStr[str] | Omit = omit,
5556
tags: SequenceNotStr[str] | Omit = omit,
5657
timeout_opts: person_enrich_params.TimeoutOpts | Omit = omit,
58+
zdr: Literal["enabled", "disabled"] | Omit = omit,
5759
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5860
# The extra values given here take precedence over values defined on the client or passed to this method.
5961
extra_headers: Headers | None = None,
@@ -74,6 +76,12 @@ def enrich(
7476
timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
7577
timeoutOpts object.
7678
79+
zdr: Set to enabled to bypass shared caches and omit request and response content
80+
from retained usage logs. Asset uploads are skipped, so hosted image URLs are
81+
omitted. Requires zero data retention to be enabled for your organization
82+
(contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED.
83+
Successful ZDR responses include X-Context-ZDR: true.
84+
7785
extra_headers: Send extra headers
7886
7987
extra_query: Add additional query parameters to the request
@@ -94,6 +102,7 @@ def enrich(
94102
"social_urls": social_urls,
95103
"tags": tags,
96104
"timeout_opts": timeout_opts,
105+
"zdr": zdr,
97106
},
98107
person_enrich_params.PersonEnrichParams,
99108
),
@@ -135,6 +144,7 @@ async def enrich(
135144
social_urls: SequenceNotStr[str] | Omit = omit,
136145
tags: SequenceNotStr[str] | Omit = omit,
137146
timeout_opts: person_enrich_params.TimeoutOpts | Omit = omit,
147+
zdr: Literal["enabled", "disabled"] | Omit = omit,
138148
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
139149
# The extra values given here take precedence over values defined on the client or passed to this method.
140150
extra_headers: Headers | None = None,
@@ -155,6 +165,12 @@ async def enrich(
155165
timeoutOpts[milliseconds]=30000&timeoutOpts[behavior]=fail or a JSON-encoded
156166
timeoutOpts object.
157167
168+
zdr: Set to enabled to bypass shared caches and omit request and response content
169+
from retained usage logs. Asset uploads are skipped, so hosted image URLs are
170+
omitted. Requires zero data retention to be enabled for your organization
171+
(contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED.
172+
Successful ZDR responses include X-Context-ZDR: true.
173+
158174
extra_headers: Send extra headers
159175
160176
extra_query: Add additional query parameters to the request
@@ -175,6 +191,7 @@ async def enrich(
175191
"social_urls": social_urls,
176192
"tags": tags,
177193
"timeout_opts": timeout_opts,
194+
"zdr": zdr,
178195
},
179196
person_enrich_params.PersonEnrichParams,
180197
),

0 commit comments

Comments
 (0)