unique_toolkit 2026.46.0.dev8__py3-none-any.whl → 2026.46.0.dev10__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,28 @@
1
1
  from functools import cache
2
2
 
3
- from jinja2 import Template
4
- from jinja2.sandbox import SandboxedEnvironment
3
+ from jinja2 import Template, TemplateError, nodes
4
+ from jinja2.exceptions import SecurityError
5
+ from jinja2.sandbox import (
6
+ UNSAFE_ASYNC_GENERATOR_ATTRIBUTES,
7
+ UNSAFE_COROUTINE_ATTRIBUTES,
8
+ UNSAFE_FUNCTION_ATTRIBUTES,
9
+ UNSAFE_GENERATOR_ATTRIBUTES,
10
+ UNSAFE_METHOD_ATTRIBUTES,
11
+ SandboxedEnvironment,
12
+ )
13
+
14
+ __all__ = ["TemplateError", "sandboxed_template", "validate_sandboxed_template"]
15
+
16
+ _UNSAFE_STATIC_ATTRIBUTES: frozenset[str] = frozenset(
17
+ {
18
+ "mro",
19
+ *UNSAFE_FUNCTION_ATTRIBUTES,
20
+ *UNSAFE_METHOD_ATTRIBUTES,
21
+ *UNSAFE_GENERATOR_ATTRIBUTES,
22
+ *UNSAFE_COROUTINE_ATTRIBUTES,
23
+ *UNSAFE_ASYNC_GENERATOR_ATTRIBUTES,
24
+ }
25
+ )
5
26
 
6
27
 
7
28
  @cache
@@ -16,3 +37,20 @@ def sandboxed_template(source: str, *, lstrip_blocks: bool = False) -> Template:
16
37
  sandbox rejects raises ``jinja2.exceptions.SecurityError``.
17
38
  """
18
39
  return _sandboxed_environment(lstrip_blocks=lstrip_blocks).from_string(source)
40
+
41
+
42
+ def validate_sandboxed_template(source: str, *, lstrip_blocks: bool = False) -> str:
43
+ """Validate that ``source`` compiles and accesses no sandbox-forbidden attributes.
44
+
45
+ Raises ``jinja2.TemplateSyntaxError`` on malformed syntax (and top-level
46
+ unknown filters/tests; filters inside conditionals are resolved by Jinja at
47
+ render time) and ``jinja2.exceptions.SecurityError`` on static dot-access to
48
+ private or internal Python attributes.
49
+ """
50
+ env = _sandboxed_environment(lstrip_blocks=lstrip_blocks)
51
+ ast = env.parse(source)
52
+ for node in ast.find_all(nodes.Getattr):
53
+ if node.attr.startswith("_") or node.attr in _UNSAFE_STATIC_ATTRIBUTES:
54
+ raise SecurityError("access to private or internal attribute is unsafe.")
55
+ env.from_string(source)
56
+ return source
@@ -69,6 +69,7 @@ class LanguageModelName(StrEnum):
69
69
  AZURE_GPT_6_LUNA_2026_0922 = "AZURE_GPT_6_LUNA_2026_0922"
70
70
  AZURE_GPT_6_SOL_2026_0922 = "AZURE_GPT_6_SOL_2026_0922"
71
71
  AZURE_GPT_61_SOL_2026_0929 = "AZURE_GPT_61_SOL_2026_0929"
72
+ AZURE_GPT_61_TERRA_2026_1026 = "AZURE_GPT_61_TERRA_2026_1026"
72
73
  AZURE_GPT_4o_2024_0513 = "AZURE_GPT_4o_2024_0513"
73
74
  AZURE_GPT_4o_2024_0806 = "AZURE_GPT_4o_2024_0806"
74
75
  AZURE_GPT_4o_2024_1120 = "AZURE_GPT_4o_2024_1120"
@@ -143,6 +144,7 @@ class LanguageModelName(StrEnum):
143
144
  LITELLM_OPENAI_GPT_6_LUNA = "litellm:openai-gpt-6-luna"
144
145
  LITELLM_OPENAI_GPT_6_SOL = "litellm:openai-gpt-6-sol"
145
146
  LITELLM_OPENAI_GPT_61_SOL = "litellm:openai-gpt-6.1-sol"
147
+ LITELLM_OPENAI_GPT_61_TERRA = "litellm:openai-gpt-6.1-terra"
146
148
  LITELLM_OPENAI_O1 = "litellm:openai-o1"
147
149
  LITELLM_OPENAI_O3 = "litellm:openai-o3"
148
150
  LITELLM_OPENAI_O3_DEEP_RESEARCH = "litellm:openai-o3-deep-research"
@@ -249,6 +251,7 @@ def get_encoder_name(model_name: LanguageModelName) -> EncoderName:
249
251
  | LMN.AZURE_GPT_6_LUNA_2026_0922
250
252
  | LMN.AZURE_GPT_6_SOL_2026_0922
251
253
  | LMN.AZURE_GPT_61_SOL_2026_0929
254
+ | LMN.AZURE_GPT_61_TERRA_2026_1026
252
255
  | LMN.AZURE_MODEL_ROUTER_2025_1118
253
256
  | LMN.LITELLM_OPENAI_GPT_5
254
257
  | LMN.LITELLM_OPENAI_GPT_5_MINI
@@ -270,6 +273,7 @@ def get_encoder_name(model_name: LanguageModelName) -> EncoderName:
270
273
  | LMN.LITELLM_OPENAI_GPT_6_LUNA
271
274
  | LMN.LITELLM_OPENAI_GPT_6_SOL
272
275
  | LMN.LITELLM_OPENAI_GPT_61_SOL
276
+ | LMN.LITELLM_OPENAI_GPT_61_TERRA
273
277
  | LMN.LITELLM_OPENAI_O1
274
278
  | LMN.LITELLM_OPENAI_O3
275
279
  | LMN.LITELLM_OPENAI_O3_DEEP_RESEARCH
@@ -3266,6 +3270,57 @@ class LanguageModelInfo(BaseModel):
3266
3270
  "max",
3267
3271
  ],
3268
3272
  )
3273
+ case (
3274
+ LanguageModelName.AZURE_GPT_61_TERRA_2026_1026
3275
+ | LanguageModelName.LITELLM_OPENAI_GPT_61_TERRA
3276
+ ):
3277
+ # https://developers.openai.com/api/docs/models/gpt-6.1-terra
3278
+ # Foundry GA 2026-10-26, version 2026-10-26:
3279
+ # https://learn.microsoft.com/en-us/azure/foundry/foundry-models/concepts/models-sold-directly-by-azure
3280
+ # https://techcommunity.microsoft.com/blog/azure-ai-foundry-blog/gpt-6-1-terra-now-generally-available-in-microsoft-foundry-build-agents-that-see/4567769
3281
+ # Context 1,050,000 with 128,000 max output → 922,000 max input.
3282
+ # `none` and `max` are documented reasoning efforts.
3283
+ provider = (
3284
+ LanguageModelProvider.AZURE
3285
+ if model_name is LanguageModelName.AZURE_GPT_61_TERRA_2026_1026
3286
+ else LanguageModelProvider.LITELLM
3287
+ )
3288
+ return cls(
3289
+ name=model_name,
3290
+ provider=provider,
3291
+ family=ModelFamily.OPENAI,
3292
+ version="2026-10-26",
3293
+ encoder_name=EncoderName.O200K_BASE,
3294
+ capabilities=[
3295
+ ModelCapabilities.CHAT_COMPLETIONS_API,
3296
+ ModelCapabilities.FUNCTION_CALLING,
3297
+ ModelCapabilities.PARALLEL_FUNCTION_CALLING,
3298
+ ModelCapabilities.REASONING,
3299
+ ModelCapabilities.RESPONSES_API,
3300
+ ModelCapabilities.STREAMING,
3301
+ ModelCapabilities.STRUCTURED_OUTPUT,
3302
+ ModelCapabilities.VISION,
3303
+ ],
3304
+ token_limits=LanguageModelTokenLimits(
3305
+ token_limit_input=922_000, token_limit_output=128_000
3306
+ ),
3307
+ info_cutoff_at=date(2026, 6, 1),
3308
+ published_at=date(2026, 10, 26),
3309
+ temperature_bounds=TemperatureBounds(
3310
+ min_temperature=0.0, max_temperature=1.0
3311
+ ),
3312
+ default_options={
3313
+ "reasoning_effort": "medium",
3314
+ },
3315
+ supported_reasoning_efforts=[
3316
+ "none",
3317
+ "low",
3318
+ "medium",
3319
+ "high",
3320
+ "xhigh",
3321
+ "max",
3322
+ ],
3323
+ )
3269
3324
  case LanguageModelName.LITELLM_OPENAI_O1:
3270
3325
  return cls(
3271
3326
  name=model_name,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: unique-toolkit
3
- Version: 2026.46.0.dev8
3
+ Version: 2026.46.0.dev10
4
4
  Summary:
5
5
  Author: Cedric Klinkert, Martin Fadler, Sadique Sheik, Fabian Schläpfer, Pascal Hauri, Ejiroghene Oki-Peter, Rami Azouz, Ricardo Visini, Sanzio Monti
6
6
  Author-email: Cedric Klinkert <cedric.klinkert@unique.ch>, Martin Fadler <martin.fadler@unique.ch>, Sadique Sheik <sadique@unique.ch>, Fabian Schläpfer <fabian@unique.ch>, Pascal Hauri <pascal@unique.ch>, Ejiroghene Oki-Peter <oki-peter.ejiroghene@unique.ai>, Rami Azouz <rami.ext@unique.ch>, Ricardo Visini <ricardo.visini@unique.ch>, Sanzio Monti <sanzio.monti@unique.ai>
@@ -16,7 +16,7 @@ Requires-Dist: sseclient>=0.0.27,<0.0.28
16
16
  Requires-Dist: openai>=1.105.0,<3
17
17
  Requires-Dist: platformdirs>=4.0.0,<5
18
18
  Requires-Dist: pillow>=12.1.1
19
- Requires-Dist: unique-sdk>=2026.46.0.dev4,<2026.46.0rc0
19
+ Requires-Dist: unique-sdk>=2026.46.0.dev5,<2026.46.0rc0
20
20
  Requires-Dist: jambo>=0.1.2,<0.2
21
21
  Requires-Dist: jinja2>=3.1.6,<4
22
22
  Requires-Dist: docxtpl>=0.20.1,<0.21
@@ -75,7 +75,7 @@ unique_toolkit/_common/utils/files.py,sha256=cPJU3Y5DlAbdakPaF1vICOCOujMHESrP4b3
75
75
  unique_toolkit/_common/utils/image/encode.py,sha256=IJhtTcIT_azhiDsPp15oYs2LPze2l-sGlZrJASHrDVI,658
76
76
  unique_toolkit/_common/utils/jinja/helpers.py,sha256=UQWj0hFMtnuUFYDJ8NKbEblvYE8DrWX1o7fKQU3H9IQ,262
77
77
  unique_toolkit/_common/utils/jinja/render.py,sha256=D48hVbDcaGz_O01Xgawd3fBgbFIiZkThShZyjN96nBo,537
78
- unique_toolkit/_common/utils/jinja/sandbox.py,sha256=UAT5Au8pEDAwrZcseDc3m7uFpLx_3vtLQ4Ureqv0Jlc,633
78
+ unique_toolkit/_common/utils/jinja/sandbox.py,sha256=b39fvrHyvFiTK1ft8mIlPOvaiP7JktLLpzLgPK27hbA,2045
79
79
  unique_toolkit/_common/utils/jinja/schema.py,sha256=uyGGN1uvcGTBBujs8KUrnMMND73MNC5YGJkSETVyUCo,2007
80
80
  unique_toolkit/_common/utils/jinja/utils.py,sha256=0SrwN6qfLlRJrl38HG7qsMr5-DwpABNnM9LpqpMgwUA,2814
81
81
  unique_toolkit/_common/utils/structured_output/__init__.py,sha256=nm_orZrlCXL0FPLUg0Jv6Ty1flXPkCgZ9caAWaS8rz8,38
@@ -403,7 +403,7 @@ unique_toolkit/language_model/constants.py,sha256=B-topqW0r83dkC_25DeQfnPk3n53qz
403
403
  unique_toolkit/language_model/default_language_model.py,sha256=mcyuFs_V6tp52C8xJSHiEHO4kFGj6xed1gvozvCRD7k,1181
404
404
  unique_toolkit/language_model/errors.py,sha256=0nm4psGCGJM2B7LIyKXy7WuswRzwARIgIK5xoC4xo34,3186
405
405
  unique_toolkit/language_model/functions.py,sha256=6Le6dDm9su6xk3sQ8IPiyUn2tf1qvzxHVUhyTTgP8Kw,28109
406
- unique_toolkit/language_model/infos.py,sha256=YFyqEDPweMDE7c0-CozfDrZ2ZUY3mVIPILFY4nlqH0Q,185513
406
+ unique_toolkit/language_model/infos.py,sha256=XUIbN7GVL_O2nsG-bDx74pFq1Za2SDU5Czouo5lw6y4,188299
407
407
  unique_toolkit/language_model/invocation_stats.py,sha256=CQbpUz394IsVd8eNTB1gPSMt5f0UXmkN1amNsqtAW6U,5857
408
408
  unique_toolkit/language_model/model_costs.py,sha256=AVHAuMTzsglzusWsVF_xwBVEndST-TVCVi0H49OhdvE,7419
409
409
  unique_toolkit/language_model/prompt.py,sha256=JSawaLjQg3VR-E2fK8engFyJnNdk21zaO8pPIodzN4Q,3991
@@ -434,6 +434,6 @@ unique_toolkit/short_term_memory/service.py,sha256=2JMBEBn6GoyK-a0xvdcWpPft-3C74
434
434
  unique_toolkit/smart_rules/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
435
435
  unique_toolkit/smart_rules/compile.py,sha256=vRe0aMJWuVIK-VsqomgxQImzke7MDmwgSxxJfYCa7zw,1386
436
436
  unique_toolkit/test_utilities/events.py,sha256=FLrhMh0A_mQutAUjoD0FdMcVQ4Gq31r35OVGzRjvLro,6760
437
- unique_toolkit-2026.46.0.dev8.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
438
- unique_toolkit-2026.46.0.dev8.dist-info/METADATA,sha256=IZE23B3fK6ZadA0RmL9M39maAgK93BiOTKQOwElc6_w,7821
439
- unique_toolkit-2026.46.0.dev8.dist-info/RECORD,,
437
+ unique_toolkit-2026.46.0.dev10.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
438
+ unique_toolkit-2026.46.0.dev10.dist-info/METADATA,sha256=HAm3qjU5XV6WbIQPBJ8eYK-El5mJrvFmnLVR8lB8u-k,7822
439
+ unique_toolkit-2026.46.0.dev10.dist-info/RECORD,,