rait-connector 0.1.0__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.
- rait_connector-0.1.0/.gitignore +231 -0
- rait_connector-0.1.0/.markdownlint.json +6 -0
- rait_connector-0.1.0/.pre-commit-config.yaml +18 -0
- rait_connector-0.1.0/.python-version +1 -0
- rait_connector-0.1.0/CHANGELOG.md +28 -0
- rait_connector-0.1.0/LICENSE +21 -0
- rait_connector-0.1.0/PKG-INFO +241 -0
- rait_connector-0.1.0/README.md +228 -0
- rait_connector-0.1.0/docs/examples/batch-evaluation.md +247 -0
- rait_connector-0.1.0/docs/examples/callbacks.md +227 -0
- rait_connector-0.1.0/docs/examples/single-evaluation.md +175 -0
- rait_connector-0.1.0/docs/getting-started/configuration.md +137 -0
- rait_connector-0.1.0/docs/getting-started/installation.md +76 -0
- rait_connector-0.1.0/docs/getting-started/quickstart.md +99 -0
- rait_connector-0.1.0/docs/index.md +52 -0
- rait_connector-0.1.0/docs/reference/client.md +7 -0
- rait_connector-0.1.0/docs/reference/constants.md +7 -0
- rait_connector-0.1.0/docs/reference/evaluators.md +23 -0
- rait_connector-0.1.0/docs/reference/exceptions.md +13 -0
- rait_connector-0.1.0/docs/reference/models.md +7 -0
- rait_connector-0.1.0/mkdocs.yml +37 -0
- rait_connector-0.1.0/pyproject.toml +26 -0
- rait_connector-0.1.0/src/rait_connector/__init__.py +49 -0
- rait_connector-0.1.0/src/rait_connector/auth.py +165 -0
- rait_connector-0.1.0/src/rait_connector/client.py +522 -0
- rait_connector-0.1.0/src/rait_connector/config.py +201 -0
- rait_connector-0.1.0/src/rait_connector/constants.py +38 -0
- rait_connector-0.1.0/src/rait_connector/encryption.py +204 -0
- rait_connector-0.1.0/src/rait_connector/evaluators/__init__.py +10 -0
- rait_connector-0.1.0/src/rait_connector/evaluators/base.py +78 -0
- rait_connector-0.1.0/src/rait_connector/evaluators/orchestrator.py +208 -0
- rait_connector-0.1.0/src/rait_connector/evaluators/registry.py +291 -0
- rait_connector-0.1.0/src/rait_connector/exceptions.py +30 -0
- rait_connector-0.1.0/src/rait_connector/http.py +117 -0
- rait_connector-0.1.0/src/rait_connector/models.py +64 -0
- rait_connector-0.1.0/uv.lock +1909 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
|
|
204
|
+
# Ruff stuff:
|
|
205
|
+
.ruff_cache/
|
|
206
|
+
|
|
207
|
+
# PyPI configuration file
|
|
208
|
+
.pypirc
|
|
209
|
+
|
|
210
|
+
# Marimo
|
|
211
|
+
marimo/_static/
|
|
212
|
+
marimo/_lsp/
|
|
213
|
+
__marimo__/
|
|
214
|
+
|
|
215
|
+
# Streamlit
|
|
216
|
+
.streamlit/secrets.toml
|
|
217
|
+
|
|
218
|
+
# Nuitka
|
|
219
|
+
*.build/
|
|
220
|
+
*.dist/
|
|
221
|
+
*.onefile-build/
|
|
222
|
+
*.exe
|
|
223
|
+
|
|
224
|
+
# Encryption and decryption keys
|
|
225
|
+
keys/
|
|
226
|
+
|
|
227
|
+
# Log files
|
|
228
|
+
logs/
|
|
229
|
+
|
|
230
|
+
# Output files
|
|
231
|
+
output/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
3
|
+
rev: v0.14.2
|
|
4
|
+
hooks:
|
|
5
|
+
- id: ruff-check
|
|
6
|
+
args: [--fix]
|
|
7
|
+
- id: ruff-format
|
|
8
|
+
|
|
9
|
+
- repo: https://github.com/crate-ci/typos
|
|
10
|
+
rev: v1.40.0
|
|
11
|
+
hooks:
|
|
12
|
+
- id: typos
|
|
13
|
+
|
|
14
|
+
- repo: https://github.com/igorshubovych/markdownlint-cli
|
|
15
|
+
rev: v0.47.0
|
|
16
|
+
hooks:
|
|
17
|
+
- id: markdownlint
|
|
18
|
+
args: [--fix]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2025-12-22
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Initial release of RAIT Connector
|
|
13
|
+
- RAITClient for LLM evaluation across ethical dimensions
|
|
14
|
+
- Support for 22 evaluation metrics across 8 ethical dimensions:
|
|
15
|
+
- Bias and Fairness: Hate and Unfairness
|
|
16
|
+
- Explainability and Transparency: Ungrounded Attributes, Groundedness, Groundedness Pro
|
|
17
|
+
- Monitoring and Compliance: Content Safety
|
|
18
|
+
- Legal and Regulatory Compliance: Protected Materials
|
|
19
|
+
- Security and Adversarial Robustness: Code Vulnerability
|
|
20
|
+
- Model Performance: Coherence, Fluency, QA, Similarity, F1 Score, BLEU, GLEU, ROUGE, METEOR, Retrieval
|
|
21
|
+
- Human-AI Interaction: Relevance, Response Completeness
|
|
22
|
+
- Social and Demographic Impact: Sexual, Violence, Self-Harm
|
|
23
|
+
- Parallel evaluation support with configurable workers
|
|
24
|
+
- Automatic result posting to RAIT API with encryption
|
|
25
|
+
- Batch evaluation with custom callbacks
|
|
26
|
+
- Type-safe data validation with Pydantic
|
|
27
|
+
- Flexible configuration via environment variables or direct parameters
|
|
28
|
+
- Comprehensive documentation with examples
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [2025] [Responsible Systems Limited]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rait-connector
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python library for evaluating LLM outputs across multiple ethical dimensions and performance metrics using Azure AI Evaluation services.
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Classifier: Development Status :: 3 - Alpha
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
8
|
+
Requires-Python: >=3.12
|
|
9
|
+
Requires-Dist: azure-ai-evaluation>=1.12.0
|
|
10
|
+
Requires-Dist: cryptography>=46.0.3
|
|
11
|
+
Requires-Dist: pydantic-settings>=2.12.0
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# RAIT Connector
|
|
15
|
+
|
|
16
|
+
Python library for evaluating LLM outputs across multiple ethical dimensions and performance metrics using Azure AI Evaluation services.
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- **22 Evaluation Metrics** across 8 ethical dimensions
|
|
21
|
+
- **Parallel Execution** for faster evaluations
|
|
22
|
+
- **Automatic API Integration** with RAIT services
|
|
23
|
+
- **Type-Safe** with Pydantic models
|
|
24
|
+
- **Flexible Configuration** via environment variables or direct parameters
|
|
25
|
+
- **Batch Processing** with custom callbacks
|
|
26
|
+
- **Comprehensive Documentation** with examples
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install rait-connector
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Or with uv:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
uv add rait-connector
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from rait_connector import RAITClient
|
|
44
|
+
|
|
45
|
+
# Initialize client
|
|
46
|
+
client = RAITClient()
|
|
47
|
+
|
|
48
|
+
# Evaluate a single prompt
|
|
49
|
+
result = client.evaluate(
|
|
50
|
+
prompt_id="123",
|
|
51
|
+
prompt_url="https://example.com/123",
|
|
52
|
+
timestamp="2025-12-11T10:00:00Z",
|
|
53
|
+
model_name="gpt-4",
|
|
54
|
+
model_version="1.0",
|
|
55
|
+
query="What is AI?",
|
|
56
|
+
response="AI is artificial intelligence...",
|
|
57
|
+
environment="production",
|
|
58
|
+
purpose="monitoring"
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
print(f"Evaluation complete: {result['prompt_id']}")
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Configuration
|
|
65
|
+
|
|
66
|
+
### Environment Variables
|
|
67
|
+
|
|
68
|
+
Set required environment variables:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# RAIT API
|
|
72
|
+
export RAIT_API_URL="https://api.raitracker.com"
|
|
73
|
+
export RAIT_CLIENT_ID="your-client-id"
|
|
74
|
+
export RAIT_CLIENT_SECRET="your-client-secret"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Azure OpenAI
|
|
79
|
+
export AZURE_OPENAI_ENDPOINT="https://your.openai.azure.com"
|
|
80
|
+
export AZURE_OPENAI_API_KEY="your-api-key"
|
|
81
|
+
export AZURE_OPENAI_DEPLOYMENT="your-deployment"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Azure AD
|
|
86
|
+
export AZURE_CLIENT_ID="your-azure-client-id"
|
|
87
|
+
export AZURE_TENANT_ID="your-azure-tenant-id"
|
|
88
|
+
export AZURE_CLIENT_SECRET="your-azure-client-secret"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Azure Resources
|
|
93
|
+
export AZURE_SUBSCRIPTION_ID="your-subscription-id"
|
|
94
|
+
export AZURE_RESOURCE_GROUP="your-resource-group"
|
|
95
|
+
export AZURE_PROJECT_NAME="your-project-name"
|
|
96
|
+
export AZURE_ACCOUNT_NAME="your-account-name"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Direct Configuration
|
|
100
|
+
|
|
101
|
+
Or pass configuration directly:
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
client = RAITClient(
|
|
105
|
+
rait_api_url="https://api.raitracker.com",
|
|
106
|
+
rait_client_id="your-client-id",
|
|
107
|
+
rait_client_secret="your-secret",
|
|
108
|
+
azure_openai_endpoint="https://your.openai.azure.com",
|
|
109
|
+
azure_openai_api_key="your-key",
|
|
110
|
+
azure_openai_deployment="gpt-4",
|
|
111
|
+
# ... other parameters
|
|
112
|
+
)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Evaluation Metrics
|
|
116
|
+
|
|
117
|
+
RAIT Connector supports 22 metrics across 8 ethical dimensions:
|
|
118
|
+
|
|
119
|
+
| Dimension | Metrics |
|
|
120
|
+
|-----------|---------|
|
|
121
|
+
| **Bias and Fairness** | Hate and Unfairness |
|
|
122
|
+
| **Explainability and Transparency** | Ungrounded Attributes, Groundedness, Groundedness Pro |
|
|
123
|
+
| **Monitoring and Compliance** | Content Safety |
|
|
124
|
+
| **Legal and Regulatory Compliance** | Protected Materials |
|
|
125
|
+
| **Security and Adversarial Robustness** | Code Vulnerability |
|
|
126
|
+
| **Model Performance** | Coherence, Fluency, QA, Similarity, F1 Score, BLEU, GLEU, ROUGE, METEOR, Retrieval |
|
|
127
|
+
| **Human-AI Interaction** | Relevance, Response Completeness |
|
|
128
|
+
| **Social and Demographic Impact** | Sexual, Violence, Self-Harm |
|
|
129
|
+
|
|
130
|
+
## Batch Evaluation
|
|
131
|
+
|
|
132
|
+
Evaluate multiple prompts efficiently:
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
prompts = [
|
|
136
|
+
{
|
|
137
|
+
"prompt_id": "001",
|
|
138
|
+
"prompt_url": "https://example.com/001",
|
|
139
|
+
"timestamp": "2025-12-11T10:00:00Z",
|
|
140
|
+
"model_name": "gpt-4",
|
|
141
|
+
"model_version": "1.0",
|
|
142
|
+
"query": "What is AI?",
|
|
143
|
+
"response": "AI is...",
|
|
144
|
+
"environment": "production",
|
|
145
|
+
"purpose": "monitoring"
|
|
146
|
+
},
|
|
147
|
+
# ... more prompts
|
|
148
|
+
]
|
|
149
|
+
|
|
150
|
+
summary = client.evaluate_batch(prompts)
|
|
151
|
+
print(f"Completed: {summary['successful']}/{summary['total']}")
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### With Custom Callback
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
def on_complete(summary):
|
|
158
|
+
print(f"Success: {summary['successful']}")
|
|
159
|
+
print(f"Failed: {summary['failed']}")
|
|
160
|
+
|
|
161
|
+
client.evaluate_batch(prompts, on_complete=on_complete)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Parallel Execution
|
|
165
|
+
|
|
166
|
+
Control parallelism for faster evaluations:
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
result = client.evaluate(
|
|
170
|
+
...,
|
|
171
|
+
parallel=True,
|
|
172
|
+
max_workers=10 # Use 10 parallel workers
|
|
173
|
+
)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Documentation
|
|
177
|
+
|
|
178
|
+
Full documentation is available in the [docs/](docs/) directory:
|
|
179
|
+
|
|
180
|
+
- [Installation Guide](docs/getting-started/installation.md)
|
|
181
|
+
- [Quick Start](docs/getting-started/quickstart.md)
|
|
182
|
+
- [API Reference](docs/reference/client.md)
|
|
183
|
+
- [Examples](docs/examples/single-evaluation.md)
|
|
184
|
+
|
|
185
|
+
## Requirements
|
|
186
|
+
|
|
187
|
+
- Python 3.12+
|
|
188
|
+
- Azure OpenAI access
|
|
189
|
+
- RAIT API credentials
|
|
190
|
+
|
|
191
|
+
## Development
|
|
192
|
+
|
|
193
|
+
### Setup
|
|
194
|
+
|
|
195
|
+
Clone the repository:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
git clone https://github.com/Responsible-Systems/rait-connector.git
|
|
199
|
+
cd rait-connector
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Install dependencies:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
uv sync --dev
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Install pre-commit hooks:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
uv tool install pre-commit
|
|
212
|
+
pre-commit install
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Project Documentation
|
|
216
|
+
|
|
217
|
+
Serve docs locally:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
uv run mkdocs serve
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Build docs:
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
uv run mkdocs build
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Contributing
|
|
230
|
+
|
|
231
|
+
Contributions are welcome! Please read our contributing guidelines.
|
|
232
|
+
|
|
233
|
+
## Support
|
|
234
|
+
|
|
235
|
+
For issues and questions:
|
|
236
|
+
|
|
237
|
+
- GitHub Issues: <https://github.com/Responsible-Systems/rait-connector/issues>
|
|
238
|
+
|
|
239
|
+
## Changelog
|
|
240
|
+
|
|
241
|
+
See [CHANGELOG.md](CHANGELOG.md) for release history.
|