Python Client for Indexify
Project description
Indexify Python SDK
This is the Python SDK to build real-time continuously running unstructured data processing pipelines with Indexify.
Start by writing and testing your pipelines locally using your data, then deploy them into the Indexify service to process data in real-time at scale.
Installation
pip install indexify
Examples
- Extracts text, tables and images from an ingested PDF file
- Indexes the text using MiniLM-L6-v2, the images with CLIP
- Writes the results into a vector database.
Youtube Transcription Summarizer
- Downloads Youtube Video
- Extracts audio from the video and transcribes using
Faster Whisper
- Uses Llama 3.1 backed by
Llama.cpp
to understand and classify the nature of the video. - Routes the transcription dynamically to one of the transcription summarizer to retain specific summarization attributes.
- Finally the entire transcription is embedded and stored in a vector database for retrieval.
Quick Start
- Write data processing functions in Python and use Pydantic objects for returning complex data types from functions
- Connect functions using a graph interface. Indexify automatically stores function outputs and passes them along to downstream functions.
- If a function returns a list, the downstream functions will be called with each item in the list in parallel.
- The input of the first function becomes the input to the HTTP endpoint of the Graph.
Functional Features
- There is NO limit to volume of data being ingested since we use blob stores for storing metadata and objects
- The server can handle 10s of 1000s of files being ingested into the graphs in parallel.
- The scheduler reacts under 8 microseconds to ingestion events, so it's suitable for workflows which needs to run in realtime.
- Batch ingestion is handled gracefully by batching ingested data and scheduling for high throughput in production settings.
from pydantic import BaseModel
from indexify import indexify_function
from typing import Dict, Any, Optional, List
# Define function inputs and outputs
class Document(BaseModel):
text: str
metadata: Dict[str, Any]
class TextChunk(BaseModel):
text: str
metadata: Dict[str, Any]
embedding: Optional[List[float]] = None
# Decorate a function which is going to be part of your data processing graph
@indexify_function()
def split_text(doc: Document) -> List[TextChunk]:
midpoint = len(doc.text) // 2
first_half = TextChunk(text=doc.text[:midpoint], metadata=doc.metadata)
second_half = TextChunk(text=doc.text[midpoint:], metadata=doc.metadata)
return [first_half, second_half]
# Any requirements specified is automatically installed in production clusters
@indexify_function(requirements=["langchain_text_splitter"])
def compute_embedding(chunk: TextChunk) -> TextChunk:
chunk.embedding = [0.1, 0.2, 0.3]
return chunk
# You can constrain functions to run on specific executors
@indexify_function(executor_runtime_name="postgres-driver-image")
def write_to_db(chunk: TextChunk):
# Write to your favorite vector database
...
## Create a graph
from indexify import Graph
g = Graph(name="my_graph", start_node=split_text)
g.add_edge(split_text, compute_embedding)
g.add_edge(embed_text, write_to_db)
Graph Execution
Every time the Graph is invoked, Indexify will provide an Invocation Id
which can be used to know about the status of the processing and any outputs from the Graph.
Run the Graph Locally
from indexify import IndexifyClient
client = IndexifyClient(local=True)
client.register_graph(g)
invocation_id = client.invoke_graph_with_object(g.name, Document(text="Hello, world!", metadata={"source": "test"}))
graph_outputs = client.graph_outputs(g.name, invocation_id)
Deploy the Graph to Indexify Server for Production
Work In Progress - The version of server that works with python based graphs haven't been released yet. It will be shortly released. Join discord for development updates.
from indexify import IndexifyClient
client = IndexifyClient(service_url="http://localhost:8900")
client.register_graph(g)
Ingestion into the Service
Extraction Graphs continuously run on the Indexify Service like any other web service. Indexify Server runs the extraction graphs in parallel and in real-time when new data is ingested into the service.
output_id = client.invoke_graph_with_object(g.name, Document(text="Hello, world!", metadata={"source": "test"}))
Retrieve Graph Outputs for a given ingestion object
graph_outputs = client.graph_outputs(g.name, output_id)
Retrieve All Graph Inputs
graph_inputs = client.graph_inputs(g.name)
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
Built Distribution
File details
Details for the file indexify-0.2.26.tar.gz
.
File metadata
- Download URL: indexify-0.2.26.tar.gz
- Upload date:
- Size: 33.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 951aed024b7b74e9af0e86ad51f181274ee257165e705b27de5758ff4361c3ab |
|
MD5 | 91622f6a71d3914f45bc86042495d201 |
|
BLAKE2b-256 | 1b1aee59dea873411aea239c4908feac9f3c68d398f482804fd009d8b3d92883 |
Provenance
The following attestation bundles were made for indexify-0.2.26.tar.gz
:
Publisher:
publish_indexify_pypi.yaml
on tensorlakeai/indexify
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
indexify-0.2.26.tar.gz
- Subject digest:
951aed024b7b74e9af0e86ad51f181274ee257165e705b27de5758ff4361c3ab
- Sigstore transparency entry: 147848074
- Sigstore integration time:
- Predicate type:
File details
Details for the file indexify-0.2.26-py3-none-any.whl
.
File metadata
- Download URL: indexify-0.2.26-py3-none-any.whl
- Upload date:
- Size: 43.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 893c2775f0ca9bd1900b6f60297bbf1378214199a5253024ac7503f8feb5cf97 |
|
MD5 | d0d2cb217f9f529174776b295113b185 |
|
BLAKE2b-256 | df94026745f3867412ea15a70bdb955e9dfd019ac3bf868c6f66db4f65cd2819 |
Provenance
The following attestation bundles were made for indexify-0.2.26-py3-none-any.whl
:
Publisher:
publish_indexify_pypi.yaml
on tensorlakeai/indexify
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
indexify-0.2.26-py3-none-any.whl
- Subject digest:
893c2775f0ca9bd1900b6f60297bbf1378214199a5253024ac7503f8feb5cf97
- Sigstore transparency entry: 147848075
- Sigstore integration time:
- Predicate type: