@1kbirds/chidori 0.1.24 → 0.1.26

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/Cargo.toml CHANGED
@@ -10,7 +10,7 @@ repository = "https://github.com/ThousandBirdsInc/chidori"
10
10
 
11
11
  # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
12
12
  [lib]
13
- name = "chidori"
13
+ name = "_chidori"
14
14
  crate-type = ["cdylib", "lib"]
15
15
  bench = false
16
16
 
@@ -33,7 +33,7 @@ sqlparser = "0.34.0"
33
33
  # serde-wasm-bindgen should be used instead
34
34
 
35
35
  # Vendor protoc and openssl so we don't need to separately install them
36
- openssl = { version = "0.10", features = ["vendored"] }
36
+ openssl = { version = "0.10.55", features = ["vendored"] }
37
37
 
38
38
  once_cell = "1"
39
39
  prompt-graph-core = { path = "../prompt-graph-core", version = "^0.1.24" }
@@ -77,7 +77,7 @@ wasm-bindgen-test = "0.2"
77
77
  tonic-build = "0.9.2"
78
78
  pyo3-build-config = "0.19.1"
79
79
 
80
-
81
- [package.metadata.maturin]
82
- python-source = "package_python"
83
- name = "chidori"
80
+ [profile.release]
81
+ lto = "fat"
82
+ codegen-units = 1
83
+ strip = true
package/README.md CHANGED
@@ -5,3 +5,6 @@
5
5
 
6
6
  ## Generating Nodejs Client
7
7
  - npm run build-release
8
+
9
+
10
+ Python patterns were implemented while referring to https://github.com/pydantic/pydantic-core/tree/main/python/pydantic_core
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@1kbirds/chidori",
3
- "version": "0.1.24",
3
+ "version": "v0.1.26",
4
4
  "description": "Chidori is a library for building and running reactive AI agents.",
5
5
  "main": "package_node/index.js",
6
6
  "scripts": {
7
- "build": "cargo-cp-artifact -nc ./package_node/native/chidori.node -- cargo build --message-format=json-render-diagnostics --features nodejs",
7
+ "build": "cargo-cp-artifact -a cdylib _chidori ./package_node/native/chidori.node -- cargo build --message-format=json-render-diagnostics --features nodejs",
8
8
  "build-debug": "npm run build --",
9
9
  "build-release": "npm run build -- --release",
10
10
  "test-rust": "cargo test",
11
- "test-js": "jest tests/nodejs"
11
+ "test-js": "jest tests/nodejs",
12
+ "install": "node-pre-gyp install"
12
13
  },
13
14
  "os": [
14
15
  "darwin",
package/pyproject.toml CHANGED
@@ -3,7 +3,7 @@ name = "chidori"
3
3
  repository = "https://github.com/thousandbirds/chidori"
4
4
  description = "A framework for building LLM based agents"
5
5
  authors = [
6
- {name = "Colton Pierson"}
6
+ {name = "Colton Pierson", email = "colton@thousandbirds.ai"}
7
7
  ]
8
8
  classifiers=[
9
9
  "Development Status :: 3 - Alpha",
@@ -29,5 +29,7 @@ requires = ["maturin>=1.0,<2.0"]
29
29
  build-backend = "maturin"
30
30
 
31
31
  [tool.maturin]
32
+ python-source = "package_python"
33
+ module-name = "chidori._chidori"
34
+ bindings = "pyo3"
32
35
  features = ["python"]
33
- python-source = "package_python"
@@ -402,8 +402,8 @@ async fn get_client(url: String) -> Result<ExecutionRuntimeClient<tonic::transpo
402
402
  // TODO: return a handle to nodes so that we can understand and inspect them
403
403
  // TODO: include a __repr__ method on those nodes
404
404
 
405
- #[pyclass]
406
405
  #[derive(Clone)]
406
+ #[pyclass(name="NodeHandle")]
407
407
  struct PyNodeHandle {
408
408
  n: NodeHandle,
409
409
  }
@@ -746,7 +746,7 @@ impl PyGraphBuilder {
746
746
  }
747
747
 
748
748
  // https://github.com/PyO3/pyo3/issues/525
749
- #[pyo3(signature = (name=String::new(), queries=vec!["None".to_string()], output_tables=vec![], output=String::from("type O {}"), node_type_name=String::new()))]
749
+ #[pyo3(signature = (name=String::new(), queries=vec!["None".to_string()], output_tables=vec![], output=String::from("{}"), node_type_name=String::new()))]
750
750
  fn custom_node<'a>(
751
751
  mut self_: PyRefMut<'_, Self>,
752
752
  py: Python<'a>,
@@ -797,7 +797,7 @@ impl PyGraphBuilder {
797
797
  }
798
798
 
799
799
 
800
- #[pyo3(signature = (name=String::new(), queries=vec!["None".to_string()], output_tables=vec![], output=String::from("type O { }"), template=String::new(), action="WRITE".to_string(), embedding_model="TEXT_EMBEDDING_ADA_002".to_string(), db_vendor="QDRANT".to_string(), collection_name=String::new()))]
800
+ #[pyo3(signature = (name=String::new(), queries=vec!["None".to_string()], output_tables=vec![], output=String::from("{}"), template=String::new(), action="WRITE".to_string(), embedding_model="TEXT_EMBEDDING_ADA_002".to_string(), db_vendor="QDRANT".to_string(), collection_name=String::new()))]
801
801
  fn vector_memory_node<'a>(
802
802
  mut self_: PyRefMut<'_, Self>,
803
803
  py: Python<'a>,
@@ -910,11 +910,12 @@ impl PyGraphBuilder {
910
910
  /// the `lib.name` setting in the `Cargo.toml`, else Python will not be able to
911
911
  /// import the module.
912
912
  #[pymodule]
913
- #[pyo3(name = "chidori")]
913
+ #[pyo3(name = "_chidori")]
914
914
  fn chidori(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
915
915
  // pyo3_log::init();
916
916
  m.add_class::<PyChidori>()?;
917
917
  m.add_class::<PyGraphBuilder>()?;
918
+ m.add_class::<PyNodeHandle>()?;
918
919
  Ok(())
919
920
  }
920
921
 
@@ -538,7 +538,7 @@ impl GraphBuilder {
538
538
  let node = create_custom_node(
539
539
  def.name.clone(),
540
540
  remap_queries(def.queries.clone()),
541
- def.output.unwrap_or("type O {}".to_string()),
541
+ def.output.unwrap_or("{}".to_string()),
542
542
  def.node_type_name,
543
543
  def.output_tables.unwrap_or(vec![])
544
544
  );
@@ -553,7 +553,7 @@ impl GraphBuilder {
553
553
  let node = create_code_node(
554
554
  def.name.clone(),
555
555
  remap_queries(def.queries.clone()),
556
- def.output.unwrap_or("type O {}".to_string()),
556
+ def.output.unwrap_or("{}".to_string()),
557
557
  SourceNodeType::Code("DENO".to_string(), def.code, def.is_template.unwrap_or(false)),
558
558
  def.output_tables.unwrap_or(vec![])
559
559
  );
@@ -568,7 +568,7 @@ impl GraphBuilder {
568
568
  let node = create_vector_memory_node(
569
569
  def.name.clone(),
570
570
  remap_queries(def.queries.clone()),
571
- def.output.unwrap_or("type O {}".to_string()),
571
+ def.output.unwrap_or("{}".to_string()),
572
572
  def.action.unwrap_or("READ".to_string()),
573
573
  def.embedding_model.unwrap_or("TEXT_EMBEDDING_ADA_002".to_string()),
574
574
  def.template.unwrap_or("".to_string()),
@@ -16,13 +16,7 @@ async def test_simple_agent():
16
16
  )
17
17
  pn = await g.deno_code_node(
18
18
  name="CodeNode",
19
- queries=["""
20
- query Q {
21
- InspirationalQuote {
22
- promptResult
23
- }
24
- }
25
- """],
19
+ queries=["""SELECT promptResult FROM InspirationalQuote"""],
26
20
  code="""
27
21
  return {"output": "Here is your quote for "+ new Date() + {{InspirationalQuote.promptResult}} }
28
22
  """,
@@ -1,8 +0,0 @@
1
- # pytest cache directory #
2
-
3
- This directory contains data from the pytest's cache plugin,
4
- which provides the `--lf` and `--ff` options, as well as the `cache` fixture.
5
-
6
- **Do not** commit this to version control.
7
-
8
- See [the docs](https://docs.pytest.org/en/stable/how-to/cache.html) for more information.
Binary file
@@ -1,6 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <settings>
3
- <option name="USE_PROJECT_PROFILE" value="false" />
4
- <version value="1.0" />
5
- </settings>
6
- </component>
@@ -1,4 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
4
- </project>
@@ -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>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
5
- </component>
6
- </project>
File without changes
@@ -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