cocoindex 0.1.32__tar.gz → 0.1.34__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 (232) hide show
  1. {cocoindex-0.1.32 → cocoindex-0.1.34}/Cargo.lock +1 -1
  2. {cocoindex-0.1.32 → cocoindex-0.1.34}/Cargo.toml +5 -2
  3. {cocoindex-0.1.32 → cocoindex-0.1.34}/PKG-INFO +59 -25
  4. {cocoindex-0.1.32 → cocoindex-0.1.34}/README.md +58 -24
  5. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/core/flow_methods.mdx +3 -3
  6. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/code_embedding/pyproject.toml +1 -1
  7. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/docs_to_knowledge_graph/pyproject.toml +1 -1
  8. cocoindex-0.1.34/examples/fastapi_server_docker/.dockerignore +2 -0
  9. cocoindex-0.1.34/examples/fastapi_server_docker/.env +1 -0
  10. cocoindex-0.1.34/examples/fastapi_server_docker/README.md +10 -0
  11. cocoindex-0.1.34/examples/fastapi_server_docker/compose.yaml +18 -0
  12. cocoindex-0.1.34/examples/fastapi_server_docker/dockerfile +13 -0
  13. cocoindex-0.1.34/examples/fastapi_server_docker/main.py +30 -0
  14. cocoindex-0.1.34/examples/fastapi_server_docker/requirements.txt +5 -0
  15. cocoindex-0.1.34/examples/fastapi_server_docker/sample_code/main.py +113 -0
  16. cocoindex-0.1.34/examples/fastapi_server_docker/src/cocoindex_funs.py +45 -0
  17. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/gdrive_text_embedding/pyproject.toml +1 -1
  18. cocoindex-0.1.34/examples/image_search_example/.env +1 -0
  19. cocoindex-0.1.34/examples/image_search_example/README.md +61 -0
  20. cocoindex-0.1.34/examples/image_search_example/frontend/.gitignore +136 -0
  21. cocoindex-0.1.34/examples/image_search_example/frontend/index.html +12 -0
  22. cocoindex-0.1.34/examples/image_search_example/frontend/package-lock.json +1265 -0
  23. cocoindex-0.1.34/examples/image_search_example/frontend/package.json +18 -0
  24. cocoindex-0.1.34/examples/image_search_example/frontend/src/App.jsx +53 -0
  25. cocoindex-0.1.34/examples/image_search_example/frontend/src/main.jsx +10 -0
  26. cocoindex-0.1.34/examples/image_search_example/frontend/src/style.css +83 -0
  27. cocoindex-0.1.34/examples/image_search_example/frontend/vite.config.js +10 -0
  28. cocoindex-0.1.34/examples/image_search_example/img/cat1.jpeg +0 -0
  29. cocoindex-0.1.34/examples/image_search_example/img/dog1.jpeg +0 -0
  30. cocoindex-0.1.34/examples/image_search_example/img/elephant1.jpg +0 -0
  31. cocoindex-0.1.34/examples/image_search_example/img/giraffe.jpg +0 -0
  32. cocoindex-0.1.34/examples/image_search_example/main.py +125 -0
  33. cocoindex-0.1.34/examples/image_search_example/requirements.txt +5 -0
  34. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/manuals_llm_extraction/pyproject.toml +1 -1
  35. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/pdf_embedding/pyproject.toml +1 -1
  36. cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/.env +3 -0
  37. cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/README.md +66 -0
  38. cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/img/cocoinsight.png +0 -0
  39. cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/img/neo4j.png +0 -0
  40. cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/main.py +185 -0
  41. cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/products/p1.json +22 -0
  42. cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/products/p2.json +22 -0
  43. cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/products/p3.json +22 -0
  44. cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/products/p4.json +22 -0
  45. cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/products/p5.json +22 -0
  46. cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/products/p6.json +22 -0
  47. cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/products/p7.json +26 -0
  48. cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/products/p8.json +21 -0
  49. cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/products/p9.json +21 -0
  50. cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/pyproject.toml +6 -0
  51. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding/pyproject.toml +1 -1
  52. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding_qdrant/pyproject.toml +1 -1
  53. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/__init__.py +1 -0
  54. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/cli.py +15 -14
  55. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/flow.py +31 -51
  56. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/setup.py +4 -4
  57. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/base/spec.rs +232 -11
  58. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/builder/analyzed_flow.rs +3 -3
  59. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/db_tracking_setup.rs +13 -8
  60. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/llm/anthropic.rs +16 -10
  61. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/llm/gemini.rs +12 -6
  62. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/factory_bases.rs +29 -5
  63. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/interface.rs +6 -1
  64. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/storages/neo4j.rs +127 -81
  65. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/storages/postgres.rs +22 -6
  66. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/storages/qdrant.rs +14 -4
  67. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/py/mod.rs +98 -8
  68. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/setup/components.rs +30 -38
  69. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/setup/db_metadata.rs +10 -5
  70. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/setup/driver.rs +99 -48
  71. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/setup/states.rs +35 -42
  72. cocoindex-0.1.34/src/utils/yaml_ser.rs +731 -0
  73. cocoindex-0.1.32/src/utils/yaml_ser.rs +0 -349
  74. {cocoindex-0.1.32 → cocoindex-0.1.34}/.cargo/config.toml +0 -0
  75. {cocoindex-0.1.32 → cocoindex-0.1.34}/.env.lib_debug +0 -0
  76. {cocoindex-0.1.32 → cocoindex-0.1.34}/.github/ISSUE_TEMPLATE//360/237/220/233-bug-report.md +0 -0
  77. {cocoindex-0.1.32 → cocoindex-0.1.34}/.github/ISSUE_TEMPLATE//360/237/222/241-feature-request.md +0 -0
  78. {cocoindex-0.1.32 → cocoindex-0.1.34}/.github/scripts/update_version.sh +0 -0
  79. {cocoindex-0.1.32 → cocoindex-0.1.34}/.github/workflows/CI.yml +0 -0
  80. {cocoindex-0.1.32 → cocoindex-0.1.34}/.github/workflows/_test.yml +0 -0
  81. {cocoindex-0.1.32 → cocoindex-0.1.34}/.github/workflows/docs.yml +0 -0
  82. {cocoindex-0.1.32 → cocoindex-0.1.34}/.github/workflows/release.yml +0 -0
  83. {cocoindex-0.1.32 → cocoindex-0.1.34}/.gitignore +0 -0
  84. {cocoindex-0.1.32 → cocoindex-0.1.34}/.vscode/settings.json +0 -0
  85. {cocoindex-0.1.32 → cocoindex-0.1.34}/CODE_OF_CONDUCT.md +0 -0
  86. {cocoindex-0.1.32 → cocoindex-0.1.34}/CONTRIBUTING.md +0 -0
  87. {cocoindex-0.1.32 → cocoindex-0.1.34}/LICENSE +0 -0
  88. {cocoindex-0.1.32 → cocoindex-0.1.34}/dev/neo4j.yaml +0 -0
  89. {cocoindex-0.1.32 → cocoindex-0.1.34}/dev/postgres.yaml +0 -0
  90. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/.gitignore +0 -0
  91. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/README.md +0 -0
  92. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/about/community.md +0 -0
  93. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/about/contributing.md +0 -0
  94. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/ai/llm.mdx +0 -0
  95. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/core/basics.md +0 -0
  96. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/core/cli.mdx +0 -0
  97. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/core/custom_function.mdx +0 -0
  98. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/core/data_example.svg +0 -0
  99. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/core/data_types.mdx +0 -0
  100. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/core/flow_def.mdx +0 -0
  101. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/core/flow_example.svg +0 -0
  102. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/core/initialization.mdx +0 -0
  103. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/getting_started/installation.md +0 -0
  104. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/getting_started/markdown_files.zip +0 -0
  105. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/getting_started/overview.md +0 -0
  106. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/getting_started/quickstart.md +0 -0
  107. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/ops/functions.md +0 -0
  108. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/ops/sources.md +0 -0
  109. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/ops/storages.md +0 -0
  110. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docusaurus.config.ts +0 -0
  111. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/package.json +0 -0
  112. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/sidebars.ts +0 -0
  113. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/src/components/HomepageFeatures/index.tsx +0 -0
  114. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/src/components/HomepageFeatures/styles.module.css +0 -0
  115. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/src/css/custom.css +0 -0
  116. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/src/theme/Root.js +0 -0
  117. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/static/.nojekyll +0 -0
  118. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/static/img/docusaurus.png +0 -0
  119. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/static/img/favicon.ico +0 -0
  120. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/static/img/icon.svg +0 -0
  121. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/static/robots.txt +0 -0
  122. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/tsconfig.json +0 -0
  123. {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/yarn.lock +0 -0
  124. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/code_embedding/.env +0 -0
  125. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/code_embedding/README.md +0 -0
  126. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/code_embedding/main.py +0 -0
  127. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/docs_to_knowledge_graph/.env +0 -0
  128. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/docs_to_knowledge_graph/README.md +0 -0
  129. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/docs_to_knowledge_graph/main.py +0 -0
  130. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/docs_to_knowledge_graph/markdown_files/1706.03762v7.md +0 -0
  131. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/docs_to_knowledge_graph/markdown_files/1810.04805v2.md +0 -0
  132. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/docs_to_knowledge_graph/markdown_files/rfc8259.md +0 -0
  133. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/gdrive_text_embedding/.env.example +0 -0
  134. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/gdrive_text_embedding/.gitignore +0 -0
  135. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/gdrive_text_embedding/README.md +0 -0
  136. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/gdrive_text_embedding/data/1706.03762v7.docx +0 -0
  137. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/gdrive_text_embedding/data/1810.04805v2.docx +0 -0
  138. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/gdrive_text_embedding/main.py +0 -0
  139. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/manuals_llm_extraction/.env +0 -0
  140. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/manuals_llm_extraction/README.md +0 -0
  141. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/manuals_llm_extraction/main.py +0 -0
  142. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/manuals_llm_extraction/manuals/array.pdf +0 -0
  143. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/manuals_llm_extraction/manuals/base64.pdf +0 -0
  144. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/manuals_llm_extraction/manuals/copy.pdf +0 -0
  145. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/manuals_llm_extraction/manuals/glob.pdf +0 -0
  146. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/pdf_embedding/.env +0 -0
  147. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/pdf_embedding/README.md +0 -0
  148. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/pdf_embedding/main.py +0 -0
  149. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/pdf_embedding/pdf_files/1706.03762v7.pdf +0 -0
  150. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/pdf_embedding/pdf_files/1810.04805v2.pdf +0 -0
  151. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/pdf_embedding/pdf_files/rfc8259.pdf +0 -0
  152. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding/.env +0 -0
  153. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding/README.md +0 -0
  154. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding/Text_Embedding.ipynb +0 -0
  155. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding/main.py +0 -0
  156. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding/markdown_files/1706.03762v7.md +0 -0
  157. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding/markdown_files/1810.04805v2.md +0 -0
  158. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding/markdown_files/rfc8259.md +0 -0
  159. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding_qdrant/.env +0 -0
  160. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding_qdrant/README.md +0 -0
  161. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding_qdrant/main.py +0 -0
  162. {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding_qdrant/markdown_files/rfc8259.md +0 -0
  163. {cocoindex-0.1.32 → cocoindex-0.1.34}/pyproject.toml +0 -0
  164. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/auth_registry.py +0 -0
  165. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/convert.py +0 -0
  166. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/functions.py +0 -0
  167. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/index.py +0 -0
  168. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/lib.py +0 -0
  169. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/llm.py +0 -0
  170. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/op.py +0 -0
  171. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/py.typed +0 -0
  172. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/query.py +0 -0
  173. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/runtime.py +0 -0
  174. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/setting.py +0 -0
  175. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/sources.py +0 -0
  176. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/storages.py +0 -0
  177. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/tests/__init__.py +0 -0
  178. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/tests/test_convert.py +0 -0
  179. {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/typing.py +0 -0
  180. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/base/field_attrs.rs +0 -0
  181. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/base/json_schema.rs +0 -0
  182. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/base/mod.rs +0 -0
  183. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/base/schema.rs +0 -0
  184. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/base/value.rs +0 -0
  185. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/builder/analyzer.rs +0 -0
  186. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/builder/flow_builder.rs +0 -0
  187. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/builder/mod.rs +0 -0
  188. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/builder/plan.rs +0 -0
  189. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/db_tracking.rs +0 -0
  190. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/dumper.rs +0 -0
  191. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/evaluator.rs +0 -0
  192. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/live_updater.rs +0 -0
  193. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/memoization.rs +0 -0
  194. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/mod.rs +0 -0
  195. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/query.rs +0 -0
  196. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/row_indexer.rs +0 -0
  197. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/source_indexer.rs +0 -0
  198. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/stats.rs +0 -0
  199. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/lib.rs +0 -0
  200. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/lib_context.rs +0 -0
  201. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/llm/mod.rs +2 -2
  202. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/llm/ollama.rs +0 -0
  203. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/llm/openai.rs +0 -0
  204. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/functions/extract_by_llm.rs +0 -0
  205. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/functions/mod.rs +0 -0
  206. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/functions/parse_json.rs +0 -0
  207. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/functions/split_recursively.rs +0 -0
  208. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/mod.rs +0 -0
  209. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/py_factory.rs +0 -0
  210. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/registration.rs +0 -0
  211. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/registry.rs +0 -0
  212. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/sdk.rs +0 -0
  213. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/sources/google_drive.rs +0 -0
  214. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/sources/local_file.rs +0 -0
  215. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/sources/mod.rs +0 -0
  216. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/storages/mod.rs +0 -0
  217. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/storages/spec.rs +0 -0
  218. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/prelude.rs +0 -0
  219. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/py/convert.rs +0 -0
  220. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/server.rs +0 -0
  221. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/service/error.rs +0 -0
  222. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/service/flows.rs +0 -0
  223. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/service/mod.rs +0 -0
  224. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/service/search.rs +0 -0
  225. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/settings.rs +0 -0
  226. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/setup/auth_registry.rs +0 -0
  227. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/setup/mod.rs +0 -0
  228. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/utils/db.rs +0 -0
  229. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/utils/fingerprint.rs +0 -0
  230. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/utils/immutable.rs +0 -0
  231. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/utils/mod.rs +0 -0
  232. {cocoindex-0.1.32 → cocoindex-0.1.34}/src/utils/retriable.rs +0 -0
@@ -533,7 +533,7 @@ dependencies = [
533
533
 
534
534
  [[package]]
535
535
  name = "cocoindex"
536
- version = "0.1.32"
536
+ version = "0.1.34"
537
537
  dependencies = [
538
538
  "anyhow",
539
539
  "async-openai",
@@ -2,10 +2,13 @@
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.32"
5
+ version = "0.1.34"
6
6
  edition = "2021"
7
7
 
8
- # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
+ [profile.release]
9
+ codegen-units = 1
10
+ lto = true
11
+
9
12
  [lib]
10
13
  name = "cocoindex_engine"
11
14
  crate-type = ["cdylib"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cocoindex
3
- Version: 0.1.32
3
+ Version: 0.1.34
4
4
  Requires-Dist: sentence-transformers>=3.3.1
5
5
  Requires-Dist: click>=8.1.8
6
6
  Requires-Dist: rich>=14.0.0
@@ -28,44 +28,74 @@ Project-URL: Homepage, https://cocoindex.io/
28
28
  [![PyPI version](https://img.shields.io/pypi/v/cocoindex?color=5B5BD6)](https://pypi.org/project/cocoindex/)
29
29
  [![PyPI - Downloads](https://img.shields.io/pypi/dm/cocoindex)](https://pypistats.org/packages/cocoindex)
30
30
 
31
- <!-- [![Python](https://img.shields.io/badge/python-3.11%20to%203.13-5B5BD6?logo=python&logoColor=white)](https://www.python.org/) -->
32
31
  [![CI](https://github.com/cocoindex-io/cocoindex/actions/workflows/CI.yml/badge.svg?event=push&color=5B5BD6)](https://github.com/cocoindex-io/cocoindex/actions/workflows/CI.yml)
33
32
  [![release](https://github.com/cocoindex-io/cocoindex/actions/workflows/release.yml/badge.svg?event=push&color=5B5BD6)](https://github.com/cocoindex-io/cocoindex/actions/workflows/release.yml)
34
33
  [![Discord](https://img.shields.io/discord/1314801574169673738?logo=discord&color=5B5BD6&logoColor=white)](https://discord.com/invite/zpA9S2DR7s)
35
- <!--[![LinkedIn](https://img.shields.io/badge/LinkedIn-CocoIndex-5B5BD6?logo=linkedin&logoColor=white)](https://www.linkedin.com/company/cocoindex) -->
36
- <!--[![X (Twitter)](https://img.shields.io/twitter/follow/cocoindex_io)](https://twitter.com/intent/follow?screen_name=cocoindex_io) -->
37
-
38
34
  </div>
39
35
 
40
- CocoIndex is the world's first open-source engine that supports both custom transformation logic and incremental updates specialized for data indexing.
36
+ **CocoIndex** is an ultra performant data transformation framework, with its core engine written in Rust. The problem it tries to solve is to make it easy to prepare fresh data for AI - either creating embedding, building knowledge graphs, or performing other data transformations - and take real-time data pipelines beyond traditional SQL.
37
+
38
+ <p align="center">
39
+ <img src="https://cocoindex.io/images/cocoindex-features.png" alt="CocoIndex Features" width="500">
40
+ </p>
41
+
42
+ The philosophy is to have the framework handle the source updates, and having developers only worry about defining a series of data transformation, inspired by spreadsheet.
43
+
44
+ ## Dataflow programming
45
+ Unlike a workflow orchestration framework where data is usually opaque, in CocoIndex, data and data operations are first class citizens. CocoIndex follows the idea of [Dataflow](https://en.wikipedia.org/wiki/Dataflow_programming) programming model. Each transformation creates a new field solely based on input fields, without hidden states and value mutation. All data before/after each transformation is observable, with lineage out of the box.
46
+
47
+ **Particularly**, users don't explicitly mutate data by creating, updating and deleting. Rather, they define something like - for a set of source data, this is the transformation or formula. The framework takes care of the data operations such as when to create, update, or delete.
48
+
49
+ ```python
50
+ # import
51
+ data['content'] = flow_builder.add_source(...)
52
+
53
+ # transform
54
+ data['out'] = data['content']
55
+ .transform(...)
56
+ .transform(...)
57
+
58
+ # collect data
59
+ collector.collect(...)
60
+
61
+ # export to db, vector db, graph db ...
62
+ collector.export(...)
63
+ ```
64
+
65
+ ## Data Freshness
66
+ As a data framework, CocoIndex takes it to the next level on data freshness. **Incremental processing** is one of the core values provided by CocoIndex.
67
+
41
68
  <p align="center">
42
- <img src="https://cocoindex.io/images/venn.svg" alt="CocoIndex">
69
+ <img src="https://github.com/user-attachments/assets/f4eb29b3-84ee-4fa0-a1e2-80eedeeabde6" alt="Incremental Processing" width="700">
43
70
  </p>
44
- With CocoIndex, users declare the transformation, CocoIndex creates & maintains an index, and keeps the derived index up to date based on source update, with minimal computation and changes.
71
+
72
+ The frameworks takes care of
73
+ - Change data capture.
74
+ - Figure out what exactly needs to be updated, and only updating that without having to recompute everything.
75
+
76
+ This makes it fast to reflect any source updates to the target store. If you have concerns with surfacing stale data to AI agents and are spending lots of efforts working on infra piece to optimize the latency, the framework actually handles it for you.
45
77
 
46
78
 
47
79
  ## Quick Start:
48
- If you're new to CocoIndex 🤗, we recommend checking out the 📖 [Documentation](https://cocoindex.io/docs) and ⚡ [Quick Start Guide](https://cocoindex.io/docs/getting_started/quickstart). We also have a ▶️ [quick start video tutorial](https://youtu.be/gv5R8nOXsWU?si=9ioeKYkMEnYevTXT) for you to jump start.
80
+ If you're new to CocoIndex, we recommend checking out
81
+ - 📖 [Documentation](https://cocoindex.io/docs)
82
+ - ⚡ [Quick Start Guide](https://cocoindex.io/docs/getting_started/quickstart)
83
+ - 🎬 [Quick Start Video Tutorial](https://youtu.be/gv5R8nOXsWU?si=9ioeKYkMEnYevTXT)
49
84
 
50
85
  ### Setup
86
+
51
87
  1. Install CocoIndex Python library
52
88
 
53
89
  ```bash
54
90
  pip install -U cocoindex
55
91
  ```
56
92
 
57
- 2. Setup Postgres with pgvector extension; or bring up a Postgres database using docker compose:
93
+ 2. [Install Postgres](https://cocoindex.io/docs/getting_started/installation#-install-postgres) if you don't have one. CocoIndex uses it for incremental processing.
58
94
 
59
- - Make sure Docker Compose is installed: [docs](https://docs.docker.com/compose/install/)
60
- - Start a Postgres SQL database for cocoindex using our docker compose config:
61
95
 
62
- ```bash
63
- docker compose -f <(curl -L https://raw.githubusercontent.com/cocoindex-io/cocoindex/refs/heads/main/dev/postgres.yaml) up -d
64
- ```
96
+ ### Define data flow
65
97
 
66
- ### Start your first indexing flow!
67
- Follow [Quick Start Guide](https://cocoindex.io/docs/getting_started/quickstart) to define your first indexing flow.
68
- A common indexing flow looks like:
98
+ Follow [Quick Start Guide](https://cocoindex.io/docs/getting_started/quickstart) to define your first indexing flow. An example flow looks like:
69
99
 
70
100
  ```python
71
101
  @cocoindex.flow_def(name="TextEmbedding")
@@ -106,10 +136,11 @@ def text_embedding_flow(flow_builder: cocoindex.FlowBuilder, data_scope: cocoind
106
136
  ```
107
137
 
108
138
  It defines an index flow like this:
109
- ![Flow diagram](docs/docs/core/flow_example.svg)
110
139
 
111
- ### Play with existing example and demo
112
- Go to the [examples directory](examples) to try out with any of the examples, following instructions under specific example directory.
140
+ <img width="363" alt="Data Flow" src="https://github.com/user-attachments/assets/2ea7be6d-3d94-42b1-b2bd-22515577e463" />
141
+
142
+
143
+ ## 🚀 Examples and demo
113
144
 
114
145
  | Example | Description |
115
146
  |---------|-------------|
@@ -120,8 +151,11 @@ Go to the [examples directory](examples) to try out with any of the examples, fo
120
151
  | [Google Drive Text Embedding](examples/gdrive_text_embedding) | Index text documents from Google Drive |
121
152
  | [Docs to Knowledge Graph](examples/docs_to_knowledge_graph) | Extract relationships from Markdown documents and build a knowledge graph |
122
153
  | [Embeddings to Qdrant](examples/text_embedding_qdrant) | Index documents in a Qdrant collection for semantic search |
154
+ | [FastAPI Server with Docker](examples/fastapi_server_docker) | Run the semantic search server in a Dockerized FastAPI setup |
155
+ | [Product_Taxonomy_Knowledge_Graph](examples/product_taxonomy_knowledge_graph) | Build knowledge graph for product recommendations |
156
+ | [Image Search with Vision API](examples/image_search_example) | Generates detailed captions for images using a vision model, embeds them, enables semantic search via FastAPI and served on a React frontend.|
123
157
 
124
- More coming and stay tuned! If there's any specific examples you would like to see, please let us know in our [Discord community](https://discord.com/invite/zpA9S2DR7s) 🌱.
158
+ More coming and stay tuned 👀!
125
159
 
126
160
  ## 📖 Documentation
127
161
  For detailed documentation, visit [CocoIndex Documentation](https://cocoindex.io/docs), including a [Quickstart guide](https://cocoindex.io/docs/getting_started/quickstart).
@@ -135,13 +169,13 @@ Welcome with a huge coconut hug 🥥⋆。˚🤗. We are super excited for commu
135
169
  Join our community here:
136
170
 
137
171
  - 🌟 [Star us on GitHub](https://github.com/cocoindex-io/cocoindex)
138
- - 💬 [Start a GitHub Discussion](https://github.com/cocoindex-io/cocoindex/discussions)
139
172
  - 👋 [Join our Discord community](https://discord.com/invite/zpA9S2DR7s)
140
- - 𝕏 [Follow us on X](https://x.com/cocoindex_io)
141
- - 🐚 [Follow us on LinkedIn](https://www.linkedin.com/company/cocoindex/about/)
142
173
  - ▶️ [Subscribe to our YouTube channel](https://www.youtube.com/@cocoindex-io)
143
174
  - 📜 [Read our blog posts](https://cocoindex.io/blogs/)
144
175
 
176
+ ## Support us:
177
+ We are constantly improving, and more features and examples are coming soon. If you love this project, please drop us a star ⭐ at GitHub repo [![GitHub](https://img.shields.io/github/stars/cocoindex-io/cocoindex?color=5B5BD6)](https://github.com/cocoindex-io/cocoindex) to stay tuned and help us grow.
178
+
145
179
  ## License
146
180
  CocoIndex is Apache 2.0 licensed.
147
181
 
@@ -12,44 +12,74 @@
12
12
  [![PyPI version](https://img.shields.io/pypi/v/cocoindex?color=5B5BD6)](https://pypi.org/project/cocoindex/)
13
13
  [![PyPI - Downloads](https://img.shields.io/pypi/dm/cocoindex)](https://pypistats.org/packages/cocoindex)
14
14
 
15
- <!-- [![Python](https://img.shields.io/badge/python-3.11%20to%203.13-5B5BD6?logo=python&logoColor=white)](https://www.python.org/) -->
16
15
  [![CI](https://github.com/cocoindex-io/cocoindex/actions/workflows/CI.yml/badge.svg?event=push&color=5B5BD6)](https://github.com/cocoindex-io/cocoindex/actions/workflows/CI.yml)
17
16
  [![release](https://github.com/cocoindex-io/cocoindex/actions/workflows/release.yml/badge.svg?event=push&color=5B5BD6)](https://github.com/cocoindex-io/cocoindex/actions/workflows/release.yml)
18
17
  [![Discord](https://img.shields.io/discord/1314801574169673738?logo=discord&color=5B5BD6&logoColor=white)](https://discord.com/invite/zpA9S2DR7s)
19
- <!--[![LinkedIn](https://img.shields.io/badge/LinkedIn-CocoIndex-5B5BD6?logo=linkedin&logoColor=white)](https://www.linkedin.com/company/cocoindex) -->
20
- <!--[![X (Twitter)](https://img.shields.io/twitter/follow/cocoindex_io)](https://twitter.com/intent/follow?screen_name=cocoindex_io) -->
21
-
22
18
  </div>
23
19
 
24
- CocoIndex is the world's first open-source engine that supports both custom transformation logic and incremental updates specialized for data indexing.
20
+ **CocoIndex** is an ultra performant data transformation framework, with its core engine written in Rust. The problem it tries to solve is to make it easy to prepare fresh data for AI - either creating embedding, building knowledge graphs, or performing other data transformations - and take real-time data pipelines beyond traditional SQL.
21
+
22
+ <p align="center">
23
+ <img src="https://cocoindex.io/images/cocoindex-features.png" alt="CocoIndex Features" width="500">
24
+ </p>
25
+
26
+ The philosophy is to have the framework handle the source updates, and having developers only worry about defining a series of data transformation, inspired by spreadsheet.
27
+
28
+ ## Dataflow programming
29
+ Unlike a workflow orchestration framework where data is usually opaque, in CocoIndex, data and data operations are first class citizens. CocoIndex follows the idea of [Dataflow](https://en.wikipedia.org/wiki/Dataflow_programming) programming model. Each transformation creates a new field solely based on input fields, without hidden states and value mutation. All data before/after each transformation is observable, with lineage out of the box.
30
+
31
+ **Particularly**, users don't explicitly mutate data by creating, updating and deleting. Rather, they define something like - for a set of source data, this is the transformation or formula. The framework takes care of the data operations such as when to create, update, or delete.
32
+
33
+ ```python
34
+ # import
35
+ data['content'] = flow_builder.add_source(...)
36
+
37
+ # transform
38
+ data['out'] = data['content']
39
+ .transform(...)
40
+ .transform(...)
41
+
42
+ # collect data
43
+ collector.collect(...)
44
+
45
+ # export to db, vector db, graph db ...
46
+ collector.export(...)
47
+ ```
48
+
49
+ ## Data Freshness
50
+ As a data framework, CocoIndex takes it to the next level on data freshness. **Incremental processing** is one of the core values provided by CocoIndex.
51
+
25
52
  <p align="center">
26
- <img src="https://cocoindex.io/images/venn.svg" alt="CocoIndex">
53
+ <img src="https://github.com/user-attachments/assets/f4eb29b3-84ee-4fa0-a1e2-80eedeeabde6" alt="Incremental Processing" width="700">
27
54
  </p>
28
- With CocoIndex, users declare the transformation, CocoIndex creates & maintains an index, and keeps the derived index up to date based on source update, with minimal computation and changes.
55
+
56
+ The frameworks takes care of
57
+ - Change data capture.
58
+ - Figure out what exactly needs to be updated, and only updating that without having to recompute everything.
59
+
60
+ This makes it fast to reflect any source updates to the target store. If you have concerns with surfacing stale data to AI agents and are spending lots of efforts working on infra piece to optimize the latency, the framework actually handles it for you.
29
61
 
30
62
 
31
63
  ## Quick Start:
32
- If you're new to CocoIndex 🤗, we recommend checking out the 📖 [Documentation](https://cocoindex.io/docs) and ⚡ [Quick Start Guide](https://cocoindex.io/docs/getting_started/quickstart). We also have a ▶️ [quick start video tutorial](https://youtu.be/gv5R8nOXsWU?si=9ioeKYkMEnYevTXT) for you to jump start.
64
+ If you're new to CocoIndex, we recommend checking out
65
+ - 📖 [Documentation](https://cocoindex.io/docs)
66
+ - ⚡ [Quick Start Guide](https://cocoindex.io/docs/getting_started/quickstart)
67
+ - 🎬 [Quick Start Video Tutorial](https://youtu.be/gv5R8nOXsWU?si=9ioeKYkMEnYevTXT)
33
68
 
34
69
  ### Setup
70
+
35
71
  1. Install CocoIndex Python library
36
72
 
37
73
  ```bash
38
74
  pip install -U cocoindex
39
75
  ```
40
76
 
41
- 2. Setup Postgres with pgvector extension; or bring up a Postgres database using docker compose:
77
+ 2. [Install Postgres](https://cocoindex.io/docs/getting_started/installation#-install-postgres) if you don't have one. CocoIndex uses it for incremental processing.
42
78
 
43
- - Make sure Docker Compose is installed: [docs](https://docs.docker.com/compose/install/)
44
- - Start a Postgres SQL database for cocoindex using our docker compose config:
45
79
 
46
- ```bash
47
- docker compose -f <(curl -L https://raw.githubusercontent.com/cocoindex-io/cocoindex/refs/heads/main/dev/postgres.yaml) up -d
48
- ```
80
+ ### Define data flow
49
81
 
50
- ### Start your first indexing flow!
51
- Follow [Quick Start Guide](https://cocoindex.io/docs/getting_started/quickstart) to define your first indexing flow.
52
- A common indexing flow looks like:
82
+ Follow [Quick Start Guide](https://cocoindex.io/docs/getting_started/quickstart) to define your first indexing flow. An example flow looks like:
53
83
 
54
84
  ```python
55
85
  @cocoindex.flow_def(name="TextEmbedding")
@@ -90,10 +120,11 @@ def text_embedding_flow(flow_builder: cocoindex.FlowBuilder, data_scope: cocoind
90
120
  ```
91
121
 
92
122
  It defines an index flow like this:
93
- ![Flow diagram](docs/docs/core/flow_example.svg)
94
123
 
95
- ### Play with existing example and demo
96
- Go to the [examples directory](examples) to try out with any of the examples, following instructions under specific example directory.
124
+ <img width="363" alt="Data Flow" src="https://github.com/user-attachments/assets/2ea7be6d-3d94-42b1-b2bd-22515577e463" />
125
+
126
+
127
+ ## 🚀 Examples and demo
97
128
 
98
129
  | Example | Description |
99
130
  |---------|-------------|
@@ -104,8 +135,11 @@ Go to the [examples directory](examples) to try out with any of the examples, fo
104
135
  | [Google Drive Text Embedding](examples/gdrive_text_embedding) | Index text documents from Google Drive |
105
136
  | [Docs to Knowledge Graph](examples/docs_to_knowledge_graph) | Extract relationships from Markdown documents and build a knowledge graph |
106
137
  | [Embeddings to Qdrant](examples/text_embedding_qdrant) | Index documents in a Qdrant collection for semantic search |
138
+ | [FastAPI Server with Docker](examples/fastapi_server_docker) | Run the semantic search server in a Dockerized FastAPI setup |
139
+ | [Product_Taxonomy_Knowledge_Graph](examples/product_taxonomy_knowledge_graph) | Build knowledge graph for product recommendations |
140
+ | [Image Search with Vision API](examples/image_search_example) | Generates detailed captions for images using a vision model, embeds them, enables semantic search via FastAPI and served on a React frontend.|
107
141
 
108
- More coming and stay tuned! If there's any specific examples you would like to see, please let us know in our [Discord community](https://discord.com/invite/zpA9S2DR7s) 🌱.
142
+ More coming and stay tuned 👀!
109
143
 
110
144
  ## 📖 Documentation
111
145
  For detailed documentation, visit [CocoIndex Documentation](https://cocoindex.io/docs), including a [Quickstart guide](https://cocoindex.io/docs/getting_started/quickstart).
@@ -119,12 +153,12 @@ Welcome with a huge coconut hug 🥥⋆。˚🤗. We are super excited for commu
119
153
  Join our community here:
120
154
 
121
155
  - 🌟 [Star us on GitHub](https://github.com/cocoindex-io/cocoindex)
122
- - 💬 [Start a GitHub Discussion](https://github.com/cocoindex-io/cocoindex/discussions)
123
156
  - 👋 [Join our Discord community](https://discord.com/invite/zpA9S2DR7s)
124
- - 𝕏 [Follow us on X](https://x.com/cocoindex_io)
125
- - 🐚 [Follow us on LinkedIn](https://www.linkedin.com/company/cocoindex/about/)
126
157
  - ▶️ [Subscribe to our YouTube channel](https://www.youtube.com/@cocoindex-io)
127
158
  - 📜 [Read our blog posts](https://cocoindex.io/blogs/)
128
159
 
160
+ ## Support us:
161
+ We are constantly improving, and more features and examples are coming soon. If you love this project, please drop us a star ⭐ at GitHub repo [![GitHub](https://img.shields.io/github/stars/cocoindex-io/cocoindex?color=5B5BD6)](https://github.com/cocoindex-io/cocoindex) to stay tuned and help us grow.
162
+
129
163
  ## License
130
164
  CocoIndex is Apache 2.0 licensed.
@@ -70,7 +70,7 @@ This is to achieve best efficiency.
70
70
 
71
71
  ### One time update
72
72
 
73
- <Tabs>
73
+ <Tabs queryString="code_lang">
74
74
  <TabItem value="shell" label="Shell" default>
75
75
 
76
76
  The `cocoindex update` subcommand creates/updates data in the target storage.
@@ -108,7 +108,7 @@ A data source may enable one or multiple *change capture mechanisms*:
108
108
 
109
109
  Change capture mechanisms enable CocoIndex to continuously capture changes from the source data and update the target data accordingly, under live update mode.
110
110
 
111
- <Tabs>
111
+ <Tabs queryString="code_lang">
112
112
  <TabItem value="shell" label="Shell" default>
113
113
 
114
114
  To perform live update, run the `cocoindex update` subcommand with `-L` option:
@@ -191,7 +191,7 @@ with cocoindex.FlowLiveUpdater(demo_flow) as my_updater:
191
191
 
192
192
  CocoIndex allows you to run the transformations defined by the flow without updating the target storage.
193
193
 
194
- <Tabs>
194
+ <Tabs queryString="code_lang">
195
195
  <TabItem value="shell" label="Shell" default>
196
196
 
197
197
  The `cocoindex evaluate` subcommand runs the transformation and dumps flow outputs.
@@ -3,4 +3,4 @@ name = "code-embedding"
3
3
  version = "0.1.0"
4
4
  description = "Simple example for cocoindex: build embedding index based on source code."
5
5
  requires-python = ">=3.10"
6
- dependencies = ["cocoindex>=0.1.30", "python-dotenv>=1.0.1"]
6
+ dependencies = ["cocoindex>=0.1.32", "python-dotenv>=1.0.1"]
@@ -3,4 +3,4 @@ name = "manuals-to-kg"
3
3
  version = "0.1.0"
4
4
  description = "Simple example for cocoindex: extract triples from files and build knowledge graph."
5
5
  requires-python = ">=3.10"
6
- dependencies = ["cocoindex>=0.1.30", "python-dotenv>=1.0.1"]
6
+ dependencies = ["cocoindex>=0.1.32", "python-dotenv>=1.0.1"]
@@ -0,0 +1,2 @@
1
+ .venv
2
+ __pycache__
@@ -0,0 +1 @@
1
+ COCOINDEX_DATABASE_URL=postgres://cocoindex:cocoindex@coco_db:5432/cocoindex
@@ -0,0 +1,10 @@
1
+ ## Run cocoindex docker container with a simple query endpoint via fastapi
2
+ In this example, we provide a simple docker container using docker compose to build pgvector17 along with a simple python fastapi script than runs a simple query endpoint. This example uses the code from the code embedding example.
3
+
4
+ ## How to run
5
+ Edit the sample code directory to include the code you want to query over in
6
+ ```sample_code/```
7
+
8
+ Edit the configuration code from the file ```src/cocoindex_funs.py``` line 23 to 25.
9
+
10
+ Finally build the docker container via: ```docker compose up``` while inside the directory of the example.
@@ -0,0 +1,18 @@
1
+ services:
2
+ coco_db:
3
+ image: pgvector/pgvector:pg17
4
+ restart: always
5
+ environment:
6
+ POSTGRES_USER: cocoindex
7
+ POSTGRES_PASSWORD: cocoindex
8
+ POSTGRES_DB: cocoindex
9
+ ports:
10
+ - "5432:5432"
11
+
12
+ coco_api:
13
+ build:
14
+ context: .
15
+ ports:
16
+ - 8080:8080
17
+ depends_on:
18
+ - coco_db
@@ -0,0 +1,13 @@
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+
5
+ COPY requirements.txt .
6
+
7
+ RUN pip install -r requirements.txt
8
+
9
+ COPY . .
10
+
11
+ RUN cat .env
12
+
13
+ CMD ["sh", "-c", "echo yes | python main.py cocoindex setup && python main.py cocoindex update && python main.py"]
@@ -0,0 +1,30 @@
1
+ import cocoindex
2
+ import uvicorn
3
+
4
+ from fastapi import FastAPI
5
+ from dotenv import load_dotenv
6
+
7
+ from src.cocoindex_funs import code_embedding_flow, code_to_embedding
8
+
9
+ fastapi_app = FastAPI()
10
+
11
+ query_handler = cocoindex.query.SimpleSemanticsQueryHandler(
12
+ name="SemanticsSearch",
13
+ flow=code_embedding_flow,
14
+ target_name="code_embeddings",
15
+ query_transform_flow=code_to_embedding,
16
+ default_similarity_metric=cocoindex.VectorSimilarityMetric.COSINE_SIMILARITY
17
+ )
18
+
19
+ @fastapi_app.get("/query")
20
+ def query_endpoint(string: str):
21
+ results, _ = query_handler.search(string, 10)
22
+ return results
23
+
24
+ @cocoindex.main_fn()
25
+ def _run():
26
+ uvicorn.run(fastapi_app, host="0.0.0.0", port=8080)
27
+
28
+ if __name__ == "__main__":
29
+ load_dotenv(override=True)
30
+ _run()
@@ -0,0 +1,5 @@
1
+ cocoindex>=0.1.26
2
+ python-dotenv>=1.0.1
3
+ fastapi==0.115.12
4
+ fastapi-cli==0.0.7
5
+ uvicorn==0.34.2
@@ -0,0 +1,113 @@
1
+ class Button:
2
+ def __init__(self, label, on_click):
3
+ self.label = label
4
+ self.on_click = on_click
5
+
6
+ def click(self):
7
+ print(f"Button '{self.label}' clicked.")
8
+ if callable(self.on_click):
9
+ self.on_click()
10
+
11
+
12
+ class ProgressBar:
13
+ def __init__(self, max_value):
14
+ self.max_value = max_value
15
+ self.current_value = 0
16
+
17
+ def update(self, value):
18
+ self.current_value = min(value, self.max_value)
19
+ self.display()
20
+
21
+ def display(self):
22
+ percent = (self.current_value / self.max_value) * 100
23
+ print(f"Progress: {percent:.2f}%")
24
+
25
+
26
+ class Slider:
27
+ def __init__(self, min_value, max_value, initial_value=None):
28
+ self.min_value = min_value
29
+ self.max_value = max_value
30
+ self.value = initial_value if initial_value is not None else min_value
31
+
32
+ def set_value(self, new_value):
33
+ if self.min_value <= new_value <= self.max_value:
34
+ self.value = new_value
35
+ print(f"Slider set to {self.value}")
36
+ else:
37
+ print("Value out of range.")
38
+
39
+
40
+ class Dropdown:
41
+ def __init__(self, options):
42
+ self.options = options
43
+ self.selected = None
44
+
45
+ def select(self, option):
46
+ if option in self.options:
47
+ self.selected = option
48
+ print(f"Dropdown selected: {option}")
49
+ else:
50
+ print("Option not available.")
51
+
52
+
53
+ class TextField:
54
+ def __init__(self, placeholder=''):
55
+ self.placeholder = placeholder
56
+ self.text = ''
57
+
58
+ def input(self, new_text):
59
+ self.text = new_text
60
+ print(f"Text field updated: {self.text}")
61
+
62
+
63
+ class Checkbox:
64
+ def __init__(self, label):
65
+ self.label = label
66
+ self.checked = False
67
+
68
+ def toggle(self):
69
+ self.checked = not self.checked
70
+ print(f"{self.label}: {'Checked' if self.checked else 'Unchecked'}")
71
+
72
+
73
+ class RadioButton:
74
+ def __init__(self, group, label):
75
+ self.group = group
76
+ self.label = label
77
+ self.selected = False
78
+
79
+ def select(self):
80
+ self.selected = True
81
+ print(f"Radio button '{self.label}' selected in group '{self.group}'.")
82
+
83
+
84
+ class ToggleSwitch:
85
+ def __init__(self, state=False):
86
+ self.state = state
87
+
88
+ def toggle(self):
89
+ self.state = not self.state
90
+ print(f"ToggleSwitch is now {'On' if self.state else 'Off'}")
91
+
92
+
93
+ class Tooltip:
94
+ def __init__(self, text):
95
+ self.text = text
96
+
97
+ def show(self):
98
+ print(f"Tooltip: {self.text}")
99
+
100
+
101
+ class Modal:
102
+ def __init__(self, content):
103
+ self.content = content
104
+ self.visible = False
105
+
106
+ def open(self):
107
+ self.visible = True
108
+ print("Modal opened.")
109
+ print(f"Content: {self.content}")
110
+
111
+ def close(self):
112
+ self.visible = False
113
+ print("Modal closed.")
@@ -0,0 +1,45 @@
1
+ import cocoindex
2
+ import os
3
+
4
+ @cocoindex.op.function()
5
+ def extract_extension(filename: str) -> str:
6
+ """Extract the extension of a filename."""
7
+ return os.path.splitext(filename)[1]
8
+
9
+ def code_to_embedding(text: cocoindex.DataSlice) -> cocoindex.DataSlice:
10
+ """
11
+ Embed the text using a SentenceTransformer model.
12
+ """
13
+ return text.transform(
14
+ cocoindex.functions.SentenceTransformerEmbed(
15
+ model="sentence-transformers/all-MiniLM-L6-v2"))
16
+
17
+ @cocoindex.flow_def(name="CodeEmbedding")
18
+ def code_embedding_flow(flow_builder: cocoindex.FlowBuilder, data_scope: cocoindex.DataScope):
19
+ """
20
+ Define an example flow that embeds files into a vector database.
21
+ """
22
+ data_scope["files"] = flow_builder.add_source(
23
+ cocoindex.sources.LocalFile(path="sample_code",
24
+ included_patterns=["*.py", "*.rs", "*.toml", "*.md", "*.mdx", "*.ts", "*.tsx"],
25
+ excluded_patterns=[".*", "target", "**/node_modules"]))
26
+ code_embeddings = data_scope.add_collector()
27
+
28
+ with data_scope["files"].row() as file:
29
+ file["extension"] = file["filename"].transform(extract_extension)
30
+ file["chunks"] = file["content"].transform(
31
+ cocoindex.functions.SplitRecursively(),
32
+ language=file["extension"], chunk_size=1000, chunk_overlap=300)
33
+ with file["chunks"].row() as chunk:
34
+ chunk["embedding"] = chunk["text"].call(code_to_embedding)
35
+ code_embeddings.collect(filename=file["filename"], location=chunk["location"],
36
+ code=chunk["text"], embedding=chunk["embedding"])
37
+
38
+ code_embeddings.export(
39
+ "code_embeddings",
40
+ cocoindex.storages.Postgres(),
41
+ primary_key_fields=["filename", "location"],
42
+ vector_indexes=[
43
+ cocoindex.VectorIndexDef(
44
+ field_name="embedding",
45
+ metric=cocoindex.VectorSimilarityMetric.COSINE_SIMILARITY)])
@@ -3,4 +3,4 @@ name = "gdrive-text-embedding"
3
3
  version = "0.1.0"
4
4
  description = "Simple example for cocoindex: build embedding index based on Google Drive files."
5
5
  requires-python = ">=3.11"
6
- dependencies = ["cocoindex>=0.1.30", "python-dotenv>=1.0.1"]
6
+ dependencies = ["cocoindex>=0.1.32", "python-dotenv>=1.0.1"]
@@ -0,0 +1 @@
1
+ COCOINDEX_DATABASE_URL="postgresql://cocoindex:cocoindex@127.0.0.1:5432/cocoindex"