orbitals 0.1.0__tar.gz → 0.1.1__tar.gz
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-0.1.1/.dockerignore +5 -0
- orbitals-0.1.1/CONTRIBUTING.md +45 -0
- orbitals-0.1.1/Dockerfile +23 -0
- orbitals-0.1.0/Dockerfile → orbitals-0.1.1/Dockerfile copy +16 -13
- {orbitals-0.1.0 → orbitals-0.1.1}/LICENSE +1 -1
- orbitals-0.1.1/PKG-INFO +164 -0
- orbitals-0.1.1/README.md +109 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/README.scope-guard.md +99 -51
- orbitals-0.1.1/assets/orbitals-banner.png +0 -0
- orbitals-0.1.1/examples/scope-guard/test.py +27 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/pyproject.toml +28 -9
- {orbitals-0.1.0 → orbitals-0.1.1}/src/orbitals/scope_guard/guards/base.py +4 -4
- {orbitals-0.1.0 → orbitals-0.1.1}/src/orbitals/scope_guard/guards/hf.py +1 -1
- {orbitals-0.1.0 → orbitals-0.1.1}/src/orbitals/scope_guard/guards/vllm.py +2 -2
- {orbitals-0.1.0 → orbitals-0.1.1}/src/orbitals/scope_guard/serving/main.py +2 -14
- {orbitals-0.1.0 → orbitals-0.1.1}/src/orbitals/types.py +14 -2
- orbitals-0.1.1/src/orbitals/utils.py +53 -0
- orbitals-0.1.1/src/scripts/playground.ipynb +267 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/src/scripts/push_hf_pipeline.py +2 -9
- {orbitals-0.1.0 → orbitals-0.1.1}/uv.lock +332 -488
- orbitals-0.1.0/.dockerignore +0 -2
- orbitals-0.1.0/PKG-INFO +0 -103
- orbitals-0.1.0/README.md +0 -76
- orbitals-0.1.0/src/orbitals/utils.py +0 -45
- orbitals-0.1.0/src/scripts/playground.ipynb +0 -196
- {orbitals-0.1.0 → orbitals-0.1.1}/.gitignore +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/AGENTS.md +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/assets/orbitals.svg +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/assets/scope-guard.svg +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/examples/scope-guard/api.py +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/examples/scope-guard/async_api.py +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/examples/scope-guard/local.py +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/examples/scope-guard/vllm_serve.py +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/src/hf_pipeline/scope_guard.py +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/src/orbitals/__init__.py +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/src/orbitals/cli/__init__.py +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/src/orbitals/cli/main.py +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/src/orbitals/scope_guard/__init__.py +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/src/orbitals/scope_guard/cli/__init__.py +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/src/orbitals/scope_guard/cli/convert_default_model_name.py +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/src/orbitals/scope_guard/cli/main.py +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/src/orbitals/scope_guard/cli/serve.py +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/src/orbitals/scope_guard/guards/__init__.py +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/src/orbitals/scope_guard/guards/api.py +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/src/orbitals/scope_guard/modeling.py +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/src/orbitals/scope_guard/prompting.py +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/src/orbitals/scope_guard/serving/__init__.py +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/src/orbitals/scope_guard/serving/vllm_logging_config.json +0 -0
- {orbitals-0.1.0 → orbitals-0.1.1}/src/scripts/push_model.py +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Contributing to Orbitals
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to `orbitals`! We welcome contributions from the community.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
1. **Fork the repository** and clone it locally
|
|
8
|
+
2. **Install dependencies** using `uv`:
|
|
9
|
+
```bash
|
|
10
|
+
uv sync
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Development Workflow
|
|
14
|
+
|
|
15
|
+
1. Create a new branch for your feature or fix:
|
|
16
|
+
```bash
|
|
17
|
+
git checkout -b feature/your-feature-name
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
2. Make your changes and ensure they follow the project's coding conventions
|
|
21
|
+
|
|
22
|
+
3. Test your changes thoroughly
|
|
23
|
+
|
|
24
|
+
4. Commit your changes with a clear, descriptive message
|
|
25
|
+
|
|
26
|
+
5. Push to your fork and submit a pull request
|
|
27
|
+
|
|
28
|
+
## Coding Conventions
|
|
29
|
+
|
|
30
|
+
- Use **Google-style docstrings** for all documentation
|
|
31
|
+
- Follow PEP 8 style guidelines
|
|
32
|
+
- Keep code modular and well-organized
|
|
33
|
+
|
|
34
|
+
## Reporting Issues
|
|
35
|
+
|
|
36
|
+
When reporting issues, please include:
|
|
37
|
+
|
|
38
|
+
- A clear description of the problem
|
|
39
|
+
- Steps to reproduce the issue
|
|
40
|
+
- Expected vs actual behavior
|
|
41
|
+
- Your environment details (Python version, OS, etc.)
|
|
42
|
+
|
|
43
|
+
## Questions?
|
|
44
|
+
|
|
45
|
+
Feel free to open an issue for any questions or discussions about contributing.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
FROM vllm/vllm-openai:v0.14.1
|
|
2
|
+
|
|
3
|
+
ARG DEBIAN_FRONTEND=noninteractive
|
|
4
|
+
|
|
5
|
+
COPY --from=ghcr.io/astral-sh/uv:0.9.8-debian-slim /usr/local/bin/uv /usr/local/bin/uvx /bin/
|
|
6
|
+
|
|
7
|
+
WORKDIR /app
|
|
8
|
+
ENV PATH="/app/.venv/bin:$PATH"
|
|
9
|
+
ENV UV_COMPILE_BYTECODE=1
|
|
10
|
+
|
|
11
|
+
ARG MODEL
|
|
12
|
+
ENV MODEL=${MODEL}
|
|
13
|
+
|
|
14
|
+
RUN hf download ${MODEL}
|
|
15
|
+
|
|
16
|
+
COPY pyproject.toml uv.lock README.md src /app/src/
|
|
17
|
+
|
|
18
|
+
RUN pip install -e .[serving]
|
|
19
|
+
|
|
20
|
+
EXPOSE 8000
|
|
21
|
+
|
|
22
|
+
ENTRYPOINT ["/bin/bash", "-c"]
|
|
23
|
+
CMD ["orbitals scope-guard serve ${MODEL} --port 8000 --host 0.0.0.0"]
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
FROM
|
|
1
|
+
FROM nvidia/cuda:13.1.1-cudnn-devel-ubuntu24.04 AS builder
|
|
2
2
|
|
|
3
3
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
4
|
-
ARG MODEL
|
|
5
4
|
|
|
6
5
|
COPY --from=ghcr.io/astral-sh/uv:0.9.8-debian-slim /usr/local/bin/uv /usr/local/bin/uvx /bin/
|
|
7
6
|
|
|
@@ -11,33 +10,34 @@ ENV UV_COMPILE_BYTECODE=1
|
|
|
11
10
|
|
|
12
11
|
RUN \
|
|
13
12
|
apt-get update && \
|
|
14
|
-
apt-get install -y --no-install-recommends git
|
|
13
|
+
apt-get install -y --no-install-recommends git python3.12
|
|
15
14
|
|
|
16
15
|
COPY pyproject.toml uv.lock README.md /app/
|
|
17
16
|
|
|
18
17
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
19
18
|
uv venv -p 3.12 && \
|
|
20
|
-
uv sync --frozen --extra serve --no-install-project --no-dev
|
|
19
|
+
uv sync --frozen --extra scope-guard-serve --no-install-project --no-dev
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
ARG MODEL
|
|
22
|
+
RUN hf download ${MODEL}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
uv sync --locked --extra serve --no-editable --no-dev
|
|
24
|
+
COPY src /app/src/
|
|
26
25
|
|
|
27
26
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
28
|
-
--
|
|
29
|
-
hf auth login --token $(cat /run/secrets/HF_TOKEN) && \
|
|
30
|
-
hf download $(scope-classifier convert-default-model-name ${MODEL}) && \
|
|
31
|
-
rm -rf /root/.huggingface
|
|
27
|
+
uv sync --locked --extra scope-guard-serve --no-editable --no-dev
|
|
32
28
|
|
|
33
29
|
# TODO remove next line
|
|
34
30
|
ENTRYPOINT ["/bin/bash", "-c"]
|
|
35
31
|
|
|
36
|
-
FROM
|
|
32
|
+
FROM nvidia/cuda:13.1.1-cudnn-runtime-ubuntu24.04 AS runner
|
|
37
33
|
|
|
38
34
|
WORKDIR /app
|
|
39
35
|
ENV PATH="/app/.venv/bin:$PATH"
|
|
40
36
|
|
|
37
|
+
RUN \
|
|
38
|
+
apt-get update && \
|
|
39
|
+
apt-get install -y --no-install-recommends python3.12
|
|
40
|
+
|
|
41
41
|
COPY --from=builder /app/.venv/ /app/.venv/
|
|
42
42
|
|
|
43
43
|
RUN mkdir -p /root/.cache/huggingface/hub
|
|
@@ -45,5 +45,8 @@ COPY --from=builder /root/.cache/huggingface/hub /root/.cache/huggingface/hub
|
|
|
45
45
|
|
|
46
46
|
EXPOSE 8000
|
|
47
47
|
|
|
48
|
+
ARG MODEL
|
|
49
|
+
ENV MODEL=${MODEL}
|
|
50
|
+
|
|
48
51
|
ENTRYPOINT ["/bin/bash", "-c"]
|
|
49
|
-
CMD [
|
|
52
|
+
CMD ["orbitals scope-guard serve ${MODEL} --port 8000 --host 0.0.0.0"]
|
|
@@ -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.
|
orbitals-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: orbitals
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: LLM Guardrails tailored to your Principles
|
|
5
|
+
Author-email: Luigi Procopio <luigi@principled-intelligence.com>, Edoardo Barba <edoardo@principled-intelligence.com>
|
|
6
|
+
License: Apache-2.0
|
|
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
|
+
Requires-Python: ==3.13
|
|
15
|
+
Requires-Dist: aiohttp
|
|
16
|
+
Requires-Dist: pydantic>=2.0.0
|
|
17
|
+
Requires-Dist: requests
|
|
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: nvidia-ml-py; extra == 'all'
|
|
23
|
+
Requires-Dist: transformers<5.0.0,>=4.47.0; extra == 'all'
|
|
24
|
+
Requires-Dist: uvicorn>=0.29.0; extra == 'all'
|
|
25
|
+
Requires-Dist: vllm<0.13.0,>=0.11.0; extra == 'all'
|
|
26
|
+
Requires-Dist: xgrammar; extra == 'all'
|
|
27
|
+
Provides-Extra: scope-guard-all
|
|
28
|
+
Requires-Dist: accelerate>=1.11.0; extra == 'scope-guard-all'
|
|
29
|
+
Requires-Dist: fastapi[standard]>=0.119.1; extra == 'scope-guard-all'
|
|
30
|
+
Requires-Dist: nvidia-ml-py; extra == 'scope-guard-all'
|
|
31
|
+
Requires-Dist: transformers<5.0.0,>=4.47.0; extra == 'scope-guard-all'
|
|
32
|
+
Requires-Dist: uvicorn>=0.29.0; extra == 'scope-guard-all'
|
|
33
|
+
Requires-Dist: vllm<0.13.0,>=0.11.0; extra == 'scope-guard-all'
|
|
34
|
+
Requires-Dist: xgrammar; extra == 'scope-guard-all'
|
|
35
|
+
Provides-Extra: scope-guard-hf
|
|
36
|
+
Requires-Dist: accelerate>=1.11.0; extra == 'scope-guard-hf'
|
|
37
|
+
Requires-Dist: nvidia-ml-py; extra == 'scope-guard-hf'
|
|
38
|
+
Requires-Dist: transformers<5.0.0,>=4.47.0; extra == 'scope-guard-hf'
|
|
39
|
+
Provides-Extra: scope-guard-serve
|
|
40
|
+
Requires-Dist: fastapi[standard]>=0.119.1; extra == 'scope-guard-serve'
|
|
41
|
+
Requires-Dist: nvidia-ml-py; extra == 'scope-guard-serve'
|
|
42
|
+
Requires-Dist: transformers<5.0.0,>=4.47.0; extra == 'scope-guard-serve'
|
|
43
|
+
Requires-Dist: uvicorn>=0.29.0; extra == 'scope-guard-serve'
|
|
44
|
+
Requires-Dist: vllm<0.13.0,>=0.11.0; extra == 'scope-guard-serve'
|
|
45
|
+
Requires-Dist: xgrammar; extra == 'scope-guard-serve'
|
|
46
|
+
Provides-Extra: scope-guard-vllm
|
|
47
|
+
Requires-Dist: nvidia-ml-py; extra == 'scope-guard-vllm'
|
|
48
|
+
Requires-Dist: transformers<5.0.0,>=4.47.0; extra == 'scope-guard-vllm'
|
|
49
|
+
Requires-Dist: vllm<0.13.0,>=0.11.0; extra == 'scope-guard-vllm'
|
|
50
|
+
Requires-Dist: xgrammar; extra == 'scope-guard-vllm'
|
|
51
|
+
Provides-Extra: serving
|
|
52
|
+
Requires-Dist: fastapi[standard]>=0.119.1; extra == 'serving'
|
|
53
|
+
Requires-Dist: uvicorn>=0.29.0; extra == 'serving'
|
|
54
|
+
Description-Content-Type: text/markdown
|
|
55
|
+
|
|
56
|
+
<div align="center">
|
|
57
|
+
<img src="assets/orbitals-banner.png" width="70%" />
|
|
58
|
+
<h3 align="center">
|
|
59
|
+
<p>
|
|
60
|
+
<b>LLM Guardrails tailored to your Principles</b>
|
|
61
|
+
</p>
|
|
62
|
+
</h4>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<p align="center">
|
|
66
|
+
<img src="https://img.shields.io/pypi/v/orbitals?color=green" alt="PyPI Version">
|
|
67
|
+
<!-- <img src="https://img.shields.io/badge/type%20checked-ty-blue.svg?color=green" alt="Type Checked with ty"> -->
|
|
68
|
+
<img src="https://img.shields.io/pypi/pyversions/orbitals" alt="Python Versions">
|
|
69
|
+
<img src="https://img.shields.io/github/license/principled-intelligence/orbitals" alt="GitHub License">
|
|
70
|
+
</p>
|
|
71
|
+
|
|
72
|
+
## Overview
|
|
73
|
+
|
|
74
|
+
**Orbitals** is a lightweight Python library for adding LLM guardrails in just a few lines of code. With Orbitals, you can add a governance layer tailored to **user-specific principles**. Rather than enforcing generic notions of safety, compliance, and correctness, Orbitals validates inputs (e.g., user requests) and outputs (e.g., assistant responses) against user-defined specifications and custom policies. This makes guardrails explicit, auditable, and aligned with the user's philosophy.
|
|
75
|
+
|
|
76
|
+
### Key Features
|
|
77
|
+
|
|
78
|
+
- **User-defined specifications** — Guardrails that match your use case and your custom policies, not generic safety rules
|
|
79
|
+
- **Simple integration** — Add guardrails with minimal code changes
|
|
80
|
+
- **Open framework, open models** — Orbitals is open-source and is a simple interface for our open models
|
|
81
|
+
|
|
82
|
+
## Getting started
|
|
83
|
+
|
|
84
|
+
### Installation
|
|
85
|
+
|
|
86
|
+
You can install Orbitals via pip:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
pip install orbitals[all]
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Basic Usage
|
|
93
|
+
|
|
94
|
+
Here's a quick example to get you started with Orbitals, in which we use the ScopeGuard module to guard an AI service (for example, a customer support chatbot) from user requests that violate specified principles or fall outside of the scope of the core task of the assistant.
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
from orbitals.scope_guard import ScopeGuard
|
|
98
|
+
|
|
99
|
+
ai_service_description = "You are a helpful assistant for ..."
|
|
100
|
+
user_message = "Can I buy ..."
|
|
101
|
+
|
|
102
|
+
guardrail = ScopeGuard()
|
|
103
|
+
result = guardrail.validate(user_message, ai_service_description)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The result of a guardrail validation will indicate whether the input or output passed the guardrail checks, along with details on any violations. You can then handle violations as needed, such as by rejecting the input or modifying the output. For example:
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
if result.scope_class.value == "Restricted" or result.scope_class.value == "Out of Scope":
|
|
110
|
+
print("Request violates guardrail:", result.evidences)
|
|
111
|
+
else:
|
|
112
|
+
# The user request is safe!
|
|
113
|
+
# We can now pass it to the AI assistant for processing.
|
|
114
|
+
...
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Available Guardrails
|
|
118
|
+
|
|
119
|
+
Orbitals currently provides the following guardrail modules:
|
|
120
|
+
|
|
121
|
+
| Guardrail | Description | Hosting Options |
|
|
122
|
+
|:----------|:------------|:----------------|
|
|
123
|
+
| **[ScopeGuard](README.scope-guard.md)** | Classifies user queries against AI assistant specifications to detect out-of-scope requests, policy violations, and chit-chat | Self-hosted / Cloud hosting |
|
|
124
|
+
| 🚀 *Coming Soon* | More guardrails are on the way — stay tuned for updates! | — |
|
|
125
|
+
|
|
126
|
+
#### Hosting Options
|
|
127
|
+
|
|
128
|
+
- **Self-hosted**: Use open-weight models that you can deploy on your own infrastructure, ensuring data privacy and control.
|
|
129
|
+
- **Cloud hosting**: (Coming soon) Managed hosting options for ease of use and scalability
|
|
130
|
+
|
|
131
|
+
### Documentation
|
|
132
|
+
|
|
133
|
+
For detailed documentation, including installation instructions, usage guides, and API references, please visit the Orbitals Documentation.
|
|
134
|
+
|
|
135
|
+
- [ScopeGuard Documentation](README.scope-guard.md)
|
|
136
|
+
|
|
137
|
+
### FAQ
|
|
138
|
+
|
|
139
|
+
- **Can I use Orbitals for commercial applications?**
|
|
140
|
+
Yes, Orbitals is designed to be used in both research and commercial applications. It is licensed under the Apache 2.0 License, which allows for commercial use.
|
|
141
|
+
- **Other questions?**
|
|
142
|
+
Feel free to reach out to us at [orbitals@principled-intelligence.com](mailto:orbitals@principled-intelligence.com)!
|
|
143
|
+
|
|
144
|
+
### Contributing
|
|
145
|
+
|
|
146
|
+
We welcome contributions from the community! If you'd like to contribute to Orbitals, please check out our [Contributing Guide](CONTRIBUTING.md) for guidelines on how to get started.
|
|
147
|
+
|
|
148
|
+
### License
|
|
149
|
+
|
|
150
|
+
This project is licensed under the Apache 2.0 License. See the [LICENSE](LICENSE) file for details.
|
|
151
|
+
|
|
152
|
+
### Contact
|
|
153
|
+
|
|
154
|
+
For questions, feedback, or support, please reach out to us at [orbitals@principled-intelligence.com](mailto:orbitals@principled-intelligence.com).
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
<div align="center">
|
|
159
|
+
<p>
|
|
160
|
+
<b>Built with ❤️ by <a href="https://principled-intelligence.com">Principled Intelligence</a></b>
|
|
161
|
+
<br />
|
|
162
|
+
Follow us on <a href="https://www.linkedin.com/company/principled-ai/">LinkedIn</a> for the latest updates.
|
|
163
|
+
</p>
|
|
164
|
+
</div>
|
orbitals-0.1.1/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="assets/orbitals-banner.png" width="70%" />
|
|
3
|
+
<h3 align="center">
|
|
4
|
+
<p>
|
|
5
|
+
<b>LLM Guardrails tailored to your Principles</b>
|
|
6
|
+
</p>
|
|
7
|
+
</h4>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
<img src="https://img.shields.io/pypi/v/orbitals?color=green" alt="PyPI Version">
|
|
12
|
+
<!-- <img src="https://img.shields.io/badge/type%20checked-ty-blue.svg?color=green" alt="Type Checked with ty"> -->
|
|
13
|
+
<img src="https://img.shields.io/pypi/pyversions/orbitals" alt="Python Versions">
|
|
14
|
+
<img src="https://img.shields.io/github/license/principled-intelligence/orbitals" alt="GitHub License">
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
|
|
19
|
+
**Orbitals** is a lightweight Python library for adding LLM guardrails in just a few lines of code. With Orbitals, you can add a governance layer tailored to **user-specific principles**. Rather than enforcing generic notions of safety, compliance, and correctness, Orbitals validates inputs (e.g., user requests) and outputs (e.g., assistant responses) against user-defined specifications and custom policies. This makes guardrails explicit, auditable, and aligned with the user's philosophy.
|
|
20
|
+
|
|
21
|
+
### Key Features
|
|
22
|
+
|
|
23
|
+
- **User-defined specifications** — Guardrails that match your use case and your custom policies, not generic safety rules
|
|
24
|
+
- **Simple integration** — Add guardrails with minimal code changes
|
|
25
|
+
- **Open framework, open models** — Orbitals is open-source and is a simple interface for our open models
|
|
26
|
+
|
|
27
|
+
## Getting started
|
|
28
|
+
|
|
29
|
+
### Installation
|
|
30
|
+
|
|
31
|
+
You can install Orbitals via pip:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install orbitals[all]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Basic Usage
|
|
38
|
+
|
|
39
|
+
Here's a quick example to get you started with Orbitals, in which we use the ScopeGuard module to guard an AI service (for example, a customer support chatbot) from user requests that violate specified principles or fall outside of the scope of the core task of the assistant.
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from orbitals.scope_guard import ScopeGuard
|
|
43
|
+
|
|
44
|
+
ai_service_description = "You are a helpful assistant for ..."
|
|
45
|
+
user_message = "Can I buy ..."
|
|
46
|
+
|
|
47
|
+
guardrail = ScopeGuard()
|
|
48
|
+
result = guardrail.validate(user_message, ai_service_description)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The result of a guardrail validation will indicate whether the input or output passed the guardrail checks, along with details on any violations. You can then handle violations as needed, such as by rejecting the input or modifying the output. For example:
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
if result.scope_class.value == "Restricted" or result.scope_class.value == "Out of Scope":
|
|
55
|
+
print("Request violates guardrail:", result.evidences)
|
|
56
|
+
else:
|
|
57
|
+
# The user request is safe!
|
|
58
|
+
# We can now pass it to the AI assistant for processing.
|
|
59
|
+
...
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Available Guardrails
|
|
63
|
+
|
|
64
|
+
Orbitals currently provides the following guardrail modules:
|
|
65
|
+
|
|
66
|
+
| Guardrail | Description | Hosting Options |
|
|
67
|
+
|:----------|:------------|:----------------|
|
|
68
|
+
| **[ScopeGuard](README.scope-guard.md)** | Classifies user queries against AI assistant specifications to detect out-of-scope requests, policy violations, and chit-chat | Self-hosted / Cloud hosting |
|
|
69
|
+
| 🚀 *Coming Soon* | More guardrails are on the way — stay tuned for updates! | — |
|
|
70
|
+
|
|
71
|
+
#### Hosting Options
|
|
72
|
+
|
|
73
|
+
- **Self-hosted**: Use open-weight models that you can deploy on your own infrastructure, ensuring data privacy and control.
|
|
74
|
+
- **Cloud hosting**: (Coming soon) Managed hosting options for ease of use and scalability
|
|
75
|
+
|
|
76
|
+
### Documentation
|
|
77
|
+
|
|
78
|
+
For detailed documentation, including installation instructions, usage guides, and API references, please visit the Orbitals Documentation.
|
|
79
|
+
|
|
80
|
+
- [ScopeGuard Documentation](README.scope-guard.md)
|
|
81
|
+
|
|
82
|
+
### FAQ
|
|
83
|
+
|
|
84
|
+
- **Can I use Orbitals for commercial applications?**
|
|
85
|
+
Yes, Orbitals is designed to be used in both research and commercial applications. It is licensed under the Apache 2.0 License, which allows for commercial use.
|
|
86
|
+
- **Other questions?**
|
|
87
|
+
Feel free to reach out to us at [orbitals@principled-intelligence.com](mailto:orbitals@principled-intelligence.com)!
|
|
88
|
+
|
|
89
|
+
### Contributing
|
|
90
|
+
|
|
91
|
+
We welcome contributions from the community! If you'd like to contribute to Orbitals, please check out our [Contributing Guide](CONTRIBUTING.md) for guidelines on how to get started.
|
|
92
|
+
|
|
93
|
+
### License
|
|
94
|
+
|
|
95
|
+
This project is licensed under the Apache 2.0 License. See the [LICENSE](LICENSE) file for details.
|
|
96
|
+
|
|
97
|
+
### Contact
|
|
98
|
+
|
|
99
|
+
For questions, feedback, or support, please reach out to us at [orbitals@principled-intelligence.com](mailto:orbitals@principled-intelligence.com).
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
<div align="center">
|
|
104
|
+
<p>
|
|
105
|
+
<b>Built with ❤️ by <a href="https://principled-intelligence.com">Principled Intelligence</a></b>
|
|
106
|
+
<br />
|
|
107
|
+
Follow us on <a href="https://www.linkedin.com/company/principled-ai/">LinkedIn</a> for the latest updates.
|
|
108
|
+
</p>
|
|
109
|
+
</div>
|