llm-comply 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.
- llm_comply-0.1.0/LICENSE +21 -0
- llm_comply-0.1.0/PKG-INFO +96 -0
- llm_comply-0.1.0/README.md +64 -0
- llm_comply-0.1.0/pyproject.toml +72 -0
- llm_comply-0.1.0/setup.cfg +4 -0
- llm_comply-0.1.0/src/llm_comply/__init__.py +19 -0
- llm_comply-0.1.0/src/llm_comply/_vendor/__init__.py +0 -0
- llm_comply-0.1.0/src/llm_comply/_vendor/httpclient.py +2808 -0
- llm_comply-0.1.0/src/llm_comply/_vendor/sse.py +703 -0
- llm_comply-0.1.0/src/llm_comply/cli.py +216 -0
- llm_comply-0.1.0/src/llm_comply/config.py +72 -0
- llm_comply-0.1.0/src/llm_comply/display.py +160 -0
- llm_comply-0.1.0/src/llm_comply/http.py +105 -0
- llm_comply-0.1.0/src/llm_comply/result.py +72 -0
- llm_comply-0.1.0/src/llm_comply/runner.py +127 -0
- llm_comply-0.1.0/src/llm_comply/schema.py +160 -0
- llm_comply-0.1.0/src/llm_comply/specs/__init__.py +0 -0
- llm_comply-0.1.0/src/llm_comply/specs/anthropic.json +1 -0
- llm_comply-0.1.0/src/llm_comply/specs/openai_chat.json +1 -0
- llm_comply-0.1.0/src/llm_comply/specs/openresponses.json +4230 -0
- llm_comply-0.1.0/src/llm_comply/specs/test_image.jpg +0 -0
- llm_comply-0.1.0/src/llm_comply/test_case.py +47 -0
- llm_comply-0.1.0/src/llm_comply/tests/__init__.py +0 -0
- llm_comply-0.1.0/src/llm_comply/tests/anthropic.py +237 -0
- llm_comply-0.1.0/src/llm_comply/tests/google_genai.py +261 -0
- llm_comply-0.1.0/src/llm_comply/tests/open_responses.py +400 -0
- llm_comply-0.1.0/src/llm_comply/tests/openai_chat.py +237 -0
- llm_comply-0.1.0/src/llm_comply/validators.py +564 -0
- llm_comply-0.1.0/src/llm_comply.egg-info/PKG-INFO +96 -0
- llm_comply-0.1.0/src/llm_comply.egg-info/SOURCES.txt +32 -0
- llm_comply-0.1.0/src/llm_comply.egg-info/dependency_links.txt +1 -0
- llm_comply-0.1.0/src/llm_comply.egg-info/entry_points.txt +2 -0
- llm_comply-0.1.0/src/llm_comply.egg-info/requires.txt +11 -0
- llm_comply-0.1.0/src/llm_comply.egg-info/top_level.txt +1 -0
llm_comply-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Peng Ding
|
|
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,96 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: llm-comply
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Multi-format LLM API compliance testing tool — validates endpoints against OpenAI Chat, Open Responses, Anthropic, and Google GenAI specs.
|
|
5
|
+
Author-email: Oaklight <oaklight@gmx.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/Oaklight/llm-comply
|
|
8
|
+
Project-URL: Issues, https://github.com/Oaklight/llm-comply/issues
|
|
9
|
+
Keywords: openai,anthropic,gemini,google-genai,compliance,testing,api-validation,openapi,llm,open-responses
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Topic :: Software Development :: Testing
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: jsonschema>=4.0.0
|
|
23
|
+
Provides-Extra: rich
|
|
24
|
+
Requires-Dist: rich>=13.0.0; extra == "rich"
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
27
|
+
Requires-Dist: pre-commit>=4.0.0; extra == "dev"
|
|
28
|
+
Requires-Dist: ruff>=0.6.0; extra == "dev"
|
|
29
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: twine>=5.0.0; extra == "dev"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# llm-comply
|
|
34
|
+
|
|
35
|
+
[](https://pypi.org/project/llm-comply/)
|
|
36
|
+
[](https://github.com/Oaklight/llm-comply/actions/workflows/ci.yml)
|
|
37
|
+
[](https://pypi.org/project/llm-comply/)
|
|
38
|
+
[](https://github.com/Oaklight/llm-comply/blob/master/LICENSE)
|
|
39
|
+
|
|
40
|
+
Multi-format LLM API compliance testing tool — validates endpoints against official specs for **OpenAI Chat Completions**, **Open Responses**, **Anthropic Messages**, and **Google GenAI**.
|
|
41
|
+
|
|
42
|
+
## Install
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install llm-comply
|
|
46
|
+
# For colored terminal output:
|
|
47
|
+
pip install llm-comply[rich]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Quick Start
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Open Responses (default)
|
|
54
|
+
llm-comply -u https://api.openai.com/v1 -k $OPENAI_API_KEY -m gpt-4o-mini
|
|
55
|
+
|
|
56
|
+
# OpenAI Chat Completions
|
|
57
|
+
llm-comply --format openai-chat -u https://api.openai.com/v1 -k $OPENAI_API_KEY -m gpt-4o-mini
|
|
58
|
+
|
|
59
|
+
# Anthropic Messages
|
|
60
|
+
llm-comply --format anthropic -u https://api.anthropic.com/v1 -k $KEY -m claude-haiku-4-5 \
|
|
61
|
+
--auth-header x-api-key --no-bearer -H anthropic-version:2023-06-01
|
|
62
|
+
|
|
63
|
+
# Google GenAI
|
|
64
|
+
llm-comply --format google-genai -u https://generativelanguage.googleapis.com -k $KEY \
|
|
65
|
+
-m gemini-2.5-flash --auth-header x-goog-api-key --no-bearer
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Options
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
-u, --base-url URL API base URL (required)
|
|
72
|
+
-k, --api-key KEY API key (or set OPENRESPONSES_API_KEY env)
|
|
73
|
+
-m, --model MODEL Model name (default: gpt-4o-mini)
|
|
74
|
+
--format FORMAT API format: open-responses, openai-chat, anthropic, google-genai
|
|
75
|
+
-f, --filter IDS Comma-separated test IDs to run
|
|
76
|
+
-i, --ignore PATTERNS Ignore errors matching substrings (e.g. refusal,verbosity)
|
|
77
|
+
-H, --header K:V Extra headers (e.g. anthropic-version:2023-06-01)
|
|
78
|
+
--auth-header NAME Auth header name (default: Authorization)
|
|
79
|
+
--no-bearer Don't prepend "Bearer " to API key
|
|
80
|
+
-v, --verbose Show request/response on failure
|
|
81
|
+
--json JSON output for CI
|
|
82
|
+
--list List available test IDs
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Test Coverage
|
|
86
|
+
|
|
87
|
+
| Format | Tests | What's Validated |
|
|
88
|
+
|--------|:-----:|-----------------|
|
|
89
|
+
| Open Responses | 12 | Schema + semantic (lifecycle, phases, compaction) |
|
|
90
|
+
| OpenAI Chat | 8 | Schema + semantic (choices, finish_reason, delta) |
|
|
91
|
+
| Anthropic Messages | 8 | Schema + semantic (content blocks, stop_reason) |
|
|
92
|
+
| Google GenAI | 8 | Semantic only (candidates, parts, finishReason) |
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
MIT
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# llm-comply
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/llm-comply/)
|
|
4
|
+
[](https://github.com/Oaklight/llm-comply/actions/workflows/ci.yml)
|
|
5
|
+
[](https://pypi.org/project/llm-comply/)
|
|
6
|
+
[](https://github.com/Oaklight/llm-comply/blob/master/LICENSE)
|
|
7
|
+
|
|
8
|
+
Multi-format LLM API compliance testing tool — validates endpoints against official specs for **OpenAI Chat Completions**, **Open Responses**, **Anthropic Messages**, and **Google GenAI**.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install llm-comply
|
|
14
|
+
# For colored terminal output:
|
|
15
|
+
pip install llm-comply[rich]
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Open Responses (default)
|
|
22
|
+
llm-comply -u https://api.openai.com/v1 -k $OPENAI_API_KEY -m gpt-4o-mini
|
|
23
|
+
|
|
24
|
+
# OpenAI Chat Completions
|
|
25
|
+
llm-comply --format openai-chat -u https://api.openai.com/v1 -k $OPENAI_API_KEY -m gpt-4o-mini
|
|
26
|
+
|
|
27
|
+
# Anthropic Messages
|
|
28
|
+
llm-comply --format anthropic -u https://api.anthropic.com/v1 -k $KEY -m claude-haiku-4-5 \
|
|
29
|
+
--auth-header x-api-key --no-bearer -H anthropic-version:2023-06-01
|
|
30
|
+
|
|
31
|
+
# Google GenAI
|
|
32
|
+
llm-comply --format google-genai -u https://generativelanguage.googleapis.com -k $KEY \
|
|
33
|
+
-m gemini-2.5-flash --auth-header x-goog-api-key --no-bearer
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Options
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
-u, --base-url URL API base URL (required)
|
|
40
|
+
-k, --api-key KEY API key (or set OPENRESPONSES_API_KEY env)
|
|
41
|
+
-m, --model MODEL Model name (default: gpt-4o-mini)
|
|
42
|
+
--format FORMAT API format: open-responses, openai-chat, anthropic, google-genai
|
|
43
|
+
-f, --filter IDS Comma-separated test IDs to run
|
|
44
|
+
-i, --ignore PATTERNS Ignore errors matching substrings (e.g. refusal,verbosity)
|
|
45
|
+
-H, --header K:V Extra headers (e.g. anthropic-version:2023-06-01)
|
|
46
|
+
--auth-header NAME Auth header name (default: Authorization)
|
|
47
|
+
--no-bearer Don't prepend "Bearer " to API key
|
|
48
|
+
-v, --verbose Show request/response on failure
|
|
49
|
+
--json JSON output for CI
|
|
50
|
+
--list List available test IDs
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Test Coverage
|
|
54
|
+
|
|
55
|
+
| Format | Tests | What's Validated |
|
|
56
|
+
|--------|:-----:|-----------------|
|
|
57
|
+
| Open Responses | 12 | Schema + semantic (lifecycle, phases, compaction) |
|
|
58
|
+
| OpenAI Chat | 8 | Schema + semantic (choices, finish_reason, delta) |
|
|
59
|
+
| Anthropic Messages | 8 | Schema + semantic (content blocks, stop_reason) |
|
|
60
|
+
| Google GenAI | 8 | Semantic only (candidates, parts, finishReason) |
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
MIT
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "llm-comply"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
authors = [{ name = "Oaklight", email = "oaklight@gmx.com" }]
|
|
9
|
+
description = "Multi-format LLM API compliance testing tool — validates endpoints against OpenAI Chat, Open Responses, Anthropic, and Google GenAI specs."
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
license = "MIT"
|
|
13
|
+
keywords = [
|
|
14
|
+
"openai",
|
|
15
|
+
"anthropic",
|
|
16
|
+
"gemini",
|
|
17
|
+
"google-genai",
|
|
18
|
+
"compliance",
|
|
19
|
+
"testing",
|
|
20
|
+
"api-validation",
|
|
21
|
+
"openapi",
|
|
22
|
+
"llm",
|
|
23
|
+
"open-responses",
|
|
24
|
+
]
|
|
25
|
+
classifiers = [
|
|
26
|
+
"Development Status :: 3 - Alpha",
|
|
27
|
+
"Intended Audience :: Developers",
|
|
28
|
+
"Programming Language :: Python :: 3",
|
|
29
|
+
"Programming Language :: Python :: 3.10",
|
|
30
|
+
"Programming Language :: Python :: 3.11",
|
|
31
|
+
"Programming Language :: Python :: 3.12",
|
|
32
|
+
"Programming Language :: Python :: 3.13",
|
|
33
|
+
"Topic :: Software Development :: Testing",
|
|
34
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
35
|
+
]
|
|
36
|
+
dependencies = [
|
|
37
|
+
"jsonschema>=4.0.0",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[project.optional-dependencies]
|
|
41
|
+
rich = ["rich>=13.0.0"]
|
|
42
|
+
dev = [
|
|
43
|
+
"pytest>=7.0.0",
|
|
44
|
+
"pre-commit>=4.0.0",
|
|
45
|
+
"ruff>=0.6.0",
|
|
46
|
+
"build>=1.0.0",
|
|
47
|
+
"twine>=5.0.0",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[project.urls]
|
|
51
|
+
Repository = "https://github.com/Oaklight/llm-comply"
|
|
52
|
+
Issues = "https://github.com/Oaklight/llm-comply/issues"
|
|
53
|
+
|
|
54
|
+
[project.scripts]
|
|
55
|
+
llm-comply = "llm_comply.cli:main"
|
|
56
|
+
|
|
57
|
+
[tool.setuptools.packages.find]
|
|
58
|
+
where = ["src"]
|
|
59
|
+
|
|
60
|
+
[tool.setuptools.package-data]
|
|
61
|
+
"llm_comply" = ["specs/*.json", "specs/*.jpg"]
|
|
62
|
+
|
|
63
|
+
[tool.setuptools.dynamic]
|
|
64
|
+
version = { attr = "llm_comply.__version__" }
|
|
65
|
+
|
|
66
|
+
[tool.ruff]
|
|
67
|
+
target-version = "py310"
|
|
68
|
+
exclude = ["src/llm_comply/_vendor"]
|
|
69
|
+
|
|
70
|
+
[tool.ruff.lint]
|
|
71
|
+
select = ["E", "F", "UP"]
|
|
72
|
+
ignore = ["UP007", "E501"]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""llm-comply: Multi-format LLM API compliance testing tool."""
|
|
2
|
+
|
|
3
|
+
__version__ = "0.1.0"
|
|
4
|
+
|
|
5
|
+
from .config import ComplianceConfig
|
|
6
|
+
from .display import get_display
|
|
7
|
+
from .result import SuiteResult, TestResult, TestStatus
|
|
8
|
+
from .runner import TestRunner
|
|
9
|
+
from .schema import SpecLoader
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"ComplianceConfig",
|
|
13
|
+
"SpecLoader",
|
|
14
|
+
"SuiteResult",
|
|
15
|
+
"TestResult",
|
|
16
|
+
"TestRunner",
|
|
17
|
+
"TestStatus",
|
|
18
|
+
"get_display",
|
|
19
|
+
]
|
|
File without changes
|