txtai README

The project's README from github.com/neuml/txtai. As one markdown file: README.md.

All-in-one AI framework

Version GitHub last commit GitHub issues Join Slack Build Status Coverage Status

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

architecture architecture

The key component of txtai is an embeddings database, which is 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.10+, Hugging Face Transformers, Sentence Transformers and FastAPI. txtai is open-source under an Apache 2.0 license.

[!NOTE]

NeuML is the company behind txtai and we provide AI consulting services around our stack. Schedule a meeting or send a message to learn more.

We're also building an easy and secure way to run hosted txtai applications with txtai.cloud.

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 70 example notebooks and applications are also available.

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.

Notebook Description
Introducing txtai ▶️ Overview of the functionality provided by txtai Open In Colab
Similarity search with images Embed images and text into the same space for search 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

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.

Notebook Description
Prompt templates and task chains Build model prompts and connect tasks together with workflows Open In Colab
Integrate LLM frameworks Integrate llama.cpp, LiteLLM and custom generation frameworks Open In Colab
Build knowledge graphs with LLMs Build knowledge graphs with LLM-driven entity extraction Open In Colab
Parsing the stars with txtai Explore an astronomical knowledge graph of known stars, planets, galaxies Open 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 smolagents framework. This supports all LLMs txtai supports (Hugging Face, llama.cpp, OpenAI / Claude / AWS Bedrock via LiteLLM). Agent prompting with agents.md and skill.md are also supported.

Check out this Agent Quickstart Example. Additional examples are listed below.

Notebook Description
Granting autonomy to agents Agents that iteratively solve problems as they see fit Open In Colab
TxtAI got skills Integrate skill.md files with your agent Open In Colab
Agent Tools ▶️ Learn about the txtai agent toolkit Open In Colab
Analyzing LinkedIn Company Posts with Graphs and Agents Exploring how to improve social media engagement with AI Open 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

Check out this RAG Quickstart Example. Additional examples are listed below.

Notebook Description
Build RAG pipelines with txtai ▶️ Guide on retrieval augmented generation including how to create citations Open In Colab
RAG is more than Vector Search Context retrieval via Web, SQL and other sources Open In Colab
GraphRAG with Wikipedia and GPT OSS Deep graph search powered RAG Open In Colab
Speech to Speech RAG ▶️ Full cycle speech to speech workflow with RAG Open 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.

Check out this Workflow Quickstart Example. Additional examples are listed below.

Notebook Description
Run pipeline workflows ▶️ Simple yet powerful constructs to efficiently process data Open In Colab
Building abstractive text summaries Run abstractive text summarization 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

Installation

install install

The easiest way to install is via pip and PyPI

pip install txtai

Python 3.10+ 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, lightweight minimal installation 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.

Component Model(s)
Embeddings all-MiniLM-L6-v2
Image Captions BLIP
Labels - Zero Shot DeBERTa v3 Zeroshot
Labels - Fixed Fine-tune with training pipeline
Large Language Model (LLM) Gemma 4 31B
Summarization DistilBART
Text-to-Speech ESPnet JETS
Transcription Whisper
Translation OPUS 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

Application Description
[rag](https://github.com/n

txtai (neuml/txtai)

Searching Database…

13K ·GitHub
这是什么?txtai 是一个一体化的 AI 框架,用于语义搜索、大语言模型编排以及大语言模型工作流。它的核心是一个嵌入数据库,结合了向量索引、图网络和关系型数据库,可用于驱动搜索,或作为大语言模型应用的知识来源。
它是向量数据库、大语言模型框架,还是两者兼有?两者兼有:它是一个 Python 框架,以嵌入数据库为核心(包括向量索引、稀疏索引、图和关系型存储),并提供用于大语言模型编排的流水线、工作流和智能体。
我该如何安装并开始使用?通过 pip 从 PyPI 安装(需要 Python 3.10+),最好在虚拟环境中进行;也支持使用 Docker 容器运行。
它基于哪些库?我使用某个大语言模型是否需要 API 密钥?它基于 Python 3.10+、Hugging Face Transformers、Sentence Transformers 和 FastAPI 构建;大语言模型既可以在本地运行(例如 llama.cpp、Hugging Face 模型),也可以通过外部 API 调用(OpenAI、Claude、通过 LiteLLM 调用的 AWS Bedrock),因此只有在选择托管模型时才需要 API 密钥。
我能否让所有内容都留在本地,而不发送到外部服务?可以,txtai 设计为可完全在本地运行,不会将数据发送到远程服务;如果你愿意,它也可以连接云端大语言模型 API。
txtai 的智能体实际能做什么?智能体可以连接嵌入、流水线、工作流和其他智能体,自主解决复杂问题;它们基于 smolagents 框架构建,支持 agents.md/skill.md 提示方式,并可搭配 txtai 支持的任何大语言模型使用。
除了普通的向量搜索,txtai 如何帮助实现检索增强生成(RAG)?它的检索增强生成流水线会以知识库作为上下文来约束大语言模型的输出(从而减少幻觉),并且可以从网页、SQL 等多种来源获取上下文,而不仅限于向量搜索,还能生成引用。
txtai 为大语言模型组件推荐哪个模型?当前的模型指南推荐将 Gemma 4 31B 用于大语言模型组件,同时也推荐了用于嵌入的 all-MiniLM-L6-v2 和用于语音转录的 Whisper 等模型。
除了 Python,还有哪些语言可以使用 txtai?txtai 提供 Web 和模型上下文协议(MCP)API,并提供 JavaScript、Java、Rust 和 Go 的绑定,因此并不局限于 Python。
Creator
neuml
Size
55.5 MB
Stars
13K
Age
6y
Commits · 90 Days