kitaru-evaluator 0.1.0rc0__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.
@@ -0,0 +1,298 @@
1
+ # iCloud conflict duplicates (pattern: "filename 2.ext" or "filename 2")
2
+ *[[:space:]]2.[!.]*
3
+ *[[:space:]]2
4
+
5
+ # Helm dependency artifacts (rebuilt via helm dep update)
6
+ helm/charts/
7
+ helm/Chart.lock
8
+
9
+ # pnpm
10
+ **/.pnpm-store
11
+
12
+ # macOS
13
+ .DS_Store
14
+
15
+ # Byte-compiled / optimized / DLL files
16
+ __pycache__/
17
+ *.py[codz]
18
+ *$py.class
19
+
20
+ # C extensions
21
+ *.so
22
+
23
+ # Distribution / packaging
24
+ .Python
25
+ build/
26
+ develop-eggs/
27
+ dist/
28
+ plugins/candidate-wheels/*
29
+ !plugins/candidate-wheels/.gitkeep
30
+ downloads/
31
+ eggs/
32
+ .eggs/
33
+ lib/
34
+ !docs/lib/
35
+ lib64/
36
+ parts/
37
+ sdist/
38
+ var/
39
+ wheels/
40
+ share/python-wheels/
41
+ *.egg-info/
42
+ .installed.cfg
43
+ *.egg
44
+ MANIFEST
45
+
46
+ # PyInstaller
47
+ # Usually these files are written by a python script from a template
48
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
49
+ *.manifest
50
+ *.spec
51
+
52
+ # Installer logs
53
+ pip-log.txt
54
+ pip-delete-this-directory.txt
55
+
56
+ # Unit test / coverage reports
57
+ htmlcov/
58
+ .tox/
59
+ .nox/
60
+ .coverage
61
+ .coverage.*
62
+ .cache
63
+ nosetests.xml
64
+ coverage.xml
65
+ *.cover
66
+ *.py.cover
67
+ .hypothesis/
68
+ .pytest_cache/
69
+ cover/
70
+
71
+ # Translations
72
+ *.mo
73
+ *.pot
74
+
75
+ # Django stuff:
76
+ *.log
77
+ local_settings.py
78
+ db.sqlite3
79
+ db.sqlite3-journal
80
+
81
+ # Flask stuff:
82
+ instance/
83
+ .webassets-cache
84
+
85
+ # Scrapy stuff:
86
+ .scrapy
87
+
88
+ # Sphinx documentation
89
+ docs/_build/
90
+
91
+ # PyBuilder
92
+ .pybuilder/
93
+ target/
94
+
95
+ # Jupyter Notebook
96
+ .ipynb_checkpoints
97
+
98
+ # IPython
99
+ profile_default/
100
+ ipython_config.py
101
+
102
+ # pyenv
103
+ # For a library or package, you might want to ignore these files since the code is
104
+ # intended to run in multiple environments; otherwise, check them in:
105
+ # .python-version
106
+
107
+ # pipenv
108
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
109
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
110
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
111
+ # install all needed dependencies.
112
+ #Pipfile.lock
113
+
114
+ # UV
115
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
116
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
117
+ # commonly ignored for libraries.
118
+ #uv.lock
119
+
120
+ # poetry
121
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
122
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
123
+ # commonly ignored for libraries.
124
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
125
+ #poetry.lock
126
+ #poetry.toml
127
+
128
+ # pdm
129
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
130
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
131
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
132
+ #pdm.lock
133
+ #pdm.toml
134
+ .pdm-python
135
+ .pdm-build/
136
+
137
+ # pixi
138
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
139
+ #pixi.lock
140
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
141
+ # in the .venv directory. It is recommended not to include this directory in version control.
142
+ .pixi
143
+
144
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
145
+ __pypackages__/
146
+
147
+ # Celery stuff
148
+ celerybeat-schedule
149
+ celerybeat.pid
150
+
151
+ # SageMath parsed files
152
+ *.sage.py
153
+
154
+ # Environments
155
+ .env
156
+ .envrc
157
+ .venv
158
+ env/
159
+ venv/
160
+ ENV/
161
+ env.bak/
162
+ venv.bak/
163
+
164
+ # Spyder project settings
165
+ .spyderproject
166
+ .spyproject
167
+
168
+ # Rope project settings
169
+ .ropeproject
170
+
171
+ # mypy
172
+ .mypy_cache/
173
+ .dmypy.json
174
+ dmypy.json
175
+
176
+ # Pyre type checker
177
+ .pyre/
178
+
179
+ # pytype static type analyzer
180
+ .pytype/
181
+
182
+ # Cython debug symbols
183
+ cython_debug/
184
+
185
+ # PyCharm
186
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
187
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
188
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
189
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
190
+ #.idea/
191
+
192
+ # Abstra
193
+ # Abstra is an AI-powered process automation framework.
194
+ # Ignore directories containing user credentials, local state, and settings.
195
+ # Learn more at https://abstra.io/docs
196
+ .abstra/
197
+
198
+ # Visual Studio Code
199
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
200
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
201
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
202
+ # you could uncomment the following to ignore the entire vscode folder
203
+ # .vscode/
204
+
205
+ # Ruff stuff:
206
+ .ruff_cache/
207
+
208
+ # PyPI configuration file
209
+ .pypirc
210
+
211
+ # Cursor
212
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
213
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
214
+ # refer to https://docs.cursor.com/context/ignore-files
215
+ .cursorignore
216
+ .cursorindexingignore
217
+
218
+ # Marimo
219
+ marimo/_static/
220
+ marimo/_lsp/
221
+ __marimo__/
222
+
223
+ # Cloudflare local state
224
+ .wrangler/
225
+
226
+ # Local project markers
227
+ .kitaru/
228
+ .zen/
229
+
230
+ # Git worktrees (isolated workspaces created via git worktree add)
231
+ .worktrees/
232
+
233
+ # Design docs + Repoprompt
234
+ design/
235
+ dogfood-output/
236
+ prompt-exports/
237
+
238
+ # Local Kitaru UI build artifacts (used by docker/Dockerfile.server-dev)
239
+ docker/kitaru-ui-dist/
240
+
241
+ # MCP
242
+ .mcp.json
243
+
244
+ # Claude
245
+ **/.claude/settings.local.json
246
+ .claude/*
247
+ !.claude/settings.json
248
+ !.claude/skills/
249
+
250
+ # Playwright MCP
251
+ .playwright-mcp/
252
+
253
+ # Bundled Kitaru UI (generated at build time by scripts/download-ui.sh)
254
+ src/kitaru/_ui/dist/
255
+ src/kitaru/_ui/bundle_manifest.json
256
+ .kitaru-ui-bundles/
257
+
258
+ # Codex
259
+ .codex/*
260
+ !.codex/skills/
261
+ AGENTS.override.md
262
+ .agents/skills/*
263
+ !.agents/skills/kitaru-dev/
264
+ !.agents/skills/kitaru-dev/**
265
+ !.agents/skills/kitaru-docs/
266
+ !.agents/skills/kitaru-docs/**
267
+ !.agents/skills/kitaru-evaluator-authoring/
268
+ !.agents/skills/kitaru-evaluator-authoring/**
269
+ !.agents/skills/kitaru-session-improvement/
270
+ !.agents/skills/kitaru-session-improvement/**
271
+ !.agents/skills/kitaru-tests-release/
272
+ !.agents/skills/kitaru-tests-release/**
273
+
274
+ # Agent Skills
275
+ .pi/
276
+ .claude/skills/building-pydantic-ai-agents
277
+ .claude/skills/instrumentation
278
+ skills-lock.json
279
+
280
+ # Local PR review screenshots
281
+ .pr-screenshots/
282
+
283
+ # Local scratch — single-developer scratch flow files at repo root
284
+ /my_flow.py
285
+ .claude/skills/logfire-instrumentation
286
+ .clawpatch/
287
+ docs/investigations/
288
+ docs/plans/
289
+ docs/reviews/
290
+ plans/
291
+ replay-verify-reports-live/
292
+ replay-verify-reports/
293
+
294
+ # OpenAPI baseline build output
295
+ openapi/.build/
296
+
297
+ # Generated by the canonical evaluator-authoring walkthrough
298
+ /examples/pydantic_ai_ticket_resolver/evaluator.py
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0rc0
4
+
5
+ - Initial release candidate for the built-in evaluator package.
@@ -0,0 +1,7 @@
1
+ Metadata-Version: 2.4
2
+ Name: kitaru-evaluator
3
+ Version: 0.1.0rc0
4
+ Summary: Built-in deterministic evaluators for Kitaru.
5
+ License-Expression: Apache-2.0
6
+ Requires-Python: >=3.11
7
+ Requires-Dist: kitaru<0.23,>=0.22.0rc0
@@ -0,0 +1,14 @@
1
+ [project]
2
+ name = "kitaru-evaluator"
3
+ version = "0.1.0rc0"
4
+ description = "Built-in deterministic evaluators for Kitaru."
5
+ license = "Apache-2.0"
6
+ requires-python = ">=3.11"
7
+ dependencies = ["kitaru>=0.22.0rc0,<0.23"]
8
+
9
+ [build-system]
10
+ requires = ["hatchling"]
11
+ build-backend = "hatchling.build"
12
+
13
+ [tool.hatch.build.targets.wheel]
14
+ packages = ["src/kitaru_evaluator"]
@@ -0,0 +1 @@
1
+ """Built-in deterministic evaluators for Kitaru."""
@@ -0,0 +1,69 @@
1
+ """Basic deterministic evaluators."""
2
+
3
+ from collections import Counter
4
+
5
+ from kitaru.api_models.v1.evaluation import EvaluationResult
6
+ from kitaru.api_models.v1.session_node import NodeType
7
+ from kitaru.task.evaluator import SessionView
8
+
9
+
10
+ def cost(session: SessionView) -> EvaluationResult:
11
+ """Report the total recorded cost of a session."""
12
+ recorded_cost = session.session.cost
13
+ if recorded_cost is None or any(
14
+ node.node_type is NodeType.LLM_CALL and node.cost is None
15
+ for node in session.nodes
16
+ ):
17
+ return EvaluationResult(
18
+ name="cost",
19
+ value="unavailable",
20
+ explanation="The session has incomplete LLM cost information.",
21
+ )
22
+ return EvaluationResult(
23
+ name="cost",
24
+ score=float(recorded_cost),
25
+ explanation=f"The session recorded a total cost of {recorded_cost}.",
26
+ )
27
+
28
+
29
+ def latency(session: SessionView) -> EvaluationResult:
30
+ """Measure the wall-clock duration of a session in seconds."""
31
+ started_at = session.session.started_at
32
+ ended_at = session.session.ended_at
33
+ if started_at is None or ended_at is None:
34
+ return EvaluationResult(
35
+ name="latency_seconds",
36
+ score=0.0,
37
+ explanation="The session has no complete timing information.",
38
+ )
39
+ duration = max((ended_at - started_at).total_seconds(), 0.0)
40
+ return EvaluationResult(
41
+ name="latency_seconds",
42
+ score=duration,
43
+ explanation=f"The session ran for {duration:.3f} seconds.",
44
+ )
45
+
46
+
47
+ def tool_call_patterns(session: SessionView) -> EvaluationResult:
48
+ """Classify whether a session repeats calls to the same tool."""
49
+ tool_names = [
50
+ node.tool_name or node.name
51
+ for node in session.nodes
52
+ if node.node_type is NodeType.TOOL_CALL
53
+ ]
54
+ counts = Counter(tool_names)
55
+ repeated_calls = sum(count - 1 for count in counts.values() if count > 1)
56
+ if not tool_names:
57
+ pattern = "no-tool-calls"
58
+ elif repeated_calls:
59
+ pattern = "repeated-tools"
60
+ else:
61
+ pattern = "distinct-tools"
62
+ return EvaluationResult(
63
+ name="tool_call_pattern",
64
+ score=float(repeated_calls),
65
+ value=pattern,
66
+ explanation=(
67
+ f"Found {len(tool_names)} tool calls and {repeated_calls} repeated calls."
68
+ ),
69
+ )