Indexify
Compute Engine for Building and Serving Multi-Stage Data-Intensive Workflows
Indexify is a compute framework for building durable data-intensive workflows and serving them as APIs. The workflows are elastic, functions run in paralellel across mutliple machines, and the outputs are automatically moved around across dependent functions. The Graphs are served as live API endpoints for seamless integration with existing systems.
Key Features
- Conditional Branching and Data Flow: Router functions can dynamically chose one or more edges in Graph making it easy to invoke expert models based on inputs.
- Local Inference: Run LLMs in workflow functions using LLamaCPP, vLLM, or Hugging Face Transformers.
- Distributed Map and Reduce: Automatically parallelizes functions over sequences across multiple machines. Reducer functions are durable and invoked as map functions finish.
- Version Graphs and Backfill: Backfill API to update previously processed data when functions or models are updated.
- Request Queuing and Batching: Automatically queues and batches parallel workflow invocations to maximize GPU utilization.
Workflows were traditionally written as a sequence of steps. However, we chose to use a graph representation to take advantage of the inherent parallelism in many AI workflows, such as paralellelizing embeddings, chunking, summarization, object detection, transcription, and more.
A webscraper and summarizer workflow built using Indexify.
Quick Start
Letโs build a workflow to summarize a website! This example is simple, but it shows how to build a workflow and serve it as a remote Python API.
Install
Install the Indexify SDK.
pip install indexify
Define the Graph
We will write two functions, scrape_website
and summarize_text
.
We create a Graph website-summarizer
that executes the scrape function, and then executes the summarizer with the outputs of the scraper.
from indexify import indexify_function, Graph
@indexify_function()
def scrape_website(url: str) -> str:
import requests
return requests.get(f"http://r.jina.ai/{url}").text
@indexify_function()
def summarize_text(text: str) -> str:
from openai import OpenAI
completion = OpenAI().chat.completiions.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a helpful assistant. Generate a summary of this website"},
{"role": "user", "content": text},
],
)
return completion.choices[0].message.content
g = Graph(name="website-summarizer", start_node=scrape_website)
g.add_edge(scrape_website, summarize_text)
Test the Graph In-Process
The graph can be run as-is, this is useful for testing.
g.run(url="https://en.wikipedia.org/wiki/Golden_State_Warriors")
Deploying a Graph as an Remote API
When itโs time to consume your graph from other applications, you can serve it as an API. You can run the server in production in many ways, but here we run this in our laptop to show how it works.
indexify-cli server-dev-mode
This starts the following processes -
- Server: Orchestrates functions in the graph, stores execution state, and hosts Remote Graph APIs.
- Executor: Runs the individual functions in the graph.
Once the server is ready, you can deploy the graph -
from indexify import RemoteGraph
RemoteGraph.deploy(g, server_url="http://localhost:8900")
Call a Graph Endpoint
Once the graph is deployed, you can get a reference of the Graph in any application.
graph = RemoteGraph.by_name(name="website-summarizer", server_url="http://localhost:8900")
You can now call the graph as a remote API.
invocation_id = graph.run(blocking_until_done=True, url="https://en.wikipedia.org/wiki/Golden_State_Warriors")
results = graph.output(invocation_id)
Key Concepts
Learn about the key concepts in Indexify, such as Graphs, Functions, and Images.
Packaging Dependencies
A detailed example of text, table and image extraction from PDF. It also covers building image and text indexes and doing cross-modal retrieval, re-ranking, and reciproal rank fusion.
Deployment
Deployment of Indexify in various environments - Bare Metal, Docker Compose, and Kubernetes.
Was this page helpful?