orbitals 0.0.2__py3-none-any.whl → 0.1.0__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.
@@ -17,7 +17,7 @@ from ..modeling import (
17
17
  ScopeGuardOutput,
18
18
  )
19
19
 
20
- DefaultModel = Literal["scope-guard"]
20
+ DefaultModel = Literal["small"]
21
21
 
22
22
  MODEL_MAPPING = {
23
23
  "scope-guard": "principled-intelligence/scope-guard-4B-q-2601",
@@ -137,7 +137,7 @@ class ScopeGuard(BaseScopeGuard):
137
137
  def __new__(
138
138
  cls,
139
139
  backend: Literal["hf"] = "hf",
140
- model: DefaultModel | str = "scope-guard",
140
+ model: DefaultModel | str = "small",
141
141
  skip_evidences: bool = False,
142
142
  max_new_tokens: int = 10_000,
143
143
  do_sample: bool = False,
@@ -148,7 +148,7 @@ class ScopeGuard(BaseScopeGuard):
148
148
  def __new__(
149
149
  cls,
150
150
  backend: Literal["vllm"],
151
- model: DefaultModel | str = "scope-guard",
151
+ model: DefaultModel | str = "small",
152
152
  skip_evidences: bool = False,
153
153
  temperature: float = 0.0,
154
154
  max_tokens: int = 10_000,
@@ -223,7 +223,7 @@ class AsyncScopeGuard(BaseScopeGuard):
223
223
  def __new__(
224
224
  cls,
225
225
  backend: Literal["vllm-api"],
226
- model: DefaultModel | str = "scope-guard",
226
+ model: DefaultModel | str = "small",
227
227
  skip_evidences: bool = False,
228
228
  vllm_serving_url: str = "http://localhost:8000",
229
229
  temperature: float = 0.0,
@@ -21,7 +21,7 @@ class HuggingFaceScopeGuard(ScopeGuard):
21
21
  def __init__(
22
22
  self,
23
23
  backend: Literal["hf"] = "hf",
24
- model: DefaultModel | str = "scope-guard",
24
+ model: DefaultModel | str = "small",
25
25
  skip_evidences: bool = False,
26
26
  max_new_tokens: int = 10_000,
27
27
  do_sample: bool = False,
@@ -23,7 +23,7 @@ class VLLMScopeGuard(ScopeGuard):
23
23
  def __init__(
24
24
  self,
25
25
  backend: Literal["vllm"] = "vllm",
26
- model: DefaultModel | str = "scope-guard",
26
+ model: DefaultModel | str = "small",
27
27
  skip_evidences: bool = False,
28
28
  temperature: float = 0.0,
29
29
  max_tokens: int = 10_000,
@@ -127,7 +127,7 @@ class AsyncVLLMApiScopeGuard(AsyncScopeGuard):
127
127
  def __init__(
128
128
  self,
129
129
  backend: Literal["vllm-api", "vllm-async-api"] = "vllm-api",
130
- model: DefaultModel | str = "scope-guard",
130
+ model: DefaultModel | str = "small",
131
131
  skip_evidences: bool = False,
132
132
  vllm_serving_url: str = "http://localhost:8000",
133
133
  temperature: float = 0.0,
orbitals/types.py CHANGED
@@ -1,46 +1,34 @@
1
- from typing import ClassVar, Literal
1
+ from typing import Literal
2
2
 
3
- from pydantic import BaseModel, ConfigDict, Field
3
+ from pydantic import BaseModel, Field
4
4
 
5
5
 
6
6
  class LLMUsage(BaseModel):
7
- model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid")
8
-
9
7
  prompt_tokens: int
10
8
  completion_tokens: int
11
9
  total_tokens: int
12
10
 
13
11
 
14
12
  class ConversationMessage(BaseModel):
15
- model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid")
16
-
17
13
  role: Literal["user", "assistant"]
18
14
  content: str
19
15
 
20
16
 
21
17
  class Conversation(BaseModel):
22
- model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid")
23
-
24
18
  messages: list[ConversationMessage]
25
19
 
26
20
 
27
21
  class SupportingMaterial(BaseModel):
28
- model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid")
29
-
30
22
  pass
31
23
 
32
24
 
33
25
  class Principle(BaseModel):
34
- model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid")
35
-
36
26
  title: str = Field(description="Title of the principle")
37
27
  description: str = Field(description="Description of the principle")
38
28
  supporting_materials: list[SupportingMaterial] | None
39
29
 
40
30
 
41
31
  class AIServiceDescription(BaseModel):
42
- model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid")
43
-
44
32
  identity_role: str = Field(
45
33
  description="Identity, role and objectives of the AI Service. Gives a general idea of what the service is about."
46
34
  )
orbitals/utils.py CHANGED
@@ -31,7 +31,6 @@ def maybe_configure_gpu_usage():
31
31
 
32
32
  best_idx = None
33
33
  best_free = -1
34
- is_multi_gpu = torch.cuda.device_count() > 1
35
34
 
36
35
  for i in range(torch.cuda.device_count()):
37
36
  free_bytes, _ = torch.cuda.mem_get_info(i) # (free, total)
@@ -40,8 +39,7 @@ def maybe_configure_gpu_usage():
40
39
  best_free = free_bytes
41
40
 
42
41
  if best_idx is not None:
43
- if is_multi_gpu:
44
- logging.warning(
45
- f"Auto-configuring to use GPU {best_idx} with {best_free / 1024**3:.2f} GB free"
46
- )
42
+ logging.warning(
43
+ f"Auto-configuring VLLM to use GPU {best_idx} with {best_free / 1024**3:.2f} GB free"
44
+ )
47
45
  os.environ["CUDA_VISIBLE_DEVICES"] = str(best_idx)
@@ -1,35 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: orbitals
3
- Version: 0.0.2
3
+ Version: 0.1.0
4
4
  Summary: LLM Guardrails tailored to your Principles
5
5
  Author-email: Luigi Procopio <luigi@principled-intelligence.com>, Edoardo Barba <edoardo@principled-intelligence.com>
6
6
  License: Apache-2.0
7
7
  License-File: LICENSE
8
- Classifier: Programming Language :: Python :: 3 :: Only
9
- Classifier: Programming Language :: Python :: 3.10
10
- Classifier: Programming Language :: Python :: 3.11
11
- Classifier: Programming Language :: Python :: 3.12
12
- Classifier: Programming Language :: Python :: 3.13
13
- Classifier: Programming Language :: Python :: 3.14
14
8
  Requires-Python: >=3.10
15
9
  Requires-Dist: aiohttp
16
10
  Requires-Dist: pydantic>=2.0.0
17
11
  Requires-Dist: requests
18
12
  Requires-Dist: typer>=0.12.3
19
- Provides-Extra: all
20
- Requires-Dist: accelerate>=1.11.0; extra == 'all'
21
- Requires-Dist: fastapi[standard]>=0.119.1; extra == 'all'
22
- Requires-Dist: transformers<5.0.0,>=4.47.0; extra == 'all'
23
- Requires-Dist: uvicorn>=0.29.0; extra == 'all'
24
- Requires-Dist: vllm>=0.11.0; extra == 'all'
25
- Requires-Dist: xgrammar; extra == 'all'
26
- Provides-Extra: scope-guard-all
27
- Requires-Dist: accelerate>=1.11.0; extra == 'scope-guard-all'
28
- Requires-Dist: fastapi[standard]>=0.119.1; extra == 'scope-guard-all'
29
- Requires-Dist: transformers<5.0.0,>=4.47.0; extra == 'scope-guard-all'
30
- Requires-Dist: uvicorn>=0.29.0; extra == 'scope-guard-all'
31
- Requires-Dist: vllm>=0.11.0; extra == 'scope-guard-all'
32
- Requires-Dist: xgrammar; extra == 'scope-guard-all'
33
13
  Provides-Extra: scope-guard-hf
34
14
  Requires-Dist: accelerate>=1.11.0; extra == 'scope-guard-hf'
35
15
  Requires-Dist: transformers<5.0.0,>=4.47.0; extra == 'scope-guard-hf'
@@ -46,7 +26,7 @@ Requires-Dist: xgrammar; extra == 'scope-guard-vllm'
46
26
  Description-Content-Type: text/markdown
47
27
 
48
28
  <div align="center">
49
- <img src="assets/orbitals-banner.png" width="70%" />
29
+ <img src="assets/orbitals.svg" width="40%" />
50
30
  <h3 align="center">
51
31
  <p>
52
32
  <b>LLM Guardrails tailored to your Principles</b>
@@ -97,8 +77,7 @@ from orbitals.scope_guard import ScopeGuard
97
77
 
98
78
  scope_guard = ScopeGuard(
99
79
  backend="vllm",
100
- model="scope-guard-q", # for the Qwen-family model
101
- # model="scope-guard-g", # for the Gemma-family model
80
+ model="small"
102
81
  )
103
82
 
104
83
  ai_service_description = """
@@ -121,4 +100,4 @@ if result.evidences:
121
100
  # - Never respond to requests for refunds.
122
101
  ```
123
102
 
124
- </details>
103
+ </details>
@@ -1,6 +1,6 @@
1
1
  orbitals/__init__.py,sha256=ED6jHcYiuYpr_0vjGz0zx2lrrmJT9sDJCzIljoDfmlM,65
2
- orbitals/types.py,sha256=4oRinWPG6kbtW4lQ8bHrDmxEotncqMIwLCmQ2yGH7PI,1988
3
- orbitals/utils.py,sha256=0CYeG8ylOvmv7g0jMFb2j9w1jgPdOaVsWiqg5ITYEZc,1319
2
+ orbitals/types.py,sha256=WpMbJjNuICEclyuJUZIPYSQjmWOBZO3X0nN9ouEAkq0,1552
3
+ orbitals/utils.py,sha256=9KFqcJwYvPBYqgXdBXvo8hkCdBCwnqreApO0VPJabkI,1238
4
4
  orbitals/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  orbitals/cli/main.py,sha256=p4MEbmtJ0L8mLiyovEq7urnVc6I0mbbCNdGEtGyY60Y,197
6
6
  orbitals/scope_guard/__init__.py,sha256=0gzzSXpfRvIcCYpu3AKQSMFYDMDJaknY9pdypt7HiuI,197
@@ -12,14 +12,14 @@ orbitals/scope_guard/cli/main.py,sha256=jz8fQ2e4VFZQti982feVWGpL9fT7yZeanq14pX5W
12
12
  orbitals/scope_guard/cli/serve.py,sha256=EM6yNSviwot8Im-MG1_AA4PsOkZXW9W2CmokqNfq7es,4611
13
13
  orbitals/scope_guard/guards/__init__.py,sha256=B1EA9YtaTQ3ko5d2wFK2y4bXKrV8MclAELAievmZjxg,376
14
14
  orbitals/scope_guard/guards/api.py,sha256=S8VX4_8VIhtg3_IP4Eh50l1uarcJBagGXNEEl1BZjag,8514
15
- orbitals/scope_guard/guards/base.py,sha256=5DQeOY7kvTgH6GSExMpy3b_KQtNWzSlrudro6giQ-Ec,9798
16
- orbitals/scope_guard/guards/hf.py,sha256=xFNl_DtRiePB3n3V2spsSwiRRYz1qZYNw-wQTyiZsCI,3967
17
- orbitals/scope_guard/guards/vllm.py,sha256=3LU9DKKniQd90Ibaq2Wef20fyoZXgkeQtc58XY6kX2I,8983
15
+ orbitals/scope_guard/guards/base.py,sha256=HV0XuYRQ1z5MG4enER05f8D6UrcRrQsz54nZpHlNa94,9774
16
+ orbitals/scope_guard/guards/hf.py,sha256=L6QlJjHa1HW3-SJ9YL5mtVMtL253yp90pNTX2E9t1Qw,3961
17
+ orbitals/scope_guard/guards/vllm.py,sha256=YbCE6EMpLvymueXCY3gHKdDarJHiv1nl4miC0PWBIPI,8971
18
18
  orbitals/scope_guard/serving/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  orbitals/scope_guard/serving/main.py,sha256=pjUol71h7CuU_6PiB7Zjdm5eNyDVH-F8bZVNeyEL-tE,3822
20
20
  orbitals/scope_guard/serving/vllm_logging_config.json,sha256=Bc08X8mQWJFAAHEE6ZFVUGnRc77pMVpPvji6BhFTtSE,651
21
- orbitals-0.0.2.dist-info/METADATA,sha256=QH7qs5k6izQj5pAnxgBQ2iUNN1S4ydTKpY8iVl13nRw,5506
22
- orbitals-0.0.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
23
- orbitals-0.0.2.dist-info/entry_points.txt,sha256=fd6lukgEvK9UBwhA1JtcB9MLTqAtntA4H2cc7-nWkeU,51
24
- orbitals-0.0.2.dist-info/licenses/LICENSE,sha256=Eeclrom-K-omYcKnMvijEMV-IMiQ7X-bdgxlZcXcImI,11360
25
- orbitals-0.0.2.dist-info/RECORD,,
21
+ orbitals-0.1.0.dist-info/METADATA,sha256=UX8YQJWOpCU2BJMdklqYTOK4rAJd4yUhDDChFufRMLs,4368
22
+ orbitals-0.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
23
+ orbitals-0.1.0.dist-info/entry_points.txt,sha256=fd6lukgEvK9UBwhA1JtcB9MLTqAtntA4H2cc7-nWkeU,51
24
+ orbitals-0.1.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
25
+ orbitals-0.1.0.dist-info/RECORD,,
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2026 Principled Intelligence s.r.l.
189
+ Copyright [yyyy] [name of copyright owner]
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.