Home

Awesome

<p align="center"> <img src="https://raw.githubusercontent.com/neuml/txtai/master/logo.png"/> </p> <p align="center"> <b>All-in-one embeddings database</b> </p> <p align="center"> <a href="https://github.com/neuml/txtai/releases"> <img src="https://img.shields.io/github/release/neuml/txtai.svg?style=flat&color=success" alt="Version"/> </a> <a href="https://github.com/neuml/txtai"> <img src="https://img.shields.io/github/last-commit/neuml/txtai.svg?style=flat&color=blue" alt="GitHub last commit"/> </a> <a href="https://github.com/neuml/txtai/issues"> <img src="https://img.shields.io/github/issues/neuml/txtai.svg?style=flat&color=success" alt="GitHub issues"/> </a> <a href="https://join.slack.com/t/txtai/shared_invite/zt-1cagya4yf-DQeuZbd~aMwH5pckBU4vPg"> <img src="https://img.shields.io/badge/slack-join-blue?style=flat&logo=slack&logocolor=white" alt="Join Slack"/> </a> <a href="https://github.com/neuml/txtai/actions?query=workflow%3Abuild"> <img src="https://github.com/neuml/txtai/workflows/build/badge.svg" alt="Build Status"/> </a> <a href="https://coveralls.io/github/neuml/txtai?branch=master"> <img src="https://img.shields.io/coverallsCoverage/github/neuml/txtai" alt="Coverage Status"> </a> </p>

txtai is an all-in-one embeddings database for semantic search, LLM orchestration and language model workflows.

architecture architecture

Embeddings databases are a union of vector indexes (sparse and dense), graph networks and relational databases.

This foundation enables vector search and/or serves as a powerful knowledge source for large language model (LLM) applications.

Build autonomous agents, retrieval augmented generation (RAG) processes, multi-model workflows and more.

Summary of txtai features:

txtai is built with Python 3.9+, Hugging Face Transformers, Sentence Transformers and FastAPI. txtai is open-source under an Apache 2.0 license.

Interested in an easy and secure way to run hosted txtai applications? Then join the txtai.cloud preview to learn more.

Why txtai?

why why

New vector databases, LLM frameworks and everything in between are sprouting up daily. Why build with txtai?

# Get started in a couple lines
import txtai

embeddings = txtai.Embeddings()
embeddings.index(["Correct", "Not what we hoped"])
embeddings.search("positive", 1)
#[(0, 0.29862046241760254)]
# app.yml
embeddings:
    path: sentence-transformers/all-MiniLM-L6-v2
CONFIG=app.yml uvicorn "txtai.api:app"
curl -X GET "http://localhost:8000/search?query=positive"

Use Cases

The following sections introduce common txtai use cases. A comprehensive set of over 60 example notebooks and applications are also available.

Semantic Search

Build semantic/similarity/vector/neural search applications.

demo

Traditional search systems use keywords to find data. Semantic search has an understanding of natural language and identifies results that have the same meaning, not necessarily the same keywords.

search search

Get started with the following examples.

NotebookDescription
Introducing txtai ▶️Overview of the functionality provided by txtaiOpen In Colab
Similarity search with imagesEmbed images and text into the same space for searchOpen In Colab
Build a QA databaseQuestion matching with semantic searchOpen In Colab
Semantic GraphsExplore topics, data connectivity and run network analysisOpen In Colab

LLM Orchestration

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

llm

See below to learn more.

NotebookDescription
Prompt templates and task chainsBuild model prompts and connect tasks together with workflowsOpen In Colab
Integrate LLM frameworksIntegrate llama.cpp, LiteLLM and custom generation frameworksOpen In Colab
Build knowledge graphs with LLMsBuild knowledge graphs with LLM-driven entity extractionOpen In Colab

Agents

Agents connect embeddings, pipelines, workflows and other agents together to autonomously solve complex problems.

agent

txtai agents are built on top of the Transformers Agent framework. This supports all LLMs txtai supports (Hugging Face, llama.cpp, OpenAI / Claude / AWS Bedrock via LiteLLM).

See the link below to learn more.

NotebookDescription
What's new in txtai 8.0Agents with txtaiOpen In Colab
Analyzing Hugging Face Posts with Graphs and AgentsExplore a rich dataset with Graph Analysis and AgentsOpen In Colab
Granting autonomy to agentsAgents that iteratively solve problems as they see fitOpen In Colab

Retrieval augmented generation

Retrieval augmented generation (RAG) reduces the risk of LLM hallucinations by constraining the output with a knowledge base as context. RAG is commonly used to "chat with your data".

rag rag

A novel feature of txtai is that it can provide both an answer and source citation.

NotebookDescription
Build RAG pipelines with txtaiGuide on retrieval augmented generation including how to create citationsOpen In Colab
How RAG with txtai worksCreate RAG processes, API services and Docker instancesOpen In Colab
Advanced RAG with graph path traversalGraph path traversal to collect complex sets of data for advanced RAGOpen In Colab
Speech to Speech RAG ▶️Full cycle speech to speech workflow with RAGOpen In Colab

Language Model Workflows

Language model workflows, also known as semantic workflows, connect language models together to build intelligent applications.

flows flows

While LLMs are powerful, there are plenty of smaller, more specialized models that work better and faster for specific tasks. This includes models for extractive question-answering, automatic summarization, text-to-speech, transcription and translation.

NotebookDescription
Run pipeline workflows ▶️Simple yet powerful constructs to efficiently process dataOpen In Colab
Building abstractive text summariesRun abstractive text summarizationOpen In Colab
Transcribe audio to textConvert audio files to textOpen In Colab
Translate text between languagesStreamline machine translation and language detectionOpen In Colab

Installation

install install

The easiest way to install is via pip and PyPI

pip install txtai

Python 3.9+ is supported. Using a Python virtual environment is recommended.

See the detailed install instructions for more information covering optional dependencies, environment specific prerequisites, installing from source, conda support and how to run with containers.

Model guide

models

See the table below for the current recommended models. These models all allow commercial use and offer a blend of speed and performance.

ComponentModel(s)
Embeddingsall-MiniLM-L6-v2
Image CaptionsBLIP
Labels - Zero ShotBART-Large-MNLI
Labels - FixedFine-tune with training pipeline
Large Language Model (LLM)Llama 3.1 Instruct
SummarizationDistilBART
Text-to-SpeechESPnet JETS
TranscriptionWhisper
TranslationOPUS Model Series

Models can be loaded as either a path from the Hugging Face Hub or a local directory. Model paths are optional, defaults are loaded when not specified. For tasks with no recommended model, txtai uses the default models as shown in the Hugging Face Tasks guide.

See the following links to learn more.

Powered by txtai

The following applications are powered by txtai.

apps

ApplicationDescription
ragRetrieval Augmented Generation (RAG) application
ragdataBuild knowledge bases for RAG
paperaiSemantic search and workflows for medical/scientific papers
annotateaiAutomatically annotate papers with LLMs

In addition to this list, there are also many other open-source projects, published research and closed proprietary/commercial projects that have built on txtai in production.

Further Reading

further further

Documentation

Full documentation on txtai including configuration settings for embeddings, pipelines, workflows, API and a FAQ with common questions/issues is available.

Contributing

For those who would like to contribute to txtai, please see this guide.