Skip to main content

Indexify Extractor SDK

PyPI version

Indexify Extractor SDK is for developing new extractors to extract information from any unstructured data sources.

We already have a few extractors here - https://github.com/tensorlakeai/indexify If you don't find one that works for your use-case use this SDK to build one.

Install the SDK

Install the SDK from PyPi

virtualenv ve
source ve/bin/activate
pip install indexify-extractor-sdk

Implement the extractor SDK

There are two ways to implement an extractor. If you don't need any setup/teardown or additional functionality, check out the decorator:

from indexify_extractor_sdk import Content, extractor

@extractor()
def my_extractor(content: Content, params: dict) -> List[Content]:
    return [
        Content.from_text(
            text="Hello World",
            features=[
                Feature.embedding(values=[1, 2, 3]),
                Feature.metadata(json.loads('{"a": 1, "b": "foo"}')),
            ],
            labels={"url": "test.com"},
        ),
        Content.from_text(
            text="Pipe Baz",
            features=[Feature.embedding(values=[1, 2, 3])],
            labels={"url": "test.com"},
        ),
    ]

Note: @extractor() takes many parameters, check out the documentation for more details.

For more advanced use cases, check out the class:

from indexify_extractor_sdk import Content, Extractor, Feature
from pydantic import BaseModel

class InputParams(BaseModel):
    pass

class MyExtractor(Extractor):
    input_mime_types = ["text/plain", "application/pdf", "image/jpeg"]

    def __init__(self):
        super().__init__()

    def extract(self, content: Content, params: InputParams) -> List[Content]:
        return [
            Content.from_text(
                text="Hello World",
                features=[
                    Feature.embedding(values=[1, 2, 3]),
                    Feature.metadata(json.loads('{"a": 1, "b": "foo"}')),
                ],
                labels={"url": "test.com"},
            ),
            Content.from_text(
                text="Pipe Baz",
                features=[Feature.embedding(values=[1, 2, 3])],
                labels={"url": "test.com"},
            ),
        ]

    def sample_input(self) -> Content:
        return Content.from_text("hello world")

Test the extractor

You can run the extractor locally using the command line tool attached to the SDK like this, by passing some arbitrary text or a file.

indexify-extractor local my_extractor:MyExtractor --text "hello"

Deploy the extractor

Once you are ready to deploy the new extractor and ready to build pipelines with it. Package the extractor and deploy as many copies you want, and point it to the indexify server. Indexify server has two addresses, one for sending your extractor the extraction task, and another endpoint for your extractor to write the extracted content.

indexify-extractor join-server --coordinator-addr localhost:8950 --ingestion-addr:8900

Metadata

Release files for indexify-extractor-sdk 0.0.92

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for indexify-extractor-sdk 0.0.92
File Size Uploaded Provenance Actions
indexify_extractor_sdk-0.0.92.tar.gz 49.4 kB Without provenance Details for indexify_extractor_sdk-0.0.92.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for indexify-extractor-sdk 0.0.92
File Interpreter ABI Platform Actions
indexify_extractor_sdk-0.0.92-py3-none-any.whl Python 3 none any Details for indexify_extractor_sdk-0.0.92-py3-none-any.whl

Total release size: 111.1 kB

Release files / indexify_extractor_sdk-0.0.92.tar.gz

Download URL indexify_extractor_sdk-0.0.92.tar.gz
Size 49.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ed569429ecd95902fb77393e6c7f121a4e3ab40a5d018796f7472f9e82ec26b8
BLAKE2b-256 checksum
How to use checksums
8aeb30938c69108035827cb42444adf5ff4af2edaba7120fd4669764c1f34458
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Release files / indexify_extractor_sdk-0.0.92-py3-none-any.whl

Download URL indexify_extractor_sdk-0.0.92-py3-none-any.whl
Size 61.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c72adaa43cd30edae806499cf7c1845b8ea40a90a1165f7d0ead7d1706e42d9
BLAKE2b-256 checksum
How to use checksums
20c57ad8f07df37460077fff79c4974331fa88ed8742adfacecc74d4b58e2079
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.5

Security for indexify-extractor-sdk 0.0.92

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.92 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page