kedi-decisions 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.
- kedi_decisions-0.1.0/.gitattributes +1 -0
- kedi_decisions-0.1.0/.github/workflows/publish.yml +68 -0
- kedi_decisions-0.1.0/.gitignore +218 -0
- kedi_decisions-0.1.0/.python-version +1 -0
- kedi_decisions-0.1.0/LICENSE +21 -0
- kedi_decisions-0.1.0/Makefile +32 -0
- kedi_decisions-0.1.0/PKG-INFO +85 -0
- kedi_decisions-0.1.0/README.md +62 -0
- kedi_decisions-0.1.0/docs/LAYA.md +126 -0
- kedi_decisions-0.1.0/docs/VALIDATION.md +110 -0
- kedi_decisions-0.1.0/packages/kedi-laya/LICENSE +21 -0
- kedi_decisions-0.1.0/packages/kedi-laya/README.md +44 -0
- kedi_decisions-0.1.0/packages/kedi-laya/examples/local_laya.py +21 -0
- kedi_decisions-0.1.0/packages/kedi-laya/pyproject.toml +28 -0
- kedi_decisions-0.1.0/packages/kedi-laya/src/kedi_laya/__init__.py +35 -0
- kedi_decisions-0.1.0/packages/kedi-laya/src/kedi_laya/_mlx_context.py +39 -0
- kedi_decisions-0.1.0/packages/kedi-laya/src/kedi_laya/_response.py +84 -0
- kedi_decisions-0.1.0/packages/kedi-laya/src/kedi_laya/client.py +184 -0
- kedi_decisions-0.1.0/packages/kedi-laya/src/kedi_laya/integrations/__init__.py +1 -0
- kedi_decisions-0.1.0/packages/kedi-laya/src/kedi_laya/integrations/langchain.py +52 -0
- kedi_decisions-0.1.0/packages/kedi-laya/src/kedi_laya/integrations/pydantic.py +39 -0
- kedi_decisions-0.1.0/packages/kedi-laya/src/kedi_laya/py.typed +0 -0
- kedi_decisions-0.1.0/packages/kedi-laya/tests/test_laya.py +321 -0
- kedi_decisions-0.1.0/packages/kedi-laya/tests/test_laya_context.py +68 -0
- kedi_decisions-0.1.0/packages/kedi-laya/validation/laya_capture.kedi +29 -0
- kedi_decisions-0.1.0/packages/kedi-laya/validation/laya_local.py +132 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/LICENSE +21 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/README.md +325 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/README.md +28 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/capabilities.py +59 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/jev_reply_review/README.md +113 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/jev_reply_review/attempt_01_broad_criterion.json +131 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/jev_reply_review/attempt_02_refund_only.json +111 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/jev_reply_review/attempt_03_action_criterion.json +131 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/jev_reply_review/live_run.json +131 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/jev_reply_review/main.kedi +56 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/jev_reply_review/run.py +101 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/kedi/01_rubric.kedi +14 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/kedi/02_probability.kedi +16 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/kedi/03_choice.kedi +18 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/kedi/04_boolean.kedi +22 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/kedi/05_labels.kedi +7 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/kedi/06_nested.kedi +19 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/kedi/07_nullable.kedi +12 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/kedi/binary_judge.kedi +13 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/kedi/judge.kedi +20 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/kedi/routing.kedi +16 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/kedi/weighted_judge.kedi +26 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/langchain_agent.py +22 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/langchain_contacts.py +29 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/pydantic_agent.py +27 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/pydantic_contacts.py +25 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/risk_review.py +45 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/validate_kedi.py +34 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/examples/validate_release.py +106 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/pyproject.toml +82 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/src/kedi_typesafe/__init__.py +38 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/src/kedi_typesafe/core/__init__.py +24 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/src/kedi_typesafe/core/_json_types.py +3 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/src/kedi_typesafe/core/errors.py +21 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/src/kedi_typesafe/core/evaluation.py +305 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/src/kedi_typesafe/core/extraction.py +13 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/src/kedi_typesafe/core/metadata.py +5 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/src/kedi_typesafe/core/schema.py +42 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/src/kedi_typesafe/core/transport.py +55 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/src/kedi_typesafe/integrations/__init__.py +5 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/src/kedi_typesafe/integrations/_langchain_routing.py +8 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/src/kedi_typesafe/integrations/_langchain_transport.py +109 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/src/kedi_typesafe/integrations/_pydantic_errors.py +31 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/src/kedi_typesafe/integrations/_pydantic_provider.py +26 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/src/kedi_typesafe/integrations/_pydantic_stream.py +28 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/src/kedi_typesafe/integrations/langchain.py +86 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/src/kedi_typesafe/integrations/pydantic.py +242 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/tests/core/test_capabilities.py +144 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/tests/core/test_capability_errors.py +184 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/tests/core/test_evaluation.py +489 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/tests/core/test_extraction.py +96 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/tests/core/test_metadata_validation.py +45 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/tests/core/test_schema.py +384 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/tests/core/test_schema_edges.py +72 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/tests/integrations/test_boundary_contracts.py +124 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/tests/integrations/test_custom_endpoint.py +129 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/tests/integrations/test_langchain.py +341 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/tests/integrations/test_langchain_capabilities.py +180 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/tests/integrations/test_live.py +32 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/tests/integrations/test_provider_errors.py +92 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/tests/integrations/test_pydantic.py +373 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/tests/integrations/test_pydantic_capabilities.py +119 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/validation/README.md +56 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/validation/jev-0.2-release.json +419 -0
- kedi_decisions-0.1.0/packages/kedi-typesafe/validation/kedi-capabilities-0.2.json +114 -0
- kedi_decisions-0.1.0/pyproject.toml +64 -0
- kedi_decisions-0.1.0/pyrightconfig.json +14 -0
- kedi_decisions-0.1.0/src/kedi_decisions/__init__.py +24 -0
- kedi_decisions-0.1.0/src/kedi_decisions/_json_types.py +16 -0
- kedi_decisions-0.1.0/src/kedi_decisions/contracts.py +78 -0
- kedi_decisions-0.1.0/src/kedi_decisions/errors.py +25 -0
- kedi_decisions-0.1.0/src/kedi_decisions/evaluation.py +469 -0
- kedi_decisions-0.1.0/src/kedi_decisions/extraction.py +115 -0
- kedi_decisions-0.1.0/src/kedi_decisions/integrations/__init__.py +1 -0
- kedi_decisions-0.1.0/src/kedi_decisions/integrations/_langchain_routing.py +39 -0
- kedi_decisions-0.1.0/src/kedi_decisions/integrations/_pydantic_stream.py +57 -0
- kedi_decisions-0.1.0/src/kedi_decisions/integrations/langchain.py +395 -0
- kedi_decisions-0.1.0/src/kedi_decisions/integrations/pydantic.py +240 -0
- kedi_decisions-0.1.0/src/kedi_decisions/metadata.py +120 -0
- kedi_decisions-0.1.0/src/kedi_decisions/py.typed +0 -0
- kedi_decisions-0.1.0/src/kedi_decisions/routing.py +86 -0
- kedi_decisions-0.1.0/src/kedi_decisions/schema.py +486 -0
- kedi_decisions-0.1.0/tests/test_decision_integrations.py +293 -0
- kedi_decisions-0.1.0/uv.lock +3501 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*.kedi linguist-language=Python
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
name: Validate and Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
inputs:
|
|
9
|
+
publish:
|
|
10
|
+
description: Publish the validated workspace packages to PyPI
|
|
11
|
+
type: boolean
|
|
12
|
+
default: false
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
concurrency:
|
|
18
|
+
group: publish-${{ github.ref }}
|
|
19
|
+
cancel-in-progress: false
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
validate:
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
|
|
26
|
+
- uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7
|
|
27
|
+
with:
|
|
28
|
+
version: "0.11.21"
|
|
29
|
+
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
|
|
30
|
+
with:
|
|
31
|
+
python-version: "3.12"
|
|
32
|
+
- name: Install locked dependencies
|
|
33
|
+
run: uv sync --locked --group dev
|
|
34
|
+
- name: Run quality gates and build packages
|
|
35
|
+
run: make prod
|
|
36
|
+
- name: Check distribution metadata
|
|
37
|
+
run: uvx --from twine twine check dist/*
|
|
38
|
+
- name: Validate built wheels outside the workspace
|
|
39
|
+
working-directory: ${{ runner.temp }}
|
|
40
|
+
run: |
|
|
41
|
+
uv venv package-smoke --python 3.12
|
|
42
|
+
uv pip install --python package-smoke/bin/python \
|
|
43
|
+
--find-links "$GITHUB_WORKSPACE/dist" \
|
|
44
|
+
'kedi-decisions[pydantic,langchain]==0.1.0' \
|
|
45
|
+
'kedi-typesafe[all]==0.3.0' 'kedi-laya[pydantic,langchain]==0.1.0'
|
|
46
|
+
package-smoke/bin/python -c "import kedi_decisions, kedi_typesafe, kedi_laya; from kedi_typesafe import TypeSafeModel; from kedi_typesafe.integrations.langchain import TypeSafeChatModel"
|
|
47
|
+
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
|
|
48
|
+
with:
|
|
49
|
+
name: distributions
|
|
50
|
+
path: dist/*
|
|
51
|
+
if-no-files-found: error
|
|
52
|
+
|
|
53
|
+
publish:
|
|
54
|
+
if: github.event_name == 'workflow_dispatch' && inputs.publish && github.ref == 'refs/heads/main'
|
|
55
|
+
needs: validate
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
steps:
|
|
58
|
+
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
|
|
59
|
+
with:
|
|
60
|
+
name: distributions
|
|
61
|
+
path: dist
|
|
62
|
+
- uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7
|
|
63
|
+
with:
|
|
64
|
+
version: "0.11.21"
|
|
65
|
+
- name: Publish validated distributions
|
|
66
|
+
run: uv publish --check-url https://pypi.org/simple/ dist/*
|
|
67
|
+
env:
|
|
68
|
+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,218 @@
|
|
|
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
|
+
# Temporary file for partial code execution
|
|
204
|
+
tempCodeRunnerFile.py
|
|
205
|
+
|
|
206
|
+
# Ruff stuff:
|
|
207
|
+
.ruff_cache/
|
|
208
|
+
|
|
209
|
+
# PyPI configuration file
|
|
210
|
+
.pypirc
|
|
211
|
+
|
|
212
|
+
# Marimo
|
|
213
|
+
marimo/_static/
|
|
214
|
+
marimo/_lsp/
|
|
215
|
+
__marimo__/
|
|
216
|
+
|
|
217
|
+
# Streamlit
|
|
218
|
+
.streamlit/secrets.toml
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kedi Programming Language
|
|
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,32 @@
|
|
|
1
|
+
UV ?= uv
|
|
2
|
+
|
|
3
|
+
.PHONY: format format-check lint ty basedpyright check tests coverage build prod
|
|
4
|
+
|
|
5
|
+
format:
|
|
6
|
+
$(UV) run --group dev ruff check --fix .
|
|
7
|
+
$(UV) run --group dev ruff format .
|
|
8
|
+
|
|
9
|
+
format-check:
|
|
10
|
+
$(UV) run --group dev ruff format --check .
|
|
11
|
+
|
|
12
|
+
lint:
|
|
13
|
+
$(UV) run --group dev ruff check .
|
|
14
|
+
|
|
15
|
+
ty:
|
|
16
|
+
$(UV) run --group dev ty check src packages/kedi-typesafe/src packages/kedi-laya/src
|
|
17
|
+
|
|
18
|
+
basedpyright:
|
|
19
|
+
$(UV) run --group dev basedpyright
|
|
20
|
+
|
|
21
|
+
check: lint format-check ty basedpyright
|
|
22
|
+
|
|
23
|
+
tests:
|
|
24
|
+
$(UV) run --group dev pytest -m "not live"
|
|
25
|
+
|
|
26
|
+
coverage:
|
|
27
|
+
$(UV) run --group dev pytest -m "not live" --cov --cov-branch
|
|
28
|
+
|
|
29
|
+
build:
|
|
30
|
+
$(UV) build --all-packages
|
|
31
|
+
|
|
32
|
+
prod: check coverage build
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: kedi-decisions
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Typed decision contracts and model integrations
|
|
5
|
+
Project-URL: Repository, https://github.com/kedi-lang/kedi-decisions
|
|
6
|
+
Project-URL: Issues, https://github.com/kedi-lang/kedi-decisions/issues
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Requires-Dist: jsonschema<5,>=4.26
|
|
11
|
+
Requires-Dist: pydantic<3,>=2.12
|
|
12
|
+
Provides-Extra: langchain
|
|
13
|
+
Requires-Dist: langchain==1.4.3; extra == 'langchain'
|
|
14
|
+
Provides-Extra: laya
|
|
15
|
+
Requires-Dist: kedi-laya[pydantic,torch]==0.1.0; extra == 'laya'
|
|
16
|
+
Provides-Extra: laya-mlx
|
|
17
|
+
Requires-Dist: kedi-laya[mlx,pydantic]==0.1.0; extra == 'laya-mlx'
|
|
18
|
+
Provides-Extra: pydantic
|
|
19
|
+
Requires-Dist: pydantic-ai-slim==2.54.0; extra == 'pydantic'
|
|
20
|
+
Provides-Extra: typesafe
|
|
21
|
+
Requires-Dist: kedi-typesafe==0.3.0; extra == 'typesafe'
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# Kedi Decisions
|
|
25
|
+
|
|
26
|
+
Provider-neutral typed decisions, with independent Jev and Laya integrations.
|
|
27
|
+
|
|
28
|
+
The root `kedi-decisions` package contains schema planning, criteria, validation,
|
|
29
|
+
decision evidence and optional framework bridges. It imports neither TypeSafe
|
|
30
|
+
SDK nor MLX/PyTorch. Provider packages live in `packages/` and can be installed
|
|
31
|
+
independently. Kedi itself is not required to use them.
|
|
32
|
+
|
|
33
|
+
| Install | Includes |
|
|
34
|
+
| --- | --- |
|
|
35
|
+
| `kedi-decisions` | Shared contracts and validation only |
|
|
36
|
+
| `kedi-decisions[typesafe]` | Jev and its native Pydantic AI integration |
|
|
37
|
+
| `kedi-decisions[laya]` | Laya, upstream PyTorch runtime, Pydantic AI |
|
|
38
|
+
| `kedi-decisions[laya-mlx]` | Laya, Apple Silicon MLX runtime, Pydantic AI |
|
|
39
|
+
| `kedi-decisions[langchain]` | Optional shared LangChain integration |
|
|
40
|
+
|
|
41
|
+
Jev's LangChain transport is installed with `kedi-typesafe[langchain]`.
|
|
42
|
+
The shared `langchain` extra alone does not install provider-specific SDKs.
|
|
43
|
+
|
|
44
|
+
These package versions are not yet published to PyPI. Clone the monorepo to
|
|
45
|
+
work from source:
|
|
46
|
+
|
|
47
|
+
```sh
|
|
48
|
+
git clone https://github.com/kedi-lang/kedi-decisions.git
|
|
49
|
+
cd kedi-decisions
|
|
50
|
+
uv sync --locked --group dev
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Add `--extra laya-mlx` or `--extra laya` only on a host where that runtime is
|
|
54
|
+
needed. Installation does not download model weights.
|
|
55
|
+
|
|
56
|
+
## Layout
|
|
57
|
+
|
|
58
|
+
- `src/kedi_decisions/`: shared contract, schema, evidence and integrations.
|
|
59
|
+
- `packages/kedi-typesafe/`: TypeSafe SDK conversion and Jev transport.
|
|
60
|
+
- `packages/kedi-laya/`: local inference, MLX/Torch loading and model wrappers.
|
|
61
|
+
- `tests/`: package isolation and cross-provider contracts.
|
|
62
|
+
|
|
63
|
+
Kedi programs import the shared criteria with `> import: decisions`; Python
|
|
64
|
+
callers embedded in Kedi use `kedi.decisions`. These replace the former
|
|
65
|
+
provider-specific Kedi type-import modules. Neither surface selects a model,
|
|
66
|
+
loads weights, or imports a provider SDK. Standalone Python callers can import
|
|
67
|
+
directly from `kedi_decisions`. Provider packages retain their public API.
|
|
68
|
+
|
|
69
|
+
## Compatibility
|
|
70
|
+
|
|
71
|
+
`kedi_typesafe` retains its public exports, evaluator/client ownership rules,
|
|
72
|
+
strict default boolean threshold of 0.85, SDK-native question plans and metadata
|
|
73
|
+
envelope. Criteria are aliases of the shared objects, not duplicate classes.
|
|
74
|
+
Existing serialized `x-typesafe` schema annotations and route identifiers are
|
|
75
|
+
retained for compatibility; they do not imply a dependency on the TypeSafe SDK.
|
|
76
|
+
|
|
77
|
+
Jev and Laya can return similar decision shapes without having interchangeable
|
|
78
|
+
confidence calibration. A finite-choice interface is not free-form extraction.
|
|
79
|
+
Unsupported schema types fail before model invocation.
|
|
80
|
+
|
|
81
|
+
## Checks
|
|
82
|
+
|
|
83
|
+
`make check`, `make tests` and `make build` validate the workspace. Live validation
|
|
84
|
+
programs reside with their provider packages and are excluded from normal CI.
|
|
85
|
+
`make coverage` enforces a 98% combined line/branch coverage floor.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Kedi Decisions
|
|
2
|
+
|
|
3
|
+
Provider-neutral typed decisions, with independent Jev and Laya integrations.
|
|
4
|
+
|
|
5
|
+
The root `kedi-decisions` package contains schema planning, criteria, validation,
|
|
6
|
+
decision evidence and optional framework bridges. It imports neither TypeSafe
|
|
7
|
+
SDK nor MLX/PyTorch. Provider packages live in `packages/` and can be installed
|
|
8
|
+
independently. Kedi itself is not required to use them.
|
|
9
|
+
|
|
10
|
+
| Install | Includes |
|
|
11
|
+
| --- | --- |
|
|
12
|
+
| `kedi-decisions` | Shared contracts and validation only |
|
|
13
|
+
| `kedi-decisions[typesafe]` | Jev and its native Pydantic AI integration |
|
|
14
|
+
| `kedi-decisions[laya]` | Laya, upstream PyTorch runtime, Pydantic AI |
|
|
15
|
+
| `kedi-decisions[laya-mlx]` | Laya, Apple Silicon MLX runtime, Pydantic AI |
|
|
16
|
+
| `kedi-decisions[langchain]` | Optional shared LangChain integration |
|
|
17
|
+
|
|
18
|
+
Jev's LangChain transport is installed with `kedi-typesafe[langchain]`.
|
|
19
|
+
The shared `langchain` extra alone does not install provider-specific SDKs.
|
|
20
|
+
|
|
21
|
+
These package versions are not yet published to PyPI. Clone the monorepo to
|
|
22
|
+
work from source:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
git clone https://github.com/kedi-lang/kedi-decisions.git
|
|
26
|
+
cd kedi-decisions
|
|
27
|
+
uv sync --locked --group dev
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Add `--extra laya-mlx` or `--extra laya` only on a host where that runtime is
|
|
31
|
+
needed. Installation does not download model weights.
|
|
32
|
+
|
|
33
|
+
## Layout
|
|
34
|
+
|
|
35
|
+
- `src/kedi_decisions/`: shared contract, schema, evidence and integrations.
|
|
36
|
+
- `packages/kedi-typesafe/`: TypeSafe SDK conversion and Jev transport.
|
|
37
|
+
- `packages/kedi-laya/`: local inference, MLX/Torch loading and model wrappers.
|
|
38
|
+
- `tests/`: package isolation and cross-provider contracts.
|
|
39
|
+
|
|
40
|
+
Kedi programs import the shared criteria with `> import: decisions`; Python
|
|
41
|
+
callers embedded in Kedi use `kedi.decisions`. These replace the former
|
|
42
|
+
provider-specific Kedi type-import modules. Neither surface selects a model,
|
|
43
|
+
loads weights, or imports a provider SDK. Standalone Python callers can import
|
|
44
|
+
directly from `kedi_decisions`. Provider packages retain their public API.
|
|
45
|
+
|
|
46
|
+
## Compatibility
|
|
47
|
+
|
|
48
|
+
`kedi_typesafe` retains its public exports, evaluator/client ownership rules,
|
|
49
|
+
strict default boolean threshold of 0.85, SDK-native question plans and metadata
|
|
50
|
+
envelope. Criteria are aliases of the shared objects, not duplicate classes.
|
|
51
|
+
Existing serialized `x-typesafe` schema annotations and route identifiers are
|
|
52
|
+
retained for compatibility; they do not imply a dependency on the TypeSafe SDK.
|
|
53
|
+
|
|
54
|
+
Jev and Laya can return similar decision shapes without having interchangeable
|
|
55
|
+
confidence calibration. A finite-choice interface is not free-form extraction.
|
|
56
|
+
Unsupported schema types fail before model invocation.
|
|
57
|
+
|
|
58
|
+
## Checks
|
|
59
|
+
|
|
60
|
+
`make check`, `make tests` and `make build` validate the workspace. Live validation
|
|
61
|
+
programs reside with their provider packages and are excluded from normal CI.
|
|
62
|
+
`make coverage` enforces a 98% combined line/branch coverage floor.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# Local Laya decisions
|
|
2
|
+
|
|
3
|
+
The optional `LayaClient` connects Laya-compatible `predict(state, questions)`
|
|
4
|
+
models to the same validated schema projection as Jev. It does not generate
|
|
5
|
+
prose, call a hosted service, or require `TYPESAFE_API_KEY`.
|
|
6
|
+
|
|
7
|
+
These packages are currently in the monorepo source checkout, not yet published.
|
|
8
|
+
From this repository run `uv sync --extra laya-mlx --extra langchain` on Apple
|
|
9
|
+
Silicon with Python 3.11+. Use `--extra laya` for the upstream PyTorch runtime.
|
|
10
|
+
Neither backend is a base dependency. Laya does not import the TypeSafe SDK.
|
|
11
|
+
|
|
12
|
+
## Python
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
from typing import Literal
|
|
16
|
+
from pydantic import BaseModel
|
|
17
|
+
from pydantic_ai import Agent
|
|
18
|
+
from kedi_laya import LayaClient
|
|
19
|
+
|
|
20
|
+
class Route(BaseModel):
|
|
21
|
+
team: Literal["billing", "technical"]
|
|
22
|
+
|
|
23
|
+
with LayaClient("aac6fef/laya-multilingual-mlx") as client:
|
|
24
|
+
agent = Agent(client.as_pydantic_model(), output_type=Route)
|
|
25
|
+
result = agent.run_sync("Please refund my duplicate charge.")
|
|
26
|
+
print(result.output.team)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Use `client.as_langchain_model().with_structured_output(Route)` for LangChain.
|
|
30
|
+
Use `client.as_evaluator().evaluate_sync(state=..., schema=Route.model_json_schema())`
|
|
31
|
+
for a direct decision API; its result contains `values`, `metadata`, model name,
|
|
32
|
+
and reported token usage. An asynchronous `evaluate` method is also available.
|
|
33
|
+
|
|
34
|
+
The [complete example](../packages/kedi-laya/examples/local_laya.py) also captures a raw probability.
|
|
35
|
+
`ChoiceCriteria`, `Rubric`, `BooleanCriteria`, `Probability`, nested supported
|
|
36
|
+
models, and strict boolean thresholds share the existing schema implementation.
|
|
37
|
+
The default bool rule remains `probability > 0.85`, independently of an
|
|
38
|
+
application's choice-acceptance policy. Free-form strings remain unsupported.
|
|
39
|
+
|
|
40
|
+
## Other checkpoints and predictors
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
client = LayaClient(
|
|
44
|
+
"organization/checkpoint",
|
|
45
|
+
backend="torch",
|
|
46
|
+
load_options={"device": "cpu"},
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
# Supply an already-loaded Laya-compatible model instead of a loader.
|
|
50
|
+
client = LayaClient("my-checkpoint", backend="mlx", predictor=my_agent)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`backend` accepts `auto` (default), `mlx`, or `torch`. Auto selects installed MLX
|
|
54
|
+
on Apple Silicon, otherwise PyTorch. The checkpoint may be a Hub ID or a
|
|
55
|
+
local directory. `load_options` is forwarded unchanged to that backend's `load`;
|
|
56
|
+
only pass options supported by that runtime (MLX supports `revision`, for example).
|
|
57
|
+
No backend or hosted fallback is selected silently. Caller-supplied predictors
|
|
58
|
+
must implement Laya's result contract, including question types and probabilities.
|
|
59
|
+
Injection does not make unrelated models Laya-compatible.
|
|
60
|
+
|
|
61
|
+
The client loads weights lazily once and serializes predictions on that client.
|
|
62
|
+
Async calls move inference off the event loop. Cancelling the waiter does not
|
|
63
|
+
cancel an executing native kernel; subsequent predictions wait for it to finish.
|
|
64
|
+
Reuse a client/model for a session instead of constructing it per decision.
|
|
65
|
+
`close()` waits for active inference and drops the client's model reference.
|
|
66
|
+
It never calls `close` on a caller-owned predictor. Closing an evaluator does
|
|
67
|
+
not close the borrowed client: the client owner controls its lifetime.
|
|
68
|
+
|
|
69
|
+
## Context and evidence
|
|
70
|
+
|
|
71
|
+
- The built-in MLX loader checks the actual tokenizer, question/option budget,
|
|
72
|
+
and checkpoint context window before prediction. It rejects silent truncation.
|
|
73
|
+
Many Laya checkpoints have a 512-token window, including question/options.
|
|
74
|
+
- Injected predictors and upstream PyTorch loaders retain their own context
|
|
75
|
+
handling. The MLX preflight is not a universal guarantee for those runtimes.
|
|
76
|
+
- Laya emits four-decimal probabilities. The evaluator accepts only the
|
|
77
|
+
corresponding rounding error in their sum; raw probabilities are not rescaled.
|
|
78
|
+
Invalid labels, missing answers, out-of-range values, and large sum errors fail.
|
|
79
|
+
- Choice/score confidence is supplied by Laya, not fabricated from its winner.
|
|
80
|
+
Laya's entropy-based confidence is not calibrated to Jev's confidence. A shared
|
|
81
|
+
numeric cutoff does not demonstrate equal reliability between providers.
|
|
82
|
+
- Laya's extra action head is not an approval decision and never authorizes tools.
|
|
83
|
+
- Metadata keeps `provider: laya` and the requested checkpoint name;
|
|
84
|
+
the runtime's generic `laya-rl-agent` response label is not used as checkpoint ID.
|
|
85
|
+
Laya uses the `decisions` metadata envelope. Jev keeps its existing `typesafe`
|
|
86
|
+
envelope for compatibility; Kedi understands both.
|
|
87
|
+
- There is no generated-text token stream. Reported input counts come from Laya;
|
|
88
|
+
missing usage stays unknown at the decision API, rather than being invented.
|
|
89
|
+
|
|
90
|
+
## Kedi
|
|
91
|
+
|
|
92
|
+
With the updated Kedi checkout and this package installed:
|
|
93
|
+
|
|
94
|
+
```kedi
|
|
95
|
+
> adapter: pydantic
|
|
96
|
+
> model: laya/aac6fef/laya-multilingual-mlx
|
|
97
|
+
> import: decisions
|
|
98
|
+
|
|
99
|
+
>> The team for "Please refund my duplicate charge" is [team: Literal["billing", "technical"]].
|
|
100
|
+
= <team>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`> adapter: langchain` uses the same surface. `laya-mlx/<checkpoint>` remains an
|
|
104
|
+
explicit MLX alias. These are decision models, not general-purpose agent harnesses.
|
|
105
|
+
Kedi does not attach its implicit artifact toolset to these models.
|
|
106
|
+
|
|
107
|
+
`> import: decisions` exposes the same shared criteria as `from kedi.decisions import ...`.
|
|
108
|
+
Laya uses `decision_threshold` (default `0.85`, strict greater-than) and
|
|
109
|
+
`decision_tool_call_threshold` (default `0.6`). Jev's existing `typesafe_*`
|
|
110
|
+
settings and the standalone provider package APIs are unchanged. Both providers
|
|
111
|
+
use the shared Kedi criteria import instead of provider-specific type modules.
|
|
112
|
+
|
|
113
|
+
Zero-argument handoffs can be selected and returned to the agent framework.
|
|
114
|
+
Parameterized tools raise `ToolCallProposed` for an explicit argument-producing
|
|
115
|
+
handler; the decision model never fabricates arbitrary arguments. The stream
|
|
116
|
+
interface delivers an already completed decision, not generated-text deltas.
|
|
117
|
+
|
|
118
|
+
The model wrappers declare `kedi_prompt_mode = "decision"`. The updated Kedi
|
|
119
|
+
runtime preserves template context and typed captures, but asks for decisions
|
|
120
|
+
instead of instructing the model to complete a grammatical sentence. Native
|
|
121
|
+
Pydantic AI and LangChain callers still control their own prompts; this marker
|
|
122
|
+
does not rewrite their input. It is not an accuracy guarantee.
|
|
123
|
+
|
|
124
|
+
Sources: [Laya MLX implementation](https://github.com/mizorewww/laya-mlx),
|
|
125
|
+
[multilingual checkpoint](https://huggingface.co/aac6fef/laya-multilingual-mlx),
|
|
126
|
+
[upstream Laya](https://pypi.org/project/laya/).
|