@emseepea/create-api-backed-server 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.
|
@@ -1,23 +1,38 @@
|
|
|
1
|
-
import
|
|
1
|
+
import test from "node:test";
|
|
2
|
+
import {
|
|
3
|
+
assertNoToolCalls,
|
|
4
|
+
assertResponseContains,
|
|
5
|
+
assertResponseMeaning,
|
|
6
|
+
assertToolCalls,
|
|
7
|
+
createConversation,
|
|
8
|
+
} from "@emseepea/testing/semantic";
|
|
2
9
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
10
|
+
test("searches once and remembers the common name for a follow-up", async (t) => {
|
|
11
|
+
const chat = await createConversation(t, {
|
|
12
|
+
server: new URL("../test-support/llm-server.mjs", import.meta.url),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// The judged search covers the backend result's domain meaning. The exact
|
|
16
|
+
// no-call follow-up adds memory coverage without paying for a second judge.
|
|
17
|
+
const search = await chat.send(
|
|
18
|
+
'Search the public taxon catalogue for "pea". ' +
|
|
19
|
+
"Which species has more recorded observations, how many does it have, " +
|
|
20
|
+
"and does that count estimate the wild population?",
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
assertToolCalls(search, [{
|
|
24
|
+
name: "search-pea-taxa",
|
|
25
|
+
arguments: { query: "pea" },
|
|
26
|
+
}]);
|
|
27
|
+
assertResponseContains(search, "Pisum sativum");
|
|
28
|
+
await assertResponseMeaning(search, {
|
|
29
|
+
expected:
|
|
30
|
+
"Pisum sativum has the most recorded observations, with 8,720. " +
|
|
31
|
+
"The response explains that recorded observations are not an estimate " +
|
|
32
|
+
"of the wild population.",
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const followUp = await chat.send("What was its common name?");
|
|
36
|
+
assertNoToolCalls(followUp);
|
|
37
|
+
assertResponseContains(followUp, "Common Pea");
|
|
23
38
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emseepea/create-api-backed-server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Create an Em See Pea server backed by a public web API.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@emseepea/server": "0.3.0",
|
|
22
22
|
"zod": "4.4.3",
|
|
23
|
-
"@emseepea/testing": "0.
|
|
23
|
+
"@emseepea/testing": "0.3.0",
|
|
24
24
|
"@modelcontextprotocol/client": "2.0.0",
|
|
25
25
|
"@types/node": "24.13.3",
|
|
26
26
|
"typescript": "6.0.3",
|