# AI use cases for Txtai (neuml/txtai)

Repo: [neuml/txtai](https://github.com/neuml/txtai) | Use cases: 3 | Page: https://dedupedai.com/use-cases/neuml-txtai/

txtai is an all-in-one AI framework for semantic search, LLM orchestration and language model workflows. It covers embeddings databases, retrieval augmented generation, agents and pipelines, with a built-in API and local operation.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Build semantic search in a few lines: https://dedupedai.com/use-cases/neuml-txtai/build-semantic-search-in-a-few-lines-with-txtai/
- Serve a search API from one YAML file: https://dedupedai.com/use-cases/neuml-txtai/serve-a-txtai-search-api-from-a-yaml-file/
- Chat with your documents using Txtai RAG: https://dedupedai.com/use-cases/neuml-txtai/chat-with-your-documents-using-txtai-rag/

## How to build semantic search in a few lines with Txtai

Repo: [neuml/txtai](https://github.com/neuml/txtai) | Difficulty: Beginner | Time: 15 minutes | Basis: From the README

Index text with Txtai Embeddings and search it by meaning.

**Who it is for:** A developer adding meaning-based search to a small app.

**The problem:** Keyword search misses results that mean the same thing in different words.

**The outcome:** A working embeddings index you can query in Python.

### Steps

1. Install with `pip install txtai`
2. Import it with `import txtai`
3. Create `embeddings = txtai.Embeddings()`
4. Index your texts with `embeddings.index(["Correct", "Not what we hoped"])`, swapping in your own list
5. Query with `embeddings.search("positive", 1)`

### Prompt to paste into your agent

```text
Using neuml/txtai, install it with `pip install txtai`, index a list of <my documents> with `embeddings.index` and run `embeddings.search` for a few queries.
```

### Caveat

This card is written from the neuml/txtai README, not from a test run by Deduped. Before you start, make sure you have Python 3.11 or newer and pip. Check the repo for newer instructions before you rely on these steps.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/neuml-txtai/build-semantic-search-in-a-few-lines-with-txtai/

## How to serve a search API from one YAML file with Txtai

Repo: [neuml/txtai](https://github.com/neuml/txtai) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Configure an embeddings model in app.yml and expose it over HTTP.

**Who it is for:** A developer who wants to call search from any language.

**The problem:** Wrapping a search library in your own web service takes boilerplate.

**The outcome:** A local API answering search queries via curl.

### Steps

1. Install with `pip install txtai`
2. Create app.yml with an `embeddings:` entry whose `path:` is `sentence-transformers/all-MiniLM-L6-v2`
3. Start the API with `CONFIG=app.yml uvicorn "txtai.api:app"`
4. Query it with `curl -X GET "http://localhost:8000/search?query=positive"`

### Prompt to paste into your agent

```text
With neuml/txtai, write app.yml using sentence-transformers/all-MiniLM-L6-v2, start `CONFIG=app.yml uvicorn "txtai.api:app"` and test with `curl -X GET "http://localhost:8000/search?query=positive"`.
```

### Caveat

The README example only configures embeddings; load documents into the index before expecting results.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/neuml-txtai/serve-a-txtai-search-api-from-a-yaml-file/

## How to chat with your documents using Txtai RAG with Txtai

Repo: [neuml/txtai](https://github.com/neuml/txtai) | Difficulty: Intermediate | Time: 1 hour | Basis: From the README

Follow the README's RAG quickstart to ground LLM answers in your own data.

**Who it is for:** A developer building a question answering tool over private text.

**The problem:** LLMs hallucinate without a knowledge base to constrain them.

**The outcome:** A RAG pipeline that answers from your indexed content.

### Steps

1. Install with `pip install txtai`
2. Open the RAG Quickstart Example linked in the README, examples/rag_quickstart.py
3. Swap in your own documents for the sample data
4. Run it and review the answers against your sources

### Prompt to paste into your agent

```text
Using neuml/txtai, install it with `pip install txtai`, adapt examples/rag_quickstart.py to index <my documents>, and ask it three questions with citations to the source text.
```

### Caveat

Check the quickstart file for which model it downloads before running.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/neuml-txtai/chat-with-your-documents-using-txtai-rag/
