# txtai

> All-in-one embeddings database for semantic search, LLM orchestration, and RAG

- Category: Retrieval & Knowledge (RAG) / RAG Frameworks & Platforms
- Language: Python
- Licence: Apache-2.0
- Repository: https://github.com/neuml/txtai
- Website: https://neuml.github.io/txtai
- Canonical page: https://ai-tldr.dev/tools/txtai/

## In short

txtai is an open-source AI framework built around an embeddings database that combines vector indexes (sparse and dense), graph networks, and relational databases. You can index text, documents, audio, images, and video, then run vector search over them or use the index as a knowledge source for LLM applications. It sits in the RAG Frameworks & Platforms category of the Retrieval & Knowledge (RAG) tools and is open-source, written in Python and licensed Apache-2.0.

## Overview

txtai is an open-source AI framework built around an embeddings database that combines vector indexes (sparse and dense), graph networks, and relational databases. You can index text, documents, audio, images, and video, then run vector search over them or use the index as a knowledge source for LLM applications.

It is aimed at Python developers who want to build semantic search, retrieval augmented generation (RAG), and multi-model workflows without wiring together several separate services. Pipelines wrap language-model tasks such as question answering, summarization, transcription, and translation, and workflows join those pipelines into larger processes.

Within the RAG frameworks category, txtai bundles the vector store, retrieval, pipelines, and agents into one package. It runs locally so your data stays on your machine, and it ships with sensible defaults plus a web and Model Context Protocol (MCP) API for use from other languages.

## What it does

- Embeddings database that unites sparse and dense vector indexes, graph networks, and relational storage
- Vector search with SQL, object storage, topic modeling, and graph analysis, plus multimodal indexing across text, documents, audio, images, and video
- Pipelines for LLM prompts, question answering, labeling, transcription, translation, and summarization
- Workflows that chain pipelines together to build microservices or multi-model processes
- Agents that connect embeddings, pipelines, workflows, and other agents to solve multi-step tasks
- Web and Model Context Protocol (MCP) APIs with bindings for JavaScript, Java, Rust, and Go

## Getting started

Install txtai with pip, then build an embeddings index and run a search in a few lines of Python.

1. Install txtai

   Install the package from PyPI. txtai requires Python 3.10 or later.

```bash
pip install txtai
```

2. Index and search

   Create an Embeddings instance, index a few records, and run a semantic search.

```python
import txtai

embeddings = txtai.Embeddings()
embeddings.index(["Correct", "Not what we hoped"])
embeddings.search("positive", 1)
#[(0, 0.29862046241760254)]
```

3. Serve it as an API (optional)

   Define an embeddings config in a YAML file and run it behind the built-in FastAPI service.

```yaml
# app.yml
embeddings:
    path: sentence-transformers/all-MiniLM-L6-v2
```

4. Start the API server

   Launch the API with uvicorn and query it over HTTP.

```bash
CONFIG=app.yml uvicorn "txtai.api:app"
curl -X GET "http://localhost:8000/search?query=positive"
```

## When to use it

- Build a semantic or similarity search application that matches on meaning instead of exact keywords
- Power a RAG pipeline by using the embeddings database as the retrieval source for an LLM
- Run language-model pipelines for summarization, translation, transcription, or question answering
- Chain pipelines into workflows or autonomous agents that solve multi-step tasks
