orbitals 0.0.1__py3-none-any.whl → 0.0.2__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.
- orbitals/types.py +14 -2
- orbitals/utils.py +5 -3
- {orbitals-0.0.1.dist-info → orbitals-0.0.2.dist-info}/METADATA +24 -3
- {orbitals-0.0.1.dist-info → orbitals-0.0.2.dist-info}/RECORD +7 -7
- {orbitals-0.0.1.dist-info → orbitals-0.0.2.dist-info}/licenses/LICENSE +1 -1
- {orbitals-0.0.1.dist-info → orbitals-0.0.2.dist-info}/WHEEL +0 -0
- {orbitals-0.0.1.dist-info → orbitals-0.0.2.dist-info}/entry_points.txt +0 -0
orbitals/types.py
CHANGED
|
@@ -1,34 +1,46 @@
|
|
|
1
|
-
from typing import Literal
|
|
1
|
+
from typing import ClassVar, Literal
|
|
2
2
|
|
|
3
|
-
from pydantic import BaseModel, Field
|
|
3
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class LLMUsage(BaseModel):
|
|
7
|
+
model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid")
|
|
8
|
+
|
|
7
9
|
prompt_tokens: int
|
|
8
10
|
completion_tokens: int
|
|
9
11
|
total_tokens: int
|
|
10
12
|
|
|
11
13
|
|
|
12
14
|
class ConversationMessage(BaseModel):
|
|
15
|
+
model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid")
|
|
16
|
+
|
|
13
17
|
role: Literal["user", "assistant"]
|
|
14
18
|
content: str
|
|
15
19
|
|
|
16
20
|
|
|
17
21
|
class Conversation(BaseModel):
|
|
22
|
+
model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid")
|
|
23
|
+
|
|
18
24
|
messages: list[ConversationMessage]
|
|
19
25
|
|
|
20
26
|
|
|
21
27
|
class SupportingMaterial(BaseModel):
|
|
28
|
+
model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid")
|
|
29
|
+
|
|
22
30
|
pass
|
|
23
31
|
|
|
24
32
|
|
|
25
33
|
class Principle(BaseModel):
|
|
34
|
+
model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid")
|
|
35
|
+
|
|
26
36
|
title: str = Field(description="Title of the principle")
|
|
27
37
|
description: str = Field(description="Description of the principle")
|
|
28
38
|
supporting_materials: list[SupportingMaterial] | None
|
|
29
39
|
|
|
30
40
|
|
|
31
41
|
class AIServiceDescription(BaseModel):
|
|
42
|
+
model_config: ClassVar[ConfigDict] = ConfigDict(extra="forbid")
|
|
43
|
+
|
|
32
44
|
identity_role: str = Field(
|
|
33
45
|
description="Identity, role and objectives of the AI Service. Gives a general idea of what the service is about."
|
|
34
46
|
)
|
orbitals/utils.py
CHANGED
|
@@ -31,6 +31,7 @@ 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
|
|
34
35
|
|
|
35
36
|
for i in range(torch.cuda.device_count()):
|
|
36
37
|
free_bytes, _ = torch.cuda.mem_get_info(i) # (free, total)
|
|
@@ -39,7 +40,8 @@ def maybe_configure_gpu_usage():
|
|
|
39
40
|
best_free = free_bytes
|
|
40
41
|
|
|
41
42
|
if best_idx is not None:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
+
)
|
|
45
47
|
os.environ["CUDA_VISIBLE_DEVICES"] = str(best_idx)
|
|
@@ -1,15 +1,35 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: orbitals
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.2
|
|
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
|
|
8
14
|
Requires-Python: >=3.10
|
|
9
15
|
Requires-Dist: aiohttp
|
|
10
16
|
Requires-Dist: pydantic>=2.0.0
|
|
11
17
|
Requires-Dist: requests
|
|
12
18
|
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'
|
|
13
33
|
Provides-Extra: scope-guard-hf
|
|
14
34
|
Requires-Dist: accelerate>=1.11.0; extra == 'scope-guard-hf'
|
|
15
35
|
Requires-Dist: transformers<5.0.0,>=4.47.0; extra == 'scope-guard-hf'
|
|
@@ -26,7 +46,7 @@ Requires-Dist: xgrammar; extra == 'scope-guard-vllm'
|
|
|
26
46
|
Description-Content-Type: text/markdown
|
|
27
47
|
|
|
28
48
|
<div align="center">
|
|
29
|
-
<img src="assets/
|
|
49
|
+
<img src="assets/orbitals-banner.png" width="70%" />
|
|
30
50
|
<h3 align="center">
|
|
31
51
|
<p>
|
|
32
52
|
<b>LLM Guardrails tailored to your Principles</b>
|
|
@@ -77,7 +97,8 @@ from orbitals.scope_guard import ScopeGuard
|
|
|
77
97
|
|
|
78
98
|
scope_guard = ScopeGuard(
|
|
79
99
|
backend="vllm",
|
|
80
|
-
model="scope-guard"
|
|
100
|
+
model="scope-guard-q", # for the Qwen-family model
|
|
101
|
+
# model="scope-guard-g", # for the Gemma-family model
|
|
81
102
|
)
|
|
82
103
|
|
|
83
104
|
ai_service_description = """
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
orbitals/__init__.py,sha256=ED6jHcYiuYpr_0vjGz0zx2lrrmJT9sDJCzIljoDfmlM,65
|
|
2
|
-
orbitals/types.py,sha256=
|
|
3
|
-
orbitals/utils.py,sha256=
|
|
2
|
+
orbitals/types.py,sha256=4oRinWPG6kbtW4lQ8bHrDmxEotncqMIwLCmQ2yGH7PI,1988
|
|
3
|
+
orbitals/utils.py,sha256=0CYeG8ylOvmv7g0jMFb2j9w1jgPdOaVsWiqg5ITYEZc,1319
|
|
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
|
|
@@ -18,8 +18,8 @@ orbitals/scope_guard/guards/vllm.py,sha256=3LU9DKKniQd90Ibaq2Wef20fyoZXgkeQtc58X
|
|
|
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.
|
|
22
|
-
orbitals-0.0.
|
|
23
|
-
orbitals-0.0.
|
|
24
|
-
orbitals-0.0.
|
|
25
|
-
orbitals-0.0.
|
|
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,,
|
|
@@ -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
|
|
189
|
+
Copyright 2026 Principled Intelligence s.r.l.
|
|
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.
|
|
File without changes
|
|
File without changes
|