Skip to content

Commit 808556a

Browse files
feat(api): api update
1 parent 7b6ee51 commit 808556a

7 files changed

Lines changed: 60 additions & 15 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: 10
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/unlayer/unlayer-35699cec89167aa9ce539f8008695911611f8bdf923234ed701ee3dbc0c5bcd2.yml
3-
openapi_spec_hash: 2ec4eef9500ac0007e1740f431835931
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/unlayer/unlayer-091234302d1c0907a6e2c646ad31f2757e832985758314af9171390851ffc12f.yml
3+
openapi_spec_hash: bbac170e82fb6bb60e0db638457623d1
44
config_hash: 20e7fbba9d423291aaf676f6a629dcaf

src/unlayer/resources/templates/generate.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
from __future__ import annotations
44

5-
from typing import Iterable
5+
from typing import Union, Iterable
66

77
import httpx
88

9-
from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given
9+
from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given
1010
from ..._utils import maybe_transform, async_maybe_transform
1111
from ..._compat import cached_property
1212
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -51,6 +51,7 @@ def create(
5151
project_id: str | Omit = omit,
5252
context: generate_create_params.Context | Omit = omit,
5353
conversation_id: str | Omit = omit,
54+
fallback_models: Union[bool, SequenceNotStr[str]] | Omit = omit,
5455
locale: str | Omit = omit,
5556
model: str | Omit = omit,
5657
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -81,10 +82,14 @@ def create(
8182
8283
conversation_id: Reserved for future server-side conversation memory.
8384
85+
fallback_models: Transient-outage fallback controls. Omit to use Unlayer defaults only when no
86+
model is pinned; true always uses Unlayer defaults; false disables the outage
87+
tail; an ordered array replaces the default provider/model strings.
88+
8489
locale: BCP-47 fallback locale for AI status messages.
8590
86-
model: AI model in "provider/id" form, e.g. "anthropic/claude-opus-4-7". Optional —
87-
server resolves a default per output kind.
91+
model: Preferred AI model in "provider/id" form, e.g. "anthropic/claude-opus-4-7".
92+
Optional — server resolves a default per output kind.
8893
8994
extra_headers: Send extra headers
9095
@@ -102,6 +107,7 @@ def create(
102107
"output": output,
103108
"context": context,
104109
"conversation_id": conversation_id,
110+
"fallback_models": fallback_models,
105111
"locale": locale,
106112
"model": model,
107113
},
@@ -165,6 +171,7 @@ async def create(
165171
project_id: str | Omit = omit,
166172
context: generate_create_params.Context | Omit = omit,
167173
conversation_id: str | Omit = omit,
174+
fallback_models: Union[bool, SequenceNotStr[str]] | Omit = omit,
168175
locale: str | Omit = omit,
169176
model: str | Omit = omit,
170177
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -195,10 +202,14 @@ async def create(
195202
196203
conversation_id: Reserved for future server-side conversation memory.
197204
205+
fallback_models: Transient-outage fallback controls. Omit to use Unlayer defaults only when no
206+
model is pinned; true always uses Unlayer defaults; false disables the outage
207+
tail; an ordered array replaces the default provider/model strings.
208+
198209
locale: BCP-47 fallback locale for AI status messages.
199210
200-
model: AI model in "provider/id" form, e.g. "anthropic/claude-opus-4-7". Optional —
201-
server resolves a default per output kind.
211+
model: Preferred AI model in "provider/id" form, e.g. "anthropic/claude-opus-4-7".
212+
Optional — server resolves a default per output kind.
202213
203214
extra_headers: Send extra headers
204215
@@ -216,6 +227,7 @@ async def create(
216227
"output": output,
217228
"context": context,
218229
"conversation_id": conversation_id,
230+
"fallback_models": fallback_models,
219231
"locale": locale,
220232
"model": model,
221233
},

src/unlayer/resources/templates/import_.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
from __future__ import annotations
44

5-
from typing import Iterable
5+
from typing import Union, Iterable
66
from typing_extensions import Literal
77

88
import httpx
99

10-
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
10+
from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
1111
from ..._utils import maybe_transform, async_maybe_transform
1212
from ..._compat import cached_property
1313
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -54,6 +54,7 @@ def create(
5454
display_mode: Literal["email", "web", "popup", "document"],
5555
input: Iterable[import_create_params.Input],
5656
project_id: str | Omit = omit,
57+
fallback_models: Union[bool, SequenceNotStr[str]] | Omit = omit,
5758
model: str | Omit = omit,
5859
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5960
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -74,7 +75,11 @@ def create(
7475
7576
project_id: The project ID (required for PAT auth, auto-resolved for API key auth)
7677
77-
model: AI model to use. Accepts a provider/model string (e.g.
78+
fallback_models: Transient-outage fallback controls. Omit to use Unlayer defaults only when no
79+
model is pinned; true always uses Unlayer defaults; false disables the outage
80+
tail; an ordered array replaces the default provider/model strings.
81+
82+
model: Preferred AI model. Accepts a provider/model string (e.g.
7883
"anthropic/claude-opus-4-7", "openai/gpt-5.5"), a bare provider ("anthropic",
7984
"openai") which uses that provider's default model, or a bare model id
8085
("claude-opus-4-7", "gpt-5.5") with the provider inferred from the name.
@@ -94,6 +99,7 @@ def create(
9499
{
95100
"display_mode": display_mode,
96101
"input": input,
102+
"fallback_models": fallback_models,
97103
"model": model,
98104
},
99105
import_create_params.ImportCreateParams,
@@ -139,6 +145,7 @@ async def create(
139145
display_mode: Literal["email", "web", "popup", "document"],
140146
input: Iterable[import_create_params.Input],
141147
project_id: str | Omit = omit,
148+
fallback_models: Union[bool, SequenceNotStr[str]] | Omit = omit,
142149
model: str | Omit = omit,
143150
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
144151
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -159,7 +166,11 @@ async def create(
159166
160167
project_id: The project ID (required for PAT auth, auto-resolved for API key auth)
161168
162-
model: AI model to use. Accepts a provider/model string (e.g.
169+
fallback_models: Transient-outage fallback controls. Omit to use Unlayer defaults only when no
170+
model is pinned; true always uses Unlayer defaults; false disables the outage
171+
tail; an ordered array replaces the default provider/model strings.
172+
173+
model: Preferred AI model. Accepts a provider/model string (e.g.
163174
"anthropic/claude-opus-4-7", "openai/gpt-5.5"), a bare provider ("anthropic",
164175
"openai") which uses that provider's default model, or a bare model id
165176
("claude-opus-4-7", "gpt-5.5") with the provider inferred from the name.
@@ -179,6 +190,7 @@ async def create(
179190
{
180191
"display_mode": display_mode,
181192
"input": input,
193+
"fallback_models": fallback_models,
182194
"model": model,
183195
},
184196
import_create_params.ImportCreateParams,

src/unlayer/types/templates/generate_create_params.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,19 @@ class GenerateCreateParams(TypedDict, total=False):
4242
conversation_id: Annotated[str, PropertyInfo(alias="conversationId")]
4343
"""Reserved for future server-side conversation memory."""
4444

45+
fallback_models: Annotated[Union[bool, SequenceNotStr[str]], PropertyInfo(alias="fallbackModels")]
46+
"""Transient-outage fallback controls.
47+
48+
Omit to use Unlayer defaults only when no model is pinned; true always uses
49+
Unlayer defaults; false disables the outage tail; an ordered array replaces the
50+
default provider/model strings.
51+
"""
52+
4553
locale: str
4654
"""BCP-47 fallback locale for AI status messages."""
4755

4856
model: str
49-
"""AI model in "provider/id" form, e.g.
57+
"""Preferred AI model in "provider/id" form, e.g.
5058
5159
"anthropic/claude-opus-4-7". Optional — server resolves a default per output
5260
kind.

src/unlayer/types/templates/import_create_params.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
from __future__ import annotations
44

5-
from typing import Iterable
5+
from typing import Union, Iterable
66
from typing_extensions import Literal, Required, Annotated, TypedDict
77

8+
from ..._types import SequenceNotStr
89
from ..._utils import PropertyInfo
910

1011
__all__ = ["ImportCreateParams", "Input"]
@@ -24,8 +25,16 @@ class ImportCreateParams(TypedDict, total=False):
2425
project_id: Annotated[str, PropertyInfo(alias="projectId")]
2526
"""The project ID (required for PAT auth, auto-resolved for API key auth)"""
2627

28+
fallback_models: Annotated[Union[bool, SequenceNotStr[str]], PropertyInfo(alias="fallbackModels")]
29+
"""Transient-outage fallback controls.
30+
31+
Omit to use Unlayer defaults only when no model is pinned; true always uses
32+
Unlayer defaults; false disables the outage tail; an ordered array replaces the
33+
default provider/model strings.
34+
"""
35+
2736
model: str
28-
"""AI model to use.
37+
"""Preferred AI model.
2938
3039
Accepts a provider/model string (e.g. "anthropic/claude-opus-4-7",
3140
"openai/gpt-5.5"), a bare provider ("anthropic", "openai") which uses that

tests/api_resources/templates/test_generate.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def test_method_create_with_all_params(self, client: Unlayer) -> None:
7575
},
7676
},
7777
conversation_id="conversationId",
78+
fallback_models=True,
7879
locale="locale",
7980
model="model",
8081
)
@@ -211,6 +212,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncUnlayer) -
211212
},
212213
},
213214
conversation_id="conversationId",
215+
fallback_models=True,
214216
locale="locale",
215217
model="model",
216218
)

tests/api_resources/templates/test_import_.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def test_method_create_with_all_params(self, client: Unlayer) -> None:
3939
}
4040
],
4141
project_id="projectId",
42+
fallback_models=True,
4243
model="model",
4344
)
4445
assert_matches_type(ImportCreateResponse, import_, path=["response"])
@@ -97,6 +98,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncUnlayer) -
9798
}
9899
],
99100
project_id="projectId",
101+
fallback_models=True,
100102
model="model",
101103
)
102104
assert_matches_type(ImportCreateResponse, import_, path=["response"])

0 commit comments

Comments
 (0)