Skip to main content

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.

Project description

CocoIndex

Data transformation for AI

GitHub Documentation License PyPI version PyPI - Downloads CI release Discord

cocoindex-io%2Fcocoindex | Trendshift

Ultra performant data transformation framework for AI, with core engine written in Rust. Support incremental processing and data lineage out-of-box. Exceptional developer velocity. Production-ready at day 0.

⭐ Drop a star to help us grow!


CocoIndex Transformation


CocoIndex makes it super easy to transform data with AI workloads, and keep source data and target in sync effortlessly.


CocoIndex Features


Either creating embedding, building knowledge graphs, or any data transformations - beyond traditional SQL.

Exceptional velocity

Just declare transformation in dataflow with ~100 lines of python

# import
data['content'] = flow_builder.add_source(...)

# transform
data['out'] = data['content']
    .transform(...)
    .transform(...)

# collect data
collector.collect(...)

# export to db, vector db, graph db ...
collector.export(...)

CocoIndex follows the idea of Dataflow 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.

Particularly, developers don't explicitly mutate data by creating, updating and deleting. They just need to define transformation/formula for a set of source data.

Build like LEGO

Native builtins for different source, targets and transformations. Standardize interface, make it 1-line code switch between different components.

CocoIndex Features

Data Freshness

CocoIndex keep source data and target in sync effortlessly.

Incremental Processing

It has out-of-box support for incremental indexing:

  • minimal recomputation on source or logic change.
  • (re-)processing necessary portions; reuse cache when possible

Quick Start:

If you're new to CocoIndex, we recommend checking out

Setup

  1. Install CocoIndex Python library
pip install -U cocoindex
  1. Install Postgres if you don't have one. CocoIndex uses it for incremental processing.

Define data flow

Follow Quick Start Guide to define your first indexing flow. An example flow looks like:

@cocoindex.flow_def(name="TextEmbedding")
def text_embedding_flow(flow_builder: cocoindex.FlowBuilder, data_scope: cocoindex.DataScope):
    # Add a data source to read files from a directory
    data_scope["documents"] = flow_builder.add_source(cocoindex.sources.LocalFile(path="markdown_files"))

    # Add a collector for data to be exported to the vector index
    doc_embeddings = data_scope.add_collector()

    # Transform data of each document
    with data_scope["documents"].row() as doc:
        # Split the document into chunks, put into `chunks` field
        doc["chunks"] = doc["content"].transform(
            cocoindex.functions.SplitRecursively(),
            language="markdown", chunk_size=2000, chunk_overlap=500)

        # Transform data of each chunk
        with doc["chunks"].row() as chunk:
            # Embed the chunk, put into `embedding` field
            chunk["embedding"] = chunk["text"].transform(
                cocoindex.functions.SentenceTransformerEmbed(
                    model="sentence-transformers/all-MiniLM-L6-v2"))

            # Collect the chunk into the collector.
            doc_embeddings.collect(filename=doc["filename"], location=chunk["location"],
                                   text=chunk["text"], embedding=chunk["embedding"])

    # Export collected data to a vector index.
    doc_embeddings.export(
        "doc_embeddings",
        cocoindex.targets.Postgres(),
        primary_key_fields=["filename", "location"],
        vector_indexes=[
            cocoindex.VectorIndexDef(
                field_name="embedding",
                metric=cocoindex.VectorSimilarityMetric.COSINE_SIMILARITY)])

It defines an index flow like this:

Data Flow

🚀 Examples and demo

Example Description
Text Embedding Index text documents with embeddings for semantic search
Code Embedding Index code embeddings for semantic search
PDF Embedding Parse PDF and index text embeddings for semantic search
Manuals LLM Extraction Extract structured information from a manual using LLM
Amazon S3 Embedding Index text documents from Amazon S3
Azure Blob Storage Embedding Index text documents from Azure Blob Storage
Google Drive Text Embedding Index text documents from Google Drive
Docs to Knowledge Graph Extract relationships from Markdown documents and build a knowledge graph
Embeddings to Qdrant Index documents in a Qdrant collection for semantic search
FastAPI Server with Docker Run the semantic search server in a Dockerized FastAPI setup
Product Recommendation Build real-time product recommendations with LLM and graph database
Image Search with Vision API Generates detailed captions for images using a vision model, embeds them, enables live-updating semantic search via FastAPI and served on a React frontend
Face Recognition Recognize faces in images and build embedding index
Paper Metadata Index papers in PDF files, and build metadata tables for each paper
Custom Output Files Convert markdown files to HTML files and save them to a local directory, using CocoIndex Custom Targets

More coming and stay tuned 👀!

📖 Documentation

For detailed documentation, visit CocoIndex Documentation, including a Quickstart guide.

🤝 Contributing

We love contributions from our community ❤️. For details on contributing or running the project for development, check out our contributing guide.

👥 Community

Welcome with a huge coconut hug 🥥⋆。˚🤗. We are super excited for community contributions of all kinds - whether it's code improvements, documentation updates, issue reports, feature requests, and discussions in our Discord.

Join our community here:

Support us:

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 to stay tuned and help us grow.

License

CocoIndex is Apache 2.0 licensed.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cocoindex-0.1.76.tar.gz (10.6 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

cocoindex-0.1.76-pp311-pypy311_pp73-manylinux_2_28_aarch64.whl (15.7 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ ARM64

cocoindex-0.1.76-cp313-cp313t-manylinux_2_28_aarch64.whl (15.7 MB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.28+ ARM64

cocoindex-0.1.76-cp313-cp313-win_amd64.whl (15.6 MB view details)

Uploaded CPython 3.13Windows x86-64

cocoindex-0.1.76-cp313-cp313-manylinux_2_28_x86_64.whl (16.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

cocoindex-0.1.76-cp313-cp313-manylinux_2_28_aarch64.whl (15.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

cocoindex-0.1.76-cp313-cp313-macosx_11_0_arm64.whl (15.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

cocoindex-0.1.76-cp313-cp313-macosx_10_12_x86_64.whl (16.0 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

cocoindex-0.1.76-cp312-cp312-win_amd64.whl (15.6 MB view details)

Uploaded CPython 3.12Windows x86-64

cocoindex-0.1.76-cp312-cp312-manylinux_2_28_x86_64.whl (16.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

cocoindex-0.1.76-cp312-cp312-manylinux_2_28_aarch64.whl (15.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

cocoindex-0.1.76-cp312-cp312-macosx_11_0_arm64.whl (15.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

cocoindex-0.1.76-cp312-cp312-macosx_10_12_x86_64.whl (16.0 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

cocoindex-0.1.76-cp311-cp311-win_amd64.whl (15.6 MB view details)

Uploaded CPython 3.11Windows x86-64

cocoindex-0.1.76-cp311-cp311-manylinux_2_28_x86_64.whl (16.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

cocoindex-0.1.76-cp311-cp311-manylinux_2_28_aarch64.whl (15.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

cocoindex-0.1.76-cp311-cp311-macosx_11_0_arm64.whl (15.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

cocoindex-0.1.76-cp311-cp311-macosx_10_12_x86_64.whl (16.0 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

Details for the file cocoindex-0.1.76.tar.gz.

File metadata

  • Download URL: cocoindex-0.1.76.tar.gz
  • Upload date:
  • Size: 10.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.9.2

File hashes

Hashes for cocoindex-0.1.76.tar.gz
Algorithm Hash digest
SHA256 ed138fbb33bfc60e2e88b2ea1d3e577e022df80194c616e337e093d60a66680b
MD5 7917213bce552bf4a3058eecf2530fe8
BLAKE2b-256 b52d90ae1546b8dd1ca9b5cc65fbefe8ee641cbc4071535083c9b3fe21fc632a

See more details on using hashes here.

File details

Details for the file cocoindex-0.1.76-pp311-pypy311_pp73-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cocoindex-0.1.76-pp311-pypy311_pp73-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 37f331031b2edc3034274fb5426ca63e4339448cb4404fee4c0d8082f152e6a0
MD5 af9ea076dca6091ac3ded330df439a67
BLAKE2b-256 7b10bdd25be864e9338e1efa971c6d5bf94f9d8426e1baebd2b45570723ed408

See more details on using hashes here.

File details

Details for the file cocoindex-0.1.76-cp313-cp313t-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cocoindex-0.1.76-cp313-cp313t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6b606a32730d7722ab3f72001dd5535707036e7880ad0a7d1382d58b580e4fa6
MD5 ab2808924a1f5e3ef520b9ad89dfbdfb
BLAKE2b-256 20b4bdfb5ce52cff7b1280eadd7764d846d29acee13f7fe926ceceed21e58541

See more details on using hashes here.

File details

Details for the file cocoindex-0.1.76-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for cocoindex-0.1.76-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2cc7ec5391d2607c277a28a8e2acefb3ef2274772bd0cac54eff6e5a6dc8fac0
MD5 f340d82cc1eb0a20b91d81e5deeda0a3
BLAKE2b-256 d0b7546cd8368a9ee9c9555aeb45b312bfc2ca37ef83de62af8704725ade5c96

See more details on using hashes here.

File details

Details for the file cocoindex-0.1.76-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cocoindex-0.1.76-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0970bfce71630880dfafbd54987df6aa578d3772baa4f26167eb7f8750d02f48
MD5 46d7eafdd11458a998b861d6be2c5209
BLAKE2b-256 10ecd08b16a9f47bd2dcaf9e4a3f717ae9bfd0dd7ec2649793cd4d686ee04e6a

See more details on using hashes here.

File details

Details for the file cocoindex-0.1.76-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cocoindex-0.1.76-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 cd8fb7ed5be63f9155e732385149fbeb04ecda0c7d60c1a8c9e16e4400bd989e
MD5 cd9a18e6dca8b6e7ca7901c0061faa75
BLAKE2b-256 b3d157aa92a59bbcb7440995fc4742cd5f2f7e8809c313bda69993460219e822

See more details on using hashes here.

File details

Details for the file cocoindex-0.1.76-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cocoindex-0.1.76-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 80260d6fdff13a8b55cf74de69a5ce988d309d64df5b599247c1b60de3195972
MD5 bf4340d2b7b47ce911bd9246039bc454
BLAKE2b-256 55b09ff333c4961acf8a4d12b119bb6e858ea25931695e56bfffb94e92fb9db7

See more details on using hashes here.

File details

Details for the file cocoindex-0.1.76-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for cocoindex-0.1.76-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 18ea23b69f9b3586f49db4a02110a3c9df020d98aa124c2e88412aea1ec1d6f8
MD5 60dc7c6588ff465a3a9b3801218e227e
BLAKE2b-256 3e8cc1217f017f0173b53e3778f5a36bca4a7b0c28ea18e617f06e8f369c561a

See more details on using hashes here.

File details

Details for the file cocoindex-0.1.76-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for cocoindex-0.1.76-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 cd48047b587e01c26063140cd208d07844f4c1588d9cb22ea5fd26c6b40dc5e1
MD5 dcff82b3c2e34d10473165ea94946185
BLAKE2b-256 6b3fe87c3c39a4488df75c8b1bd769e2c59b354d41b436e6081f3a8e496ed90d

See more details on using hashes here.

File details

Details for the file cocoindex-0.1.76-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cocoindex-0.1.76-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 534e2b86df277259e0d0e3df44f18074b30ca7344d035928b05323dea5beb7d7
MD5 1e008c2507a33cdbb7c73000a2f09732
BLAKE2b-256 07e2f5b27706a20556e9f53333e6a1ef971aeb91c65c183efe886def5fbeda89

See more details on using hashes here.

File details

Details for the file cocoindex-0.1.76-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cocoindex-0.1.76-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6d08d66e5f5fa739dca0e8e85aa36dd65dae1f34c291182165ce55694449c851
MD5 fb934f5a0b682e9fa7694b6f191dff0b
BLAKE2b-256 be0e3d64ecd1f07ebd97e25c7ba253babd956cc5061e12be3d7c6ec3b63fdff1

See more details on using hashes here.

File details

Details for the file cocoindex-0.1.76-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cocoindex-0.1.76-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a12a51d66822b6c38f366b828409d66a93c59bb1b400e9d7ead3f13e5b56569f
MD5 6f39d9d9c5081f1050255a703a002e4e
BLAKE2b-256 b53faf1a911512dc37d1b20d1cf3bdf686e5c8d64a12fc827f55d166e854d576

See more details on using hashes here.

File details

Details for the file cocoindex-0.1.76-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for cocoindex-0.1.76-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f7a51773753d4cf4477e11eb934e28bad22ed686a383bbe4f16a7c1b9cef4b6a
MD5 bf19f49022ade6b4a67337a607e55f1b
BLAKE2b-256 6deb581325111233d525eac28357e072a89b98601e7205468c8b28078c921d6e

See more details on using hashes here.

File details

Details for the file cocoindex-0.1.76-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for cocoindex-0.1.76-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f69c8a3acde45a736613e4dc518e9990b0b082494b656e4ced6976482cf8b138
MD5 fa59e80d27966277ce106eddf9025ce7
BLAKE2b-256 0159c828512a55f11ca3481435edfbf14bf4d4e731beddf8ec8ac787279f3783

See more details on using hashes here.

File details

Details for the file cocoindex-0.1.76-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cocoindex-0.1.76-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5310ba19f65e2e6063456e6c9ea66b9c70c089207cf93bd2d63d65b815653d90
MD5 894e95944702f5081a2900f53464cae0
BLAKE2b-256 393b42c8560622e4d377d1cbaae8ce3e14ad7e4a9562d95b7fc8ef5025ef457f

See more details on using hashes here.

File details

Details for the file cocoindex-0.1.76-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for cocoindex-0.1.76-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 da38606650fb81ac39b7bc9425e8c9f83eb6e60926cd230b5e03153c4c7e0a2e
MD5 316affd4e25a56ac3c04f4967cfe16a0
BLAKE2b-256 fc5e08db325d404afef9e54dcf4ff8920c0331646938a9de58dc450bdfa01458

See more details on using hashes here.

File details

Details for the file cocoindex-0.1.76-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for cocoindex-0.1.76-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 828a9e46f57d9a5d125a4b394c20c7769011afea4fc8d9f6df08a6788d44b401
MD5 fde0644dc3924198e6076477beaf03dd
BLAKE2b-256 50b8f871350a2f54b6382e55983ce691cc8de2bed3532a6ee12e83485e360d06

See more details on using hashes here.

File details

Details for the file cocoindex-0.1.76-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for cocoindex-0.1.76-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 92f7e7c0700dee4ebedd24750f92c676dcffbcc8fa0b5f9c674b7231cbbc15a6
MD5 b88819918548db03b3668ac1e778bd30
BLAKE2b-256 b51e222765b7a7f485ba7e8131dde92428ec7d1d82d02135495aeb1ce2f6341b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page