@1kbirds/chidori 0.1.24 → 3.3.0

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 (39) hide show
  1. package/README.md +115 -5
  2. package/dist/agent.d.ts +487 -0
  3. package/dist/agent.js +46 -0
  4. package/dist/index.d.ts +332 -0
  5. package/dist/index.js +318 -0
  6. package/package.json +27 -32
  7. package/src/agent.ts +548 -0
  8. package/src/index.ts +580 -0
  9. package/.pytest_cache/README.md +0 -8
  10. package/CHANGELOG.md +0 -33
  11. package/Cargo.toml +0 -83
  12. package/build/stage/v0.1.24/chidori-v0.1.24-node-v108-darwin-arm64-unknown.tar.gz +0 -0
  13. package/build/stage/v0.1.24/chidori-v0.1.24-node-v93-darwin-arm64-unknown.tar.gz +0 -0
  14. package/build.rs +0 -7
  15. package/package_node/index.d.ts +0 -0
  16. package/package_node/index.js +0 -130
  17. package/package_node/native/chidori.node +0 -0
  18. package/package_python/.idea/inspectionProfiles/profiles_settings.xml +0 -6
  19. package/package_python/.idea/misc.xml +0 -4
  20. package/package_python/.idea/modules.xml +0 -8
  21. package/package_python/.idea/package_python.iml +0 -8
  22. package/package_python/.idea/vcs.xml +0 -6
  23. package/package_python/chidori/__init__.py +0 -0
  24. package/package_python/chidori/__pycache__/__init__.cpython-310.pyc +0 -0
  25. package/package_python/chidori/__pycache__/test_chidori.cpython-310-pytest-7.4.0.pyc +0 -0
  26. package/package_python/chidori/__pycache__/test_promptgraph.cpython-310-pytest-7.4.0.pyc +0 -0
  27. package/package_python/chidori/chidori.pyi +0 -32
  28. package/package_python/chidori/py.typed +0 -0
  29. package/package_python/chidori/test_chidori.py +0 -36
  30. package/pyproject.toml +0 -33
  31. package/src/lib.rs +0 -23
  32. package/src/translations/mod.rs +0 -9
  33. package/src/translations/nodejs.rs +0 -739
  34. package/src/translations/python.rs +0 -920
  35. package/src/translations/rust.rs +0 -737
  36. package/src/translations/shared.rs +0 -49
  37. package/src/translations/wasm.rs +0 -1
  38. package/tests/nodejs/chidori.test.js +0 -41
  39. package/tests/nodejs/nodeHandle.test.js +0 -15
@@ -1,49 +0,0 @@
1
- use serde_json::Value as JsonValue;
2
- use std::collections::VecDeque;
3
- use prompt_graph_core::proto2::SerializedValue;
4
- use prompt_graph_core::templates::json_value_to_serialized_value;
5
-
6
- pub fn json_value_to_paths(
7
- d: &JsonValue,
8
- ) -> Vec<(Vec<String>, SerializedValue)> {
9
- let mut paths = Vec::new();
10
- let mut queue: VecDeque<(Vec<String>, &JsonValue)> = VecDeque::new();
11
- queue.push_back((Vec::new(), d));
12
-
13
- while let Some((mut path, dict)) = queue.pop_front() {
14
- match dict {
15
- JsonValue::Object(map) => {
16
- for (key, val) in map {
17
- let key_str = key.clone();
18
- path.push(key_str.clone());
19
- match val {
20
- JsonValue::Object(_) => {
21
- queue.push_back((path.clone(), val));
22
- },
23
- _ => {
24
- paths.push((path.clone(), json_value_to_serialized_value(&val)));
25
- }
26
- }
27
- path.pop();
28
- }
29
- },
30
- JsonValue::Array(arr) => {
31
- for (i, val) in arr.iter().enumerate() {
32
- path.push(i.to_string());
33
- match val {
34
- JsonValue::Object(_) => {
35
- queue.push_back((path.clone(), val));
36
- },
37
- _ => {
38
- paths.push((path.clone(), json_value_to_serialized_value(&val)));
39
- }
40
- }
41
- path.pop();
42
- }
43
- },
44
- _ => panic!("Root should be a JSON object but was {:?}", d),
45
- }
46
- }
47
-
48
- paths
49
- }
@@ -1 +0,0 @@
1
- // https://crates.io/crates/grpc-web-client
@@ -1,41 +0,0 @@
1
- const {Chidori, GraphBuilder} = require("../..");
2
-
3
- async function delay(ms) {
4
- // Returns a promise that resolves after "ms" milliseconds
5
- return new Promise(resolve => setTimeout(resolve, ms));
6
- }
7
-
8
-
9
- test('initialize without error', () => {
10
- expect(new Chidori("1", "http://localhost:9800")).toEqual({"chi": {}});
11
- });
12
-
13
- test('start server', async () => {
14
- const chi = new Chidori("21", "http://127.0.0.1:9800");
15
- await chi.startServer();
16
- await chi.play(0,0);
17
- const g = new GraphBuilder();
18
- g.denoCodeNode({
19
- name: "InspirationalQuote",
20
- code: `return {"promptResult": "Believe"}`,
21
- output: `type InspirationalQuote { promptResult: String }`,
22
- is_template: true
23
- });
24
- g.denoCodeNode({
25
- name: "CodeNode",
26
- queries: ["query Q { InspirationalQuote { promptResult } }"],
27
- code: `return {"output": "Here is your quote for " + \`{{InspirationalQuote.promptResult}}\` }`,
28
- output: `type CodeNode { output: String }`,
29
- is_template: true
30
- });
31
- g.commit(chi, 0);
32
- await delay(1000);
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))
40
- });
41
-
@@ -1,15 +0,0 @@
1
- const {Chidori, GraphBuilder} = require("../../package_node");
2
-
3
-
4
- test('adds 1 + 2 to equal 3', () => {
5
- const gb = new GraphBuilder();
6
- expect(gb.denoCodeNode({name: "test", code: "return 1+1"})).toEqual({"nh": {}});
7
- });
8
-
9
- test('nodehandle query', async () => {
10
- const chi = new Chidori("1", "http://localhost:9800");
11
- await chi.startServer();
12
- const gb = new GraphBuilder();
13
- const nh = gb.denoCodeNode({name: "test", code: "return 1+1"});
14
- // expect(await nh.query(0, 0)).toEqual({});
15
- });