Skip to content

Examples

examples examples

See below for a comprehensive series of example notebooks and applications covering txtai.

Build semantic/similarity/vector/neural search applications.

Notebook Description
Introducing txtai ▶️ Overview of the functionality provided by txtai Open In Colab
Build an Embeddings index with Hugging Face Datasets Index and search Hugging Face Datasets Open In Colab
Build an Embeddings index from a data source Index and search a data source with word embeddings Open In Colab
Add semantic search to Elasticsearch Add semantic search to existing search systems Open In Colab
Similarity search with images Embed images and text into the same space for search Open In Colab
Custom Embeddings SQL functions Add user-defined functions to Embeddings SQL Open In Colab
Model explainability Explainability for semantic search Open In Colab
Query translation Domain-specific natural language queries with query translation Open In Colab
Build a QA database Question matching with semantic search Open In Colab
Semantic Graphs Explore topics, data connectivity and run network analysis Open In Colab
Topic Modeling with BM25 Topic modeling backed by a BM25 index Open In Colab

LLM

LLM chains, retrieval augmented generation (RAG), chat with your data, pipelines and workflows that interface with large language models (LLMs).

Notebook Description
Prompt-driven search with LLMs Embeddings-guided and Prompt-driven search with Large Language Models (LLMs) Open In Colab
Prompt templates and task chains Build model prompts and connect tasks together with workflows Open In Colab
Build RAG pipelines with txtai Guide on retrieval augmented generation including how to create citations Open In Colab
Integrate LLM frameworks Integrate llama.cpp, LiteLLM and custom generation frameworks Open In Colab
Generate knowledge with Semantic Graphs and RAG Knowledge exploration and discovery with Semantic Graphs and RAG Open In Colab
Build knowledge graphs with LLMs Build knowledge graphs with LLM-driven entity extraction Open In Colab
Advanced RAG with graph path traversal Graph path traversal to collect complex sets of data for advanced RAG Open In Colab

Pipelines

Transform data with language model backed pipelines.

Notebook Description
Extractive QA with txtai Introduction to extractive question-answering with txtai Open In Colab
Extractive QA with Elasticsearch Run extractive question-answering queries with Elasticsearch Open In Colab
Extractive QA to build structured data Build structured datasets using extractive question-answering Open In Colab
Apply labels with zero shot classification Use zero shot learning for labeling, classification and topic modeling Open In Colab
Building abstractive text summaries Run abstractive text summarization Open In Colab
Extract text from documents Extract text from PDF, Office, HTML and more Open In Colab
Text to speech generation Generate speech from text Open In Colab
Transcribe audio to text Convert audio files to text Open In Colab
Translate text between languages Streamline machine translation and language detection Open In Colab
Generate image captions and detect objects Captions and object detection for images Open In Colab
Near duplicate image detection Identify duplicate and near-duplicate images Open In Colab

Workflows

Efficiently process data at scale.

Notebook Description
Run pipeline workflows ▶️ Simple yet powerful constructs to efficiently process data Open In Colab
Transform tabular data with composable workflows Transform, index and search tabular data Open In Colab
Tensor workflows Performant processing of large tensor arrays Open In Colab
Entity extraction workflows Identify entity/label combinations Open In Colab
Workflow Scheduling Schedule workflows with cron expressions Open In Colab
Push notifications with workflows Generate and push notifications with workflows Open In Colab
Pictures are a worth a thousand words Generate webpage summary images with DALL-E mini Open In Colab
Run txtai with native code Execute workflows in native code with the Python C API Open In Colab

Model Training

Train NLP models.

Notebook Description
Train a text labeler Build text sequence classification models Open In Colab
Train without labels Use zero-shot classifiers to train new models Open In Colab
Train a QA model Build and fine-tune question-answering models Open In Colab
Train a language model from scratch Build new language models Open In Colab
Export and run models with ONNX Export models with ONNX, run natively in JavaScript, Java and Rust Open In Colab
Export and run other machine learning models Export and run models from scikit-learn, PyTorch and more Open In Colab

Scale

Run distributed txtai, integrate with the API and cloud endpoints.

Notebook Description
API Gallery Using txtai in JavaScript, Java, Rust and Go Open In Colab
Distributed embeddings cluster Distribute an embeddings index across multiple data nodes Open In Colab
Embeddings in the Cloud Load and use an embeddings index from the Hugging Face Hub Open In Colab
Custom API Endpoints Extend the API with custom endpoints Open In Colab
API Authorization and Authentication Add authorization, authentication and middleware dependencies to the API Open In Colab

Architecture

Deep dives into project architecture, data formats, benchmarks, and performance.

Notebook Description
Anatomy of a txtai index Deep dive into the file formats behind a txtai embeddings index Open In Colab
Embeddings components Composable search with vector, SQL and scoring components Open In Colab
Customize your own embeddings database Ways to combine vector indexes with relational databases Open In Colab
Building an efficient sparse keyword index in Python Fast and accurate sparse keyword indexing Open In Colab
Benefits of hybrid search Improve accuracy with a combination of semantic and keyword search Open In Colab
External database integration Store metadata in PostgreSQL, MariaDB, MySQL and more Open In Colab
All about vector quantization Benchmarking scalar and product quantization methods Open In Colab
External vectorization Vectorization with precomputed embeddings datasets and APIs Open In Colab

Releases

New functionality added in major releases.

Notebook Description
What's new in txtai 4.0 Content storage, SQL, object storage, reindex and compressed indexes Open In Colab
What's new in txtai 6.0 Sparse, hybrid and subindexes for embeddings, LLM improvements Open In Colab
What's new in txtai 7.0 Semantic graph 2.0, LoRA/QLoRA training and binary API support Open In Colab

Applications

Series of example applications with txtai. Links to hosted versions on Hugging Face Spaces are also provided, when available.

Application Description
Basic similarity search Basic similarity search example. Data from the original txtai demo. 🤗
Baseball stats Match historical baseball player stats using vector search. 🤗
Benchmarks Calculate performance metrics for the BEIR datasets. Local run only
Book search Book similarity search application. Index book descriptions and query using natural language statements. Local run only
Image search Image similarity search application. Index a directory of images and run searches to identify images similar to the input query. 🤗
Summarize an article Summarize an article. Workflow that extracts text from a webpage and builds a summary. 🤗
Wiki search Wikipedia search application. Queries Wikipedia API and summarizes the top result. 🤗
Workflow builder Build and execute txtai workflows. Connect summarization, text extraction, transcription, translation and similarity search pipelines together to run unified workflows. 🤗