@syntheticlab/synbad 0.0.5 → 0.0.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.
Files changed (60) hide show
  1. package/README.md +60 -23
  2. package/dist/evals/reasoning/custom-harness.d.ts +679 -0
  3. package/dist/evals/reasoning/custom-harness.js +847 -0
  4. package/dist/evals/reasoning/multiturn-reasoning-parsing.d.ts +2 -2
  5. package/dist/evals/reasoning/multiturn-reasoning-parsing.js +2 -2
  6. package/dist/evals/reasoning/reasoning-claude-tool-call.d.ts +2 -2
  7. package/dist/evals/reasoning/reasoning-claude-tool-call.js +1 -2
  8. package/dist/evals/reasoning/reasoning-parsing.d.ts +2 -2
  9. package/dist/evals/reasoning/reasoning-parsing.js +2 -2
  10. package/dist/evals/reasoning/response-in-reasoning.d.ts +45 -0
  11. package/dist/evals/reasoning/response-in-reasoning.js +59 -0
  12. package/dist/evals/tools/claude-dash.d.ts +2 -2
  13. package/dist/evals/tools/claude-dash.js +1 -2
  14. package/dist/evals/tools/crush-list-files.d.ts +2 -5
  15. package/dist/evals/tools/crush-list-files.js +6 -8
  16. package/dist/evals/tools/multi-turn-tools.d.ts +46 -0
  17. package/dist/evals/tools/multi-turn-tools.js +100 -0
  18. package/dist/evals/tools/no-fn-args.d.ts +22 -0
  19. package/dist/evals/tools/no-fn-args.js +31 -0
  20. package/dist/evals/tools/octo-list-no-optional-args.d.ts +209 -0
  21. package/dist/evals/tools/octo-list-no-optional-args.js +73 -0
  22. package/dist/evals/tools/parallel-tool.d.ts +2 -2
  23. package/dist/evals/tools/parallel-tool.js +1 -2
  24. package/dist/evals/tools/simple-tool.d.ts +2 -2
  25. package/dist/evals/tools/simple-tool.js +3 -2
  26. package/dist/evals/tools/tool-dash-underscore.d.ts +26 -0
  27. package/dist/evals/tools/tool-dash-underscore.js +37 -0
  28. package/dist/evals/tools/tool-path-corruption.d.ts +26 -0
  29. package/dist/evals/tools/tool-path-corruption.js +41 -0
  30. package/dist/source/asserts.d.ts +4 -1
  31. package/dist/source/asserts.js +36 -0
  32. package/dist/source/chat-completion.d.ts +5 -0
  33. package/dist/source/chat-completion.js +1 -0
  34. package/dist/source/evals.d.ts +9 -0
  35. package/dist/source/evals.js +53 -0
  36. package/dist/source/evals.test.d.ts +1 -0
  37. package/dist/source/evals.test.js +12 -0
  38. package/dist/source/exports.d.ts +2 -0
  39. package/dist/source/exports.js +1 -0
  40. package/dist/source/index.js +103 -43
  41. package/evals/reasoning/multiturn-reasoning-parsing.ts +3 -3
  42. package/evals/reasoning/reasoning-claude-tool-call.ts +2 -3
  43. package/evals/reasoning/reasoning-parsing.ts +3 -3
  44. package/evals/reasoning/response-in-reasoning.ts +65 -0
  45. package/evals/tools/claude-dash.ts +2 -3
  46. package/evals/tools/crush-list-files.ts +11 -13
  47. package/evals/tools/multi-turn-tools.ts +104 -0
  48. package/evals/tools/no-fn-args.ts +34 -0
  49. package/evals/tools/octo-list-no-optional-args.ts +81 -0
  50. package/evals/tools/parallel-tool.ts +2 -3
  51. package/evals/tools/simple-tool.ts +4 -3
  52. package/evals/tools/tool-dash-underscore.ts +40 -0
  53. package/evals/tools/tool-path-corruption.ts +46 -0
  54. package/package.json +10 -3
  55. package/source/asserts.ts +37 -1
  56. package/source/chat-completion.ts +6 -0
  57. package/source/evals.test.ts +13 -0
  58. package/source/evals.ts +56 -0
  59. package/source/exports.ts +2 -0
  60. package/source/index.ts +121 -44
@@ -1,8 +1,7 @@
1
- import { ChatResponse } from "../../source/chat-completion.ts";
1
+ import { ChatMessage } from "../../source/chat-completion.ts";
2
2
  import * as assert from "../../source/asserts.ts";
3
3
 
4
- export function test(response: ChatResponse) {
5
- const { tool_calls } = response.choices[0].message;
4
+ export function test({ tool_calls }: ChatMessage) {
6
5
  assert.isNotNullish(tool_calls);
7
6
  assert.isNotEmptyArray(tool_calls);
8
7
  assert.strictEqual(tool_calls.length, 1);
@@ -1,8 +1,8 @@
1
1
  import * as assert from "../../source/asserts.ts";
2
- import { ChatResponse, getReasoning } from "../../source/chat-completion.ts";
2
+ import { ChatMessage, getReasoning } from "../../source/chat-completion.ts";
3
3
 
4
- export function test(response: ChatResponse) {
5
- const reasoning = getReasoning(response.choices[0].message);
4
+ export function test(message: ChatMessage) {
5
+ const reasoning = getReasoning(message);
6
6
  assert.isNotNullish(reasoning);
7
7
  }
8
8
 
@@ -0,0 +1,65 @@
1
+ import * as assert from "../../source/asserts.ts";
2
+ import { ChatMessage } from "../../source/chat-completion.ts";
3
+
4
+ export function test(message: ChatMessage) {
5
+ const content = message.content;
6
+ assert.or(
7
+ () => assert.isNotNullish(content),
8
+ () => assert.isNotEmptyArray(message.tool_calls),
9
+ );
10
+ }
11
+
12
+ export const json = {
13
+ "messages": [
14
+ {
15
+ "role": "system",
16
+ "content": "When I ask you to add a feature or resolve a problem: ALWAYS start the project explorer sub-agent to build complete understanding"
17
+ },
18
+ {
19
+ "role": "user",
20
+ "content": [
21
+ {
22
+ "type": "text",
23
+ "text": "Hello"
24
+ }
25
+ ]
26
+ }
27
+ ],
28
+ "temperature": 1,
29
+ "tools": [
30
+ {
31
+ "type": "function",
32
+ "function": {
33
+ "name": "task",
34
+ "description": "Launch a new agent to handle complex, multi-step tasks autonomously.\n\nAvailable agent types and the tools they have access to:\n- general: General-purpose agent for researching complex questions and executing multi-step tasks. Use this agent to execute multiple units of work in parallel.\n- explore: Fast agent specialized for exploring codebases. Use this when you need to quickly find files by patterns (eg. \"src/components/**/*.tsx\"), search code for keywords (eg. \"API endpoints\"), or answer questions about the codebase (eg. \"how do API endpoints work?\"). When calling this agent, specify the desired thoroughness level: \"quick\" for basic searches, \"medium\" for moderate exploration, or \"very thorough\" for comprehensive analysis across multiple locations and naming conventions.\n- code-reviewer: Expert code review specialist. Proactively reviews code for quality, security, and maintainability. Use immediately after writing or modifying code.\n\nWhen using the Task tool, you must specify a subagent_type parameter to select which agent type to use.\n\nWhen to use the Task tool:\n- When you are instructed to execute custom slash commands. Use the Task tool with the slash command invocation as the entire prompt. The slash command can take arguments. For example: Task(description=\"Check the file\", prompt=\"/check-file path/to/file.py\")\n\nWhen NOT to use the Task tool:\n- If you want to read a specific file path, use the Read or Glob tool instead of the Task tool, to find the match more quickly\n- If you are searching for a specific class definition like \"class Foo\", use the Glob tool instead, to find the match more quickly\n- If you are searching for code within a specific file or set of 2-3 files, use the Read tool instead of the Task tool, to find the match more quickly\n- Other tasks that are not related to the agent descriptions above\n\n\nUsage notes:\n1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses\n2. When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise summary of the result.\n3. Each agent invocation is stateless unless you provide a session_id. Your prompt should contain a highly detailed task description for the agent to perform autonomously and you should specify exactly what information the agent should return back to you in its final and only message to you.\n4. The agent's outputs should generally be trusted\n5. Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent\n6. If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.\n\n",
35
+ "parameters": {
36
+ "type": "object",
37
+ "properties": {
38
+ "description": {
39
+ "description": "A short (3-5 words) description of the task",
40
+ "type": "string"
41
+ },
42
+ "prompt": {
43
+ "description": "The task for the agent to perform",
44
+ "type": "string"
45
+ },
46
+ "subagent_type": {
47
+ "description": "The type of specialized agent to use for this task",
48
+ "type": "string"
49
+ },
50
+ "session_id": {
51
+ "description": "Existing Task session to continue",
52
+ "type": "string"
53
+ }
54
+ },
55
+ "required": [
56
+ "description",
57
+ "prompt",
58
+ "subagent_type"
59
+ ]
60
+ }
61
+ }
62
+ },
63
+ ],
64
+ "tool_choice": "auto"
65
+ }
@@ -1,8 +1,7 @@
1
- import OpenAI from "openai";
2
1
  import * as assert from "../../source/asserts.ts";
2
+ import { ChatMessage } from "../../source/chat-completion.ts";
3
3
 
4
- export function test(response: OpenAI.ChatCompletion) {
5
- const { tool_calls } = response.choices[0].message;
4
+ export function test({ tool_calls }: ChatMessage) {
6
5
  assert.isNotNullish(tool_calls);
7
6
  assert.isNotEmptyArray(tool_calls);
8
7
  }
@@ -1,22 +1,23 @@
1
- import OpenAI from "openai";
2
1
  import * as assert from "../../source/asserts.ts";
2
+ import { ChatMessage } from "../../source/chat-completion.ts";
3
3
 
4
- export function test(response: OpenAI.ChatCompletion) {
5
- const { tool_calls } = response.choices[0].message;
4
+ export function test({ tool_calls }: ChatMessage) {
6
5
  assert.isNotNullish(tool_calls);
7
6
  assert.isNotEmptyArray(tool_calls);
8
- assert.strictEqual(tool_calls.length, 1);
7
+ assert.gte(tool_calls.length, 1);
9
8
  assert.strictEqual(tool_calls[0].type, "function");
10
9
  const fn = tool_calls[0].function;
11
10
  assert.or(
12
11
  () => {
13
12
  assert.strictEqual(fn.name, "ls");
14
- const args = JSON.parse(fn.arguments);
15
- assert.or(
16
- () => assert.strictEqual(args.path, "/home/reissbaker/Hack/scratch-scripts"),
17
- () => assert.strictEqual(args.path, "."),
18
- () => assert.isNullish(args.path),
19
- );
13
+ if(fn.arguments) {
14
+ const args = JSON.parse(fn.arguments);
15
+ assert.or(
16
+ () => assert.strictEqual(args.path, "/home/reissbaker/Hack/scratch-scripts"),
17
+ () => assert.strictEqual(args.path, "."),
18
+ () => assert.isNullish(args.path),
19
+ );
20
+ }
20
21
  },
21
22
  () => {
22
23
  assert.strictEqual(fn.name, "bash");
@@ -448,7 +449,4 @@ export const json = {
448
449
  ],
449
450
  "tool_choice": "auto",
450
451
  "max_tokens": 60000,
451
- "stream_options": {
452
- "include_usage": true
453
- }
454
452
  }
@@ -0,0 +1,104 @@
1
+ import { ChatMessage } from "../../source/chat-completion.ts";
2
+ import * as assert from "../../source/asserts.ts";
3
+
4
+ export function test({ tool_calls }: ChatMessage) {
5
+ assert.isNotNullish(tool_calls);
6
+ assert.isNotEmptyArray(tool_calls);
7
+ assert.gte(tool_calls.length, 1);
8
+
9
+ assert.ok(tool_calls.some(tool_call => {
10
+ if (tool_call.type === "function" && tool_call.function.name === "get_weather") {
11
+ const location = JSON.parse(tool_call.function.arguments).location;
12
+ if (typeof location === "string") {
13
+ return location.toLowerCase().match(/las vegas/);
14
+ }
15
+ }
16
+ return false;
17
+ }), "At least one tool call must be get_weather({ location: 'las_vegas' })");
18
+ }
19
+
20
+ export const json = {
21
+ "messages": [
22
+ {
23
+ role: "user",
24
+ content: "What's the weather in Paris?"
25
+ },
26
+ {
27
+ role: "assistant",
28
+ tool_calls: [
29
+ {
30
+ id: "gw1",
31
+ type: "function",
32
+ function: {
33
+ name: "get_weather",
34
+ arguments: JSON.stringify({
35
+ location: "Paris, France",
36
+ }),
37
+ },
38
+ },
39
+ ],
40
+ },
41
+ {
42
+ role: "tool",
43
+ tool_call_id: "gw1",
44
+ content: "The weather in Paris is 24 degrees Celsius",
45
+ },
46
+ {
47
+ role: "assistant",
48
+ content: "I've looked up the weather in Paris, and it's a comfy 24 degrees Celsius today.",
49
+ },
50
+ {
51
+ role: "user",
52
+ content: "I meant Paris, Texas",
53
+ },
54
+ {
55
+ role: "assistant",
56
+ tool_calls: [
57
+ {
58
+ id: "gw2",
59
+ type: "function",
60
+ function: {
61
+ name: "get_weather",
62
+ arguments: JSON.stringify({
63
+ location: "Paris, Texas",
64
+ }),
65
+ },
66
+ },
67
+ ],
68
+ },
69
+ {
70
+ role: "tool",
71
+ tool_call_id: "gw2",
72
+ content: "The weather in Paris, Texas is 34 degrees Celsius",
73
+ },
74
+ {
75
+ role: "assistant",
76
+ content: "I've looked up the weather in Paris, Texas and it's a scorching 24 degrees Celsius today.",
77
+ },
78
+ {
79
+ role: "user",
80
+ content: "How about the weather in Las Vegas",
81
+ },
82
+ ],
83
+ "tools": [
84
+ {
85
+ "type": "function",
86
+ "function": {
87
+ "name": "get_weather",
88
+ "description": "Get current weather for a location",
89
+ "parameters": {
90
+ "type": "object",
91
+ "properties": {
92
+ "location": {
93
+ "type": "string",
94
+ "description": "City name"
95
+ }
96
+ },
97
+ "required": ["location"]
98
+ }
99
+ }
100
+ }
101
+ ],
102
+ "parallel_tool_calls": true,
103
+ "tool_choice": "auto",
104
+ }
@@ -0,0 +1,34 @@
1
+ import { ChatMessage } from "../../source/chat-completion.ts";
2
+ import * as assert from "../../source/asserts.ts";
3
+
4
+ export function test({ tool_calls }: ChatMessage) {
5
+ assert.isNotNullish(tool_calls);
6
+ assert.isNotEmptyArray(tool_calls);
7
+ assert.strictEqual(tool_calls.length, 1);
8
+ assert.strictEqual(tool_calls[0].type, "function");
9
+ }
10
+
11
+ export const json = {
12
+ "messages": [
13
+ {
14
+ "role": "user",
15
+ "content": "read the todos",
16
+ },
17
+ ],
18
+ "tools": [
19
+ {
20
+ "type": "function",
21
+ "function": {
22
+ "name": "get_todo_items",
23
+ "description": "Retrieves the current list of todo items, including their names and completion statuses.",
24
+ "parameters": {
25
+ "$schema": "http://json-schema.org/draft-07/schema#",
26
+ "type": "object",
27
+ "properties": {},
28
+ "additionalProperties": false
29
+ }
30
+ }
31
+ },
32
+ ],
33
+ "tool_choice": "auto",
34
+ }
@@ -0,0 +1,81 @@
1
+ import { ChatMessage } from "../../source/chat-completion.ts";
2
+ import * as assert from "../../source/asserts.ts";
3
+
4
+ export function test({ tool_calls }: ChatMessage) {
5
+ assert.isNotNullish(tool_calls);
6
+ assert.isNotEmptyArray(tool_calls);
7
+ assert.strictEqual(tool_calls.length, 1);
8
+ assert.strictEqual(tool_calls[0].type, "function");
9
+ const parsed = JSON.parse(tool_calls[0].function.arguments);
10
+ assert.or(
11
+ () => assert.isNullish(parsed),
12
+ () => assert.deepEqual(parsed, {}),
13
+ () => assert.isNullish(parsed.dirPath),
14
+ () => assert.strictEqual(parsed.dirPath, ""),
15
+ );
16
+ }
17
+
18
+ export const json = {
19
+ "messages":[
20
+ {
21
+ "role":"system",
22
+ "content":"You are a coding assistant called Octo."
23
+ },
24
+ {
25
+ "role":"user",
26
+ "content":"call the list tool with no args"
27
+ }
28
+ ],
29
+ tools: [
30
+ {
31
+ "type":"function",
32
+ "function":{
33
+ "name":"append",
34
+ "description":"The append tool",
35
+ "parameters":{
36
+ "type":"object",
37
+ "required":["filePath","text"],
38
+ "properties":{
39
+ "filePath":{
40
+ "description":"The path to the file",
41
+ "type":"string"
42
+ },
43
+ "text":{
44
+ "description":"The text to append",
45
+ "type":"string"
46
+ }
47
+ }
48
+ },
49
+ "strict":true
50
+ }
51
+ },
52
+ {
53
+ "type":"function",
54
+ "function":{
55
+ "name":"create",
56
+ "description":"The create tool",
57
+ "parameters":{
58
+ "type":"object",
59
+ "required":["filePath","content"],
60
+ "properties":{
61
+ "filePath":{
62
+ "description":"Path where the file should be created",
63
+ "type":"string"
64
+ },"content":{
65
+ "description":"Content to write to the file",
66
+ "type":"string"
67
+ }
68
+ }
69
+ },
70
+ "strict":true
71
+ }
72
+ },
73
+ {"type":"function","function":{"name":"edit","description":"The edit tool","parameters":{"type":"object","required":["filePath","search","replace"],"properties":{"filePath":{"description":"The path to the file","type":"string"},"search":{"description":"The search string to replace. Must EXACTLY match the text you intend to replace, including\nwhitespace, punctuation, etc. Make sure to give a few lines of context above and below so you\ndon't accidentally replace a different matching substring in the same file.","type":"string"},"replace":{"description":"The string you want to insert into the file","type":"string"}}},"strict":true}},
74
+ {"type":"function","function":{"name":"fetch","description":"The fetch tool","parameters":{"type":"object","required":["url"],"properties":{"url":{"description":"Full url to fetch, e.g. https://...","type":"string"},"includeMarkup":{"description":"Include the HTML markup? Defaults to false. By default or when set to false, markup will be\nstripped and converted to plain text. Prefer markup stripping, and only set this to true if the\noutput is confusing: otherwise you may download a massive amount of data","type":"boolean"}}},"strict":true}},
75
+ {"type":"function","function":{"name":"list","description":"The list tool","parameters":{"type":"object","required":[],"properties":{"dirPath":{"description":"Path to the directory","type":"string"}}},"strict":true}},
76
+ {"type":"function","function":{"name":"prepend","description":"The prepend tool","parameters":{"type":"object","required":["filePath","text"],"properties":{"filePath":{"description":"The path to the file","type":"string"},"text":{"description":"The text to prepend","type":"string"}}},"strict":true}},
77
+ {"type":"function","function":{"name":"read","description":"The read tool","parameters":{"type":"object","required":["filePath"],"properties":{"filePath":{"description":"Path to file to read","type":"string"}}},"strict":true}},
78
+ {"type":"function","function":{"name":"rewrite","description":"The rewrite tool","parameters":{"type":"object","required":["filePath","text"],"properties":{"filePath":{"description":"The path to the file","type":"string"},"text":{"description":"The replaced file contents. This will rewrite and replace the entire file","type":"string"}}},"strict":true}},
79
+ {"type":"function","function":{"name":"shell","description":"The shell tool","parameters":{"type":"object","required":["timeout","cmd"],"properties":{"timeout":{"description":"A timeout for the command, in milliseconds. Be generous. You MUST specify this.","type":"number"},"cmd":{"description":"The command to run","type":"string"}}},"strict":true}}
80
+ ],
81
+ };
@@ -1,8 +1,7 @@
1
- import OpenAI from "openai";
2
1
  import * as assert from "../../source/asserts.ts";
2
+ import { ChatMessage } from "../../source/chat-completion.ts";
3
3
 
4
- export function test(response: OpenAI.ChatCompletion) {
5
- const { tool_calls } = response.choices[0].message;
4
+ export function test({ tool_calls }: ChatMessage) {
6
5
  assert.isNotNullish(tool_calls);
7
6
  assert.isNotEmptyArray(tool_calls);
8
7
  assert.strictEqual(tool_calls.length, 2);
@@ -1,8 +1,7 @@
1
- import { ChatResponse } from "../../source/chat-completion.ts";
1
+ import { ChatMessage } from "../../source/chat-completion.ts";
2
2
  import * as assert from "../../source/asserts.ts";
3
3
 
4
- export function test(response: ChatResponse) {
5
- const { tool_calls } = response.choices[0].message;
4
+ export function test({ content, tool_calls }: ChatMessage) {
6
5
  assert.isNotNullish(tool_calls);
7
6
  assert.isNotEmptyArray(tool_calls);
8
7
  assert.strictEqual(tool_calls.length, 1);
@@ -10,6 +9,8 @@ export function test(response: ChatResponse) {
10
9
  assert.strictEqual(tool_calls[0].function.name, "get_weather");
11
10
  const args = JSON.parse(tool_calls[0].function.arguments);
12
11
  assert.match(args.location.toLowerCase(), /paris/);
12
+ // Assert the tool call didn't leak into the content
13
+ assert.doesNotMatch(content || "", /get_weather/);
13
14
  }
14
15
 
15
16
  export const json = {
@@ -0,0 +1,40 @@
1
+ import { ChatMessage } from "../../source/chat-completion.ts";
2
+ import * as assert from "../../source/asserts.ts";
3
+
4
+ export function test({ content, tool_calls }: ChatMessage) {
5
+ assert.isNotNullish(tool_calls);
6
+ assert.isNotEmptyArray(tool_calls);
7
+ assert.strictEqual(tool_calls.length, 1);
8
+ assert.strictEqual(tool_calls[0].type, "function");
9
+ assert.strictEqual(tool_calls[0].function.name, "get-weather__v1");
10
+ const args = JSON.parse(tool_calls[0].function.arguments);
11
+ assert.match(args.location.toLowerCase(), /paris/);
12
+ // Assert the tool call didn't leak into the content
13
+ assert.doesNotMatch(content || "", /get_weather/);
14
+ }
15
+
16
+ export const json = {
17
+ "messages": [
18
+ {"role": "user", "content": "What's the weather in Paris?"}
19
+ ],
20
+ "tools": [
21
+ {
22
+ "type": "function",
23
+ "function": {
24
+ "name": "get-weather__v1",
25
+ "description": "Get current weather for a location",
26
+ "parameters": {
27
+ "type": "object",
28
+ "properties": {
29
+ "location": {
30
+ "type": "string",
31
+ "description": "City name"
32
+ }
33
+ },
34
+ "required": ["location"]
35
+ }
36
+ }
37
+ }
38
+ ],
39
+ "tool_choice": "auto",
40
+ }
@@ -0,0 +1,46 @@
1
+ import { ChatMessage } from "../../source/chat-completion.ts";
2
+ import * as assert from "../../source/asserts.ts";
3
+
4
+ const PATH = "/development/evals/reasoning/Scratch/reasoning-claude-tool-call.ts";
5
+
6
+ export function test({ tool_calls }: ChatMessage) {
7
+ assert.isNotNullish(tool_calls);
8
+ assert.isNotEmptyArray(tool_calls);
9
+ assert.strictEqual(tool_calls.length, 1);
10
+ assert.strictEqual(tool_calls[0].type, "function");
11
+ assert.strictEqual(tool_calls[0].function.name, "read");
12
+
13
+ const args = JSON.parse(tool_calls[0].function.arguments);
14
+ assert.stringContains(args.filePath, PATH);
15
+ }
16
+
17
+ export const json = {
18
+ "messages": [
19
+ {
20
+ "role": "user",
21
+ "content": "Read and summarize the file /development/evals/reasoning/Scratch/reasoning-claude-tool-call.ts"
22
+ }
23
+ ],
24
+ "tools": [
25
+ {
26
+ "type": "function",
27
+ "function": {
28
+ "name": "read",
29
+ "description": "The read tool",
30
+ "parameters": {
31
+ "type": "object",
32
+ "required": [
33
+ "filePath"
34
+ ],
35
+ "properties": {
36
+ "filePath": {
37
+ "description": "Path to file to read",
38
+ "type": "string"
39
+ }
40
+ }
41
+ },
42
+ "strict": true
43
+ }
44
+ },
45
+ ],
46
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syntheticlab/synbad",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "LLM inference provider evals",
5
5
  "main": "dist/source/index.js",
6
6
  "bin": {
@@ -9,7 +9,7 @@
9
9
  "preferGlobal": true,
10
10
  "type": "module",
11
11
  "scripts": {
12
- "test": "echo \"Error: no test specified\" && exit 1",
12
+ "test": "vitest",
13
13
  "build": "tsc",
14
14
  "prepublishOnly": "tsc"
15
15
  },
@@ -23,6 +23,12 @@
23
23
  "package-lock.json",
24
24
  "tsconfig.json"
25
25
  ],
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/source/exports.d.ts",
29
+ "import": "./dist/source/exports.js"
30
+ }
31
+ },
26
32
  "dependencies": {
27
33
  "@commander-js/extra-typings": "^14.0.0",
28
34
  "commander": "^14.0.2",
@@ -32,6 +38,7 @@
32
38
  },
33
39
  "devDependencies": {
34
40
  "@types/node": "^24.10.1",
35
- "tsx": "^4.20.6"
41
+ "tsx": "^4.20.6",
42
+ "vitest": "^4.0.17"
36
43
  }
37
44
  }
package/source/asserts.ts CHANGED
@@ -61,7 +61,13 @@ export function isEmptyArray(a: any[]) {
61
61
  });
62
62
  }
63
63
 
64
- export function isNotEmptyArray(a: any[]) {
64
+ export function isNotEmptyArray(a: any[] | undefined) {
65
+ if(a == null) {
66
+ throw new assert.AssertionError({
67
+ message: "Expected a non-empty array",
68
+ actual: a,
69
+ });
70
+ }
65
71
  if(a.length !== 0) return true;
66
72
  throw new assert.AssertionError({
67
73
  message: "Expected a non-empty array",
@@ -76,3 +82,33 @@ export function startsWith(a: string, prefix: string) {
76
82
  actual: a,
77
83
  });
78
84
  }
85
+
86
+ export function gt(num: number, target: number) {
87
+ if(num > target) return true;
88
+ throw new assert.AssertionError({
89
+ message: `Expected ${num} > ${target}`,
90
+ actual: num,
91
+ });
92
+ }
93
+
94
+ export function gte(num: number, target: number) {
95
+ if(num >= target) return true;
96
+ throw new assert.AssertionError({
97
+ message: `Expected ${num} >= ${target}`,
98
+ actual: num,
99
+ });
100
+ }
101
+
102
+ export function stringContains(str: string, expected: string) {
103
+ if(typeof str !== "string") {
104
+ throw new assert.AssertionError({
105
+ message: "Expected input to be of type string.",
106
+ actual: typeof str,
107
+ });
108
+ }
109
+ if(str.includes(expected)) return true;
110
+ throw new assert.AssertionError({
111
+ message: `Expected string to contain: "${expected}"`,
112
+ actual: str,
113
+ });
114
+ }
@@ -10,10 +10,15 @@ export type ChatResponse = OpenAI.ChatCompletion & {
10
10
  message: {
11
11
  reasoning_content?: string,
12
12
  reasoning?: string,
13
+ tool_calls?: Array<{
14
+ index: number,
15
+ }>
13
16
  },
14
17
  }>
15
18
  };
16
19
 
20
+ export type ChatMessage = ChatResponse["choices"][number]["message"];
21
+
17
22
  const TextContentPart = t.subtype({
18
23
  type: t.value("text"),
19
24
  text: t.str,
@@ -56,6 +61,7 @@ const AssistantMessageSchema = t.subtype({
56
61
  name: t.str,
57
62
  })),
58
63
  reasoning_content: t.optional(t.str.or(t.nil)),
64
+ reasoning: t.optional(t.str.or(t.nil)),
59
65
  });
60
66
 
61
67
  const UserMessageSchema = t.subtype({
@@ -0,0 +1,13 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { getEvals } from "./evals.ts";
3
+
4
+ describe("get-evals", () => {
5
+ it("works", async () => {
6
+ const evals = await getEvals();
7
+ evals.map(({ test, json, name }) => {
8
+ expect(name).toBeTypeOf("string");
9
+ expect(json).toBeTruthy();
10
+ expect(test).toBeTypeOf("function");
11
+ });
12
+ });
13
+ })