@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.
- package/README.md +115 -5
- 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 +27 -32
- package/src/agent.ts +548 -0
- package/src/index.ts +580 -0
- package/.pytest_cache/README.md +0 -8
- package/CHANGELOG.md +0 -33
- package/Cargo.toml +0 -83
- 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/build.rs +0 -7
- package/package_node/index.d.ts +0 -0
- package/package_node/index.js +0 -130
- package/package_node/native/chidori.node +0 -0
- package/package_python/.idea/inspectionProfiles/profiles_settings.xml +0 -6
- package/package_python/.idea/misc.xml +0 -4
- package/package_python/.idea/modules.xml +0 -8
- package/package_python/.idea/package_python.iml +0 -8
- package/package_python/.idea/vcs.xml +0 -6
- package/package_python/chidori/__init__.py +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/chidori.pyi +0 -32
- package/package_python/chidori/py.typed +0 -0
- package/package_python/chidori/test_chidori.py +0 -36
- package/pyproject.toml +0 -33
- 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 -920
- 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/build.rs
DELETED
package/package_node/index.d.ts
DELETED
|
File without changes
|
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
|
-
};
|
|
Binary file
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/package_python.iml" filepath="$PROJECT_DIR$/.idea/package_python.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="PYTHON_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<content url="file://$MODULE_DIR$" />
|
|
5
|
-
<orderEntry type="inheritedJdk" />
|
|
6
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
7
|
-
</component>
|
|
8
|
-
</module>
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import *
|
|
4
|
-
|
|
5
|
-
class Chidori:
|
|
6
|
-
def start_server(self, file_path: Optional[str]) -> None: ...
|
|
7
|
-
def play(self, branch: int, frame: int) -> None: ...
|
|
8
|
-
def pause(self, frame: int) -> None: ...
|
|
9
|
-
def branch(self) -> None: ...
|
|
10
|
-
def query(self, query: str, branch: int, frame: int) -> None: ...
|
|
11
|
-
def list_branches(self) -> None: ...
|
|
12
|
-
def display_graph_structure(self) -> None: ...
|
|
13
|
-
def list_registered_graphs(self) -> None: ...
|
|
14
|
-
def list_input_proposals(self) -> None: ...
|
|
15
|
-
def list_change_events(self, callback: object) -> None: ...
|
|
16
|
-
def poll_local_code_node_execution(self) -> None: ...
|
|
17
|
-
def ack_local_code_node_execution(self, branch: int, counter: int) -> None: ...
|
|
18
|
-
def respond_local_code_node_execution(self, branch: int, counter: int, node_name: str, response: Optional[object]) -> None: ...
|
|
19
|
-
|
|
20
|
-
class GraphBuilder:
|
|
21
|
-
def custom_node(self, name: str, queries: List[Optional[str]], output_tables: List[str], output: str, node_type_name: str) -> None: ...
|
|
22
|
-
def deno_code_node(self, name: str, queries: List[Optional[str]], output_tables: List[str], output: str, code: str, is_template: bool) -> None: ...
|
|
23
|
-
def vector_memory_node(self, name: str, queries: List[Optional[str]], output_tables: List[str], output: str, template: str, action: str, embedding_model: str, db_vendor: str, collection_name: str) -> None: ...
|
|
24
|
-
def prompt_node(self, name: str, queries: List[Optional[str]], output_tables: List[str], template: str, model: str) -> None: ...
|
|
25
|
-
def commit(self, c: Chidori, branch: int) -> None: ...
|
|
26
|
-
|
|
27
|
-
class NodeHandle:
|
|
28
|
-
def get_name(self) -> str: ...
|
|
29
|
-
def run_when(self, node_handle: Optional[NodeHandle]) -> None: ...
|
|
30
|
-
def query(self, branch: int, frame: int) -> None: ...
|
|
31
|
-
def __str__(self) -> str: ...
|
|
32
|
-
def __repr__(self) -> str: ...
|
|
File without changes
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import pytest
|
|
2
|
-
from unittest.mock import AsyncMock, MagicMock
|
|
3
|
-
from chidori import Chidori, GraphBuilder
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
@pytest.mark.asyncio
|
|
7
|
-
async def test_simple_agent():
|
|
8
|
-
client = Chidori("100", "http://localhost:9800")
|
|
9
|
-
g = GraphBuilder()
|
|
10
|
-
await client.start_server(":memory:")
|
|
11
|
-
await g.deno_code_node(
|
|
12
|
-
name="InspirationalQuote",
|
|
13
|
-
code="""
|
|
14
|
-
return {"promptResult": "placeholder for openai call" }
|
|
15
|
-
"""
|
|
16
|
-
)
|
|
17
|
-
pn = await g.deno_code_node(
|
|
18
|
-
name="CodeNode",
|
|
19
|
-
queries=["""
|
|
20
|
-
query Q {
|
|
21
|
-
InspirationalQuote {
|
|
22
|
-
promptResult
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
"""],
|
|
26
|
-
code="""
|
|
27
|
-
return {"output": "Here is your quote for "+ new Date() + {{InspirationalQuote.promptResult}} }
|
|
28
|
-
""",
|
|
29
|
-
is_template=True
|
|
30
|
-
)
|
|
31
|
-
# await g.commit(client, 0)
|
|
32
|
-
# await client.play(0, 0)
|
|
33
|
-
assert 1 == 1
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
package/pyproject.toml
DELETED
|
@@ -1,33 +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"}
|
|
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
|
-
features = ["python"]
|
|
33
|
-
python-source = "package_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
|
-
|