@syntheticlab/synbad 0.0.1 → 0.0.3

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 CHANGED
@@ -53,7 +53,7 @@ testing the `evals/reasoning/reasoning-parsing` test, for GLM-4.6 on Synthetic,
53
53
  and you want to run it 5 times since it isn't consistently failing:
54
54
 
55
55
  ```bash
56
- synbad.sh --env-var SYNTHETIC_API_KEY \
56
+ ./synbad.sh --env-var SYNTHETIC_API_KEY \
57
57
  --base-url "https://api.synthetic.new/openai/v1" \
58
58
  --only evals/reasoning/reasoning-parsing \
59
59
  --model "hf:zai-org/GLM-4.6" \
@@ -65,7 +65,7 @@ synbad.sh --env-var SYNTHETIC_API_KEY \
65
65
  First, install it:
66
66
 
67
67
  ```bash
68
- npm install synbad
68
+ npm install -g @syntheticlab/synbad
69
69
  ```
70
70
 
71
71
  Then run:
@@ -9,11 +9,11 @@ export function test(response) {
9
9
  assert.or(() => {
10
10
  assert.strictEqual(fn.name, "ls");
11
11
  const args = JSON.parse(fn.arguments);
12
- assert.or(() => assert.deepStrictEqual(args, {}), () => assert.strictEqual(args.path, "/home/reissbaker/Hack/scratch-scripts"), () => assert.strictEqual(args.path, "."));
12
+ assert.or(() => assert.strictEqual(args.path, "/home/reissbaker/Hack/scratch-scripts"), () => assert.strictEqual(args.path, "."), () => assert.isNullish(args.path));
13
13
  }, () => {
14
14
  assert.strictEqual(fn.name, "bash");
15
15
  const args = JSON.parse(fn.arguments);
16
- assert.ok(args.command.startsWith("ls"));
16
+ assert.or(() => assert.startsWith(args.command, "ls"), () => assert.startsWith(args.command, "find"));
17
17
  });
18
18
  }
19
19
  export const json = {
@@ -4,3 +4,4 @@ export declare function isNullish(a: unknown): asserts a is null | undefined;
4
4
  export declare function isNotNullish<T extends any>(a: T): asserts a is Exclude<T, null | undefined>;
5
5
  export declare function isEmptyArray(a: any[]): boolean;
6
6
  export declare function isNotEmptyArray(a: any[]): boolean;
7
+ export declare function startsWith(a: string, prefix: string): boolean;
@@ -52,3 +52,11 @@ export function isNotEmptyArray(a) {
52
52
  actual: a,
53
53
  });
54
54
  }
55
+ export function startsWith(a, prefix) {
56
+ if (a.startsWith(prefix))
57
+ return true;
58
+ throw new assert.AssertionError({
59
+ message: "Expected to start with: " + prefix,
60
+ actual: a,
61
+ });
62
+ }
@@ -50,7 +50,14 @@ cli.command("eval")
50
50
  model,
51
51
  ...json,
52
52
  });
53
- test.test(response);
53
+ try {
54
+ test.test(response);
55
+ }
56
+ catch (e) {
57
+ console.error("Response:");
58
+ console.error(JSON.stringify(response.choices[0], null, 2));
59
+ throw e;
60
+ }
54
61
  }
55
62
  process.stdout.write(" ✅ passed\n");
56
63
  }
@@ -13,15 +13,18 @@ export function test(response: OpenAI.ChatCompletion) {
13
13
  assert.strictEqual(fn.name, "ls");
14
14
  const args = JSON.parse(fn.arguments);
15
15
  assert.or(
16
- () => assert.deepStrictEqual(args, {}),
17
16
  () => assert.strictEqual(args.path, "/home/reissbaker/Hack/scratch-scripts"),
18
17
  () => assert.strictEqual(args.path, "."),
18
+ () => assert.isNullish(args.path),
19
19
  );
20
20
  },
21
21
  () => {
22
22
  assert.strictEqual(fn.name, "bash");
23
23
  const args = JSON.parse(fn.arguments);
24
- assert.ok(args.command.startsWith("ls"));
24
+ assert.or(
25
+ () => assert.startsWith(args.command, "ls"),
26
+ () => assert.startsWith(args.command, "find"),
27
+ );
25
28
  },
26
29
  );
27
30
  }
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@syntheticlab/synbad",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "LLM inference provider evals",
5
5
  "main": "dist/source/index.js",
6
6
  "bin": {
7
- "synbad": "dist/source/index.js"
7
+ "synbad": "dist/source/index.js"
8
8
  },
9
- "preferGlobal": true,
9
+ "preferGlobal": true,
10
10
  "type": "module",
11
11
  "scripts": {
12
12
  "test": "echo \"Error: no test specified\" && exit 1",
13
- "build": "tsc",
14
- "prepublishOnly": "tsc"
13
+ "build": "tsc",
14
+ "prepublishOnly": "tsc"
15
15
  },
16
16
  "author": "@reissbaker",
17
17
  "license": "MIT",
package/source/asserts.ts CHANGED
@@ -68,3 +68,11 @@ export function isNotEmptyArray(a: any[]) {
68
68
  actual: a,
69
69
  });
70
70
  }
71
+
72
+ export function startsWith(a: string, prefix: string) {
73
+ if(a.startsWith(prefix)) return true;
74
+ throw new assert.AssertionError({
75
+ message: "Expected to start with: " + prefix,
76
+ actual: a,
77
+ });
78
+ }
package/source/index.ts CHANGED
@@ -56,7 +56,13 @@ cli.command("eval")
56
56
  model,
57
57
  ...json,
58
58
  });
59
- test.test(response);
59
+ try {
60
+ test.test(response);
61
+ } catch(e) {
62
+ console.error("Response:");
63
+ console.error(JSON.stringify(response.choices[0], null, 2));
64
+ throw e;
65
+ }
60
66
  }
61
67
  process.stdout.write(" ✅ passed\n");
62
68
  } catch(e) {