cocoindex 0.1.22__tar.gz → 0.1.23__tar.gz

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 (184) hide show
  1. {cocoindex-0.1.22 → cocoindex-0.1.23}/Cargo.lock +5 -6
  2. {cocoindex-0.1.22 → cocoindex-0.1.23}/Cargo.toml +1 -1
  3. {cocoindex-0.1.22 → cocoindex-0.1.23}/PKG-INFO +1 -1
  4. cocoindex-0.1.23/dev/neo4j.yaml +25 -0
  5. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/docs_to_kg/main.py +14 -14
  6. {cocoindex-0.1.22 → cocoindex-0.1.23}/python/cocoindex/functions.py +3 -0
  7. {cocoindex-0.1.22 → cocoindex-0.1.23}/python/cocoindex/storages.py +10 -10
  8. {cocoindex-0.1.22 → cocoindex-0.1.23}/python/cocoindex/typing.py +1 -5
  9. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/builder/analyzer.rs +5 -5
  10. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/execution/db_tracking_setup.rs +9 -6
  11. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/ops/functions/mod.rs +1 -0
  12. cocoindex-0.1.23/src/ops/functions/parse_json.rs +104 -0
  13. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/ops/registration.rs +1 -0
  14. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/ops/storages/neo4j.rs +89 -64
  15. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/setup/driver.rs +9 -7
  16. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/setup/states.rs +12 -11
  17. cocoindex-0.1.22/dev/neo4j.yaml +0 -16
  18. {cocoindex-0.1.22 → cocoindex-0.1.23}/.cargo/config.toml +0 -0
  19. {cocoindex-0.1.22 → cocoindex-0.1.23}/.env.lib_debug +0 -0
  20. {cocoindex-0.1.22 → cocoindex-0.1.23}/.github/ISSUE_TEMPLATE//360/237/220/233-bug-report.md" +0 -0
  21. {cocoindex-0.1.22 → cocoindex-0.1.23}/.github/ISSUE_TEMPLATE//360/237/222/241-feature-request.md" +0 -0
  22. {cocoindex-0.1.22 → cocoindex-0.1.23}/.github/scripts/update_version.sh +0 -0
  23. {cocoindex-0.1.22 → cocoindex-0.1.23}/.github/workflows/CI.yml +0 -0
  24. {cocoindex-0.1.22 → cocoindex-0.1.23}/.github/workflows/docs.yml +0 -0
  25. {cocoindex-0.1.22 → cocoindex-0.1.23}/.github/workflows/release.yml +0 -0
  26. {cocoindex-0.1.22 → cocoindex-0.1.23}/.gitignore +0 -0
  27. {cocoindex-0.1.22 → cocoindex-0.1.23}/CODE_OF_CONDUCT.md +0 -0
  28. {cocoindex-0.1.22 → cocoindex-0.1.23}/CONTRIBUTING.md +0 -0
  29. {cocoindex-0.1.22 → cocoindex-0.1.23}/LICENSE +0 -0
  30. {cocoindex-0.1.22 → cocoindex-0.1.23}/README.md +0 -0
  31. {cocoindex-0.1.22 → cocoindex-0.1.23}/dev/postgres.yaml +0 -0
  32. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/.gitignore +0 -0
  33. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/README.md +0 -0
  34. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docs/about/community.md +0 -0
  35. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docs/about/contributing.md +0 -0
  36. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docs/ai/llm.mdx +0 -0
  37. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docs/core/basics.md +0 -0
  38. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docs/core/cli.mdx +0 -0
  39. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docs/core/custom_function.mdx +0 -0
  40. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docs/core/data_example.svg +0 -0
  41. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docs/core/data_types.mdx +0 -0
  42. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docs/core/flow_def.mdx +0 -0
  43. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docs/core/flow_example.svg +0 -0
  44. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docs/core/flow_methods.mdx +0 -0
  45. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docs/core/initialization.mdx +0 -0
  46. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docs/getting_started/installation.md +0 -0
  47. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docs/getting_started/markdown_files.zip +0 -0
  48. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docs/getting_started/overview.md +0 -0
  49. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docs/getting_started/quickstart.md +0 -0
  50. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docs/ops/functions.md +0 -0
  51. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docs/ops/sources.md +0 -0
  52. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docs/ops/storages.md +0 -0
  53. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/docusaurus.config.ts +0 -0
  54. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/package.json +0 -0
  55. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/sidebars.ts +0 -0
  56. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/src/components/HomepageFeatures/index.tsx +0 -0
  57. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/src/components/HomepageFeatures/styles.module.css +0 -0
  58. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/src/css/custom.css +0 -0
  59. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/src/theme/Root.js +0 -0
  60. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/static/.nojekyll +0 -0
  61. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/static/img/docusaurus.png +0 -0
  62. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/static/img/favicon.ico +0 -0
  63. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/static/img/icon.svg +0 -0
  64. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/static/robots.txt +0 -0
  65. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/tsconfig.json +0 -0
  66. {cocoindex-0.1.22 → cocoindex-0.1.23}/docs/yarn.lock +0 -0
  67. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/code_embedding/.env +0 -0
  68. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/code_embedding/README.md +0 -0
  69. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/code_embedding/main.py +0 -0
  70. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/code_embedding/pyproject.toml +0 -0
  71. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/docs_to_kg/.env +0 -0
  72. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/docs_to_kg/README.md +0 -0
  73. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/docs_to_kg/markdown_files/1706.03762v7.md +0 -0
  74. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/docs_to_kg/markdown_files/1810.04805v2.md +0 -0
  75. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/docs_to_kg/markdown_files/rfc8259.md +0 -0
  76. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/docs_to_kg/pyproject.toml +0 -0
  77. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/gdrive_text_embedding/.env.example +0 -0
  78. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/gdrive_text_embedding/.gitignore +0 -0
  79. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/gdrive_text_embedding/README.md +0 -0
  80. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/gdrive_text_embedding/data/1706.03762v7.docx +0 -0
  81. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/gdrive_text_embedding/data/1810.04805v2.docx +0 -0
  82. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/gdrive_text_embedding/main.py +0 -0
  83. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/gdrive_text_embedding/pyproject.toml +0 -0
  84. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/manuals_llm_extraction/.env +0 -0
  85. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/manuals_llm_extraction/README.md +0 -0
  86. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/manuals_llm_extraction/main.py +0 -0
  87. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/manuals_llm_extraction/manuals/array.pdf +0 -0
  88. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/manuals_llm_extraction/manuals/base64.pdf +0 -0
  89. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/manuals_llm_extraction/manuals/copy.pdf +0 -0
  90. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/manuals_llm_extraction/manuals/glob.pdf +0 -0
  91. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/manuals_llm_extraction/pyproject.toml +0 -0
  92. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/pdf_embedding/.env +0 -0
  93. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/pdf_embedding/README.md +0 -0
  94. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/pdf_embedding/main.py +0 -0
  95. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/pdf_embedding/pdf_files/1706.03762v7.pdf +0 -0
  96. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/pdf_embedding/pdf_files/1810.04805v2.pdf +0 -0
  97. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/pdf_embedding/pdf_files/rfc8259.pdf +0 -0
  98. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/pdf_embedding/pyproject.toml +0 -0
  99. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/text_embedding/.env +0 -0
  100. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/text_embedding/README.md +0 -0
  101. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/text_embedding/main.py +0 -0
  102. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/text_embedding/markdown_files/1706.03762v7.md +0 -0
  103. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/text_embedding/markdown_files/1810.04805v2.md +0 -0
  104. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/text_embedding/markdown_files/rfc8259.md +0 -0
  105. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/text_embedding/pyproject.toml +0 -0
  106. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/text_embedding_qdrant/.env +0 -0
  107. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/text_embedding_qdrant/README.md +0 -0
  108. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/text_embedding_qdrant/main.py +0 -0
  109. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/text_embedding_qdrant/markdown_files/rfc8259.md +0 -0
  110. {cocoindex-0.1.22 → cocoindex-0.1.23}/examples/text_embedding_qdrant/pyproject.toml +0 -0
  111. {cocoindex-0.1.22 → cocoindex-0.1.23}/pyproject.toml +0 -0
  112. {cocoindex-0.1.22 → cocoindex-0.1.23}/python/cocoindex/__init__.py +0 -0
  113. {cocoindex-0.1.22 → cocoindex-0.1.23}/python/cocoindex/auth_registry.py +0 -0
  114. {cocoindex-0.1.22 → cocoindex-0.1.23}/python/cocoindex/cli.py +0 -0
  115. {cocoindex-0.1.22 → cocoindex-0.1.23}/python/cocoindex/convert.py +0 -0
  116. {cocoindex-0.1.22 → cocoindex-0.1.23}/python/cocoindex/flow.py +0 -0
  117. {cocoindex-0.1.22 → cocoindex-0.1.23}/python/cocoindex/index.py +0 -0
  118. {cocoindex-0.1.22 → cocoindex-0.1.23}/python/cocoindex/lib.py +0 -0
  119. {cocoindex-0.1.22 → cocoindex-0.1.23}/python/cocoindex/llm.py +0 -0
  120. {cocoindex-0.1.22 → cocoindex-0.1.23}/python/cocoindex/op.py +0 -0
  121. {cocoindex-0.1.22 → cocoindex-0.1.23}/python/cocoindex/py.typed +0 -0
  122. {cocoindex-0.1.22 → cocoindex-0.1.23}/python/cocoindex/query.py +0 -0
  123. {cocoindex-0.1.22 → cocoindex-0.1.23}/python/cocoindex/setup.py +0 -0
  124. {cocoindex-0.1.22 → cocoindex-0.1.23}/python/cocoindex/sources.py +0 -0
  125. {cocoindex-0.1.22 → cocoindex-0.1.23}/python/cocoindex/tests/__init__.py +0 -0
  126. {cocoindex-0.1.22 → cocoindex-0.1.23}/python/cocoindex/tests/test_convert.py +0 -0
  127. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/base/field_attrs.rs +0 -0
  128. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/base/json_schema.rs +0 -0
  129. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/base/mod.rs +0 -0
  130. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/base/schema.rs +0 -0
  131. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/base/spec.rs +0 -0
  132. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/base/value.rs +0 -0
  133. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/builder/analyzed_flow.rs +0 -0
  134. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/builder/flow_builder.rs +0 -0
  135. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/builder/mod.rs +0 -0
  136. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/builder/plan.rs +0 -0
  137. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/execution/db_tracking.rs +0 -0
  138. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/execution/dumper.rs +0 -0
  139. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/execution/evaluator.rs +0 -0
  140. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/execution/live_updater.rs +0 -0
  141. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/execution/memoization.rs +0 -0
  142. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/execution/mod.rs +0 -0
  143. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/execution/query.rs +0 -0
  144. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/execution/row_indexer.rs +0 -0
  145. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/execution/source_indexer.rs +0 -0
  146. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/execution/stats.rs +0 -0
  147. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/lib.rs +0 -0
  148. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/lib_context.rs +0 -0
  149. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/llm/mod.rs +0 -0
  150. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/llm/ollama.rs +0 -0
  151. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/llm/openai.rs +0 -0
  152. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/ops/factory_bases.rs +0 -0
  153. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/ops/functions/extract_by_llm.rs +0 -0
  154. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/ops/functions/split_recursively.rs +0 -0
  155. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/ops/interface.rs +0 -0
  156. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/ops/mod.rs +0 -0
  157. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/ops/py_factory.rs +0 -0
  158. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/ops/registry.rs +0 -0
  159. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/ops/sdk.rs +0 -0
  160. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/ops/sources/google_drive.rs +0 -0
  161. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/ops/sources/local_file.rs +0 -0
  162. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/ops/sources/mod.rs +0 -0
  163. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/ops/storages/mod.rs +0 -0
  164. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/ops/storages/postgres.rs +0 -0
  165. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/ops/storages/qdrant.rs +0 -0
  166. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/prelude.rs +0 -0
  167. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/py/convert.rs +0 -0
  168. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/py/mod.rs +0 -0
  169. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/server.rs +0 -0
  170. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/service/error.rs +0 -0
  171. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/service/flows.rs +0 -0
  172. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/service/mod.rs +0 -0
  173. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/service/search.rs +0 -0
  174. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/settings.rs +0 -0
  175. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/setup/auth_registry.rs +0 -0
  176. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/setup/components.rs +0 -0
  177. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/setup/db_metadata.rs +0 -0
  178. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/setup/mod.rs +0 -0
  179. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/utils/db.rs +0 -0
  180. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/utils/fingerprint.rs +0 -0
  181. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/utils/immutable.rs +0 -0
  182. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/utils/mod.rs +0 -0
  183. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/utils/retriable.rs +0 -0
  184. {cocoindex-0.1.22 → cocoindex-0.1.23}/src/utils/yaml_ser.rs +0 -0
@@ -533,7 +533,7 @@ dependencies = [
533
533
 
534
534
  [[package]]
535
535
  name = "cocoindex"
536
- version = "0.1.22"
536
+ version = "0.1.23"
537
537
  dependencies = [
538
538
  "anyhow",
539
539
  "async-openai",
@@ -568,7 +568,7 @@ dependencies = [
568
568
  "pyo3-async-runtimes",
569
569
  "pythonize",
570
570
  "qdrant-client",
571
- "rand 0.9.0",
571
+ "rand 0.9.1",
572
572
  "regex",
573
573
  "reqwest",
574
574
  "rustls",
@@ -2697,7 +2697,7 @@ checksum = "b820744eb4dc9b57a3398183639c511b5a26d2ed702cedd3febaa1393caa22cc"
2697
2697
  dependencies = [
2698
2698
  "bytes",
2699
2699
  "getrandom 0.3.2",
2700
- "rand 0.9.0",
2700
+ "rand 0.9.1",
2701
2701
  "ring",
2702
2702
  "rustc-hash 2.1.1",
2703
2703
  "rustls",
@@ -2751,13 +2751,12 @@ dependencies = [
2751
2751
 
2752
2752
  [[package]]
2753
2753
  name = "rand"
2754
- version = "0.9.0"
2754
+ version = "0.9.1"
2755
2755
  source = "registry+https://github.com/rust-lang/crates.io-index"
2756
- checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94"
2756
+ checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97"
2757
2757
  dependencies = [
2758
2758
  "rand_chacha 0.9.0",
2759
2759
  "rand_core 0.9.3",
2760
- "zerocopy 0.8.24",
2761
2760
  ]
2762
2761
 
2763
2762
  [[package]]
@@ -2,7 +2,7 @@
2
2
  name = "cocoindex"
3
3
  # Version used for local development is always higher than others to take precedence.
4
4
  # Will be overridden for specific release versions.
5
- version = "0.1.22"
5
+ version = "0.1.23"
6
6
  edition = "2021"
7
7
 
8
8
  # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cocoindex
3
- Version: 0.1.22
3
+ Version: 0.1.23
4
4
  Requires-Dist: sentence-transformers>=3.3.1
5
5
  Requires-Dist: click>=8.1.8
6
6
  Requires-Dist: pytest ; extra == 'test'
@@ -0,0 +1,25 @@
1
+ name: cocoindex-neo4j
2
+ services:
3
+ neo4j:
4
+ image: neo4j:5-enterprise
5
+ volumes:
6
+ - /$HOME/neo4j/logs:/logs
7
+ - /$HOME/neo4j/config:/config
8
+ - /$HOME/neo4j/data:/data
9
+ - /$HOME/neo4j/plugins:/plugins
10
+ environment:
11
+ - NEO4J_AUTH=neo4j/cocoindex
12
+ - NEO4J_PLUGINS='["graph-data-science"]'
13
+ - NEO4J_ACCEPT_LICENSE_AGREEMENT=eval
14
+
15
+ # Uncomment to enable query logging
16
+ # - NEO4J_db_logs_query_enabled=VERBOSE
17
+ # - NEO4J_db_logs_query_transaction_enabled=VERBOSE
18
+ # - NEO4J_db_logs_query_parameter__logging__enabled=true
19
+ # - NEO4J_dbms_logs_http_enabled=true
20
+ # - NEO4J_server_logs_debug_enabled=true
21
+
22
+ ports:
23
+ - "7474:7474"
24
+ - "7687:7687"
25
+ restart: always
@@ -96,35 +96,35 @@ def docs_to_kg_flow(flow_builder: cocoindex.FlowBuilder, data_scope: cocoindex.D
96
96
  "document_node",
97
97
  cocoindex.storages.Neo4j(
98
98
  connection=conn_spec,
99
- mapping=cocoindex.storages.Neo4jNode(label="Document")),
99
+ mapping=cocoindex.storages.GraphNode(label="Document")),
100
100
  primary_key_fields=["filename"],
101
101
  )
102
102
  entity_relationship.export(
103
103
  "entity_relationship",
104
104
  cocoindex.storages.Neo4j(
105
105
  connection=conn_spec,
106
- mapping=cocoindex.storages.Neo4jRelationship(
106
+ mapping=cocoindex.storages.GraphRelationship(
107
107
  rel_type="RELATIONSHIP",
108
- source=cocoindex.storages.Neo4jRelationshipEnd(
108
+ source=cocoindex.storages.GraphRelationshipEnd(
109
109
  label="Entity",
110
110
  fields=[
111
- cocoindex.storages.Neo4jFieldMapping(
111
+ cocoindex.storages.GraphFieldMapping(
112
112
  field_name="subject", node_field_name="value"),
113
- cocoindex.storages.Neo4jFieldMapping(
113
+ cocoindex.storages.GraphFieldMapping(
114
114
  field_name="subject_embedding", node_field_name="embedding"),
115
115
  ]
116
116
  ),
117
- target=cocoindex.storages.Neo4jRelationshipEnd(
117
+ target=cocoindex.storages.GraphRelationshipEnd(
118
118
  label="Entity",
119
119
  fields=[
120
- cocoindex.storages.Neo4jFieldMapping(
120
+ cocoindex.storages.GraphFieldMapping(
121
121
  field_name="object", node_field_name="value"),
122
- cocoindex.storages.Neo4jFieldMapping(
122
+ cocoindex.storages.GraphFieldMapping(
123
123
  field_name="object_embedding", node_field_name="embedding"),
124
124
  ]
125
125
  ),
126
126
  nodes={
127
- "Entity": cocoindex.storages.Neo4jRelationshipNode(
127
+ "Entity": cocoindex.storages.GraphRelationshipNode(
128
128
  primary_key_fields=["value"],
129
129
  vector_indexes=[
130
130
  cocoindex.VectorIndexDef(
@@ -142,15 +142,15 @@ def docs_to_kg_flow(flow_builder: cocoindex.FlowBuilder, data_scope: cocoindex.D
142
142
  "entity_mention",
143
143
  cocoindex.storages.Neo4j(
144
144
  connection=conn_spec,
145
- mapping=cocoindex.storages.Neo4jRelationship(
145
+ mapping=cocoindex.storages.GraphRelationship(
146
146
  rel_type="MENTION",
147
- source=cocoindex.storages.Neo4jRelationshipEnd(
147
+ source=cocoindex.storages.GraphRelationshipEnd(
148
148
  label="Document",
149
- fields=[cocoindex.storages.Neo4jFieldMapping("filename")],
149
+ fields=[cocoindex.storages.GraphFieldMapping("filename")],
150
150
  ),
151
- target=cocoindex.storages.Neo4jRelationshipEnd(
151
+ target=cocoindex.storages.GraphRelationshipEnd(
152
152
  label="Entity",
153
- fields=[cocoindex.storages.Neo4jFieldMapping(
153
+ fields=[cocoindex.storages.GraphFieldMapping(
154
154
  field_name="entity", node_field_name="value")],
155
155
  ),
156
156
  ),
@@ -5,6 +5,9 @@ import sentence_transformers
5
5
  from .typing import Float32, Vector, TypeAttr
6
6
  from . import op, llm
7
7
 
8
+ class ParseJson(op.FunctionSpec):
9
+ """Parse a text into a JSON object."""
10
+
8
11
  class SplitRecursively(op.FunctionSpec):
9
12
  """Split a document (in string) recursively."""
10
13
 
@@ -29,7 +29,7 @@ class Neo4jConnection:
29
29
  db: str | None = None
30
30
 
31
31
  @dataclass
32
- class Neo4jFieldMapping:
32
+ class GraphFieldMapping:
33
33
  """Mapping for a Neo4j field."""
34
34
  field_name: str
35
35
  # Field name for the node in the Knowledge Graph.
@@ -37,36 +37,36 @@ class Neo4jFieldMapping:
37
37
  node_field_name: str | None = None
38
38
 
39
39
  @dataclass
40
- class Neo4jRelationshipEnd:
40
+ class GraphRelationshipEnd:
41
41
  """Spec for a Neo4j node type."""
42
42
  label: str
43
- fields: list[Neo4jFieldMapping]
43
+ fields: list[GraphFieldMapping]
44
44
 
45
45
  @dataclass
46
- class Neo4jRelationshipNode:
46
+ class GraphRelationshipNode:
47
47
  """Spec for a Neo4j node type."""
48
48
  primary_key_fields: Sequence[str]
49
49
  vector_indexes: Sequence[index.VectorIndexDef] = ()
50
50
 
51
51
  @dataclass
52
- class Neo4jNode:
52
+ class GraphNode:
53
53
  """Spec for a Neo4j node type."""
54
54
  kind = "Node"
55
55
 
56
56
  label: str
57
57
 
58
58
  @dataclass
59
- class Neo4jRelationship:
59
+ class GraphRelationship:
60
60
  """Spec for a Neo4j relationship."""
61
61
  kind = "Relationship"
62
62
 
63
63
  rel_type: str
64
- source: Neo4jRelationshipEnd
65
- target: Neo4jRelationshipEnd
66
- nodes: dict[str, Neo4jRelationshipNode] | None = None
64
+ source: GraphRelationshipEnd
65
+ target: GraphRelationshipEnd
66
+ nodes: dict[str, GraphRelationshipNode] | None = None
67
67
 
68
68
  class Neo4j(op.StorageSpec):
69
69
  """Graph storage powered by Neo4j."""
70
70
 
71
71
  connection: AuthEntryReference
72
- mapping: Neo4jNode | Neo4jRelationship
72
+ mapping: GraphNode | GraphRelationship
@@ -183,11 +183,7 @@ def _encode_type(type_info: AnalyzedTypeInfo) -> dict[str, Any]:
183
183
  if type_info.elem_type is None:
184
184
  raise ValueError(f"{type_info.kind} type must have an element type")
185
185
  row_type_info = analyze_type_info(type_info.elem_type)
186
- if row_type_info.dataclass_type is None:
187
- raise ValueError(f"{type_info.kind} type must have a dataclass type")
188
- encoded_type['row'] = {
189
- 'fields': _encode_fields_schema(row_type_info.dataclass_type),
190
- }
186
+ encoded_type['row'] = _encode_type(row_type_info)
191
187
 
192
188
  return encoded_type
193
189
 
@@ -714,6 +714,9 @@ impl AnalyzerContext<'_> {
714
714
  .data
715
715
  .add_field(reactive_op.name.clone(), &output_type)?;
716
716
  let reactive_op = reactive_op.clone();
717
+ let logic_fingerprinter = Fingerprinter::default()
718
+ .with(&op.op)?
719
+ .with(&output_type.without_attrs())?;
717
720
  async move {
718
721
  trace!("Start building executor for transform op `{}`", reactive_op.name);
719
722
  let executor = executor.await.with_context(|| {
@@ -725,11 +728,8 @@ impl AnalyzerContext<'_> {
725
728
  let function_exec_info = AnalyzedFunctionExecInfo {
726
729
  enable_cache,
727
730
  behavior_version,
728
- fingerprinter: Fingerprinter::default()
729
- .with(&reactive_op.name)?
730
- .with(&reactive_op.spec)?
731
- .with(&behavior_version)?
732
- .with(&output_type.without_attrs())?,
731
+ fingerprinter: logic_fingerprinter
732
+ .with(&behavior_version)?,
733
733
  output_type: output_type.typ.clone(),
734
734
  };
735
735
  if function_exec_info.enable_cache
@@ -58,7 +58,7 @@ pub struct TrackingTableSetupStatusCheck {
58
58
 
59
59
  pub legacy_table_names: Vec<String>,
60
60
 
61
- pub min_existing_version_ids: Option<i32>,
61
+ pub min_existing_version_id: Option<i32>,
62
62
  pub source_ids_to_delete: Vec<i32>,
63
63
  }
64
64
 
@@ -75,7 +75,10 @@ impl TrackingTableSetupStatusCheck {
75
75
  .into_iter()
76
76
  .cloned()
77
77
  .collect(),
78
- min_existing_version_ids: existing.possible_versions().map(|v| v.version_id).min(),
78
+ min_existing_version_id: existing
79
+ .always_exists()
80
+ .then(|| existing.possible_versions().map(|v| v.version_id).min())
81
+ .flatten(),
79
82
  source_ids_to_delete,
80
83
  }
81
84
  }
@@ -102,7 +105,7 @@ impl ResourceSetupStatusCheck for TrackingTableSetupStatusCheck {
102
105
  self.legacy_table_names.join(", ")
103
106
  ));
104
107
  }
105
- match (self.min_existing_version_ids, &self.desired_state) {
108
+ match (self.min_existing_version_id, &self.desired_state) {
106
109
  (None, Some(state)) => {
107
110
  changes.push(format!("Create the tracking table: {}. ", state.table_name))
108
111
  }
@@ -131,7 +134,7 @@ impl ResourceSetupStatusCheck for TrackingTableSetupStatusCheck {
131
134
  }
132
135
 
133
136
  fn change_type(&self) -> SetupChangeType {
134
- match (self.min_existing_version_ids, &self.desired_state) {
137
+ match (self.min_existing_version_id, &self.desired_state) {
135
138
  (None, Some(_)) => SetupChangeType::Create,
136
139
  (Some(min_version_id), Some(desired)) => {
137
140
  if min_version_id == desired.version_id && self.legacy_table_names.is_empty() {
@@ -158,11 +161,11 @@ impl ResourceSetupStatusCheck for TrackingTableSetupStatusCheck {
158
161
  sqlx::query(&query).execute(pool).await?;
159
162
  }
160
163
 
161
- if self.min_existing_version_ids != Some(desired.version_id) {
164
+ if self.min_existing_version_id != Some(desired.version_id) {
162
165
  upgrade_tracking_table(
163
166
  pool,
164
167
  &desired.table_name,
165
- self.min_existing_version_ids.unwrap_or(0),
168
+ self.min_existing_version_id.unwrap_or(0),
166
169
  desired.version_id,
167
170
  )
168
171
  .await?;
@@ -1,2 +1,3 @@
1
1
  pub mod extract_by_llm;
2
+ pub mod parse_json;
2
3
  pub mod split_recursively;
@@ -0,0 +1,104 @@
1
+ use crate::ops::sdk::*;
2
+ use anyhow::Result;
3
+ use std::collections::HashMap;
4
+ use std::sync::{Arc, LazyLock};
5
+ use unicase::UniCase;
6
+
7
+ pub struct Args {
8
+ text: ResolvedOpArg,
9
+ language: Option<ResolvedOpArg>,
10
+ }
11
+
12
+ type ParseFn = fn(&str) -> Result<serde_json::Value>;
13
+ struct LanguageConfig {
14
+ parse_fn: ParseFn,
15
+ }
16
+
17
+ fn add_language<'a>(
18
+ output: &'a mut HashMap<UniCase<&'static str>, Arc<LanguageConfig>>,
19
+ name: &'static str,
20
+ aliases: impl IntoIterator<Item = &'static str>,
21
+ parse_fn: ParseFn,
22
+ ) {
23
+ let lang_config = Arc::new(LanguageConfig { parse_fn });
24
+ for name in std::iter::once(name).chain(aliases.into_iter()) {
25
+ if output.insert(name.into(), lang_config.clone()).is_some() {
26
+ panic!("Language `{name}` already exists");
27
+ }
28
+ }
29
+ }
30
+
31
+ fn parse_json(text: &str) -> Result<serde_json::Value> {
32
+ Ok(serde_json::from_str(text)?)
33
+ }
34
+
35
+ static PARSE_FN_BY_LANG: LazyLock<HashMap<UniCase<&'static str>, Arc<LanguageConfig>>> =
36
+ LazyLock::new(|| {
37
+ let mut map = HashMap::new();
38
+ add_language(&mut map, "json", [".json"], parse_json);
39
+ map
40
+ });
41
+
42
+ struct Executor {
43
+ args: Args,
44
+ }
45
+
46
+ #[async_trait]
47
+ impl SimpleFunctionExecutor for Executor {
48
+ async fn evaluate(&self, input: Vec<value::Value>) -> Result<value::Value> {
49
+ let text = self.args.text.value(&input)?.as_str()?;
50
+ let lang_config = {
51
+ let language = self.args.language.value(&input)?;
52
+ language
53
+ .optional()
54
+ .map(|v| anyhow::Ok(v.as_str()?.as_ref()))
55
+ .transpose()?
56
+ .and_then(|lang| PARSE_FN_BY_LANG.get(&UniCase::new(lang)))
57
+ };
58
+ let parse_fn = lang_config.map(|c| c.parse_fn).unwrap_or(parse_json);
59
+ let parsed_value = parse_fn(text)?;
60
+ Ok(value::Value::Basic(value::BasicValue::Json(Arc::new(
61
+ parsed_value,
62
+ ))))
63
+ }
64
+ }
65
+
66
+ pub struct Factory;
67
+
68
+ #[async_trait]
69
+ impl SimpleFunctionFactoryBase for Factory {
70
+ type Spec = EmptySpec;
71
+ type ResolvedArgs = Args;
72
+
73
+ fn name(&self) -> &str {
74
+ "ParseJson"
75
+ }
76
+
77
+ fn resolve_schema(
78
+ &self,
79
+ _spec: &EmptySpec,
80
+ args_resolver: &mut OpArgsResolver<'_>,
81
+ _context: &FlowInstanceContext,
82
+ ) -> Result<(Args, EnrichedValueType)> {
83
+ let args = Args {
84
+ text: args_resolver
85
+ .next_arg("text")?
86
+ .expect_type(&ValueType::Basic(BasicValueType::Str))?,
87
+ language: args_resolver
88
+ .next_optional_arg("language")?
89
+ .expect_type(&ValueType::Basic(BasicValueType::Str))?,
90
+ };
91
+
92
+ let output_schema = make_output_type(BasicValueType::Json);
93
+ Ok((args, output_schema))
94
+ }
95
+
96
+ async fn build_executor(
97
+ self: Arc<Self>,
98
+ _spec: EmptySpec,
99
+ args: Args,
100
+ _context: Arc<FlowInstanceContext>,
101
+ ) -> Result<Box<dyn SimpleFunctionExecutor>> {
102
+ Ok(Box::new(Executor { args }))
103
+ }
104
+ }
@@ -9,6 +9,7 @@ fn register_executor_factories(registry: &mut ExecutorFactoryRegistry) -> Result
9
9
  sources::local_file::Factory.register(registry)?;
10
10
  sources::google_drive::Factory.register(registry)?;
11
11
 
12
+ functions::parse_json::Factory.register(registry)?;
12
13
  functions::split_recursively::Factory.register(registry)?;
13
14
  functions::extract_by_llm::Factory.register(registry)?;
14
15