@1kbirds/chidori 0.1.26 → 3.4.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.
- package/README.md +138 -6
- package/dist/agent-env.d.ts +38 -0
- package/dist/agent-env.js +1 -0
- package/dist/agent.d.ts +487 -0
- package/dist/agent.js +46 -0
- package/dist/index.d.ts +332 -0
- package/dist/index.js +318 -0
- package/package.json +34 -33
- package/src/agent-env.ts +43 -0
- package/src/agent.ts +548 -0
- package/src/index.ts +580 -0
- package/CHANGELOG.md +0 -33
- package/Cargo.toml +0 -83
- package/build.rs +0 -7
- package/package_node/index.d.ts +0 -0
- package/package_node/index.js +0 -130
- package/pyproject.toml +0 -35
- package/src/lib.rs +0 -23
- package/src/translations/mod.rs +0 -9
- package/src/translations/nodejs.rs +0 -739
- package/src/translations/python.rs +0 -921
- package/src/translations/rust.rs +0 -737
- package/src/translations/shared.rs +0 -49
- package/src/translations/wasm.rs +0 -1
- package/tests/nodejs/chidori.test.js +0 -41
- package/tests/nodejs/nodeHandle.test.js +0 -15
- package/tests/python/test_chidori.py +0 -30
package/package_node/index.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const {
|
|
4
|
-
simpleFun,
|
|
5
|
-
nodehandleRunWhen,
|
|
6
|
-
nodehandleQuery,
|
|
7
|
-
chidoriNew,
|
|
8
|
-
chidoriStartServer,
|
|
9
|
-
chidoriObjInterface,
|
|
10
|
-
chidoriPlay,
|
|
11
|
-
chidoriPause,
|
|
12
|
-
chidoriBranch,
|
|
13
|
-
chidoriQuery,
|
|
14
|
-
chidoriGraphStructure,
|
|
15
|
-
chidoriRegisterCustomNodeHandle,
|
|
16
|
-
chidoriRunCustomNodeLoop,
|
|
17
|
-
graphbuilderNew,
|
|
18
|
-
graphbuilderCustomNode,
|
|
19
|
-
graphbuilderPromptNode,
|
|
20
|
-
graphbuilderDenoCodeNode,
|
|
21
|
-
graphbuilderVectorMemoryNode,
|
|
22
|
-
graphbuilderCommit
|
|
23
|
-
} = require("./native/chidori.node");
|
|
24
|
-
|
|
25
|
-
const toSnakeCase = str => str.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`);
|
|
26
|
-
|
|
27
|
-
const transformKeys = (obj) => {
|
|
28
|
-
if (Array.isArray(obj)) {
|
|
29
|
-
return obj.map(val => transformKeys(val));
|
|
30
|
-
} else if (obj !== null && obj.constructor === Object) {
|
|
31
|
-
return Object.keys(obj).reduce((accumulator, key) => {
|
|
32
|
-
accumulator[toSnakeCase(key)] = transformKeys(obj[key]);
|
|
33
|
-
return accumulator;
|
|
34
|
-
}, {});
|
|
35
|
-
}
|
|
36
|
-
return obj;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
class NodeHandle {
|
|
40
|
-
constructor(nh) {
|
|
41
|
-
this.nh = nh;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
runWhen(graphBuilder, otherNodeHandle) {
|
|
45
|
-
return nodehandleRunWhen.call(this.nh, graphBuilder.g, otherNodeHandle.nh);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
query(branch, frame) {
|
|
49
|
-
return nodehandleQuery.call(this.nh, branch, frame);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
class Chidori {
|
|
55
|
-
constructor(fileId, url) {
|
|
56
|
-
this.chi = chidoriNew(fileId, url);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
startServer(filePath) {
|
|
60
|
-
return chidoriStartServer.call(this.chi, filePath);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
objectInterface(executionStatus) {
|
|
64
|
-
return chidoriObjInterface.call(this.chi, executionStatus);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
play(branch, frame) {
|
|
68
|
-
return chidoriPlay.call(this.chi, branch, frame);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
pause(branch, frame) {
|
|
72
|
-
return chidoriPause.call(this.chi, branch, frame);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
query(query, branch, frame) {
|
|
76
|
-
return chidoriQuery.call(this.chi, query, branch, frame)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
branch(branch, frame) {
|
|
80
|
-
return chidoriBranch.call(this.chi, branch, frame);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
graphStructure(branch) {
|
|
84
|
-
return chidoriGraphStructure.call(this.chi, branch);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
registerCustomNodeHandle(nodeTypeName, handle) {
|
|
88
|
-
// TODO: we actually pass a callback to the function provided by the user, which they invoke with their result
|
|
89
|
-
return chidoriRegisterCustomNodeHandle.call(this.chi, nodeTypeName, handle);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
runCustomNodeLoop() {
|
|
93
|
-
return chidoriRunCustomNodeLoop.call(this.chi);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
class GraphBuilder {
|
|
99
|
-
constructor() {
|
|
100
|
-
this.g = graphbuilderNew();
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
customNode(createCustomNodeOpts) {
|
|
104
|
-
return new NodeHandle(graphbuilderCustomNode.call(this.g, transformKeys(createCustomNodeOpts)));
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
promptNode(promptNodeCreateOpts) {
|
|
108
|
-
return new NodeHandle(graphbuilderPromptNode.call(this.g, transformKeys(promptNodeCreateOpts)));
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
denoCodeNode(denoCodeNodeCreateOpts) {
|
|
112
|
-
return new NodeHandle(graphbuilderDenoCodeNode.call(this.g, transformKeys(denoCodeNodeCreateOpts)));
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
vectorMemoryNode(vectorMemoryNodeCreateOpts) {
|
|
116
|
-
return new NodeHandle(graphbuilderVectorMemoryNode.call(this.g, transformKeys(vectorMemoryNodeCreateOpts)));
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
commit(chidori) {
|
|
120
|
-
return graphbuilderCommit.call(this.g, chidori.chi, 0);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
module.exports = {
|
|
126
|
-
Chidori: Chidori,
|
|
127
|
-
GraphBuilder: GraphBuilder,
|
|
128
|
-
NodeHandle: NodeHandle,
|
|
129
|
-
simpleFun: simpleFun
|
|
130
|
-
};
|
package/pyproject.toml
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
[project]
|
|
2
|
-
name = "chidori"
|
|
3
|
-
repository = "https://github.com/thousandbirds/chidori"
|
|
4
|
-
description = "A framework for building LLM based agents"
|
|
5
|
-
authors = [
|
|
6
|
-
{name = "Colton Pierson", email = "colton@thousandbirds.ai"}
|
|
7
|
-
]
|
|
8
|
-
classifiers=[
|
|
9
|
-
"Development Status :: 3 - Alpha",
|
|
10
|
-
"Intended Audience :: Developers",
|
|
11
|
-
"Topic :: Software Development",
|
|
12
|
-
"Topic :: Software Development :: Libraries",
|
|
13
|
-
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
14
|
-
]
|
|
15
|
-
dependencies = [
|
|
16
|
-
"typing-extensions>=3; python_version < '3.8'",
|
|
17
|
-
"cffi"
|
|
18
|
-
]
|
|
19
|
-
requires-python = ">=3.9"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
[project.urls]
|
|
23
|
-
homepage = "https://github.com/thousandbirds/chidori"
|
|
24
|
-
documentation = "https://github.com/thousandbirds/chidori/README.md"
|
|
25
|
-
repository = "https://github.com/thousandbirds/chidori"
|
|
26
|
-
|
|
27
|
-
[build-system]
|
|
28
|
-
requires = ["maturin>=1.0,<2.0"]
|
|
29
|
-
build-backend = "maturin"
|
|
30
|
-
|
|
31
|
-
[tool.maturin]
|
|
32
|
-
python-source = "package_python"
|
|
33
|
-
module-name = "chidori._chidori"
|
|
34
|
-
bindings = "pyo3"
|
|
35
|
-
features = ["python"]
|
package/src/lib.rs
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
extern crate protobuf;
|
|
2
|
-
extern crate neon_serde3;
|
|
3
|
-
pub mod translations;
|
|
4
|
-
|
|
5
|
-
pub use prompt_graph_core::proto2::{ChangeValue, Path, SerializedValue};
|
|
6
|
-
pub use prompt_graph_core::proto2::serialized_value::Val;
|
|
7
|
-
pub use prompt_graph_core::proto2::*;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/// Our local server implementation is an extension of this. Implementing support for multiple
|
|
11
|
-
/// agent implementations to run on the same machine.
|
|
12
|
-
pub fn create_change_value(address: Vec<String>, val: Option<Val>, branch: u64) -> ChangeValue {
|
|
13
|
-
ChangeValue{
|
|
14
|
-
path: Some(Path {
|
|
15
|
-
address,
|
|
16
|
-
}),
|
|
17
|
-
value: Some(SerializedValue {
|
|
18
|
-
val,
|
|
19
|
-
}),
|
|
20
|
-
branch,
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|