@1kbirds/chidori 0.1.21 → 0.1.24
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/.pytest_cache/README.md +8 -0
- package/CHANGELOG.md +33 -0
- package/Cargo.toml +8 -4
- package/build/stage/v0.1.24/chidori-v0.1.24-node-v108-darwin-arm64-unknown.tar.gz +0 -0
- package/build/stage/v0.1.24/chidori-v0.1.24-node-v93-darwin-arm64-unknown.tar.gz +0 -0
- package/package.json +2 -3
- package/package_node/index.js +57 -23
- package/package_node/native/chidori.node +0 -0
- package/package_python/chidori/__pycache__/__init__.cpython-310.pyc +0 -0
- package/package_python/chidori/__pycache__/test_chidori.cpython-310-pytest-7.4.0.pyc +0 -0
- package/package_python/chidori/__pycache__/test_promptgraph.cpython-310-pytest-7.4.0.pyc +0 -0
- package/package_python/{chidori.pyi → chidori/chidori.pyi} +11 -9
- package/package_python/{test_chidori.py → chidori/test_chidori.py} +6 -5
- package/src/lib.rs +3 -2
- package/src/translations/mod.rs +2 -1
- package/src/translations/nodejs.rs +286 -771
- package/src/translations/python.rs +261 -306
- package/src/translations/rust.rs +311 -82
- package/src/translations/shared.rs +49 -0
- package/tests/nodejs/chidori.test.js +13 -26
- package/tests/nodejs/nodeHandle.test.js +6 -8
- /package/package_python/{__init__.py → chidori/__init__.py} +0 -0
- /package/package_python/{py.typed → chidori/py.typed} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {Chidori} = require("../..");
|
|
1
|
+
const {Chidori, GraphBuilder} = require("../..");
|
|
2
2
|
|
|
3
3
|
async function delay(ms) {
|
|
4
4
|
// Returns a promise that resolves after "ms" milliseconds
|
|
@@ -7,48 +7,35 @@ async function delay(ms) {
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
test('initialize without error', () => {
|
|
10
|
-
expect(new Chidori("1", "localhost:9800")).toEqual({"chi": {}});
|
|
10
|
+
expect(new Chidori("1", "http://localhost:9800")).toEqual({"chi": {}});
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
test('coerce to and from structure', async () => {
|
|
14
|
-
const chi = new Chidori("1", "http://localhost:9800");
|
|
15
|
-
chi.startServer()
|
|
16
|
-
expect(chi.objectInterface({
|
|
17
|
-
"id": "1",
|
|
18
|
-
"monotonic_counter": 0,
|
|
19
|
-
"branch": 0
|
|
20
|
-
})).toEqual({
|
|
21
|
-
"id": "1",
|
|
22
|
-
"monotonic_counter": 0,
|
|
23
|
-
"branch": 0
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
|
|
28
13
|
test('start server', async () => {
|
|
29
14
|
const chi = new Chidori("21", "http://127.0.0.1:9800");
|
|
30
15
|
await chi.startServer();
|
|
31
16
|
await chi.play(0,0);
|
|
32
|
-
|
|
17
|
+
const g = new GraphBuilder();
|
|
18
|
+
g.denoCodeNode({
|
|
33
19
|
name: "InspirationalQuote",
|
|
34
20
|
code: `return {"promptResult": "Believe"}`,
|
|
35
21
|
output: `type InspirationalQuote { promptResult: String }`,
|
|
36
22
|
is_template: true
|
|
37
23
|
});
|
|
38
|
-
|
|
24
|
+
g.denoCodeNode({
|
|
39
25
|
name: "CodeNode",
|
|
40
26
|
queries: ["query Q { InspirationalQuote { promptResult } }"],
|
|
41
27
|
code: `return {"output": "Here is your quote for " + \`{{InspirationalQuote.promptResult}}\` }`,
|
|
42
28
|
output: `type CodeNode { output: String }`,
|
|
43
29
|
is_template: true
|
|
44
30
|
});
|
|
31
|
+
g.commit(chi, 0);
|
|
45
32
|
await delay(1000);
|
|
46
|
-
console.log(await chi.graphStructure())
|
|
47
|
-
expect((await chi.query(`
|
|
48
|
-
|
|
49
|
-
`, 0, 100))["values"].length).toBe(1)
|
|
50
|
-
console.log(await chi.query(`
|
|
51
|
-
|
|
52
|
-
`, 0, 100))
|
|
33
|
+
console.log(await chi.graphStructure(0))
|
|
34
|
+
// expect((await chi.query(`
|
|
35
|
+
// query Q { InspirationalQuote { promptResult } }
|
|
36
|
+
// `, 0, 100))["values"].length).toBe(1)
|
|
37
|
+
// console.log(await chi.query(`
|
|
38
|
+
// query Q { CodeNode { output } }
|
|
39
|
+
// `, 0, 100))
|
|
53
40
|
});
|
|
54
41
|
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
const {
|
|
2
|
-
const {Chidori} = require("../../package_node");
|
|
1
|
+
const {Chidori, GraphBuilder} = require("../../package_node");
|
|
3
2
|
|
|
4
|
-
test('sdk', () => {
|
|
5
|
-
expect(simpleFun("1")).toBe("1");
|
|
6
|
-
});
|
|
7
3
|
|
|
8
4
|
test('adds 1 + 2 to equal 3', () => {
|
|
9
|
-
|
|
5
|
+
const gb = new GraphBuilder();
|
|
6
|
+
expect(gb.denoCodeNode({name: "test", code: "return 1+1"})).toEqual({"nh": {}});
|
|
10
7
|
});
|
|
11
8
|
|
|
12
9
|
test('nodehandle query', async () => {
|
|
13
10
|
const chi = new Chidori("1", "http://localhost:9800");
|
|
14
11
|
await chi.startServer();
|
|
15
|
-
const
|
|
16
|
-
|
|
12
|
+
const gb = new GraphBuilder();
|
|
13
|
+
const nh = gb.denoCodeNode({name: "test", code: "return 1+1"});
|
|
14
|
+
// expect(await nh.query(0, 0)).toEqual({});
|
|
17
15
|
});
|
|
File without changes
|
|
File without changes
|