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.
- {cocoindex-0.1.32 → cocoindex-0.1.34}/Cargo.lock +1 -1
- {cocoindex-0.1.32 → cocoindex-0.1.34}/Cargo.toml +5 -2
- {cocoindex-0.1.32 → cocoindex-0.1.34}/PKG-INFO +59 -25
- {cocoindex-0.1.32 → cocoindex-0.1.34}/README.md +58 -24
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/core/flow_methods.mdx +3 -3
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/code_embedding/pyproject.toml +1 -1
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/docs_to_knowledge_graph/pyproject.toml +1 -1
- cocoindex-0.1.34/examples/fastapi_server_docker/.dockerignore +2 -0
- cocoindex-0.1.34/examples/fastapi_server_docker/.env +1 -0
- cocoindex-0.1.34/examples/fastapi_server_docker/README.md +10 -0
- cocoindex-0.1.34/examples/fastapi_server_docker/compose.yaml +18 -0
- cocoindex-0.1.34/examples/fastapi_server_docker/dockerfile +13 -0
- cocoindex-0.1.34/examples/fastapi_server_docker/main.py +30 -0
- cocoindex-0.1.34/examples/fastapi_server_docker/requirements.txt +5 -0
- cocoindex-0.1.34/examples/fastapi_server_docker/sample_code/main.py +113 -0
- cocoindex-0.1.34/examples/fastapi_server_docker/src/cocoindex_funs.py +45 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/gdrive_text_embedding/pyproject.toml +1 -1
- cocoindex-0.1.34/examples/image_search_example/.env +1 -0
- cocoindex-0.1.34/examples/image_search_example/README.md +61 -0
- cocoindex-0.1.34/examples/image_search_example/frontend/.gitignore +136 -0
- cocoindex-0.1.34/examples/image_search_example/frontend/index.html +12 -0
- cocoindex-0.1.34/examples/image_search_example/frontend/package-lock.json +1265 -0
- cocoindex-0.1.34/examples/image_search_example/frontend/package.json +18 -0
- cocoindex-0.1.34/examples/image_search_example/frontend/src/App.jsx +53 -0
- cocoindex-0.1.34/examples/image_search_example/frontend/src/main.jsx +10 -0
- cocoindex-0.1.34/examples/image_search_example/frontend/src/style.css +83 -0
- cocoindex-0.1.34/examples/image_search_example/frontend/vite.config.js +10 -0
- cocoindex-0.1.34/examples/image_search_example/img/cat1.jpeg +0 -0
- cocoindex-0.1.34/examples/image_search_example/img/dog1.jpeg +0 -0
- cocoindex-0.1.34/examples/image_search_example/img/elephant1.jpg +0 -0
- cocoindex-0.1.34/examples/image_search_example/img/giraffe.jpg +0 -0
- cocoindex-0.1.34/examples/image_search_example/main.py +125 -0
- cocoindex-0.1.34/examples/image_search_example/requirements.txt +5 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/manuals_llm_extraction/pyproject.toml +1 -1
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/pdf_embedding/pyproject.toml +1 -1
- cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/.env +3 -0
- cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/README.md +66 -0
- cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/img/cocoinsight.png +0 -0
- cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/img/neo4j.png +0 -0
- cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/main.py +185 -0
- cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/products/p1.json +22 -0
- cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/products/p2.json +22 -0
- cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/products/p3.json +22 -0
- cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/products/p4.json +22 -0
- cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/products/p5.json +22 -0
- cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/products/p6.json +22 -0
- cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/products/p7.json +26 -0
- cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/products/p8.json +21 -0
- cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/products/p9.json +21 -0
- cocoindex-0.1.34/examples/product_taxonomy_knowledge_graph/pyproject.toml +6 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding/pyproject.toml +1 -1
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding_qdrant/pyproject.toml +1 -1
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/__init__.py +1 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/cli.py +15 -14
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/flow.py +31 -51
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/setup.py +4 -4
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/base/spec.rs +232 -11
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/builder/analyzed_flow.rs +3 -3
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/db_tracking_setup.rs +13 -8
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/llm/anthropic.rs +16 -10
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/llm/gemini.rs +12 -6
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/factory_bases.rs +29 -5
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/interface.rs +6 -1
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/storages/neo4j.rs +127 -81
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/storages/postgres.rs +22 -6
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/storages/qdrant.rs +14 -4
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/py/mod.rs +98 -8
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/setup/components.rs +30 -38
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/setup/db_metadata.rs +10 -5
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/setup/driver.rs +99 -48
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/setup/states.rs +35 -42
- cocoindex-0.1.34/src/utils/yaml_ser.rs +731 -0
- cocoindex-0.1.32/src/utils/yaml_ser.rs +0 -349
- {cocoindex-0.1.32 → cocoindex-0.1.34}/.cargo/config.toml +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/.env.lib_debug +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/.github/ISSUE_TEMPLATE//360/237/220/233-bug-report.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/.github/ISSUE_TEMPLATE//360/237/222/241-feature-request.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/.github/scripts/update_version.sh +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/.github/workflows/CI.yml +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/.github/workflows/_test.yml +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/.github/workflows/docs.yml +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/.github/workflows/release.yml +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/.gitignore +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/.vscode/settings.json +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/CODE_OF_CONDUCT.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/CONTRIBUTING.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/LICENSE +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/dev/neo4j.yaml +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/dev/postgres.yaml +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/.gitignore +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/README.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/about/community.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/about/contributing.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/ai/llm.mdx +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/core/basics.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/core/cli.mdx +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/core/custom_function.mdx +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/core/data_example.svg +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/core/data_types.mdx +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/core/flow_def.mdx +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/core/flow_example.svg +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/core/initialization.mdx +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/getting_started/installation.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/getting_started/markdown_files.zip +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/getting_started/overview.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/getting_started/quickstart.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/ops/functions.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/ops/sources.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docs/ops/storages.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/docusaurus.config.ts +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/package.json +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/sidebars.ts +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/src/components/HomepageFeatures/index.tsx +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/src/components/HomepageFeatures/styles.module.css +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/src/css/custom.css +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/src/theme/Root.js +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/static/.nojekyll +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/static/img/docusaurus.png +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/static/img/favicon.ico +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/static/img/icon.svg +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/static/robots.txt +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/tsconfig.json +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/docs/yarn.lock +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/code_embedding/.env +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/code_embedding/README.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/code_embedding/main.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/docs_to_knowledge_graph/.env +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/docs_to_knowledge_graph/README.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/docs_to_knowledge_graph/main.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/docs_to_knowledge_graph/markdown_files/1706.03762v7.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/docs_to_knowledge_graph/markdown_files/1810.04805v2.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/docs_to_knowledge_graph/markdown_files/rfc8259.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/gdrive_text_embedding/.env.example +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/gdrive_text_embedding/.gitignore +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/gdrive_text_embedding/README.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/gdrive_text_embedding/data/1706.03762v7.docx +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/gdrive_text_embedding/data/1810.04805v2.docx +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/gdrive_text_embedding/main.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/manuals_llm_extraction/.env +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/manuals_llm_extraction/README.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/manuals_llm_extraction/main.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/manuals_llm_extraction/manuals/array.pdf +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/manuals_llm_extraction/manuals/base64.pdf +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/manuals_llm_extraction/manuals/copy.pdf +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/manuals_llm_extraction/manuals/glob.pdf +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/pdf_embedding/.env +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/pdf_embedding/README.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/pdf_embedding/main.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/pdf_embedding/pdf_files/1706.03762v7.pdf +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/pdf_embedding/pdf_files/1810.04805v2.pdf +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/pdf_embedding/pdf_files/rfc8259.pdf +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding/.env +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding/README.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding/Text_Embedding.ipynb +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding/main.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding/markdown_files/1706.03762v7.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding/markdown_files/1810.04805v2.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding/markdown_files/rfc8259.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding_qdrant/.env +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding_qdrant/README.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding_qdrant/main.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/examples/text_embedding_qdrant/markdown_files/rfc8259.md +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/pyproject.toml +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/auth_registry.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/convert.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/functions.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/index.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/lib.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/llm.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/op.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/py.typed +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/query.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/runtime.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/setting.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/sources.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/storages.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/tests/__init__.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/tests/test_convert.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/python/cocoindex/typing.py +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/base/field_attrs.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/base/json_schema.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/base/mod.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/base/schema.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/base/value.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/builder/analyzer.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/builder/flow_builder.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/builder/mod.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/builder/plan.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/db_tracking.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/dumper.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/evaluator.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/live_updater.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/memoization.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/mod.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/query.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/row_indexer.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/source_indexer.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/execution/stats.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/lib.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/lib_context.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/llm/mod.rs +2 -2
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/llm/ollama.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/llm/openai.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/functions/extract_by_llm.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/functions/mod.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/functions/parse_json.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/functions/split_recursively.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/mod.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/py_factory.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/registration.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/registry.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/sdk.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/sources/google_drive.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/sources/local_file.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/sources/mod.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/storages/mod.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/ops/storages/spec.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/prelude.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/py/convert.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/server.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/service/error.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/service/flows.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/service/mod.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/service/search.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/settings.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/setup/auth_registry.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/setup/mod.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/utils/db.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/utils/fingerprint.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/utils/immutable.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/utils/mod.rs +0 -0
- {cocoindex-0.1.32 → cocoindex-0.1.34}/src/utils/retriable.rs +0 -0
@@ -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.
|
5
|
+
version = "0.1.34"
|
6
6
|
edition = "2021"
|
7
7
|
|
8
|
-
|
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.
|
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
|
[](https://pypi.org/project/cocoindex/)
|
29
29
|
[](https://pypistats.org/packages/cocoindex)
|
30
30
|
|
31
|
-
<!-- [](https://www.python.org/) -->
|
32
31
|
[](https://github.com/cocoindex-io/cocoindex/actions/workflows/CI.yml)
|
33
32
|
[](https://github.com/cocoindex-io/cocoindex/actions/workflows/release.yml)
|
34
33
|
[](https://discord.com/invite/zpA9S2DR7s)
|
35
|
-
<!--[](https://www.linkedin.com/company/cocoindex) -->
|
36
|
-
<!--[](https://twitter.com/intent/follow?screen_name=cocoindex_io) -->
|
37
|
-
|
38
34
|
</div>
|
39
35
|
|
40
|
-
CocoIndex is
|
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://
|
69
|
+
<img src="https://github.com/user-attachments/assets/f4eb29b3-84ee-4fa0-a1e2-80eedeeabde6" alt="Incremental Processing" width="700">
|
43
70
|
</p>
|
44
|
-
|
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
|
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.
|
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
|
-
|
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
|
-
|
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
|
-

|
110
139
|
|
111
|
-
|
112
|
-
|
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
|
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 [](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
|
[](https://pypi.org/project/cocoindex/)
|
13
13
|
[](https://pypistats.org/packages/cocoindex)
|
14
14
|
|
15
|
-
<!-- [](https://www.python.org/) -->
|
16
15
|
[](https://github.com/cocoindex-io/cocoindex/actions/workflows/CI.yml)
|
17
16
|
[](https://github.com/cocoindex-io/cocoindex/actions/workflows/release.yml)
|
18
17
|
[](https://discord.com/invite/zpA9S2DR7s)
|
19
|
-
<!--[](https://www.linkedin.com/company/cocoindex) -->
|
20
|
-
<!--[](https://twitter.com/intent/follow?screen_name=cocoindex_io) -->
|
21
|
-
|
22
18
|
</div>
|
23
19
|
|
24
|
-
CocoIndex is
|
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://
|
53
|
+
<img src="https://github.com/user-attachments/assets/f4eb29b3-84ee-4fa0-a1e2-80eedeeabde6" alt="Incremental Processing" width="700">
|
27
54
|
</p>
|
28
|
-
|
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
|
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.
|
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
|
-
|
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
|
-
|
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
|
-

|
94
123
|
|
95
|
-
|
96
|
-
|
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
|
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 [](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.
|
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.
|
6
|
+
dependencies = ["cocoindex>=0.1.32", "python-dotenv>=1.0.1"]
|
@@ -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,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.
|
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"
|