@tagma/completion-llm-judge 0.1.1 → 0.1.2
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.
- package/LICENSE +21 -21
- package/README.md +11 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +14 -13
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Tagma
|
|
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.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tagma
|
|
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.
|
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ ollama serve # usually auto-started
|
|
|
25
25
|
pipeline:
|
|
26
26
|
name: qa-loop
|
|
27
27
|
plugins:
|
|
28
|
-
-
|
|
28
|
+
- '@tagma/completion-llm-judge'
|
|
29
29
|
tracks:
|
|
30
30
|
- id: qa
|
|
31
31
|
name: QA
|
|
@@ -33,7 +33,7 @@ pipeline:
|
|
|
33
33
|
tasks:
|
|
34
34
|
- id: find-bugs
|
|
35
35
|
name: Find failing tests
|
|
36
|
-
prompt:
|
|
36
|
+
prompt: 'List all failing tests in the current workspace with their file paths.'
|
|
37
37
|
output: ./output/find-bugs.md
|
|
38
38
|
completion:
|
|
39
39
|
type: llm_judge
|
|
@@ -50,7 +50,7 @@ Swap to a hosted backend:
|
|
|
50
50
|
```yaml
|
|
51
51
|
completion:
|
|
52
52
|
type: llm_judge
|
|
53
|
-
rubric:
|
|
53
|
+
rubric: '...'
|
|
54
54
|
endpoint: https://api.openai.com/v1/chat/completions
|
|
55
55
|
model: gpt-4o-mini
|
|
56
56
|
api_key_env: OPENAI_API_KEY
|
|
@@ -67,14 +67,14 @@ await loadPlugins(['@tagma/completion-llm-judge']);
|
|
|
67
67
|
|
|
68
68
|
## Config
|
|
69
69
|
|
|
70
|
-
| Field | Type | Default
|
|
71
|
-
|
|
72
|
-
| `rubric` | string |
|
|
73
|
-
| `model` | string | `qwen3:4b`
|
|
74
|
-
| `endpoint` | string | `http://localhost:11434/v1/chat/completions`
|
|
75
|
-
| `api_key_env` | string |
|
|
76
|
-
| `timeout` | duration | `120s`
|
|
77
|
-
| `max_output_chars` | number | `8000`
|
|
70
|
+
| Field | Type | Default | Notes |
|
|
71
|
+
| ------------------ | -------- | -------------------------------------------- | ------------------------------------------------------------------------------------------ |
|
|
72
|
+
| `rubric` | string | _(required)_ | Plain-language success criteria the judge should verify |
|
|
73
|
+
| `model` | string | `qwen3:4b` | Judge model name. Swap for `qwen3:8b`, `deepseek-r1:7b`, `gpt-4o-mini`, etc. |
|
|
74
|
+
| `endpoint` | string | `http://localhost:11434/v1/chat/completions` | OpenAI-compatible chat completions URL. Default points at local Ollama |
|
|
75
|
+
| `api_key_env` | string | _(none)_ | Env var holding the bearer token. Leave unset for local Ollama; set for hosted backends |
|
|
76
|
+
| `timeout` | duration | `120s` | Max time to wait for the judge response (reasoning models need more time than chat models) |
|
|
77
|
+
| `max_output_chars` | number | `8000` | Truncate task stdout before judging (head+tail preserved) |
|
|
78
78
|
|
|
79
79
|
## Behavior
|
|
80
80
|
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,gBAAgB,EAAiC,MAAM,cAAc,CAAC;AA0IpF,QAAA,MAAM,kBAAkB,EAAE,gBA4GzB,CAAC;AAGF,eAAO,MAAM,cAAc,gBAAgB,CAAC;AAC5C,eAAO,MAAM,UAAU,cAAc,CAAC;AACtC,eAAe,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -50,11 +50,15 @@ function parseDurationSafe(raw, fallback) {
|
|
|
50
50
|
return fallback;
|
|
51
51
|
const n = Number(m[1]);
|
|
52
52
|
switch (m[2]) {
|
|
53
|
-
case 'ms':
|
|
54
|
-
|
|
55
|
-
case '
|
|
53
|
+
case 'ms':
|
|
54
|
+
return n;
|
|
55
|
+
case 'm':
|
|
56
|
+
return n * 60_000;
|
|
57
|
+
case 'h':
|
|
58
|
+
return n * 3_600_000;
|
|
56
59
|
case 's':
|
|
57
|
-
default:
|
|
60
|
+
default:
|
|
61
|
+
return n * 1000;
|
|
58
62
|
}
|
|
59
63
|
}
|
|
60
64
|
// Head-and-tail truncation preserves the start of the output (where agents
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,2EAA2E;AAC3E,wEAAwE;AACxE,uCAAuC;AACvC,EAAE;AACF,2EAA2E;AAC3E,uEAAuE;AACvE,qEAAqE;AACrE,uEAAuE;AACvE,sCAAsC;AACtC,EAAE;AACF,2EAA2E;AAC3E,wEAAwE;AACxE,uEAAuE;AACvE,8DAA8D;AAC9D,EAAE;AACF,0BAA0B;AAC1B,6CAA6C;AAC7C,YAAY;AACZ,eAAe;AACf,sBAAsB;AACtB,wBAAwB;AACxB,8BAA8B;AAC9B,mFAAm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AU,GAAG,WAAW,CAAC;AACtC,eAAe,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tagma/completion-llm-judge",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "LLM-as-judge completion plugin for tagma-sdk pipelines",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"prepublishOnly": "bun run build"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@tagma/types": "0.2.
|
|
52
|
+
"@tagma/types": "0.2.6"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"bun-types": "^1.3.11",
|
package/src/index.ts
CHANGED
|
@@ -27,9 +27,7 @@
|
|
|
27
27
|
// rubric: "Output must list at least 3 failing tests with file paths."
|
|
28
28
|
// # endpoint / model / api_key_env all default to local Ollama + qwen3:4b
|
|
29
29
|
|
|
30
|
-
import type {
|
|
31
|
-
CompletionPlugin, CompletionContext, TaskResult,
|
|
32
|
-
} from '@tagma/types';
|
|
30
|
+
import type { CompletionPlugin, CompletionContext, TaskResult } from '@tagma/types';
|
|
33
31
|
|
|
34
32
|
// Ollama exposes an OpenAI-compatible `/v1/chat/completions` route on port
|
|
35
33
|
// 11434 by default. Point this at any OpenAI-compatible server (OpenAI,
|
|
@@ -67,11 +65,15 @@ function parseDurationSafe(raw: unknown, fallback: number): number {
|
|
|
67
65
|
if (!m) return fallback;
|
|
68
66
|
const n = Number(m[1]);
|
|
69
67
|
switch (m[2]) {
|
|
70
|
-
case 'ms':
|
|
71
|
-
|
|
72
|
-
case '
|
|
68
|
+
case 'ms':
|
|
69
|
+
return n;
|
|
70
|
+
case 'm':
|
|
71
|
+
return n * 60_000;
|
|
72
|
+
case 'h':
|
|
73
|
+
return n * 3_600_000;
|
|
73
74
|
case 's':
|
|
74
|
-
default:
|
|
75
|
+
default:
|
|
76
|
+
return n * 1000;
|
|
75
77
|
}
|
|
76
78
|
}
|
|
77
79
|
|
|
@@ -235,9 +237,10 @@ const LlmJudgeCompletion: CompletionPlugin = {
|
|
|
235
237
|
const model = (config.model as string | undefined) ?? DEFAULT_MODEL;
|
|
236
238
|
const endpoint = (config.endpoint as string | undefined) ?? DEFAULT_ENDPOINT;
|
|
237
239
|
const timeoutMs = parseDurationSafe(config.timeout, DEFAULT_TIMEOUT_MS);
|
|
238
|
-
const maxChars =
|
|
239
|
-
|
|
240
|
-
|
|
240
|
+
const maxChars =
|
|
241
|
+
typeof config.max_output_chars === 'number' && config.max_output_chars > 0
|
|
242
|
+
? Math.floor(config.max_output_chars)
|
|
243
|
+
: DEFAULT_MAX_OUTPUT_CHARS;
|
|
241
244
|
|
|
242
245
|
const userContent =
|
|
243
246
|
`[Rubric]\n${rubric}\n\n` +
|
|
@@ -250,9 +253,7 @@ const LlmJudgeCompletion: CompletionPlugin = {
|
|
|
250
253
|
];
|
|
251
254
|
|
|
252
255
|
try {
|
|
253
|
-
const content = await callJudge(
|
|
254
|
-
endpoint, model, apiKey, messages, timeoutMs, ctx.signal,
|
|
255
|
-
);
|
|
256
|
+
const content = await callJudge(endpoint, model, apiKey, messages, timeoutMs, ctx.signal);
|
|
256
257
|
const firstLine = (content.split(/\r?\n/, 1)[0] ?? '').trim().toUpperCase();
|
|
257
258
|
const passed = firstLine.startsWith('PASS');
|
|
258
259
|
if (!passed) {
|