@elsium-ai/testing 0.1.6 → 0.1.7
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/README.md +52 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# @elsium-ai/testing
|
|
2
|
+
|
|
3
|
+
Testing utilities, mock providers, fixtures, and eval framework for [ElsiumAI](https://github.com/elsium-ai/elsium-ai).
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@elsium-ai/testing)
|
|
6
|
+
[](https://github.com/elsium-ai/elsium-ai/blob/main/LICENSE)
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @elsium-ai/testing --save-dev
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## What's Inside
|
|
15
|
+
|
|
16
|
+
- **Mock Providers** — Zero-latency providers for unit testing
|
|
17
|
+
- **Evals** — LLM-as-judge evaluation framework
|
|
18
|
+
- **Output Pinning** — Lock expected outputs, catch regressions when models update
|
|
19
|
+
- **Determinism Assertions** — Run N times, verify all outputs match
|
|
20
|
+
- **Prompt Versioning** — Track and compare prompt versions
|
|
21
|
+
- **Request-Matched Fixtures** — Replay fixtures by content hash, not sequence order
|
|
22
|
+
- **Regression Suites** — Automated regression detection in CI
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { assertDeterministic, createMockProvider, pinOutput } from '@elsium-ai/testing'
|
|
28
|
+
|
|
29
|
+
// Determinism check
|
|
30
|
+
const result = await assertDeterministic(
|
|
31
|
+
(seed) => llm.complete({
|
|
32
|
+
messages: [{ role: 'user', content: 'Classify: spam' }],
|
|
33
|
+
temperature: 0,
|
|
34
|
+
seed,
|
|
35
|
+
}).then(r => r.message.content),
|
|
36
|
+
{ runs: 5, seed: 42, tolerance: 0 },
|
|
37
|
+
)
|
|
38
|
+
// { deterministic: true, variance: 0, uniqueOutputs: 1 }
|
|
39
|
+
|
|
40
|
+
// Mock provider for tests
|
|
41
|
+
const mock = createMockProvider({
|
|
42
|
+
responses: [{ content: 'Mocked response' }],
|
|
43
|
+
})
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Part of ElsiumAI
|
|
47
|
+
|
|
48
|
+
This package is the testing layer of the [ElsiumAI](https://github.com/elsium-ai/elsium-ai) framework. See the [full documentation](https://github.com/elsium-ai/elsium-ai) for guides and examples.
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
[MIT](https://github.com/elsium-ai/elsium-ai/blob/main/LICENSE)
|
package/package.json
CHANGED