@1kbirds/chidori 0.1.23 → 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/CHANGELOG.md ADDED
@@ -0,0 +1,33 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## 0.1.24 (2023-07-28)
9
+
10
+ ### Fixed
11
+
12
+ - Fixing releases
13
+
14
+ ## 0.1.23 (2023-07-28)
15
+
16
+ ### Fixed
17
+
18
+ - Fixing releases
19
+
20
+ ## 0.1.22 (2023-07-28)
21
+
22
+ ### Added
23
+
24
+
25
+ ### Fixed
26
+
27
+ ### Changed
28
+
29
+ - Moved to SQL queries as triggers to nodes rather than graphql
30
+
31
+ ### Changed
32
+
33
+
package/Cargo.toml CHANGED
@@ -1,11 +1,16 @@
1
1
  [package]
2
2
  name = "chidori"
3
- version = "0.1.7"
3
+ version= "0.1.24"
4
4
  edition = "2021"
5
+ description = "A Rust library for executing prompt-graph models"
6
+ license = "MIT"
7
+ homepage = "https://docs.thousandbirds.ai"
8
+ repository = "https://github.com/ThousandBirdsInc/chidori"
9
+
5
10
 
6
11
  # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7
12
  [lib]
8
- name = "chidori"
13
+ name = "_chidori"
9
14
  crate-type = ["cdylib", "lib"]
10
15
  bench = false
11
16
 
@@ -28,10 +33,10 @@ sqlparser = "0.34.0"
28
33
  # serde-wasm-bindgen should be used instead
29
34
 
30
35
  # Vendor protoc and openssl so we don't need to separately install them
31
- openssl = { version = "0.10", features = ["vendored"] }
36
+ openssl = { version = "0.10.55", features = ["vendored"] }
32
37
 
33
38
  once_cell = "1"
34
- prompt-graph-core = { path = "../prompt-graph-core", version = "0.1.0" }
39
+ prompt-graph-core = { path = "../prompt-graph-core", version = "^0.1.24" }
35
40
  wasm-bindgen = {version = "0.2.86", features = []}
36
41
  handlebars = "4.3.7"
37
42
  anyhow = { version = "1.0", default-features = false }
@@ -72,7 +77,7 @@ wasm-bindgen-test = "0.2"
72
77
  tonic-build = "0.9.2"
73
78
  pyo3-build-config = "0.19.1"
74
79
 
75
-
76
- [package.metadata.maturin]
77
- python-source = "package_python"
78
- 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,10 +1,10 @@
1
1
  {
2
2
  "name": "@1kbirds/chidori",
3
- "version": "v0.1.23",
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",
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()),
@@ -670,7 +670,7 @@ impl NodeHandle {
670
670
  }
671
671
 
672
672
  fn get_output_type(&self) -> Vec<Vec<String>> {
673
- self.indiv.output_path.clone()
673
+ self.indiv.output_paths.clone()
674
674
  }
675
675
 
676
676
  pub fn run_when(&mut self, graph_builder: &mut GraphBuilder, other_node: &NodeHandle) -> anyhow::Result<bool> {
@@ -694,7 +694,7 @@ impl NodeHandle {
694
694
 
695
695
  pub async fn query(&self, file_id: String, url: String, branch: u64, frame: u64) -> anyhow::Result<HashMap<String, SerializedValue>> {
696
696
  let name = &self.node.core.as_ref().unwrap().name;
697
- let query = construct_query_from_output_type(&name, &name, &self.indiv.output_path).unwrap();
697
+ let query = construct_query_from_output_type(&name, &name, &self.indiv.output_paths).unwrap();
698
698
  let mut client = get_client(url).await?;
699
699
  let result = client.run_query(QueryAtFrame {
700
700
  id: file_id,
@@ -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,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